diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c38b0a70276..cac6bd1f04b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -17,6 +17,7 @@ "packages/google-cloud-dataplex": "2.2.2", "packages/google-cloud-dataproc": "4.1.1", "packages/google-cloud-deploy": "2.2.2", + "packages/google-cloud-dialogflow": "5.3.0", "packages/google-cloud-discoveryengine": "0.2.0", "packages/google-cloud-gkeconnect-gateway": "2.0.5", "packages/google-cloud-gkemulticloud": "0.1.4", diff --git a/packages/google-cloud-dialogflow/.OwlBot.yaml b/packages/google-cloud-dialogflow/.OwlBot.yaml new file mode 100644 index 00000000000..ccadb768b99 --- /dev/null +++ b/packages/google-cloud-dialogflow/.OwlBot.yaml @@ -0,0 +1,20 @@ +# 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 +# +# 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. + +deep-remove-regex: + - /owl-bot-staging + +deep-copy-regex: + - source: /google/cloud/dialogflow/(v.*)/.*-nodejs + dest: /owl-bot-staging/google-cloud-dialogflow/$1 diff --git a/packages/google-cloud-dialogflow/.cloud-repo-tools.json b/packages/google-cloud-dialogflow/.cloud-repo-tools.json new file mode 100644 index 00000000000..0ef95cef48e --- /dev/null +++ b/packages/google-cloud-dialogflow/.cloud-repo-tools.json @@ -0,0 +1,170 @@ +{ + "requiresKeyFile": true, + "requiresProjectId": true, + "client_reference_url": "https://dialogflow.com/docs/reference/api-v2/rpc/", + "release_quality": "beta", + "samples": [ + { + "id": "dialogflow_detect_intent_text", + "name": "Detect Intent (Text)", + "file": "detect.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.DetectIntentRequest", + "usage": "node detect.js --help" + }, + { + "id": "dialogflow_create_knowledge_base", + "name": "Create Knowledge Base", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.createKnowledgeBase", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_get_knowledge_base", + "name": "Get Knowledge Base", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.getKnowledgeBase", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_list_knowledge_base", + "name": "list Knowledge Base", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.listKnowledgeBase", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_delete_knowledge_base", + "name": "list Knowledge Base", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.deleteKnowledgeBase", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_create_document", + "name": "create Document", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.createDocument", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_list_document", + "name": "list Documents", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.listDocuments", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_get_document", + "name": "Get Document", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.getDocument", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_delete_document", + "name": "delete Document", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.deleteDocument", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_detect_intent_with_sentiment_analysis", + "name": "detect Intent with sentiment analysis", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.detectIntentwithSentimentAnalysis", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_detect_intent_with_texttospeech_response", + "name": "detect Intent with text-to-speech response", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.detectIntentwithtexttospeechresponse", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_detect_intent_knowledge", + "name": "detect Intent with Knowledge Base", + "file": "detect.v2beta1.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.detectIntentknowledge", + "usage": "node detect.v2beta1.js --help" + }, + { + "id": "dialogflow_detect_intent_audio", + "name": "Detect Intent (Audio)", + "file": "detect.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.DetectIntentRequest", + "usage": "node detect.js --help" + }, + { + "id": "dialogflow_detect_intent_streaming", + "name": "Detect Intent (Streaming)", + "file": "detect.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.DetectIntentRequest", + "usage": "node detect.js --help" + }, + { + "id": "dialogflow_create_entity", + "name": "Create Entity", + "file": "resource.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType", + "usage": "node resource.js --help" + }, + { + "id": "dialogflow_delete_entity", + "name": "Delete Entity", + "file": "resource.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType", + "usage": "node resource.js --help" + }, + { + "id": "dialogflow_create_intent", + "name": "Create Intent", + "file": "resource.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.Intents.CreateIntent", + "usage": "node resource.js --help" + }, + { + "id": "dialogflow_delete_intent", + "name": "Delete Intent", + "file": "resource.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.Intents.DeleteIntent", + "usage": "node resource.js --help" + }, + { + "id": "dialogflow_create_context", + "name": "Create Context", + "file": "resource.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.Contexts.CreateContext", + "usage": "node resource.js --help" + }, + { + "id": "dialogflow_delete_context", + "name": "Delete Context", + "file": "resource.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.Contexts.DeleteContext", + "usage": "node resource.js --help" + }, + { + "id": "dialogflow_create_session_entity_type", + "name": "Create Session Entity Type", + "file": "resource.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType", + "usage": "node resource.js --help" + }, + { + "id": "dialogflow_delete_session_entity_type", + "name": "Delete Session Entity Type", + "file": "resource.js", + "docs_link": "https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType", + "usage": "node resource.js --help" + } + ], + + "_product": "dialogflow", + "id": "dialogflow", + "name": "Dialogflow", + "short_name": "Dialogflow", + "docs_url": "https://dialogflow.com/docs/reference/api-v2/rpc/", + "description": "[Dialogflow](https://dialogflow.com/docs/reference/v2-agent-setup) is an enterprise-grade NLU platform that makes it easy for developers to design and integrate conversational user interfaces into mobile apps, web applications, devices, and bots.", + "api_id": "dialogflow.googleapis.com" +} diff --git a/packages/google-cloud-dialogflow/.eslintignore b/packages/google-cloud-dialogflow/.eslintignore new file mode 100644 index 00000000000..ea5b04aebe6 --- /dev/null +++ b/packages/google-cloud-dialogflow/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ +samples/generated/ diff --git a/packages/google-cloud-dialogflow/.eslintrc.json b/packages/google-cloud-dialogflow/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/packages/google-cloud-dialogflow/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/packages/google-cloud-dialogflow/.gitattributes b/packages/google-cloud-dialogflow/.gitattributes new file mode 100644 index 00000000000..33739cb74e4 --- /dev/null +++ b/packages/google-cloud-dialogflow/.gitattributes @@ -0,0 +1,4 @@ +*.ts text eol=lf +*.js text eol=lf +protos/* linguist-generated +**/api-extractor.json linguist-language=JSON-with-Comments diff --git a/packages/google-cloud-dialogflow/.gitignore b/packages/google-cloud-dialogflow/.gitignore new file mode 100644 index 00000000000..5d32b23782f --- /dev/null +++ b/packages/google-cloud-dialogflow/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +.coverage +coverage +.nyc_output +docs/ +out/ +build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/packages/google-cloud-dialogflow/.jsdoc.js b/packages/google-cloud-dialogflow/.jsdoc.js new file mode 100644 index 00000000000..fe4bcaa346d --- /dev/null +++ b/packages/google-cloud-dialogflow/.jsdoc.js @@ -0,0 +1,55 @@ +// 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. +// +// ** 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'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/dialogflow', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/packages/google-cloud-dialogflow/.mocharc.js b/packages/google-cloud-dialogflow/.mocharc.js new file mode 100644 index 00000000000..cdb7b752160 --- /dev/null +++ b/packages/google-cloud-dialogflow/.mocharc.js @@ -0,0 +1,29 @@ +// 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. +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000, + "recursive": true +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/packages/google-cloud-dialogflow/.nycrc b/packages/google-cloud-dialogflow/.nycrc new file mode 100644 index 00000000000..b18d5472b62 --- /dev/null +++ b/packages/google-cloud-dialogflow/.nycrc @@ -0,0 +1,24 @@ +{ + "report-dir": "./.coverage", + "reporter": ["text", "lcov"], + "exclude": [ + "**/*-test", + "**/.coverage", + "**/apis", + "**/benchmark", + "**/conformance", + "**/docs", + "**/samples", + "**/scripts", + "**/protos", + "**/test", + "**/*.d.ts", + ".jsdoc.js", + "**/.jsdoc.js", + "karma.conf.js", + "webpack-tests.config.js", + "webpack.config.js" + ], + "exclude-after-remap": false, + "all": true +} diff --git a/packages/google-cloud-dialogflow/.prettierignore b/packages/google-cloud-dialogflow/.prettierignore new file mode 100644 index 00000000000..9340ad9b86d --- /dev/null +++ b/packages/google-cloud-dialogflow/.prettierignore @@ -0,0 +1,6 @@ +**/node_modules +**/coverage +test/fixtures +build/ +docs/ +protos/ diff --git a/packages/google-cloud-dialogflow/.prettierrc.js b/packages/google-cloud-dialogflow/.prettierrc.js new file mode 100644 index 00000000000..d546a4ad546 --- /dev/null +++ b/packages/google-cloud-dialogflow/.prettierrc.js @@ -0,0 +1,17 @@ +// 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. + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/packages/google-cloud-dialogflow/.readme-partials.yml b/packages/google-cloud-dialogflow/.readme-partials.yml new file mode 100644 index 00000000000..1f1873688fe --- /dev/null +++ b/packages/google-cloud-dialogflow/.readme-partials.yml @@ -0,0 +1,3 @@ +introduction: |- + ### **_IMPORTANT NOTE_** + **Version 2.0.0 renames `dialogflow` to `@google-cloud/dialogflow` on npm, along with introducing TypeScript types.** diff --git a/packages/google-cloud-dialogflow/.repo-metadata.json b/packages/google-cloud-dialogflow/.repo-metadata.json new file mode 100644 index 00000000000..c96d1a9c6b0 --- /dev/null +++ b/packages/google-cloud-dialogflow/.repo-metadata.json @@ -0,0 +1,17 @@ +{ + "name": "dialogflow", + "name_pretty": "Dialogflow API", + "product_documentation": "https://cloud.google.com/dialogflow-enterprise/", + "client_documentation": "https://googleapis.dev/nodejs/dialogflow/latest", + "issue_tracker": "https://issuetracker.google.com/savedsearches/5300385", + "release_level": "stable", + "language": "nodejs", + "repo": "googleapis/google-cloud-node", + "distribution_name": "@google-cloud/dialogflow", + "api_id": "dialogflow.googleapis.com", + "requires_billing": true, + "codeowner_team": "@googleapis/ml-apis", + "default_version": "v2", + "api_shortname": "dialogflow", + "library_type": "GAPIC_AUTO" +} diff --git a/packages/google-cloud-dialogflow/CHANGELOG.md b/packages/google-cloud-dialogflow/CHANGELOG.md new file mode 100644 index 00000000000..215eb1ee17f --- /dev/null +++ b/packages/google-cloud-dialogflow/CHANGELOG.md @@ -0,0 +1,665 @@ +# Changelog + +[npm history][1] + +[1]: https://www.npmjs.com/package/dialogflow?activeTab=versions + +## [5.3.0](https://github.com/googleapis/nodejs-dialogflow/compare/v5.2.1...v5.3.0) (2022-11-11) + + +### Features + +* Add Agent Assist Summarization API (https://cloud.google.com/agent-assist/docs/summarization) ([#1002](https://github.com/googleapis/nodejs-dialogflow/issues/1002)) ([3475fc1](https://github.com/googleapis/nodejs-dialogflow/commit/3475fc14909c451b10edb847101aed8efaa75988)) +* Added obfuscated_external_user_id to Participant ([2c98a57](https://github.com/googleapis/nodejs-dialogflow/commit/2c98a57248019054654ac686f204627cf0141c83)) +* Added StreamingAnalyzeContent API ([#1004](https://github.com/googleapis/nodejs-dialogflow/issues/1004)) ([2c98a57](https://github.com/googleapis/nodejs-dialogflow/commit/2c98a57248019054654ac686f204627cf0141c83)) +* Can directly set Cloud Speech model on the SpeechToTextConfig ([2c98a57](https://github.com/googleapis/nodejs-dialogflow/commit/2c98a57248019054654ac686f204627cf0141c83)) +* Can directly set Cloud Speech model on the SpeechToTextConfig ([2c98a57](https://github.com/googleapis/nodejs-dialogflow/commit/2c98a57248019054654ac686f204627cf0141c83)) +* Include conversation dataset name to be created with dataset creation metadata ([#1003](https://github.com/googleapis/nodejs-dialogflow/issues/1003)) ([fe73406](https://github.com/googleapis/nodejs-dialogflow/commit/fe734066be3d46337513e62a3846b4c19b361636)) + + +### Bug Fixes + +* **deps:** Update dependency uuid to v9 ([#977](https://github.com/googleapis/nodejs-dialogflow/issues/977)) ([6c7ec11](https://github.com/googleapis/nodejs-dialogflow/commit/6c7ec117b01288734ddd67ad684bc9c03a5e7a8c)) +* **deps:** Use google-gax v3.5.2 ([#1007](https://github.com/googleapis/nodejs-dialogflow/issues/1007)) ([be3d1f3](https://github.com/googleapis/nodejs-dialogflow/commit/be3d1f3e1d80aea4edee6fa4b98de58a504f5ea3)) +* Preserve default values in x-goog-request-params header ([#979](https://github.com/googleapis/nodejs-dialogflow/issues/979)) ([2492264](https://github.com/googleapis/nodejs-dialogflow/commit/2492264ffa536521b794eff60c60bbe2def57b9b)) +* update proto definitions ([471c6a3](https://github.com/googleapis/nodejs-dialogflow/commit/471c6a30cb7d5dc00a96f5e84aefc8afe4d8ada3)) +* Update proto definitions ([#1010](https://github.com/googleapis/nodejs-dialogflow/issues/1010)) ([471c6a3](https://github.com/googleapis/nodejs-dialogflow/commit/471c6a30cb7d5dc00a96f5e84aefc8afe4d8ada3)) + +## [5.2.1](https://github.com/googleapis/nodejs-dialogflow/compare/v5.2.0...v5.2.1) (2022-09-01) + + +### Bug Fixes + +* Allow passing gax instance to client constructor ([#971](https://github.com/googleapis/nodejs-dialogflow/issues/971)) ([f4ee343](https://github.com/googleapis/nodejs-dialogflow/commit/f4ee343be47632cecab651b83879d6bdb66efef1)) +* Change import long to require ([#972](https://github.com/googleapis/nodejs-dialogflow/issues/972)) ([7104597](https://github.com/googleapis/nodejs-dialogflow/commit/7104597a6c26f6e484a70ba9dc460118c9174d9e)) +* Do not import the whole google-gax from proto JS ([#1553](https://github.com/googleapis/nodejs-dialogflow/issues/1553)) ([#976](https://github.com/googleapis/nodejs-dialogflow/issues/976)) ([33fe037](https://github.com/googleapis/nodejs-dialogflow/commit/33fe037549e6c2a77b26dc12857ccb77aad3c4b4)) +* Remove pip install statements ([#1546](https://github.com/googleapis/nodejs-dialogflow/issues/1546)) ([#974](https://github.com/googleapis/nodejs-dialogflow/issues/974)) ([54282a6](https://github.com/googleapis/nodejs-dialogflow/commit/54282a69cef164649ab3560d99e2bfd3b12bb9b3)) + +## [5.2.0](https://github.com/googleapis/nodejs-dialogflow/compare/v5.1.0...v5.2.0) (2022-07-10) + + +### Features + +* provide new parameter cx_current_page, the unique identifier of the CX page to override the `current_page` in the session. Add filter field to ListAnswerRecordsRequest. And add AudioInput to analysis requests docs: add more meaningful comments ([dc596ea](https://github.com/googleapis/nodejs-dialogflow/commit/dc596ea3ad8da955fa81513991f573c8665341a0)) + + +### Bug Fixes + +* **deps:** do not depend on protobufjs ([#968](https://github.com/googleapis/nodejs-dialogflow/issues/968)) ([08e36aa](https://github.com/googleapis/nodejs-dialogflow/commit/08e36aa4c4de24cbc7963f4bcf80762b892cb4c3)) + +## [5.1.0](https://github.com/googleapis/nodejs-dialogflow/compare/v5.0.0...v5.1.0) (2022-07-05) + + +### Features + +* deprecated the filter field and add resource_definition ([0d0b5c9](https://github.com/googleapis/nodejs-dialogflow/commit/0d0b5c99f68726cc53f5442f745713551bed55c2)) +* support regapic LRO ([#962](https://github.com/googleapis/nodejs-dialogflow/issues/962)) ([6957ec1](https://github.com/googleapis/nodejs-dialogflow/commit/6957ec16f4ed5cac469c8bf9cc95b048a192c62a)) + +## [5.0.0](https://github.com/googleapis/nodejs-dialogflow/compare/v4.7.0...v5.0.0) (2022-06-20) + + +### ⚠ BREAKING CHANGES + +* update library to use Node 12 (#955) +* correct broken ConversationModelEvaluation resource pattern (#945) + +### Features + +* add the API of StreamingAnalyzeContent ([#952](https://github.com/googleapis/nodejs-dialogflow/issues/952)) ([ca02d94](https://github.com/googleapis/nodejs-dialogflow/commit/ca02d9456fdfbbd0d2855f07ef1c6e9a972be7ac)) + + +### Bug Fixes + +* correct broken ConversationModelEvaluation resource pattern ([#945](https://github.com/googleapis/nodejs-dialogflow/issues/945)) ([e1785d6](https://github.com/googleapis/nodejs-dialogflow/commit/e1785d61f45e409dd7ad5005db0ae88a8c1e69d5)) +* fixes for dynamic routing and streaming descriptors ([#958](https://github.com/googleapis/nodejs-dialogflow/issues/958)) ([3330957](https://github.com/googleapis/nodejs-dialogflow/commit/33309570f0200264ac4fe6cf3052ccd8648665f8)) + + +### Build System + +* update library to use Node 12 ([#955](https://github.com/googleapis/nodejs-dialogflow/issues/955)) ([6755bed](https://github.com/googleapis/nodejs-dialogflow/commit/6755bed996af1582cf06ea9ef05281f1de880f80)) + +## [4.7.0](https://github.com/googleapis/nodejs-dialogflow/compare/v4.6.0...v4.7.0) (2022-03-25) + + +### Features + +* added export documentation method ([35a77f4](https://github.com/googleapis/nodejs-dialogflow/commit/35a77f432d7d12dfe3e56370e2205ca37dd89a7d)) +* added option to configure the number of sentences in the suggestion context ([#917](https://github.com/googleapis/nodejs-dialogflow/issues/917)) ([17aa7d6](https://github.com/googleapis/nodejs-dialogflow/commit/17aa7d68c933382ea633727181e399f32f770409)) +* removed OPTIONAL for speech model variant docs: added more docs for speech model variant and improved docs format for participant ([#906](https://github.com/googleapis/nodejs-dialogflow/issues/906)) ([7df7d27](https://github.com/googleapis/nodejs-dialogflow/commit/7df7d2798490e0a32c7f0bb15de0b1aec7666b43)) + +## [4.6.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.5.0...v4.6.0) (2021-12-13) + + +### Features + +* add eslintignore for sameple generated code ([#1302](https://www.github.com/googleapis/nodejs-dialogflow/issues/1302)) ([#905](https://www.github.com/googleapis/nodejs-dialogflow/issues/905)) ([b5dfbed](https://www.github.com/googleapis/nodejs-dialogflow/commit/b5dfbeda80f61d374ac021c90ca0e3325d9d2081)) +* added support to configure security settings, language code and time zone on conversation profile ([#895](https://www.github.com/googleapis/nodejs-dialogflow/issues/895)) ([aa2ccf7](https://www.github.com/googleapis/nodejs-dialogflow/commit/aa2ccf73e35d37350f62df997bad7fd3dd0e15bf)) +* support document metadata filter in article suggestion ([#900](https://www.github.com/googleapis/nodejs-dialogflow/issues/900)) ([6801270](https://www.github.com/googleapis/nodejs-dialogflow/commit/680127075e92ad9b4147af22ed97804cf9ae524a)) +* support document metadata filter in article suggestion and smart reply model in human agent assistant ([#899](https://www.github.com/googleapis/nodejs-dialogflow/issues/899)) ([f823aa3](https://www.github.com/googleapis/nodejs-dialogflow/commit/f823aa3e63ffee33a90b7fb02962cfa16af042be)) + +## [4.5.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.4.0...v4.5.0) (2021-10-11) + + +### Features + +* added support for TelephonyTransferCall in Participant ResponseMessage ([#880](https://www.github.com/googleapis/nodejs-dialogflow/issues/880)) ([dbcf3b0](https://www.github.com/googleapis/nodejs-dialogflow/commit/dbcf3b087cf141f88af5406bd9c1ae92f1c16e19)) + +## [4.4.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.3.1...v4.4.0) (2021-09-21) + + +### Features + +* turns on self-signed JWT feature flag ([#867](https://www.github.com/googleapis/nodejs-dialogflow/issues/867)) ([4bc4959](https://www.github.com/googleapis/nodejs-dialogflow/commit/4bc4959a8a85f8b2f1fed8133edc461db9e0dd0f)) + +### [4.3.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.3.0...v4.3.1) (2021-08-17) + + +### Bug Fixes + +* **deps:** google-gax v2.24.1 ([#864](https://www.github.com/googleapis/nodejs-dialogflow/issues/864)) ([6646fb3](https://www.github.com/googleapis/nodejs-dialogflow/commit/6646fb35de95b2933adad91a4a111ee0dfd37ce9)) + +## [4.3.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.2.0...v4.3.0) (2021-08-16) + + +### Features + +* expose `Locations` service to get/list avaliable locations of Dialogflow products; fixed some API annotations ([#860](https://www.github.com/googleapis/nodejs-dialogflow/issues/860)) ([05ea702](https://www.github.com/googleapis/nodejs-dialogflow/commit/05ea702372c08d0f0f157419799e59ea983df32a)) + + +### Bug Fixes + +* **build:** migrate to using main branch ([#862](https://www.github.com/googleapis/nodejs-dialogflow/issues/862)) ([ec0635c](https://www.github.com/googleapis/nodejs-dialogflow/commit/ec0635c17384c4fc5661d8a046b50b3fc2920505)) + +## [4.2.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.1.4...v4.2.0) (2021-08-10) + + +### Features + +* Expose `Locations` service to get/list avaliable locations of Dialogflow products docs: reorder some fields ([#857](https://www.github.com/googleapis/nodejs-dialogflow/issues/857)) ([4ffc775](https://www.github.com/googleapis/nodejs-dialogflow/commit/4ffc775af328735a00ba075e75e1065c3b1dd308)) + +### [4.1.4](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.1.3...v4.1.4) (2021-08-04) + + +### Bug Fixes + +* fix validation result docs feat: add language code to streaming recognition result docs: update environment docs ([#853](https://www.github.com/googleapis/nodejs-dialogflow/issues/853)) ([d2eb1bd](https://www.github.com/googleapis/nodejs-dialogflow/commit/d2eb1bdaf886493952163bcb41291ad492a7bfb8)) +* fix validation result docs feat: add language code to streaming recognition result feat: add time zone and security settings to conversation profile docs: update agent docs docs: update entity type docs docs: update intent docs ([#854](https://www.github.com/googleapis/nodejs-dialogflow/issues/854)) ([cda7ff3](https://www.github.com/googleapis/nodejs-dialogflow/commit/cda7ff335abad989612c104e990be1f6a55c89b5)) + +### [4.1.3](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.1.2...v4.1.3) (2021-07-21) + + +### Bug Fixes + +* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#842](https://www.github.com/googleapis/nodejs-dialogflow/issues/842)) ([ecaa1d9](https://www.github.com/googleapis/nodejs-dialogflow/commit/ecaa1d960b147bf24160b17c8d82ad85f7085d4a)) + +### [4.1.2](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.1.1...v4.1.2) (2021-07-12) + + +### Bug Fixes + +* **deps:** google-gax v2.17.1 ([#840](https://www.github.com/googleapis/nodejs-dialogflow/issues/840)) ([0035d9c](https://www.github.com/googleapis/nodejs-dialogflow/commit/0035d9cfd77045332446472e97cc06d48ca39beb)) + +### [4.1.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.1.0...v4.1.1) (2021-06-30) + + +### Bug Fixes + +* **deps:** google-gax v2.17.0 with mTLS ([#837](https://www.github.com/googleapis/nodejs-dialogflow/issues/837)) ([05819be](https://www.github.com/googleapis/nodejs-dialogflow/commit/05819be5b6592c0c377f522ae56bf3a3bdd8dbde)) +* make request optional in all cases ([#830](https://www.github.com/googleapis/nodejs-dialogflow/issues/830)) ([08ef5e5](https://www.github.com/googleapis/nodejs-dialogflow/commit/08ef5e59076b498fb423279059ab11de95a54e58)) + +## [4.1.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v4.0.0...v4.1.0) (2021-06-15) + + +### Features + +* added Automated agent reply type and allow cancellation flag for partial response feature ([#825](https://www.github.com/googleapis/nodejs-dialogflow/issues/825)) ([5b128d9](https://www.github.com/googleapis/nodejs-dialogflow/commit/5b128d97eeb63e7d7666e800e5a62789f6f56a65)) + +## [4.0.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.5.0...v4.0.0) (2021-06-15) + + +### ⚠ BREAKING CHANGES + +* helper agentPath becomes projectAgentPath +* helper intentPath becomes projectAgentIntentPath +* helper entityTypePath becomes projectAgentEntityTypePath +* remove unused proto InputText, InputAudio (#796) + +### Features + +* added Fulfillment service ([fa42037](https://www.github.com/googleapis/nodejs-dialogflow/commit/fa420372a4dc6ec99e68df277050ed36b8c3091d)) +* added more Environment RPCs ([fa42037](https://www.github.com/googleapis/nodejs-dialogflow/commit/fa420372a4dc6ec99e68df277050ed36b8c3091d)) +* added TextToSpeechSettings. ([fa42037](https://www.github.com/googleapis/nodejs-dialogflow/commit/fa420372a4dc6ec99e68df277050ed36b8c3091d)) +* added Versions service ([fa42037](https://www.github.com/googleapis/nodejs-dialogflow/commit/fa420372a4dc6ec99e68df277050ed36b8c3091d)) + + +### Bug Fixes + +* **deps:** require google-gax v2.12.0 ([#812](https://www.github.com/googleapis/nodejs-dialogflow/issues/812)) ([0ecd65c](https://www.github.com/googleapis/nodejs-dialogflow/commit/0ecd65cb683801827078fb83e60231ea45eec568)) +* remove unused proto InputText, InputAudio ([#796](https://www.github.com/googleapis/nodejs-dialogflow/issues/796)) ([4f6f7d6](https://www.github.com/googleapis/nodejs-dialogflow/commit/4f6f7d6de67533a68866da1452e669e28ff1b2a8)) + + +### Code Refactoring + +* helper agentPath becomes projectAgentPath ([fa42037](https://www.github.com/googleapis/nodejs-dialogflow/commit/fa420372a4dc6ec99e68df277050ed36b8c3091d)) +* helper entityTypePath becomes projectAgentEntityTypePath ([fa42037](https://www.github.com/googleapis/nodejs-dialogflow/commit/fa420372a4dc6ec99e68df277050ed36b8c3091d)) +* helper intentPath becomes projectAgentIntentPath ([fa42037](https://www.github.com/googleapis/nodejs-dialogflow/commit/fa420372a4dc6ec99e68df277050ed36b8c3091d)) + +## [3.5.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.4.0...v3.5.0) (2021-04-06) + + +### Features + +* expose MP3_64_KBPS and MULAW for output audio encodings. ([b07f89d](https://www.github.com/googleapis/nodejs-dialogflow/commit/b07f89dd9fecb345391c24f936cbcdfe11745921)) +* expose MP3_64_KBPS and MULAW for output audio encodings. ([b07f89d](https://www.github.com/googleapis/nodejs-dialogflow/commit/b07f89dd9fecb345391c24f936cbcdfe11745921)) + + +### Bug Fixes + +* Add all missing regional HTTP bindings in DF API. ([b07f89d](https://www.github.com/googleapis/nodejs-dialogflow/commit/b07f89dd9fecb345391c24f936cbcdfe11745921)) +* remove `input_audio` field from AnalyzeContentRequest from v2/v2beta1 ([b07f89d](https://www.github.com/googleapis/nodejs-dialogflow/commit/b07f89dd9fecb345391c24f936cbcdfe11745921)) +* remove proto message CreateCallMatcherRequest, CreateCallMatcherResponse, ListCallMatchersRequest, ListCallMatchersResponse, DeleteCallMatcherRequest, DeleteCallMatcherResponse, CallMatcher, StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse, AudioInput from v2/v2beta1, TelephonyDtmfEvents, TelephonyDtmf from v2 ([b07f89d](https://www.github.com/googleapis/nodejs-dialogflow/commit/b07f89dd9fecb345391c24f936cbcdfe11745921)) +* remove resource_reference for invisible resources. ([b07f89d](https://www.github.com/googleapis/nodejs-dialogflow/commit/b07f89dd9fecb345391c24f936cbcdfe11745921)) +* Remove resource_reference from UpdateAnswerRecord. ([b07f89d](https://www.github.com/googleapis/nodejs-dialogflow/commit/b07f89dd9fecb345391c24f936cbcdfe11745921)) +* remove rpc or fields that are unintended to release ([b07f89d](https://www.github.com/googleapis/nodejs-dialogflow/commit/b07f89dd9fecb345391c24f936cbcdfe11745921)) +* remove StreamingAnalyzeContent, CreateCallMatcher, ListCallMatchers, DeleteCallMatcher rpc from v2/v2beta1 ([b07f89d](https://www.github.com/googleapis/nodejs-dialogflow/commit/b07f89dd9fecb345391c24f936cbcdfe11745921)) + +## [3.4.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.3.0...v3.4.0) (2021-03-15) + + +### ⚠ BREAKING CHANGES + +* removed ImportAgentResponse which was not ready for use yet + +### Features + +* add additional_bindings to Dialogflow v2 ListIntents API docs: update copyrights and session docs ([66cd3a5](https://www.github.com/googleapis/nodejs-dialogflow/commit/66cd3a5b5c605deb37efbc4f87edf17b8d4dd4c1)) +* add additional_bindings to Dialogflow v2beta1 ListIntents API docs: update copyrights and session docs ([66cd3a5](https://www.github.com/googleapis/nodejs-dialogflow/commit/66cd3a5b5c605deb37efbc4f87edf17b8d4dd4c1)) +* add CCAI API ([a93fa71](https://www.github.com/googleapis/nodejs-dialogflow/commit/a93fa71d45cace7822d5585a8a407e3e7e563686)) +* added support for regionalization for document API ([#722](https://www.github.com/googleapis/nodejs-dialogflow/issues/722)) ([b6f5738](https://www.github.com/googleapis/nodejs-dialogflow/commit/b6f5738613fc5af49b966d4a8c4137921abed5ef)) +* adds style enum ([72bb3ae](https://www.github.com/googleapis/nodejs-dialogflow/commit/72bb3aed5fbe9a605810cce69a12fd3c5e4d1fac)) +* allowed custom to specify webhook headers through query parameters ([#724](https://www.github.com/googleapis/nodejs-dialogflow/issues/724)) ([a7f784a](https://www.github.com/googleapis/nodejs-dialogflow/commit/a7f784ac921a750e9df2e6edbfa3bee870187af1)) + + +### Bug Fixes + +* **browser:** check for fetch on window ([#718](https://www.github.com/googleapis/nodejs-dialogflow/issues/718)) ([fb28879](https://www.github.com/googleapis/nodejs-dialogflow/commit/fb28879443c27688d1923d6675ea97c3c5d4d0e7)) +* do not modify options object, use defaultScopes ([#706](https://www.github.com/googleapis/nodejs-dialogflow/issues/706)) ([95a938d](https://www.github.com/googleapis/nodejs-dialogflow/commit/95a938dbc5f2cc49c217bb5d3cecbbffba3e6d18)) +* remove MixedAudio ([a93fa71](https://www.github.com/googleapis/nodejs-dialogflow/commit/a93fa71d45cace7822d5585a8a407e3e7e563686)) +* removed ImportAgentResponse which was not ready for use yet ([e0d9fa6](https://www.github.com/googleapis/nodejs-dialogflow/commit/e0d9fa69bba79540c09ec777b3eee6bf0bd5e4b6)) + +## [3.3.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.2.0...v3.3.0) (2020-09-15) + + +### Features + +* added Telephony Gateway DTMF events doc: added locations in resource name formats doc: wording updates for tiers ([#683](https://www.github.com/googleapis/nodejs-dialogflow/issues/683)) ([a0cb46a](https://www.github.com/googleapis/nodejs-dialogflow/commit/a0cb46a81b3b50257152362fdb36862b1e90d567)) + + +### Bug Fixes + +* **deps:** update dependency yargs to v16 ([#676](https://www.github.com/googleapis/nodejs-dialogflow/issues/676)) ([217bb9c](https://www.github.com/googleapis/nodejs-dialogflow/commit/217bb9c209000d20157fc6478cd9a26369e8b106)) + +## [3.2.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.1.1...v3.2.0) (2020-07-29) + + +### Features + +* added support for custom content types docs: clarified wording around quota usage ([#660](https://www.github.com/googleapis/nodejs-dialogflow/issues/660)) ([8a7fbd3](https://www.github.com/googleapis/nodejs-dialogflow/commit/8a7fbd32ddcc907538fd4b0b5a129054c082dc81)) + +### [3.1.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.1.0...v3.1.1) (2020-07-23) + + +### Bug Fixes + +* publish missing client config annotations ([#653](https://www.github.com/googleapis/nodejs-dialogflow/issues/653)) ([b368797](https://www.github.com/googleapis/nodejs-dialogflow/commit/b36879723fd3aeab0c158d3ab76a5aa6505498e1)) + +## [3.1.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.0.0...v3.1.0) (2020-07-10) + + +### Features + +* adds projectAgentEnvironmentPathTemplate and projectAgentEnvironmentUserSessionContextPathTemplate ([c204d9c](https://www.github.com/googleapis/nodejs-dialogflow/commit/c204d9cd7d9f121404b15783b8da5a451a671748)) + + +### Bug Fixes + +* typeo in nodejs .gitattribute ([#639](https://www.github.com/googleapis/nodejs-dialogflow/issues/639)) ([558aad8](https://www.github.com/googleapis/nodejs-dialogflow/commit/558aad81af74888516db9667f4a4e7b56cd3d3ba)) + +## [3.0.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v2.0.0...v3.0.0) (2020-07-06) + + +### ⚠ BREAKING CHANGES + +* only v1 clients must be exported by default (#619) +* proper long running operation returned from Agent v2beta1 calls (#621) + +### Features + +* check status of long running operation by its name ([#606](https://www.github.com/googleapis/nodejs-dialogflow/issues/606)) ([77b28f1](https://www.github.com/googleapis/nodejs-dialogflow/commit/77b28f1fad846bf629fcbdccfb0b51771e2e9c76)) +* proper long running operation returned from Agent v2beta1 calls ([#621](https://www.github.com/googleapis/nodejs-dialogflow/issues/621)) ([ff509cd](https://www.github.com/googleapis/nodejs-dialogflow/commit/ff509cd59ac14958b08698dc22308bd660da82ca)) + + +### Bug Fixes + +* **deps:** update dependency uuid to v8 ([#602](https://www.github.com/googleapis/nodejs-dialogflow/issues/602)) ([9cec1be](https://www.github.com/googleapis/nodejs-dialogflow/commit/9cec1beeace132829368b99701ce7c9970e4b126)) +* exception occurred in retry method ([#615](https://www.github.com/googleapis/nodejs-dialogflow/issues/615)) ([b8b2ccd](https://www.github.com/googleapis/nodejs-dialogflow/commit/b8b2ccdf2e0c236c515706ecc6b9759ed570cfc7)) +* only v1 clients must be exported by default ([#619](https://www.github.com/googleapis/nodejs-dialogflow/issues/619)) ([d1fb5ab](https://www.github.com/googleapis/nodejs-dialogflow/commit/d1fb5abb66f1eb55545807e1f6cb45b0ec51c287)) + +## [2.0.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v1.2.0...v2.0.0) (2020-04-23) + + +### ⚠ BREAKING CHANGES + +* regenerate library based on dialogflow/v2 proto changes (#569) +* The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. +* updated protos and renamed path template helpers +* move API to typescript code generation (#523) + +### Features + +* added getValidationResult and field mask override control for output audio config ([4fd6c71](https://www.github.com/googleapis/nodejs-dialogflow/commit/4fd6c71d979256850eb655a9f4554bee051e489c)) +* deferred client initialization ([#555](https://www.github.com/googleapis/nodejs-dialogflow/issues/555)) ([93ba86e](https://www.github.com/googleapis/nodejs-dialogflow/commit/93ba86e586ffd7d563da9118f96fa1b172c13d7d)) +* drop node8 support, support for async iterators ([#574](https://www.github.com/googleapis/nodejs-dialogflow/issues/574)) ([fe8073f](https://www.github.com/googleapis/nodejs-dialogflow/commit/fe8073f79e98211eb6790e9fef05dd9ea8159573)) +* export protos in src/index.ts ([92d805b](https://www.github.com/googleapis/nodejs-dialogflow/commit/92d805b452e7c61da6c87eb32ebe3e358e15a187)) +* move API to typescript code generation ([#523](https://www.github.com/googleapis/nodejs-dialogflow/issues/523)) ([19793a5](https://www.github.com/googleapis/nodejs-dialogflow/commit/19793a57250f22c9ea7ebde1d4553cbc5c93253c)) +* Publish ListEnvironments for Dialogflow v2/v2beta1 library. ([#598](https://www.github.com/googleapis/nodejs-dialogflow/issues/598)) ([de9e8f6](https://www.github.com/googleapis/nodejs-dialogflow/commit/de9e8f6bf4cf3c3a3d8b7ca27385e6c2f39afa3b)) +* regenerate library based on dialogflow/v2 proto changes ([#569](https://www.github.com/googleapis/nodejs-dialogflow/issues/569)) ([1610850](https://www.github.com/googleapis/nodejs-dialogflow/commit/16108501e3855f6b422c6e7be74d84922f710387)) +* updated protos and renamed path template helpers ([1c1b01c](https://www.github.com/googleapis/nodejs-dialogflow/commit/1c1b01ca4de61ca2ac77fedd4c5f33d9d5797c0d)) + + +### Bug Fixes + +* add missing resource annotations and additional_bindings ([#591](https://www.github.com/googleapis/nodejs-dialogflow/issues/591)) ([5a0e2ec](https://www.github.com/googleapis/nodejs-dialogflow/commit/5a0e2ec007dd717d8c18ab8d409c9a16c9589098)) +* bump min version of dependencies ([#589](https://www.github.com/googleapis/nodejs-dialogflow/issues/589)) ([d87e221](https://www.github.com/googleapis/nodejs-dialogflow/commit/d87e221ba9bb7231b4cb7ed989a7a7293133fcdb)) +* remove eslint, update gax, fix generated protos, run the generator ([#586](https://www.github.com/googleapis/nodejs-dialogflow/issues/586)) ([b9a88cf](https://www.github.com/googleapis/nodejs-dialogflow/commit/b9a88cfb66e9908d57660e3b5168e50b2cae1b9a)) + +## [1.2.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v1.1.2...v1.2.0) (2020-02-07) + + +### Features + +* **docs:** add deprecation message to version 1.x.x README ([#526](https://www.github.com/googleapis/nodejs-dialogflow/issues/526)) ([5474ec1](https://www.github.com/googleapis/nodejs-dialogflow/commit/5474ec19e943d01e4fc31bf8a728ee0299af8621)) + +### [1.1.2](https://www.github.com/googleapis/nodejs-dialogflow/compare/v1.1.1...v1.1.2) (2020-01-28) + + +### Bug Fixes + +* enum, bytes, and Long types now accept strings ([79bc7bc](https://www.github.com/googleapis/nodejs-dialogflow/commit/79bc7bcd08bc7a786e0d75a55de38b30e0d1a569)) + +### [1.1.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v1.1.0...v1.1.1) (2020-01-09) + + +### Bug Fixes + +* proto updates, no code changes ([1388648](https://www.github.com/googleapis/nodejs-dialogflow/commit/138864846d04397d8e590e817de6c3e94d800423)) + +## [1.1.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v1.0.0...v1.1.0) (2020-01-05) + + +### Features + +* add support for operation info ([#488](https://www.github.com/googleapis/nodejs-dialogflow/issues/488)) ([12d58a6](https://www.github.com/googleapis/nodejs-dialogflow/commit/12d58a613d63045030e4f9910d8d5a3cffd34b06)) + + +### Bug Fixes + +* update proto annotations ([142ff2b](https://www.github.com/googleapis/nodejs-dialogflow/commit/142ff2b97445bbc1b333b3eea6cae4eedabf63a9)) + +## [1.0.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.14.1...v1.0.0) (2019-12-05) + + +### Features + +* adds plural and singular resource descriptor ([#471](https://www.github.com/googleapis/nodejs-dialogflow/issues/471)) ([29e47a6](https://www.github.com/googleapis/nodejs-dialogflow/commit/29e47a68e66303b4485a3d0808fd022248887534)) +* **process:** library should be at 1.x ([#481](https://www.github.com/googleapis/nodejs-dialogflow/issues/481)) ([7d0df44](https://www.github.com/googleapis/nodejs-dialogflow/commit/7d0df44c32e29fa4cb93182b6b97a15bae30836c)) + + +### Bug Fixes + +* **deps:** pin TypeScript below 3.7.0 ([4dfa20f](https://www.github.com/googleapis/nodejs-dialogflow/commit/4dfa20fc10e7a5fcc294b60d2659b24e967fc17f)) +* **deps:** update dependency yargs to v15 ([#469](https://www.github.com/googleapis/nodejs-dialogflow/issues/469)) ([74e847e](https://www.github.com/googleapis/nodejs-dialogflow/commit/74e847e7b047d83e3fdcbd601def1493d228fe08)) +* **docs:** bump release level to GA ([#475](https://www.github.com/googleapis/nodejs-dialogflow/issues/475)) ([59b5d8c](https://www.github.com/googleapis/nodejs-dialogflow/commit/59b5d8c6c4e4b7091c1b5ea31404d0f941f85b13)) + +### [0.14.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.14.0...v0.14.1) (2019-11-15) + + +### Bug Fixes + +* import long in proto ts declaration file ([#462](https://www.github.com/googleapis/nodejs-dialogflow/issues/462)) ([cacd9c8](https://www.github.com/googleapis/nodejs-dialogflow/commit/cacd9c83e8edea18c7742b55efee91bce1a06e53)) +* **docs:** snippets are now replaced in jsdoc comments ([#461](https://www.github.com/googleapis/nodejs-dialogflow/issues/461)) ([029146e](https://www.github.com/googleapis/nodejs-dialogflow/commit/029146e70d1094f2a5de7cba61ed83006b533451)) + +## [0.14.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.13.0...v0.14.0) (2019-11-08) + + +### Features + +* add webhooks, BrowseCarouselCard, TableCard and MediaContent ([#458](https://www.github.com/googleapis/nodejs-dialogflow/issues/458)) ([53051a8](https://www.github.com/googleapis/nodejs-dialogflow/commit/53051a88b401a5d48844490531c3d50437a246b7)) + +## [0.13.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.12.2...v0.13.0) (2019-11-05) + + +### Features + +* add subtitle support ([#457](https://www.github.com/googleapis/nodejs-dialogflow/issues/457)) ([6cb00ea](https://www.github.com/googleapis/nodejs-dialogflow/commit/6cb00ea6194835045250eac5127250f1e2ea61fd)) +* introduces languageCode option ([8f3943f](https://www.github.com/googleapis/nodejs-dialogflow/commit/8f3943f8f6abb575f8b255207617a24e213bae57)) + +### [0.12.2](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.12.1...v0.12.2) (2019-10-22) + + +### Bug Fixes + +* **deps:** bump google-gax to 1.7.5 ([#451](https://www.github.com/googleapis/nodejs-dialogflow/issues/451)) ([1fddbd9](https://www.github.com/googleapis/nodejs-dialogflow/commit/1fddbd9e831256c395cb3cd3f59b43024da11d2e)) + +### [0.12.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.12.0...v0.12.1) (2019-10-09) + + +### Bug Fixes + +* use compatible version of google-gax ([9a0c16a](https://www.github.com/googleapis/nodejs-dialogflow/commit/9a0c16a)) + +## [0.12.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.11.0...v0.12.0) (2019-09-16) + + +### Features + +* fuzzy extraction and regexp entities ([#430](https://www.github.com/googleapis/nodejs-dialogflow/issues/430)) ([60aab0b](https://www.github.com/googleapis/nodejs-dialogflow/commit/60aab0b)) + +## [0.11.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.10.3...v0.11.0) (2019-09-09) + + +### Bug Fixes + +* **deps:** update dependency yargs to v14 ([a9458de](https://www.github.com/googleapis/nodejs-dialogflow/commit/a9458de)) +* add newlines to JSON protos ([bc9bc73](https://www.github.com/googleapis/nodejs-dialogflow/commit/bc9bc73)) + + +### Features + +* load protos from JSON, grpc-fallback support ([8683933](https://www.github.com/googleapis/nodejs-dialogflow/commit/8683933)) + +### [0.10.3](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.10.2...v0.10.3) (2019-07-23) + + +### Bug Fixes + +* **deps:** drop dependency on through2 ([#388](https://www.github.com/googleapis/nodejs-dialogflow/issues/388)) ([301c212](https://www.github.com/googleapis/nodejs-dialogflow/commit/301c212)) + +### [0.10.2](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.10.1...v0.10.2) (2019-07-01) + + +### Bug Fixes + +* **docs:** make anchors work in jsdoc ([#375](https://www.github.com/googleapis/nodejs-dialogflow/issues/375)) ([71e9a9c](https://www.github.com/googleapis/nodejs-dialogflow/commit/71e9a9c)) + +### [0.10.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.10.0...v0.10.1) (2019-06-14) + + +### Bug Fixes + +* **docs:** move to new client docs URL ([#368](https://www.github.com/googleapis/nodejs-dialogflow/issues/368)) ([9e121db](https://www.github.com/googleapis/nodejs-dialogflow/commit/9e121db)) + +## [0.10.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.9.1...v0.10.0) (2019-06-05) + + +### Features + +* add support for apiEndpoint option ([#363](https://www.github.com/googleapis/nodejs-dialogflow/issues/363)) ([10e84a3](https://www.github.com/googleapis/nodejs-dialogflow/commit/10e84a3)) + +### [0.9.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.9.0...v0.9.1) (2019-05-20) + + +### Bug Fixes + +* DEADLINE_EXCEEDED retry code is idempotent ([#343](https://www.github.com/googleapis/nodejs-dialogflow/issues/343)) ([d1238f7](https://www.github.com/googleapis/nodejs-dialogflow/commit/d1238f7)) +* remove DEADLINE_EXCEEDED from list of idempotent operations ([871070f](https://www.github.com/googleapis/nodejs-dialogflow/commit/871070f)) +* **deps:** update dependency google-gax to v1 ([#342](https://www.github.com/googleapis/nodejs-dialogflow/issues/342)) ([dead90b](https://www.github.com/googleapis/nodejs-dialogflow/commit/dead90b)) + +## [0.9.0](https://www.github.com/googleapis/nodejs-dialogflow/compare/v0.8.2...v0.9.0) (2019-05-07) + +### BREAKING CHANGE + +This release drops support for node versions below v8.10.0. + +### Bug Fixes + +* include 'x-goog-request-params' header in requests ([#310](https://www.github.com/googleapis/nodejs-dialogflow/issues/310)) ([479defe](https://www.github.com/googleapis/nodejs-dialogflow/commit/479defe)) +* **deps:** update dependency google-gax to ^0.26.0 ([#326](https://www.github.com/googleapis/nodejs-dialogflow/issues/326)) ([7541e5f](https://www.github.com/googleapis/nodejs-dialogflow/commit/7541e5f)) + + +### Build System + +* upgrade engines field to >=8.10.0 ([#328](https://www.github.com/googleapis/nodejs-dialogflow/issues/328)) ([62f144f](https://www.github.com/googleapis/nodejs-dialogflow/commit/62f144f)) + + +### Features + +* add the `updateDocument and `reloadDocument` methods ([#315](https://www.github.com/googleapis/nodejs-dialogflow/issues/315)) ([6e2defe](https://www.github.com/googleapis/nodejs-dialogflow/commit/6e2defe)) +* support audio config ([4ecea0e](https://www.github.com/googleapis/nodejs-dialogflow/commit/4ecea0e)) + + +### BREAKING CHANGES + +* upgrade engines field to >=8.10.0 (#328) + +## v0.8.2 + +03-13-2019 16:30 PDT + +### Bug Fixes +- fix: throw on invalid credentials ([#281](https://github.com/googleapis/nodejs-dialogflow/pull/281)) + +### Dependencies +- fix(deps): update dependency google-gax to ^0.25.0 ([#269](https://github.com/googleapis/nodejs-dialogflow/pull/269)) + +### Documentation +- docs: use backticks for JS values ([#299](https://github.com/googleapis/nodejs-dialogflow/pull/299)) +- docs: update jsdoc strings and import paths ([#298](https://github.com/googleapis/nodejs-dialogflow/pull/298)) +- docs: update links in contrib guide ([#283](https://github.com/googleapis/nodejs-dialogflow/pull/283)) +- docs: update contributing path in README ([#275](https://github.com/googleapis/nodejs-dialogflow/pull/275)) +- docs: move CONTRIBUTING.md to root ([#274](https://github.com/googleapis/nodejs-dialogflow/pull/274)) +- docs: add lint/fix example to contributing guide ([#272](https://github.com/googleapis/nodejs-dialogflow/pull/272)) +- docs: fix example comments ([#271](https://github.com/googleapis/nodejs-dialogflow/pull/271)) + +### Internal / Testing Changes +- build: Add docuploader credentials to node publish jobs ([#296](https://github.com/googleapis/nodejs-dialogflow/pull/296)) +- build: use node10 to run samples-test, system-test etc ([#295](https://github.com/googleapis/nodejs-dialogflow/pull/295)) +- build: update release configuration +- chore: sync latest proto docs +- chore(deps): update dependency mocha to v6 +- build: use linkinator for docs test ([#282](https://github.com/googleapis/nodejs-dialogflow/pull/282)) +- fix(deps): update dependency yargs to v13 ([#280](https://github.com/googleapis/nodejs-dialogflow/pull/280)) +- build: create docs test npm scripts ([#279](https://github.com/googleapis/nodejs-dialogflow/pull/279)) +- build: test using @grpc/grpc-js in CI ([#276](https://github.com/googleapis/nodejs-dialogflow/pull/276)) +- refactor: improve generated code style. ([#270](https://github.com/googleapis/nodejs-dialogflow/pull/270)) + +## v0.8.1 + +01-28-2019 13:24 PST + +### Documentation +- fix(docs): dialogflow isnt published under @google-cloud scope ([#266](https://github.com/googleapis/nodejs-dialogflow/pull/266)) + +## v0.8.0 + +01-28-2019 11:05 PST + +### Dependencies +- chore(deps): update dependency eslint-config-prettier to v4 ([#261](https://github.com/googleapis/nodejs-dialogflow/pull/261)) +- fix(deps): update dependency google-gax to ^0.24.0 ([#260](https://github.com/googleapis/nodejs-dialogflow/pull/260)) +- fix(deps): update dependency google-gax to ^0.23.0 ([#256](https://github.com/googleapis/nodejs-dialogflow/pull/256)) +- fix(deps): update dependency google-gax to ^0.22.0 ([#217](https://github.com/googleapis/nodejs-dialogflow/pull/217)) +- fix(deps): update dependency google-gax to ^0.21.0 ([#215](https://github.com/googleapis/nodejs-dialogflow/pull/215)) +- chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 ([#214](https://github.com/googleapis/nodejs-dialogflow/pull/214)) +- chore: remove unused deps ([#212](https://github.com/googleapis/nodejs-dialogflow/pull/212)) +- fix(deps): update dependency through2 to v3 ([#209](https://github.com/googleapis/nodejs-dialogflow/pull/209)) +- chore(deps): update dependency eslint-plugin-node to v8 ([#199](https://github.com/googleapis/nodejs-dialogflow/pull/199)) +- chore(deps): update dependency eslint-plugin-prettier to v3 ([#191](https://github.com/googleapis/nodejs-dialogflow/pull/191)) + +### Documentation +- refactor(samples): convert sample tests from ava to mocha ([#222](https://github.com/googleapis/nodejs-dialogflow/pull/222)) +- fix(docs): properly show how to require this module ([#263](https://github.com/googleapis/nodejs-dialogflow/pull/263)) +- fix(samples): Fixed typo in example ([#179](https://github.com/googleapis/nodejs-dialogflow/pull/179)) +- build: ignore googleapis.com in doc link check ([#259](https://github.com/googleapis/nodejs-dialogflow/pull/259)) +- chore: update license year +- build: check broken links in generated docs ([#254](https://github.com/googleapis/nodejs-dialogflow/pull/254)) +- fix(docs): remove unused long running operations types +- docs: improve the quickstart sample ([#234](https://github.com/googleapis/nodejs-dialogflow/pull/234)) +- docs: update the readme ([#232](https://github.com/googleapis/nodejs-dialogflow/pull/232)) +- docs(samples): updated samples to use async/await ([#228](https://github.com/googleapis/nodejs-dialogflow/pull/228)) +- docs: Strip dynamic badges from README ([#184](https://github.com/googleapis/nodejs-dialogflow/pull/184)) + +### Internal / Testing Changes +- refactor: improve the sample tests ([#251](https://github.com/googleapis/nodejs-dialogflow/pull/251)) +- chore(build): inject yoshi automation key ([#249](https://github.com/googleapis/nodejs-dialogflow/pull/249)) +- chore: update nyc and eslint configs ([#248](https://github.com/googleapis/nodejs-dialogflow/pull/248)) +- chore: fix publish.sh permission +x ([#245](https://github.com/googleapis/nodejs-dialogflow/pull/245)) +- fix(build): fix Kokoro release script ([#244](https://github.com/googleapis/nodejs-dialogflow/pull/244)) +- build: add Kokoro configs for autorelease ([#243](https://github.com/googleapis/nodejs-dialogflow/pull/243)) +- chore: always nyc report before calling codecov ([#241](https://github.com/googleapis/nodejs-dialogflow/pull/241)) +- chore: nyc ignore build/test by default ([#240](https://github.com/googleapis/nodejs-dialogflow/pull/240)) +- chore: update the renovate config ([#237](https://github.com/googleapis/nodejs-dialogflow/pull/237)) +- fix(build): fix system key decryption ([#230](https://github.com/googleapis/nodejs-dialogflow/pull/230)) +- chore: add a synth.metadata +- chore: update eslintignore config ([#216](https://github.com/googleapis/nodejs-dialogflow/pull/216)) +- chore: drop contributors from multiple places ([#213](https://github.com/googleapis/nodejs-dialogflow/pull/213)) +- chore: use latest npm on Windows ([#210](https://github.com/googleapis/nodejs-dialogflow/pull/210)) +- fix: update gRPC timeouts ([#208](https://github.com/googleapis/nodejs-dialogflow/pull/208)) +- chore: update CircleCI config ([#207](https://github.com/googleapis/nodejs-dialogflow/pull/207)) +- chore: include build in eslintignore ([#204](https://github.com/googleapis/nodejs-dialogflow/pull/204)) +- fix: use unique name for sample test knowledge base ([#198](https://github.com/googleapis/nodejs-dialogflow/pull/198)) +- chore: update issue templates ([#197](https://github.com/googleapis/nodejs-dialogflow/pull/197)) +- chore: remove old issue template ([#195](https://github.com/googleapis/nodejs-dialogflow/pull/195)) +- build: run tests on node11 ([#194](https://github.com/googleapis/nodejs-dialogflow/pull/194)) +- chores(build): run codecov on continuous builds ([#190](https://github.com/googleapis/nodejs-dialogflow/pull/190)) +- chores(build): do not collect sponge.xml from windows builds ([#192](https://github.com/googleapis/nodejs-dialogflow/pull/192)) +- chore: update new issue template ([#189](https://github.com/googleapis/nodejs-dialogflow/pull/189)) +- build: fix codecov uploading on Kokoro ([#183](https://github.com/googleapis/nodejs-dialogflow/pull/183)) +- Update CI config ([#180](https://github.com/googleapis/nodejs-dialogflow/pull/180)) + +## v0.7.0 + +### Breaking Changes +- BREAKING: Drop support for node.js 4.x ([#164](https://github.com/googleapis/nodejs-dialogflow/pull/164)) + +### Bug fixes +- Fix typo in comment ([#168](https://github.com/googleapis/nodejs-dialogflow/pull/168)) +- Update old samples to new agent using Room Reservations and match can… ([#162](https://github.com/googleapis/nodejs-dialogflow/pull/162)) +- fix(samples/resource): fix intent creation ([#104](https://github.com/googleapis/nodejs-dialogflow/pull/104)) +- fix(deps): update dependency google-gax to ^0.20.0 ([#142](https://github.com/googleapis/nodejs-dialogflow/pull/142)) +- Remove dependency on @google-cloud/common ([#165](https://github.com/googleapis/nodejs-dialogflow/pull/165)) +- Fix typo in word 'session' in detect sample comments ([#147](https://github.com/googleapis/nodejs-dialogflow/pull/147)) +- fix(deps): update dependency uuid to v3.3.2 ([#122](https://github.com/googleapis/nodejs-dialogflow/pull/122)) + +### New Features +- Run the synth generator and update config ([#161](https://github.com/googleapis/nodejs-dialogflow/pull/161)) + +### Documentation +- feat(samples): Beta features PR ([#144](https://github.com/googleapis/nodejs-dialogflow/pull/144)) + +### Internal / Testing Changes +- Update kokoro config ([#173](https://github.com/googleapis/nodejs-dialogflow/pull/173)) +- test: remove appveyor config ([#172](https://github.com/googleapis/nodejs-dialogflow/pull/172)) +- Configure kokoro CI ([#171](https://github.com/googleapis/nodejs-dialogflow/pull/171)) +- Enable prefer-const in the eslint config ([#167](https://github.com/googleapis/nodejs-dialogflow/pull/167)) +- chore(deps): update dependency eslint-config-prettier to v3 ([#148](https://github.com/googleapis/nodejs-dialogflow/pull/148)) +- chore(deps): update dependency eslint-plugin-node to v7 ([#135](https://github.com/googleapis/nodejs-dialogflow/pull/135)) +- Ignore package-lock.json ([#163](https://github.com/googleapis/nodejs-dialogflow/pull/163)) +- chore(deps): update dependency nyc to v13 ([#154](https://github.com/googleapis/nodejs-dialogflow/pull/154)) +- chore: assert.equal => assert.strictEqual ([#139](https://github.com/googleapis/nodejs-dialogflow/pull/139)) +- chore(deps): update dependency eslint to v5 ([#112](https://github.com/googleapis/nodejs-dialogflow/pull/112)) + +## v0.6.0 + +### New Features +Version v0.6.0 of the Dialogflow NodeJS Client Library brings with it these changes: +- management of Knowledge base Documents support +- AudioConfig +- Intent: Telephony Gateway, supporting + - TelephonyPlayAudio - plays audio from a file in Telephony Gateway + - TelephonySynthesizeSpeech - synthesizes speech and plays back the audio to the caller + - TelephonyTransferCall - transfers the call in Telephony Gateway +- end_interaction option for Intent and Webhook - indicates that the intent ends an interaction +- supports alternative query results from KnowledgeService +- deprecation: Intent: ml_enabled option +- protos documentation changes + +..generated against googleapis/googleapis@9c3174a + +### Dependencies +- fix(deps): update dependency yargs to v12 (edited) (#126) +- chore(deps): update dependency @google-cloud/nodejs-repo-tools to v2.3.1 (#129) +- fix(deps): update dependency uuid to v3.3.0 (#118) +- chore(deps): update dependency nyc to v12 (#99) +- fix(deps): update dependency @google-cloud/common to ^0.20.0 (#98) +- chore(deps): update node:10 docker digest to 055fe4 (#91) + +### Documentation +- fix(samples): update the type of Training phases per (#131) + +### Internal / Testing Changes +- chore: drop repo-tools as an exec wrapper (#136) +- gen: fix synth.py to copy all versions and regenerate (#134) +- chore(build): synth.py: npm ci; node templates +- chore(deps): update node:10 docker digest to 1201e1 (#96) +- Regenerate GAPIC for V1 and V2Beta1 using synth.py (#110) diff --git a/packages/google-cloud-dialogflow/CODE_OF_CONDUCT.md b/packages/google-cloud-dialogflow/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..2add2547a81 --- /dev/null +++ b/packages/google-cloud-dialogflow/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +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 + +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. + +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 diff --git a/packages/google-cloud-dialogflow/CONTRIBUTING.md b/packages/google-cloud-dialogflow/CONTRIBUTING.md new file mode 100644 index 00000000000..f70ef1716cb --- /dev/null +++ b/packages/google-cloud-dialogflow/CONTRIBUTING.md @@ -0,0 +1,76 @@ +# How to become a contributor and submit your own code + +**Table of contents** + +* [Contributor License Agreements](#contributor-license-agreements) +* [Contributing a patch](#contributing-a-patch) +* [Running the tests](#running-the-tests) +* [Releasing the library](#releasing-the-library) + +## Contributor License Agreements + +We'd love to accept your sample apps and patches! Before we can take them, we +have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement +(CLA). + + * If you are an individual writing original source code and you're sure you + own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual). + * If you work for a company that wants to allow you to contribute your work, + then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate). + +Follow either of the two links above to access the appropriate CLA and +instructions for how to sign and return it. Once we receive it, we'll be able to +accept your pull requests. + +## Contributing A Patch + +1. Submit an issue describing your proposed change to the repo in question. +1. The repo owner will respond to your issue promptly. +1. If your proposed change is accepted, and you haven't already done so, sign a + Contributor License Agreement (see details above). +1. Fork the desired repo, develop and test your code changes. +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 Dialogflow 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]. + +1. Install dependencies: + + npm install + +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=dialogflow.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-cloud-dialogflow/LICENSE b/packages/google-cloud-dialogflow/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/packages/google-cloud-dialogflow/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/packages/google-cloud-dialogflow/README.md b/packages/google-cloud-dialogflow/README.md new file mode 100644 index 00000000000..7912c627f73 --- /dev/null +++ b/packages/google-cloud-dialogflow/README.md @@ -0,0 +1,330 @@ +[//]: # "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 + +# [Dialogflow API: Node.js Client](https://github.com/googleapis/google-cloud-node) + +[![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![npm version](https://img.shields.io/npm/v/@google-cloud/dialogflow.svg)](https://www.npmjs.org/package/@google-cloud/dialogflow) + + + + +Dialogflow API client for Node.js + + +A comprehensive list of changes in each version may be found in +[the CHANGELOG](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-dialogflow/CHANGELOG.md). + +* [Dialogflow API Node.js Client API Reference][client-docs] +* [Dialogflow API Documentation][product-docs] +* [github.com/googleapis/google-cloud-node/packages/google-cloud-dialogflow](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-dialogflow) + +Read more about the client libraries for Cloud APIs, including the older +Google APIs Client Libraries, in [Client Libraries Explained][explained]. + +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained + +**Table of contents:** + + +* [Quickstart](#quickstart) + * [Before you begin](#before-you-begin) + * [Installing the client library](#installing-the-client-library) + +* [Samples](#samples) +* [Versioning](#versioning) +* [Contributing](#contributing) +* [License](#license) + +## Quickstart + +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Dialogflow API API][enable_api]. +1. [Set up authentication with a service account][auth] so you can access the + API from your local workstation. + +### Installing the client library + +```bash +npm install @google-cloud/dialogflow +``` + + + + +## Samples + +Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. + +| Sample | Source Code | Try it | +| --------------------------- | --------------------------------- | ------ | +| Agents.delete_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js,samples/README.md) | +| Agents.export_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js,samples/README.md) | +| Agents.get_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js,samples/README.md) | +| Agents.get_validation_result | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js,samples/README.md) | +| Agents.import_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js,samples/README.md) | +| Agents.restore_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js,samples/README.md) | +| Agents.search_agents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js,samples/README.md) | +| Agents.set_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js,samples/README.md) | +| Agents.train_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js,samples/README.md) | +| Answer_records.list_answer_records | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js,samples/README.md) | +| Answer_records.update_answer_record | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js,samples/README.md) | +| Contexts.create_context | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js,samples/README.md) | +| Contexts.delete_all_contexts | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js,samples/README.md) | +| Contexts.delete_context | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js,samples/README.md) | +| Contexts.get_context | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js,samples/README.md) | +| Contexts.list_contexts | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js,samples/README.md) | +| Contexts.update_context | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js,samples/README.md) | +| Conversation_datasets.create_conversation_dataset | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.create_conversation_dataset.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.create_conversation_dataset.js,samples/README.md) | +| Conversation_datasets.delete_conversation_dataset | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js,samples/README.md) | +| Conversation_datasets.get_conversation_dataset | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.get_conversation_dataset.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.get_conversation_dataset.js,samples/README.md) | +| Conversation_datasets.import_conversation_data | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.import_conversation_data.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.import_conversation_data.js,samples/README.md) | +| Conversation_datasets.list_conversation_datasets | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.list_conversation_datasets.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.list_conversation_datasets.js,samples/README.md) | +| Conversation_models.create_conversation_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model.js,samples/README.md) | +| Conversation_models.create_conversation_model_evaluation | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js,samples/README.md) | +| Conversation_models.delete_conversation_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.delete_conversation_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.delete_conversation_model.js,samples/README.md) | +| Conversation_models.deploy_conversation_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.deploy_conversation_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.deploy_conversation_model.js,samples/README.md) | +| Conversation_models.get_conversation_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model.js,samples/README.md) | +| Conversation_models.get_conversation_model_evaluation | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js,samples/README.md) | +| Conversation_models.list_conversation_model_evaluations | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js,samples/README.md) | +| Conversation_models.list_conversation_models | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_models.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_models.js,samples/README.md) | +| Conversation_models.undeploy_conversation_model | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.undeploy_conversation_model.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.undeploy_conversation_model.js,samples/README.md) | +| Conversation_profiles.clear_suggestion_feature_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js,samples/README.md) | +| Conversation_profiles.create_conversation_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js,samples/README.md) | +| Conversation_profiles.delete_conversation_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js,samples/README.md) | +| Conversation_profiles.get_conversation_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js,samples/README.md) | +| Conversation_profiles.list_conversation_profiles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js,samples/README.md) | +| Conversation_profiles.set_suggestion_feature_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js,samples/README.md) | +| Conversation_profiles.update_conversation_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js,samples/README.md) | +| Conversations.complete_conversation | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js,samples/README.md) | +| Conversations.create_conversation | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js,samples/README.md) | +| Conversations.get_conversation | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js,samples/README.md) | +| Conversations.list_conversations | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js,samples/README.md) | +| Conversations.list_messages | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js,samples/README.md) | +| Documents.create_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js,samples/README.md) | +| Documents.delete_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js,samples/README.md) | +| Documents.export_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.export_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.export_document.js,samples/README.md) | +| Documents.get_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js,samples/README.md) | +| Documents.import_documents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.import_documents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.import_documents.js,samples/README.md) | +| Documents.list_documents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js,samples/README.md) | +| Documents.reload_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js,samples/README.md) | +| Documents.update_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js,samples/README.md) | +| Entity_types.batch_create_entities | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js,samples/README.md) | +| Entity_types.batch_delete_entities | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js,samples/README.md) | +| Entity_types.batch_delete_entity_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js,samples/README.md) | +| Entity_types.batch_update_entities | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js,samples/README.md) | +| Entity_types.batch_update_entity_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js,samples/README.md) | +| Entity_types.create_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js,samples/README.md) | +| Entity_types.delete_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js,samples/README.md) | +| Entity_types.get_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js,samples/README.md) | +| Entity_types.list_entity_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js,samples/README.md) | +| Entity_types.update_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js,samples/README.md) | +| Environments.create_environment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js,samples/README.md) | +| Environments.delete_environment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js,samples/README.md) | +| Environments.get_environment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js,samples/README.md) | +| Environments.get_environment_history | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js,samples/README.md) | +| Environments.list_environments | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js,samples/README.md) | +| Environments.update_environment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js,samples/README.md) | +| Fulfillments.get_fulfillment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js,samples/README.md) | +| Fulfillments.update_fulfillment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js,samples/README.md) | +| Intents.batch_delete_intents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js,samples/README.md) | +| Intents.batch_update_intents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js,samples/README.md) | +| Intents.create_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js,samples/README.md) | +| Intents.delete_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js,samples/README.md) | +| Intents.get_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js,samples/README.md) | +| Intents.list_intents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js,samples/README.md) | +| Intents.update_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js,samples/README.md) | +| Knowledge_bases.create_knowledge_base | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js,samples/README.md) | +| Knowledge_bases.delete_knowledge_base | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js,samples/README.md) | +| Knowledge_bases.get_knowledge_base | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js,samples/README.md) | +| Knowledge_bases.list_knowledge_bases | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js,samples/README.md) | +| Knowledge_bases.update_knowledge_base | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js,samples/README.md) | +| Participants.analyze_content | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js,samples/README.md) | +| Participants.create_participant | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js,samples/README.md) | +| Participants.get_participant | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js,samples/README.md) | +| Participants.list_participants | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js,samples/README.md) | +| Participants.streaming_analyze_content | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.streaming_analyze_content.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.streaming_analyze_content.js,samples/README.md) | +| Participants.suggest_articles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js,samples/README.md) | +| Participants.suggest_faq_answers | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js,samples/README.md) | +| Participants.suggest_smart_replies | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_smart_replies.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_smart_replies.js,samples/README.md) | +| Participants.update_participant | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js,samples/README.md) | +| Session_entity_types.create_session_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js,samples/README.md) | +| Session_entity_types.delete_session_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js,samples/README.md) | +| Session_entity_types.get_session_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js,samples/README.md) | +| Session_entity_types.list_session_entity_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js,samples/README.md) | +| Session_entity_types.update_session_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js,samples/README.md) | +| Sessions.detect_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js,samples/README.md) | +| Sessions.streaming_detect_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js,samples/README.md) | +| Versions.create_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js,samples/README.md) | +| Versions.delete_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js,samples/README.md) | +| Versions.get_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js,samples/README.md) | +| Versions.list_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js,samples/README.md) | +| Versions.update_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js,samples/README.md) | +| Agents.delete_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js,samples/README.md) | +| Agents.export_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js,samples/README.md) | +| Agents.get_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js,samples/README.md) | +| Agents.get_validation_result | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js,samples/README.md) | +| Agents.import_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js,samples/README.md) | +| Agents.restore_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js,samples/README.md) | +| Agents.search_agents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js,samples/README.md) | +| Agents.set_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js,samples/README.md) | +| Agents.train_agent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js,samples/README.md) | +| Answer_records.get_answer_record | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js,samples/README.md) | +| Answer_records.list_answer_records | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js,samples/README.md) | +| Answer_records.update_answer_record | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js,samples/README.md) | +| Contexts.create_context | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js,samples/README.md) | +| Contexts.delete_all_contexts | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js,samples/README.md) | +| Contexts.delete_context | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js,samples/README.md) | +| Contexts.get_context | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js,samples/README.md) | +| Contexts.list_contexts | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js,samples/README.md) | +| Contexts.update_context | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js,samples/README.md) | +| Conversation_profiles.clear_suggestion_feature_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js,samples/README.md) | +| Conversation_profiles.create_conversation_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js,samples/README.md) | +| Conversation_profiles.delete_conversation_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js,samples/README.md) | +| Conversation_profiles.get_conversation_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js,samples/README.md) | +| Conversation_profiles.list_conversation_profiles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js,samples/README.md) | +| Conversation_profiles.set_suggestion_feature_config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js,samples/README.md) | +| Conversation_profiles.update_conversation_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js,samples/README.md) | +| Conversations.batch_create_messages | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js,samples/README.md) | +| Conversations.complete_conversation | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js,samples/README.md) | +| Conversations.create_conversation | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js,samples/README.md) | +| Conversations.get_conversation | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js,samples/README.md) | +| Conversations.list_conversations | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js,samples/README.md) | +| Conversations.list_messages | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js,samples/README.md) | +| Conversations.suggest_conversation_summary | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.suggest_conversation_summary.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.suggest_conversation_summary.js,samples/README.md) | +| Documents.create_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js,samples/README.md) | +| Documents.delete_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js,samples/README.md) | +| Documents.get_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js,samples/README.md) | +| Documents.import_documents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js,samples/README.md) | +| Documents.list_documents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js,samples/README.md) | +| Documents.reload_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js,samples/README.md) | +| Documents.update_document | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js,samples/README.md) | +| Entity_types.batch_create_entities | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js,samples/README.md) | +| Entity_types.batch_delete_entities | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js,samples/README.md) | +| Entity_types.batch_delete_entity_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js,samples/README.md) | +| Entity_types.batch_update_entities | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js,samples/README.md) | +| Entity_types.batch_update_entity_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js,samples/README.md) | +| Entity_types.create_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js,samples/README.md) | +| Entity_types.delete_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js,samples/README.md) | +| Entity_types.get_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js,samples/README.md) | +| Entity_types.list_entity_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js,samples/README.md) | +| Entity_types.update_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js,samples/README.md) | +| Environments.create_environment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js,samples/README.md) | +| Environments.delete_environment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js,samples/README.md) | +| Environments.get_environment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js,samples/README.md) | +| Environments.get_environment_history | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js,samples/README.md) | +| Environments.list_environments | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js,samples/README.md) | +| Environments.update_environment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js,samples/README.md) | +| Fulfillments.get_fulfillment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js,samples/README.md) | +| Fulfillments.update_fulfillment | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js,samples/README.md) | +| Intents.batch_delete_intents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js,samples/README.md) | +| Intents.batch_update_intents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js,samples/README.md) | +| Intents.create_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js,samples/README.md) | +| Intents.delete_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js,samples/README.md) | +| Intents.get_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js,samples/README.md) | +| Intents.list_intents | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js,samples/README.md) | +| Intents.update_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js,samples/README.md) | +| Knowledge_bases.create_knowledge_base | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js,samples/README.md) | +| Knowledge_bases.delete_knowledge_base | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js,samples/README.md) | +| Knowledge_bases.get_knowledge_base | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js,samples/README.md) | +| Knowledge_bases.list_knowledge_bases | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js,samples/README.md) | +| Knowledge_bases.update_knowledge_base | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js,samples/README.md) | +| Participants.analyze_content | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js,samples/README.md) | +| Participants.compile_suggestion | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js,samples/README.md) | +| Participants.create_participant | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js,samples/README.md) | +| Participants.get_participant | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js,samples/README.md) | +| Participants.list_participants | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js,samples/README.md) | +| Participants.list_suggestions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js,samples/README.md) | +| Participants.streaming_analyze_content | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.streaming_analyze_content.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.streaming_analyze_content.js,samples/README.md) | +| Participants.suggest_articles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js,samples/README.md) | +| Participants.suggest_faq_answers | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js,samples/README.md) | +| Participants.suggest_smart_replies | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js,samples/README.md) | +| Participants.update_participant | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js,samples/README.md) | +| Session_entity_types.create_session_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js,samples/README.md) | +| Session_entity_types.delete_session_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js,samples/README.md) | +| Session_entity_types.get_session_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js,samples/README.md) | +| Session_entity_types.list_session_entity_types | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js,samples/README.md) | +| Session_entity_types.update_session_entity_type | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js,samples/README.md) | +| Sessions.detect_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js,samples/README.md) | +| Sessions.streaming_detect_intent | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js,samples/README.md) | +| Versions.create_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js,samples/README.md) | +| Versions.delete_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js,samples/README.md) | +| Versions.get_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js,samples/README.md) | +| Versions.list_versions | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js,samples/README.md) | +| Versions.update_version | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js,samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/quickstart.js,samples/README.md) | +| Quickstart.test | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/test/quickstart.test.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/test/quickstart.test.js,samples/README.md) | + + + +The [Dialogflow API Node.js Client API Reference][client-docs] documentation +also contains samples. + +## Supported Node.js Versions + +Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/). +Libraries are compatible with all current _active_ and _maintenance_ versions of +Node.js. +If you are using an end-of-life version of Node.js, we recommend that you update +as soon as possible to an actively supported LTS version. + +Google's client libraries support legacy versions of Node.js runtimes on a +best-efforts basis with the following warnings: + +* Legacy versions are not tested in continuous integration. +* Some security patches and features cannot be backported. +* Dependencies cannot be kept up-to-date. + +Client libraries targeting some end-of-life versions of Node.js are available, and +can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. +For example, `npm install @google-cloud/dialogflow@legacy-8` installs client libraries +for versions compatible with Node.js 8. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + + + +This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways +unless absolutely necessary (e.g. because of critical security issues) or with +an extensive deprecation period. Issues and requests against **stable** libraries +are addressed with the highest priority. + + + + + + +More Information: [Google Cloud Platform Launch Stages][launch_stages] + +[launch_stages]: https://cloud.google.com/terms/launch-stages + +## Contributing + +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). + +Please note that this `README.md`, the `samples/README.md`, +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) +are generated from a central template. To edit one of these files, make an edit +to its templates in +[directory](https://github.com/googleapis/synthtool). + +## License + +Apache Version 2.0 + +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) + +[client-docs]: https://googleapis.dev/nodejs/dialogflow/latest +[product-docs]: https://cloud.google.com/dialogflow-enterprise/ +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[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=dialogflow.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-dialogflow/linkinator.config.json b/packages/google-cloud-dialogflow/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/packages/google-cloud-dialogflow/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "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/packages/google-cloud-dialogflow/package.json b/packages/google-cloud-dialogflow/package.json new file mode 100644 index 00000000000..c18d7053da5 --- /dev/null +++ b/packages/google-cloud-dialogflow/package.json @@ -0,0 +1,73 @@ +{ + "name": "@google-cloud/dialogflow", + "description": "Dialogflow API client for Node.js", + "version": "5.3.0", + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "directory": "packages/google-cloud-dialogflow", + "url": "https://github.com/googleapis/google-cloud-node.git" + }, + "main": "build/src/index.js", + "files": [ + "build/protos", + "build/src" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google dialogflow", + "dialogflow", + "Dialogflow API" + ], + "scripts": { + "test": "c8 mocha build/test/*_v2.js && c8 mocha build/test/*_v2beta1.js", + "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test", + "system-test": "npm run compile && c8 mocha build/system-test", + "docs": "jsdoc -c .jsdoc.js", + "lint": "gts check", + "fix": "gts fix", + "docs-test": "linkinator docs", + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "predocs-test": "npm run docs", + "prepare": "npm run compile-protos && npm run compile", + "prelint": "cd samples; npm link ../; npm install", + "precompile": "gts clean" + }, + "dependencies": { + "google-gax": "^3.5.2" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^18.0.0", + "@types/sinon": "^10.0.0", + "c8": "^7.1.0", + "codecov": "^3.6.5", + "gts": "^3.1.0", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.0", + "jsdoc-region-tag": "^2.0.0", + "linkinator": "^4.0.0", + "mocha": "^9.2.2", + "null-loader": "^4.0.0", + "pack-n-play": "^1.0.0-2", + "sinon": "^14.0.0", + "ts-loader": "^9.0.0", + "typescript": "^4.6.4", + "webpack": "^5.0.0", + "webpack-cli": "^4.0.0" + }, + "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-dialogflow" +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/common_resources.proto b/packages/google-cloud-dialogflow/protos/google/cloud/common_resources.proto new file mode 100644 index 00000000000..56c9f800d5e --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/common_resources.proto @@ -0,0 +1,52 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This file contains stub messages for common resources in GCP. +// It is not intended to be directly generated, and is instead used by +// other tooling to be able to match common resource patterns. +syntax = "proto3"; + +package google.cloud; + +import "google/api/resource.proto"; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Project" + pattern: "projects/{project}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Organization" + pattern: "organizations/{organization}" +}; + + +option (google.api.resource_definition) = { + type: "cloudresourcemanager.googleapis.com/Folder" + pattern: "folders/{folder}" +}; + + +option (google.api.resource_definition) = { + type: "cloudbilling.googleapis.com/BillingAccount" + pattern: "billingAccounts/{billing_account}" +}; + +option (google.api.resource_definition) = { + type: "locations.googleapis.com/Location" + pattern: "projects/{project}/locations/{location}" +}; + diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/agent.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/agent.proto new file mode 100644 index 00000000000..fa16a4c2af2 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/agent.proto @@ -0,0 +1,559 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/validation_result.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AgentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Agents][google.cloud.dialogflow.v2.Agent]. +service Agents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Retrieves the specified agent. + rpc GetAgent(GetAgentRequest) returns (Agent) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/agent" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/agent" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Creates/updates the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc SetAgent(SetAgentRequest) returns (Agent) { + option (google.api.http) = { + post: "/v2/{agent.parent=projects/*}/agent" + body: "agent" + additional_bindings { + post: "/v2/{agent.parent=projects/*/locations/*}/agent" + body: "agent" + } + }; + option (google.api.method_signature) = "agent"; + } + + // Deletes the specified agent. + rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{parent=projects/*}/agent" + additional_bindings { + delete: "/v2/{parent=projects/*/locations/*}/agent" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the list of agents. + // + // Since there is at most one conversational agent per project, this method is + // useful primarily for listing all agents across projects the caller has + // access to. One can achieve that with a wildcard project collection id "-". + // Refer to [List + // Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). + rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/agent:search" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/agent:search" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Trains the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/agent:train" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/agent:train" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Exports the specified agent to a ZIP file. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse] + rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/agent:export" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/agent:export" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2.ExportAgentResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Imports the specified agent from a ZIP file. + // + // Uploads new intents and entity types without deleting the existing ones. + // Intents and entity types with the same name are replaced with the new + // versions from [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After the import, the imported draft + // agent will be trained automatically (unless disabled in agent settings). + // However, once the import is done, training may not be completed yet. Please + // call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train + // explicitly. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // The operation only tracks when importing is complete, not when it is done + // training. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/agent:import" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/agent:import" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Restores the specified agent from a ZIP file. + // + // Replaces the current agent version with a new one. All the intents and + // entity types in the older version are deleted. After the restore, the + // restored draft agent will be trained automatically (unless disabled in + // agent settings). However, once the restore is done, training may not be + // completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it + // returns in order to train explicitly. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // The operation only tracks when restoring is complete, not when it is done + // training. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/agent:restore" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/agent:restore" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Gets agent validation result. Agent validation is performed during + // training time and is updated automatically when training is completed. + rpc GetValidationResult(GetValidationResultRequest) returns (ValidationResult) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/agent/validationResult" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/agent/validationResult" + } + }; + } +} + +// A Dialogflow agent is a virtual agent that handles conversations with your +// end-users. It is a natural language understanding module that understands the +// nuances of human language. Dialogflow translates end-user text or audio +// during a conversation to structured data that your apps and services can +// understand. You design and build a Dialogflow agent to handle the types of +// conversations required for your system. +// +// For more information about agents, see the +// [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview). +// +message Agent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Agent" + pattern: "projects/{project}/agent" + pattern: "projects/{project}/locations/{location}/agent" + }; + + // Match mode determines how intents are detected from user queries. + enum MatchMode { + // Not specified. + MATCH_MODE_UNSPECIFIED = 0; + + // Best for agents with a small number of examples in intents and/or wide + // use of templates syntax and composite entities. + MATCH_MODE_HYBRID = 1; + + // Can be used for agents with a large number of examples in intents, + // especially the ones using @sys.any or very large custom entities. + MATCH_MODE_ML_ONLY = 2; + } + + // API version for the agent. + enum ApiVersion { + // Not specified. + API_VERSION_UNSPECIFIED = 0; + + // Legacy V1 API. + API_VERSION_V1 = 1; + + // V2 API. + API_VERSION_V2 = 2; + + // V2beta1 API. + API_VERSION_V2_BETA_1 = 3; + } + + // Represents the agent tier. + enum Tier { + // Not specified. This value should never be used. + TIER_UNSPECIFIED = 0; + + // Trial Edition, previously known as Standard Edition. + TIER_STANDARD = 1; + + // Essentials Edition, previously known as Enterprise Essential Edition. + TIER_ENTERPRISE = 2; + + // Essentials Edition (same as TIER_ENTERPRISE), previously known as + // Enterprise Plus Edition. + TIER_ENTERPRISE_PLUS = 3 [deprecated = true]; + } + + // Required. The project of this agent. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The name of this agent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The default language of the agent as a language tag. See + // [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. This field cannot be + // set by the `Update` method. + string default_language_code = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The list of all languages supported by this agent (except for the + // `default_language_code`). + repeated string supported_language_codes = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The time zone of this agent from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. + string time_zone = 5 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The description of this agent. + // The maximum length is 500 characters. If exceeded, the request is rejected. + string description = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The URI of the agent's avatar. + // Avatars are used throughout the Dialogflow console and in the self-hosted + // [Web + // Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) + // integration. + string avatar_uri = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Determines whether this agent should log conversation queries. + bool enable_logging = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Determines how intents are detected from user queries. + MatchMode match_mode = 9 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. To filter out false positive results and still get variety in + // matched natural language inputs for your agent, you can tune the machine + // learning classification threshold. If the returned score value is less than + // the threshold value, then a fallback intent will be triggered or, if there + // are no fallback intents defined, no intent will be triggered. The score + // values range from 0.0 (completely uncertain) to 1.0 (completely certain). + // If set to 0.0, the default of 0.3 is used. + float classification_threshold = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. API version displayed in Dialogflow console. If not specified, + // V2 API is assumed. Clients are free to query different service endpoints + // for different API versions. However, bots connectors and webhook calls will + // follow the specified API version. + ApiVersion api_version = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The agent tier. If not specified, TIER_STANDARD is assumed. + Tier tier = 15 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent]. +message GetAgentRequest { + // Required. The project that the agent to fetch is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent]. +message SetAgentRequest { + // Required. The agent to update. + Agent agent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent]. +message DeleteAgentRequest { + // Required. The project that the agent to delete is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. +message SearchAgentsRequest { + // Required. The project to list agents from. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents]. +message SearchAgentsResponse { + // The list of agents. There will be a maximum number of items returned based + // on the page_size field in the request. + repeated Agent agents = 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 request message for [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent]. +message TrainAgentRequest { + // Required. The project that the agent to train is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. +message ExportAgentRequest { + // Required. The project that the agent to export is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) + // URI to export the agent to. + // The format of this URI must be `gs:///`. + // If left unspecified, the serialized agent is returned inline. + // + // Dialogflow performs a write operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have write permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + string agent_uri = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent]. +message ExportAgentResponse { + // The exported agent. + oneof agent { + // The URI to a file containing the exported agent. This field is populated + // only if `agent_uri` is specified in `ExportAgentRequest`. + string agent_uri = 1; + + // Zip compressed raw byte content for agent. + bytes agent_content = 2; + } +} + +// The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent]. +message ImportAgentRequest { + // Required. The project that the agent to import is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to import. + oneof agent { + // The URI to a Google Cloud Storage file containing the agent to import. + // Note: The URI must start with "gs://". + // + // Dialogflow performs a read operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have read permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + string agent_uri = 2; + + // Zip compressed raw byte content for agent. + bytes agent_content = 3; + } +} + +// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent]. +message RestoreAgentRequest { + // Required. The project that the agent to restore is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to restore. + oneof agent { + // The URI to a Google Cloud Storage file containing the agent to restore. + // Note: The URI must start with "gs://". + // + // Dialogflow performs a read operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have read permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + string agent_uri = 2; + + // Zip compressed raw byte content for agent. + bytes agent_content = 3; + } +} + +// The request message for [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult]. +message GetValidationResultRequest { + // Required. The project that the agent is associated with. + // Format: `projects/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The language for which you want a validation result. If not + // specified, the agent's default language is used. [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. Note: languages must be enabled in the agent before they can + // be used. + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/answer_record.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/answer_record.proto new file mode 100644 index 00000000000..14ab41e15ad --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/answer_record.proto @@ -0,0 +1,294 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/participant.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AnswerRecordsProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [AnswerRecords][google.cloud.dialogflow.v2.AnswerRecord]. +service AnswerRecords { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all answer records in the specified project in reverse + // chronological order. + rpc ListAnswerRecords(ListAnswerRecordsRequest) returns (ListAnswerRecordsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/answerRecords" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/answerRecords" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the specified answer record. + rpc UpdateAnswerRecord(UpdateAnswerRecordRequest) returns (AnswerRecord) { + option (google.api.http) = { + patch: "/v2/{answer_record.name=projects/*/answerRecords/*}" + body: "answer_record" + additional_bindings { + patch: "/v2/{answer_record.name=projects/*/locations/*/answerRecords/*}" + body: "answer_record" + } + }; + option (google.api.method_signature) = "answer_record,update_mask"; + } +} + +// Answer records are records to manage answer history and feedbacks for +// Dialogflow. +// +// Currently, answer record includes: +// +// - human agent assistant article suggestion +// - human agent assistant faq article +// +// It doesn't include: +// +// - `DetectIntent` intent matching +// - `DetectIntent` knowledge +// +// Answer records are not related to the conversation history in the +// Dialogflow Console. A Record is generated even when the end-user disables +// conversation history in the console. Records are created when there's a human +// agent assistant suggestion generated. +// +// A typical workflow for customers provide feedback to an answer is: +// +// 1. For human agent assistant, customers get suggestion via ListSuggestions +// API. Together with the answers, [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] are returned to the +// customers. +// 2. The customer uses the [AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name] to call the +// [UpdateAnswerRecord][] method to send feedback about a specific answer +// that they believe is wrong. +message AnswerRecord { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/AnswerRecord" + pattern: "projects/{project}/answerRecords/{answer_record}" + pattern: "projects/{project}/locations/{location}/answerRecords/{answer_record}" + }; + + // The unique identifier of this answer record. + // Format: `projects//locations//answerRecords/`. + string name = 1; + + // Required. The AnswerFeedback for this record. You can set this with + // [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord] in order to give us feedback about + // this answer. + AnswerFeedback answer_feedback = 2 [(google.api.field_behavior) = REQUIRED]; + + // The record for this answer. + oneof record { + // Output only. The record for human agent assistant. + AgentAssistantRecord agent_assistant_record = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// Request message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]. +message ListAnswerRecordsRequest { + // Required. The project to list all answer records for in reverse + // chronological order. Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/AnswerRecord" + } + ]; + + // Optional. Filters to restrict results to specific answer records. + // + // Marked deprecated as it hasn't been, and isn't currently, supported. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 2 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. The maximum number of records to return in a single page. + // The server may return fewer records than this. If unspecified, we use 10. + // The maximum is 100. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The + // [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token] + // value returned from a previous list request used to continue listing on + // the next page. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords]. +message ListAnswerRecordsResponse { + // The list of answer records. + repeated AnswerRecord answer_records = 1; + + // A token to retrieve next page of results. Or empty if there are no more + // results. + // Pass this value in the + // [ListAnswerRecordsRequest.page_token][google.cloud.dialogflow.v2.ListAnswerRecordsRequest.page_token] + // field in the subsequent call to `ListAnswerRecords` method to retrieve the + // next page of results. + string next_page_token = 2; +} + +// Request message for [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord]. +message UpdateAnswerRecordRequest { + // Required. Answer record to update. + AnswerRecord answer_record = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents feedback the customer has about the quality & correctness of a +// certain answer in a conversation. +message AnswerFeedback { + // The correctness level of an answer. + enum CorrectnessLevel { + // Correctness level unspecified. + CORRECTNESS_LEVEL_UNSPECIFIED = 0; + + // Answer is totally wrong. + NOT_CORRECT = 1; + + // Answer is partially correct. + PARTIALLY_CORRECT = 2; + + // Answer is fully correct. + FULLY_CORRECT = 3; + } + + // The correctness level of the specific answer. + CorrectnessLevel correctness_level = 1; + + // Normally, detail feedback is provided when answer is not fully correct. + oneof detail_feedback { + // Detail feedback of agent assist suggestions. + AgentAssistantFeedback agent_assistant_detail_feedback = 2; + } + + // Indicates whether the answer/item was clicked by the human agent + // or not. Default to false. + bool clicked = 3; + + // Time when the answer/item was clicked. + google.protobuf.Timestamp click_time = 5; + + // Indicates whether the answer/item was displayed to the human + // agent in the agent desktop UI. Default to false. + bool displayed = 4; + + // Time when the answer/item was displayed. + google.protobuf.Timestamp display_time = 6; +} + +// Detail feedback of Agent Assist result. +message AgentAssistantFeedback { + // Relevance of an answer. + enum AnswerRelevance { + // Answer relevance unspecified. + ANSWER_RELEVANCE_UNSPECIFIED = 0; + + // Answer is irrelevant to query. + IRRELEVANT = 1; + + // Answer is relevant to query. + RELEVANT = 2; + } + + // Correctness of document. + enum DocumentCorrectness { + // Document correctness unspecified. + DOCUMENT_CORRECTNESS_UNSPECIFIED = 0; + + // Information in document is incorrect. + INCORRECT = 1; + + // Information in document is correct. + CORRECT = 2; + } + + // Efficiency of document. + enum DocumentEfficiency { + // Document efficiency unspecified. + DOCUMENT_EFFICIENCY_UNSPECIFIED = 0; + + // Document is inefficient. + INEFFICIENT = 1; + + // Document is efficient. + EFFICIENT = 2; + } + + // Optional. Whether or not the suggested answer is relevant. + // + // For example: + // + // * Query: "Can I change my mailing address?" + // * Suggested document says: "Items must be returned/exchanged within 60 + // days of the purchase date." + // * [answer_relevance][google.cloud.dialogflow.v2.AgentAssistantFeedback.answer_relevance]: [AnswerRelevance.IRRELEVANT][google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance.IRRELEVANT] + AnswerRelevance answer_relevance = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether or not the information in the document is correct. + // + // For example: + // + // * Query: "Can I return the package in 2 days once received?" + // * Suggested document says: "Items must be returned/exchanged within 60 + // days of the purchase date." + // * Ground truth: "No return or exchange is allowed." + // * [document_correctness]: INCORRECT + DocumentCorrectness document_correctness = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether or not the suggested document is efficient. For example, + // if the document is poorly written, hard to understand, hard to use or + // too long to find useful information, [document_efficiency][google.cloud.dialogflow.v2.AgentAssistantFeedback.document_efficiency] is + // [DocumentEfficiency.INEFFICIENT][google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency.INEFFICIENT]. + DocumentEfficiency document_efficiency = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a record of a human agent assist answer. +message AgentAssistantRecord { + // Output only. The agent assist answer. + oneof answer { + // Output only. The article suggestion answer. + ArticleAnswer article_suggestion_answer = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The FAQ answer. + FaqAnswer faq_answer = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/audio_config.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/audio_config.proto new file mode 100644 index 00000000000..b86a9d3a1d4 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/audio_config.proto @@ -0,0 +1,452 @@ +// 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.dialogflow.v2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AudioConfigProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "automl.googleapis.com/Model" + pattern: "projects/{project}/locations/{location}/models/{model}" +}; +option (google.api.resource_definition) = { + type: "speech.googleapis.com/PhraseSet" + pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}" +}; + +// Audio encoding of the audio content sent in the conversational query request. +// Refer to the +// [Cloud Speech API +// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more +// details. +enum AudioEncoding { + // Not specified. + AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + AUDIO_ENCODING_LINEAR_16 = 1; + + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is lossless (therefore + // recognition is not compromised) and requires only about half the + // bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and + // 24-bit samples, however, not all fields in `STREAMINFO` are supported. + AUDIO_ENCODING_FLAC = 2; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + AUDIO_ENCODING_MULAW = 3; + + // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + AUDIO_ENCODING_AMR = 4; + + // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_AMR_WB = 5; + + // Opus encoded audio frames in Ogg container + // ([OggOpus](https://wiki.xiph.org/OggOpus)). + // `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_OGG_OPUS = 6; + + // Although the use of lossy encodings is not recommended, if a very low + // bitrate encoding is required, `OGG_OPUS` is highly preferred over + // Speex encoding. The [Speex](https://speex.org/) encoding supported by + // Dialogflow API has a header byte in each block, as in MIME type + // `audio/x-speex-with-header-byte`. + // It is a variant of the RTP Speex encoding defined in + // [RFC 5574](https://tools.ietf.org/html/rfc5574). + // The stream is a sequence of blocks, one block per RTP packet. Each block + // starts with a byte containing the length of the block, in bytes, followed + // by one or more frames of Speex data, padded to an integral number of + // bytes (octets) as specified in RFC 5574. In other words, each RTP header + // is replaced with a single byte containing the block length. Only Speex + // wideband is supported. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; +} + +// Hints for the speech recognizer to help with recognition in a specific +// conversation state. +message SpeechContext { + // Optional. A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // This list can be used to: + // + // * improve accuracy for words and phrases you expect the user to say, + // e.g. typical commands for your Dialogflow agent + // * add additional words to the speech recognizer vocabulary + // * ... + // + // See the [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/quotas) for usage + // limits. + repeated string phrases = 1; + + // Optional. Boost for this context compared to other contexts: + // + // * If the boost is positive, Dialogflow will increase the probability that + // the phrases in this context are recognized over similar sounding phrases. + // * If the boost is unspecified or non-positive, Dialogflow will not apply + // any boost. + // + // Dialogflow recommends that you use boosts in the range (0, 20] and that you + // find a value that fits your use case with binary search. + float boost = 2; +} + +// Variant of the specified [Speech model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use. +// +// See the [Cloud Speech +// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) +// for which models have different variants. For example, the "phone_call" model +// has both a standard and an enhanced variant. When you use an enhanced model, +// you will generally receive higher quality results than for a standard model. +enum SpeechModelVariant { + // No model variant specified. In this case Dialogflow defaults to + // USE_BEST_AVAILABLE. + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0; + + // Use the best available variant of the [Speech + // model][InputAudioConfig.model] that the caller is eligible for. + // + // Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) for + // how to make your project eligible for enhanced models. + USE_BEST_AVAILABLE = 1; + + // Use standard model variant even if an enhanced model is available. See the + // [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // for details about enhanced models. + USE_STANDARD = 2; + + // Use an enhanced model variant: + // + // * If an enhanced variant does not exist for the given + // [model][google.cloud.dialogflow.v2.InputAudioConfig.model] and request language, Dialogflow falls + // back to the standard variant. + // + // The [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // describes which models have enhanced variants. + // + // * If the API caller isn't eligible for enhanced models, Dialogflow returns + // an error. Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) + // for how to make your project eligible. + USE_ENHANCED = 3; +} + +// Information for a word recognized by the speech recognizer. +message SpeechWordInfo { + // The word this info is for. + string word = 3; + + // Time offset relative to the beginning of the audio that corresponds to the + // start of the spoken word. This is an experimental feature and the accuracy + // of the time offset can vary. + google.protobuf.Duration start_offset = 1; + + // Time offset relative to the beginning of the audio that corresponds to the + // end of the spoken word. This is an experimental feature and the accuracy of + // the time offset can vary. + google.protobuf.Duration end_offset = 2; + + // The Speech confidence between 0.0 and 1.0 for this word. A higher number + // indicates an estimated greater likelihood that the recognized word is + // correct. The default of 0.0 is a sentinel value indicating that confidence + // was not set. + // + // This field is not guaranteed to be fully stable over time for the same + // audio input. Users should also not rely on it to always be provided. + float confidence = 4; +} + +// Instructs the speech recognizer how to process the audio content. +message InputAudioConfig { + // Required. Audio encoding of the audio content to process. + AudioEncoding audio_encoding = 1; + + // Required. Sample rate (in Hertz) of the audio content sent in the query. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics) for + // more details. + int32 sample_rate_hertz = 2; + + // Required. The language of the supplied audio. Dialogflow does not do + // translations. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 3; + + // If `true`, Dialogflow returns [SpeechWordInfo][google.cloud.dialogflow.v2.SpeechWordInfo] in + // [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] with information about the recognized speech + // words, e.g. start and end time offsets. If false or unspecified, Speech + // doesn't return any word-level information. + bool enable_word_info = 13; + + // A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // See [the Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + // for more details. + // + // This field is deprecated. Please use [speech_contexts]() instead. If you + // specify both [phrase_hints]() and [speech_contexts](), Dialogflow will + // treat the [phrase_hints]() as a single additional [SpeechContext](). + repeated string phrase_hints = 4 [deprecated = true]; + + // Context information to assist speech recognition. + // + // See [the Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + // for more details. + repeated SpeechContext speech_contexts = 11; + + // Which Speech model to select for the given request. Select the + // model best suited to your domain to get best results. If a model is not + // explicitly specified, then we auto-select a model based on the parameters + // in the InputAudioConfig. + // If enhanced speech model is enabled for the agent and an enhanced + // version of the specified model for the language does not exist, then the + // speech is recognized using the standard version of the specified model. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 7; + + // Which variant of the [Speech model][google.cloud.dialogflow.v2.InputAudioConfig.model] to use. + SpeechModelVariant model_variant = 10; + + // If `false` (default), recognition does not cease until the + // client closes the stream. + // If `true`, the recognizer will detect a single spoken utterance in input + // audio. Recognition ceases when it detects the audio's voice has + // stopped or paused. In this case, once a detected intent is received, the + // client should close the stream and start a new request with a new stream as + // needed. + // Note: This setting is relevant only for streaming methods. + // Note: When specified, InputAudioConfig.single_utterance takes precedence + // over StreamingDetectIntentRequest.single_utterance. + bool single_utterance = 8; + + // Only used in [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and + // [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent]. + // If `false` and recognition doesn't return any result, trigger + // `NO_SPEECH_RECOGNIZED` event to Dialogflow agent. + bool disable_no_speech_recognized_event = 14; +} + +// Gender of the voice as described in +// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). +enum SsmlVoiceGender { + // An unspecified gender, which means that the client doesn't care which + // gender the selected voice will have. + SSML_VOICE_GENDER_UNSPECIFIED = 0; + + // A male voice. + SSML_VOICE_GENDER_MALE = 1; + + // A female voice. + SSML_VOICE_GENDER_FEMALE = 2; + + // A gender-neutral voice. + SSML_VOICE_GENDER_NEUTRAL = 3; +} + +// Description of which voice to use for speech synthesis. +message VoiceSelectionParams { + // Optional. The name of the voice. If not set, the service will choose a + // voice based on the other parameters such as language_code and + // [ssml_gender][google.cloud.dialogflow.v2.VoiceSelectionParams.ssml_gender]. + string name = 1; + + // Optional. The preferred gender of the voice. If not set, the service will + // choose a voice based on the other parameters such as language_code and + // [name][google.cloud.dialogflow.v2.VoiceSelectionParams.name]. Note that this is only a preference, not requirement. If a + // voice of the appropriate gender is not available, the synthesizer should + // substitute a voice with a different gender rather than failing the request. + SsmlVoiceGender ssml_gender = 2; +} + +// Configuration of how speech should be synthesized. +message SynthesizeSpeechConfig { + // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal + // native speed supported by the specific voice. 2.0 is twice as fast, and + // 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any + // other values < 0.25 or > 4.0 will return an error. + double speaking_rate = 1; + + // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 + // semitones from the original pitch. -20 means decrease 20 semitones from the + // original pitch. + double pitch = 2; + + // Optional. Volume gain (in dB) of the normal native volume supported by the + // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of + // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) + // will play at approximately half the amplitude of the normal native signal + // amplitude. A value of +6.0 (dB) will play at approximately twice the + // amplitude of the normal native signal amplitude. We strongly recommend not + // to exceed +10 (dB) as there's usually no effective increase in loudness for + // any value greater than that. + double volume_gain_db = 3; + + // Optional. An identifier which selects 'audio effects' profiles that are + // applied on (post synthesized) text to speech. Effects are applied on top of + // each other in the order they are given. + repeated string effects_profile_id = 5; + + // Optional. The desired voice of the synthesized audio. + VoiceSelectionParams voice = 4; +} + +// Audio encoding of the output audio format in Text-To-Speech. +enum OutputAudioEncoding { + // Not specified. + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // Audio content returned as LINEAR16 also contains a WAV header. + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; + + // MP3 audio at 32kbps. + OUTPUT_AUDIO_ENCODING_MP3 = 2; + + // MP3 audio at 64kbps. + OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; + + // Opus encoded audio wrapped in an ogg container. The result will be a + // file which can be played natively on Android, and in browsers (at least + // Chrome and Firefox). The quality of the encoding is considerably higher + // than MP3 while using approximately the same bitrate. + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + OUTPUT_AUDIO_ENCODING_MULAW = 5; +} + +// Instructs the speech synthesizer on how to generate the output audio content. +// If this audio config is supplied in a request, it overrides all existing +// text-to-speech settings applied to the agent. +message OutputAudioConfig { + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; + + // The synthesis sample rate (in hertz) for this audio. If not + // provided, then the synthesizer will use the default sample rate based on + // the audio encoding. If this is different from the voice's natural sample + // rate, then the synthesizer will honor this request by converting to the + // desired sample rate (which might result in worse audio quality). + int32 sample_rate_hertz = 2; + + // Configuration of how speech should be synthesized. + SynthesizeSpeechConfig synthesize_speech_config = 3; +} + +// [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling) +// digit in Telephony Gateway. +enum TelephonyDtmf { + // Not specified. This value may be used to indicate an absent digit. + TELEPHONY_DTMF_UNSPECIFIED = 0; + + // Number: '1'. + DTMF_ONE = 1; + + // Number: '2'. + DTMF_TWO = 2; + + // Number: '3'. + DTMF_THREE = 3; + + // Number: '4'. + DTMF_FOUR = 4; + + // Number: '5'. + DTMF_FIVE = 5; + + // Number: '6'. + DTMF_SIX = 6; + + // Number: '7'. + DTMF_SEVEN = 7; + + // Number: '8'. + DTMF_EIGHT = 8; + + // Number: '9'. + DTMF_NINE = 9; + + // Number: '0'. + DTMF_ZERO = 10; + + // Letter: 'A'. + DTMF_A = 11; + + // Letter: 'B'. + DTMF_B = 12; + + // Letter: 'C'. + DTMF_C = 13; + + // Letter: 'D'. + DTMF_D = 14; + + // Asterisk/star: '*'. + DTMF_STAR = 15; + + // Pound/diamond/hash/square/gate/octothorpe: '#'. + DTMF_POUND = 16; +} + +// A wrapper of repeated TelephonyDtmf digits. +message TelephonyDtmfEvents { + // A sequence of TelephonyDtmf digits. + repeated TelephonyDtmf dtmf_events = 1; +} + +// Configures speech transcription for [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]. +message SpeechToTextConfig { + // The speech model used in speech to text. + // `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as + // `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2.AnalyzeContentRequest] and + // [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest] request. + // If enhanced model variant is specified and an enhanced + // version of the specified model for the language does not exist, then it + // would emit an error. + SpeechModelVariant speech_model_variant = 1; + + // Which Speech model to select. Select the model best suited to your domain + // to get best results. If a model is not explicitly specified, then a default + // model is used. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 2; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/context.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/context.proto new file mode 100644 index 00000000000..53dc7874dd1 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/context.proto @@ -0,0 +1,331 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ContextProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Contexts][google.cloud.dialogflow.v2.Context]. +service Contexts { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all contexts in the specified session. + rpc ListContexts(ListContextsRequest) returns (ListContextsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent/sessions/*}/contexts" + additional_bindings { + get: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified context. + rpc GetContext(GetContextRequest) returns (Context) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/sessions/*/contexts/*}" + additional_bindings { + get: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a context. + // + // If the specified context already exists, overrides the context. + rpc CreateContext(CreateContextRequest) returns (Context) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/sessions/*}/contexts" + body: "context" + additional_bindings { + post: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + body: "context" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + body: "context" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + body: "context" + } + }; + option (google.api.method_signature) = "parent,context"; + } + + // Updates the specified context. + rpc UpdateContext(UpdateContextRequest) returns (Context) { + option (google.api.http) = { + patch: "/v2/{context.name=projects/*/agent/sessions/*/contexts/*}" + body: "context" + additional_bindings { + patch: "/v2/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + body: "context" + } + additional_bindings { + patch: "/v2/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}" + body: "context" + } + additional_bindings { + patch: "/v2/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + body: "context" + } + }; + option (google.api.method_signature) = "context,update_mask"; + } + + // Deletes the specified context. + rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/sessions/*/contexts/*}" + additional_bindings { + delete: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes all active contexts in the specified session. + rpc DeleteAllContexts(DeleteAllContextsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{parent=projects/*/agent/sessions/*}/contexts" + additional_bindings { + delete: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + } + additional_bindings { + delete: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + } + additional_bindings { + delete: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Dialogflow contexts are similar to natural language context. If a person says +// to you "they are orange", you need context in order to understand what "they" +// is referring to. Similarly, for Dialogflow to handle an end-user expression +// like that, it needs to be provided with context in order to correctly match +// an intent. +// +// Using contexts, you can control the flow of a conversation. You can configure +// contexts for an intent by setting input and output contexts, which are +// identified by string names. When an intent is matched, any configured output +// contexts for that intent become active. While any contexts are active, +// Dialogflow is more likely to match intents that are configured with input +// contexts that correspond to the currently active contexts. +// +// For more information about context, see the +// [Contexts guide](https://cloud.google.com/dialogflow/docs/contexts-overview). +message Context { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Context" + pattern: "projects/{project}/agent/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + }; + + // Required. The unique identifier of the context. Format: + // `projects//agent/sessions//contexts/`, + // or `projects//agent/environments//users//sessions//contexts/`. + // + // The `Context ID` is always converted to lowercase, may only contain + // characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + // + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + // + // The following context names are reserved for internal use by Dialogflow. + // You should not use these contexts or create contexts with these names: + // + // * `__system_counters__` + // * `*_id_dialog_context` + // * `*_dialog_params_size` + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The number of conversational query requests after which the + // context expires. The default is `0`. If set to `0`, the context expires + // immediately. Contexts expire automatically after 20 minutes if there + // are no matching queries. + int32 lifespan_count = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of parameters associated with this context. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. +message ListContextsRequest { + // Required. The session to list all contexts from. + // Format: `projects//agent/sessions/` or + // `projects//agent/environments//users//sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts]. +message ListContextsResponse { + // The list of contexts. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Context contexts = 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 request message for [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext]. +message GetContextRequest { + // Required. The name of the context. Format: + // `projects//agent/sessions//contexts/` + // or `projects//agent/environments//users//sessions//contexts/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Context" + } + ]; +} + +// The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext]. +message CreateContextRequest { + // Required. The session to create a context for. + // Format: `projects//agent/sessions/` or + // `projects//agent/environments//users//sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; + + // Required. The context to create. + Context context = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext]. +message UpdateContextRequest { + // Required. The context to update. + Context context = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext]. +message DeleteContextRequest { + // Required. The name of the context to delete. Format: + // `projects//agent/sessions//contexts/` + // or `projects//agent/environments//users//sessions//contexts/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Context" + } + ]; +} + +// The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts]. +message DeleteAllContextsRequest { + // Required. The name of the session to delete all contexts from. Format: + // `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. + // If `Environment ID` is not specified we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation.proto new file mode 100644 index 00000000000..6266354ae9a --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation.proto @@ -0,0 +1,357 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/participant.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Conversations][google.cloud.dialogflow.v2.Conversation]. +service Conversations { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a new conversation. Conversations are auto-completed after 24 + // hours. + // + // Conversation Lifecycle: + // There are two stages during a conversation: Automated Agent Stage and + // Assist Stage. + // + // For Automated Agent Stage, there will be a dialogflow agent responding to + // user queries. + // + // For Assist Stage, there's no dialogflow agent responding to user queries. + // But we will provide suggestions which are generated from conversation. + // + // If [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile] is configured for a dialogflow + // agent, conversation will start from `Automated Agent Stage`, otherwise, it + // will start from `Assist Stage`. And during `Automated Agent Stage`, once an + // [Intent][google.cloud.dialogflow.v2.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff] is triggered, conversation + // will transfer to Assist Stage. + rpc CreateConversation(CreateConversationRequest) returns (Conversation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/conversations" + body: "conversation" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/conversations" + body: "conversation" + } + }; + option (google.api.method_signature) = "parent,conversation"; + } + + // Returns the list of all conversations in the specified project. + rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/conversations" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/conversations" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specific conversation. + rpc GetConversation(GetConversationRequest) returns (Conversation) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversations/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversations/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Completes the specified conversation. Finished conversations are purged + // from the database after 30 days. + rpc CompleteConversation(CompleteConversationRequest) returns (Conversation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/conversations/*}:complete" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/conversations/*}:complete" + body: "*" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists messages that belong to a given conversation. + // `messages` are ordered by `create_time` in descending order. To fetch + // updates without duplication, send request with filter + // `create_time_epoch_microseconds > + // [first item's create_time of previous request]` and empty page_token. + rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/conversations/*}/messages" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/conversations/*}/messages" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Represents a conversation. +// A conversation is an interaction between an agent, including live agents +// and Dialogflow agents, and a support customer. Conversations can +// include phone calls and text-based chat sessions. +message Conversation { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Conversation" + pattern: "projects/{project}/conversations/{conversation}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}" + }; + + // Enumeration of the completion status of the conversation. + enum LifecycleState { + // Unknown. + LIFECYCLE_STATE_UNSPECIFIED = 0; + + // Conversation is currently open for media analysis. + IN_PROGRESS = 1; + + // Conversation has been completed. + COMPLETED = 2; + } + + // Enumeration of the different conversation stages a conversation can be in. + // Reference: + // https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages + enum ConversationStage { + // Unknown. Should never be used after a conversation is successfully + // created. + CONVERSATION_STAGE_UNSPECIFIED = 0; + + // The conversation should return virtual agent responses into the + // conversation. + VIRTUAL_AGENT_STAGE = 1; + + // The conversation should not provide responses, just listen and provide + // suggestions. + HUMAN_ASSIST_STAGE = 2; + } + + // Output only. The unique identifier of this conversation. + // Format: `projects//locations//conversations/`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the Conversation. + LifecycleState lifecycle_state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The Conversation Profile to be used to configure this + // Conversation. This field cannot be updated. + // Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // Output only. It will not be empty if the conversation is to be connected over + // telephony. + ConversationPhoneNumber phone_number = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the conversation was started. + google.protobuf.Timestamp start_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the conversation was finished. + google.protobuf.Timestamp end_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The stage of a conversation. It indicates whether the virtual agent or a + // human agent is handling the conversation. + // + // If the conversation is created with the conversation profile that has + // Dialogflow config set, defaults to + // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]; Otherwise, defaults to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. + // + // If the conversation is created with the conversation profile that has + // Dialogflow config set but explicitly sets conversation_stage to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE], it skips + // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE] stage and directly goes to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. + ConversationStage conversation_stage = 7; +} + +// The request message for [Conversations.CreateConversation][google.cloud.dialogflow.v2.Conversations.CreateConversation]. +message CreateConversationRequest { + // Required. Resource identifier of the project creating the conversation. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Required. The conversation to create. + Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Identifier of the conversation. Generally it's auto generated by Google. + // Only set it if you cannot wait for the response to return a + // auto-generated one to you. + // + // The conversation ID must be compliant with the regression fomula + // "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64]. + // If the field is provided, the caller is resposible for + // 1. the uniqueness of the ID, otherwise the request will be rejected. + // 2. the consistency for whether to use custom ID or not under a project to + // better ensure uniqueness. + string conversation_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations]. +message ListConversationsRequest { + // Required. The project from which to list all conversation. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // A filter expression that filters conversations listed in the response. In + // general, the expression must specify the field name, a comparison operator, + // and the value to use for filtering: + //
    + //
  • The value must be a string, a number, or a boolean.
  • + //
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + //
  • To filter on multiple expressions, separate the + // expressions with `AND` or `OR` (omitting both implies `AND`).
  • + //
  • For clarity, expressions can be enclosed in parentheses.
  • + //
+ // Only `lifecycle_state` can be filtered on in this way. For example, + // the following expression only returns `COMPLETED` conversations: + // + // `lifecycle_state = "COMPLETED"` + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// The response message for [Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations]. +message ListConversationsResponse { + // The list of conversations. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Conversation conversations = 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 request message for [Conversations.GetConversation][google.cloud.dialogflow.v2.Conversations.GetConversation]. +message GetConversationRequest { + // Required. The name of the conversation. Format: + // `projects//locations//conversations/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; +} + +// The request message for [Conversations.CompleteConversation][google.cloud.dialogflow.v2.Conversations.CompleteConversation]. +message CompleteConversationRequest { + // Required. Resource identifier of the conversation to close. + // Format: `projects//locations//conversations/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; +} + +// The request message for [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages]. +message ListMessagesRequest { + // Required. The name of the conversation to list messages for. + // Format: `projects//locations//conversations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Filter on message fields. Currently predicates on `create_time` + // and `create_time_epoch_microseconds` are supported. `create_time` only + // support milliseconds accuracy. E.g., + // `create_time_epoch_microseconds > 1551790877964485` or + // `create_time > 2017-01-15T01:30:15.01Z`. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages]. +message ListMessagesResponse { + // The list of messages. There will be a maximum number of items + // returned based on the page_size field in the request. + // `messages` is sorted by `create_time` in descending order. + repeated Message messages = 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; +} + +// Represents a phone number for telephony integration. It allows for connecting +// a particular conversation over telephony. +message ConversationPhoneNumber { + // Output only. The phone number to connect to this conversation. + string phone_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_dataset.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_dataset.proto new file mode 100644 index 00000000000..282bdda3923 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_dataset.proto @@ -0,0 +1,320 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/gcs.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationDatasetProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Conversation datasets. +// +// Conversation datasets contain raw conversation files and their +// customizable metadata that can be used for model training. +service ConversationDatasets { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a new conversation dataset. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata] + // - `response`: [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset] + rpc CreateConversationDataset(CreateConversationDatasetRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/conversationDatasets" + body: "conversation_dataset" + }; + option (google.api.method_signature) = "parent,conversation_dataset"; + option (google.longrunning.operation_info) = { + response_type: "ConversationDataset" + metadata_type: "CreateConversationDatasetOperationMetadata" + }; + } + + // Retrieves the specified conversation dataset. + rpc GetConversationDataset(GetConversationDatasetRequest) returns (ConversationDataset) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversationDatasets/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversationDatasets/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Returns the list of all conversation datasets in the specified + // project and location. + rpc ListConversationDatasets(ListConversationDatasetsRequest) returns (ListConversationDatasetsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/conversationDatasets" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/conversationDatasets" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes the specified conversation dataset. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc DeleteConversationDataset(DeleteConversationDatasetRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/conversationDatasets/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteConversationDatasetOperationMetadata" + }; + } + + // Import data into the specified conversation dataset. Note that it + // is not allowed to import data to a conversation dataset that + // already has data in it. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata] + // - `response`: [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse] + rpc ImportConversationData(ImportConversationDataRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/conversationDatasets/*}:importConversationData" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/conversationDatasets/*}:importConversationData" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "ImportConversationDataOperationResponse" + metadata_type: "ImportConversationDataOperationMetadata" + }; + } +} + +// Represents metadata of a conversation. +message ConversationInfo { + // Optional. The language code of the conversation data within this dataset. See + // https://cloud.google.com/apis/design/standard_fields for more information. + // Supports all UTF-8 languages. + string language_code = 1 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the configuration of importing a set of conversation files in +// Google Cloud Storage. +message InputConfig { + // Required. Where the data is from. + oneof source { + // The Cloud Storage URI has the form gs:////agent*.json. Wildcards are allowed and will be expanded into all + // matched JSON files, which will be read as one conversation per file. + GcsSources gcs_source = 1; + } +} + +// Represents a conversation dataset that a user imports raw data into. +// The data inside ConversationDataset can not be changed after +// ImportConversationData finishes (and calling ImportConversationData on a +// dataset that already has data is not allowed). +message ConversationDataset { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationDataset" + pattern: "projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}" + }; + + // Output only. ConversationDataset resource name. Format: + // `projects//locations//conversationDatasets/` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The display name of the dataset. Maximum of 64 bytes. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The description of the dataset. Maximum of 10000 bytes. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Creation time of this dataset. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Input configurations set during conversation data import. + InputConfig input_config = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Metadata set during conversation data import. + ConversationInfo conversation_info = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The number of conversations this conversation dataset contains. + int64 conversation_count = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for +// [ConversationDatasets.CreateConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset]. +message CreateConversationDatasetRequest { + // Required. The project to create conversation dataset for. Format: + // `projects//locations/` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The conversation dataset to create. + ConversationDataset conversation_dataset = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationDatasets.GetConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset]. +message GetConversationDatasetRequest { + // Required. The conversation dataset to retrieve. Format: + // `projects//locations//conversationDatasets/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; +} + +// The request message for +// [ConversationDatasets.ListConversationDatasets][google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets]. +message ListConversationDatasetsRequest { + // Required. The project and location name to list all conversation datasets for. + // Format: `projects//locations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; + + // Optional. Maximum number of conversation datasets to return in a single + // page. By default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for +// [ConversationDatasets.ListConversationDatasets][google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets]. +message ListConversationDatasetsResponse { + // The list of datasets to return. + repeated ConversationDataset conversation_datasets = 1; + + // The token to use to retrieve the next page of results, or empty if there + // are no more results in the list. + string next_page_token = 2; +} + +// The request message for +// [ConversationDatasets.DeleteConversationDataset][google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset]. +message DeleteConversationDatasetRequest { + // Required. The conversation dataset to delete. Format: + // `projects//locations//conversationDatasets/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; +} + +// The request message for [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]. +message ImportConversationDataRequest { + // Required. Dataset resource name. Format: + // `projects//locations//conversationDatasets/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; + + // Required. Configuration describing where to import data from. + InputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata for a [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData] operation. +message ImportConversationDataOperationMetadata { + // The resource name of the imported conversation dataset. Format: + // `projects//locations//conversationDatasets/` + string conversation_dataset = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + }]; + + // Partial failures are failures that don't fail the whole long running + // operation, e.g. single files that couldn't be read. + repeated google.rpc.Status partial_failures = 2; + + // Timestamp when import conversation data request was created. The time is + // measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Response used for [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData] long +// running operation. +message ImportConversationDataOperationResponse { + // The resource name of the imported conversation dataset. Format: + // `projects//locations//conversationDatasets/` + string conversation_dataset = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + }]; + + // Number of conversations imported successfully. + int32 import_count = 3; +} + +// Metadata for [ConversationDatasets][CreateConversationDataset]. +message CreateConversationDatasetOperationMetadata { + // The resource name of the conversation dataset that will be created. Format: + // `projects//locations//conversationDatasets/` + string conversation_dataset = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + }]; +} + +// Metadata for [ConversationDatasets][DeleteConversationDataset]. +message DeleteConversationDatasetOperationMetadata { + +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_event.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_event.proto new file mode 100644 index 00000000000..6c45e895f14 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_event.proto @@ -0,0 +1,85 @@ +// 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.dialogflow.v2; + +import "google/cloud/dialogflow/v2/participant.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationEventProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Represents a notification sent to Pub/Sub subscribers for conversation +// lifecycle events. +message ConversationEvent { + // Enumeration of the types of events available. + enum Type { + // Type not set. + TYPE_UNSPECIFIED = 0; + + // A new conversation has been opened. This is fired when a telephone call + // is answered, or a conversation is created via the API. + CONVERSATION_STARTED = 1; + + // An existing conversation has closed. This is fired when a telephone call + // is terminated, or a conversation is closed via the API. + CONVERSATION_FINISHED = 2; + + // An existing conversation has received notification from Dialogflow that + // human intervention is required. + HUMAN_INTERVENTION_NEEDED = 3; + + // An existing conversation has received a new message, either from API or + // telephony. It is configured in + // [ConversationProfile.new_message_event_notification_config][google.cloud.dialogflow.v2.ConversationProfile.new_message_event_notification_config] + NEW_MESSAGE = 5; + + // Unrecoverable error during a telephone call. + // + // In general non-recoverable errors only occur if something was + // misconfigured in the ConversationProfile corresponding to the call. After + // a non-recoverable error, Dialogflow may stop responding. + // + // We don't fire this event: + // + // * in an API call because we can directly return the error, or, + // * when we can recover from an error. + UNRECOVERABLE_ERROR = 4; + } + + // The unique identifier of the conversation this notification + // refers to. + // Format: `projects//conversations/`. + string conversation = 1; + + // The type of the event that this notification refers to. + Type type = 2; + + // More detailed information about an error. Only set for type + // UNRECOVERABLE_ERROR_IN_PHONE_CALL. + google.rpc.Status error_status = 3; + + // Payload of conversation event. + oneof payload { + // Payload of NEW_MESSAGE event. + Message new_message_payload = 4; + } +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_model.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_model.proto new file mode 100644 index 00000000000..065290df5f0 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_model.proto @@ -0,0 +1,653 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationModelProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Manages a collection of models for human agent assistant. +service ConversationModels { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a model. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] + // - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel] + rpc CreateConversationModel(CreateConversationModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/conversationModels" + body: "conversation_model" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/conversationModels" + body: "conversation_model" + } + }; + option (google.api.method_signature) = "parent,conversation_model"; + option (google.longrunning.operation_info) = { + response_type: "ConversationModel" + metadata_type: "CreateConversationModelOperationMetadata" + }; + } + + // Gets conversation model. + rpc GetConversationModel(GetConversationModelRequest) returns (ConversationModel) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversationModels/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversationModels/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists conversation models. + rpc ListConversationModels(ListConversationModelsRequest) returns (ListConversationModelsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/conversationModels" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/conversationModels" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a model. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc DeleteConversationModel(DeleteConversationModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/conversationModels/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/conversationModels/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteConversationModelOperationMetadata" + }; + } + + // Deploys a model. If a model is already deployed, deploying it + // has no effect. A model can only serve prediction requests after it gets + // deployed. For article suggestion, custom model will not be used unless + // it is deployed. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc DeployConversationModel(DeployConversationModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/conversationModels/*}:deploy" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/conversationModels/*}:deploy" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeployConversationModelOperationMetadata" + }; + } + + // Undeploys a model. If the model is not deployed this method has no effect. + // If the model is currently being used: + // - For article suggestion, article suggestion will fallback to the default + // model if model is undeployed. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc UndeployConversationModel(UndeployConversationModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/conversationModels/*}:undeploy" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/conversationModels/*}:undeploy" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "UndeployConversationModelOperationMetadata" + }; + } + + // Gets an evaluation of conversation model. + rpc GetConversationModelEvaluation(GetConversationModelEvaluationRequest) returns (ConversationModelEvaluation) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversationModels/*/evaluations/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversationModels/*/evaluations/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Lists evaluations of a conversation model. + rpc ListConversationModelEvaluations(ListConversationModelEvaluationsRequest) returns (ListConversationModelEvaluationsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/conversationModels/*}/evaluations" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Creates evaluation of a conversation model. + rpc CreateConversationModelEvaluation(CreateConversationModelEvaluationRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations" + body: "*" + }; + option (google.api.method_signature) = "parent,conversation_model_evaluation"; + option (google.longrunning.operation_info) = { + response_type: "ConversationModelEvaluation" + metadata_type: "CreateConversationModelEvaluationOperationMetadata" + }; + } +} + +// Represents a conversation model. +message ConversationModel { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationModel" + pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}" + pattern: "projects/{project}/conversationModels/{conversation_model}" + }; + + // State of the model. + enum State { + // Should not be used, an un-set enum has this value by default. + STATE_UNSPECIFIED = 0; + + // Model being created. + CREATING = 1; + + // Model is not deployed but ready to deploy. + UNDEPLOYED = 2; + + // Model is deploying. + DEPLOYING = 3; + + // Model is deployed and ready to use. + DEPLOYED = 4; + + // Model is undeploying. + UNDEPLOYING = 5; + + // Model is deleting. + DELETING = 6; + + // Model is in error state. Not ready to deploy and use. + FAILED = 7; + + // Model is being created but the training has not started, + // The model may remain in this state until there is enough capacity to + // start training. + PENDING = 8; + } + + // Model type. + enum ModelType { + // ModelType unspecified. + MODEL_TYPE_UNSPECIFIED = 0; + + // ModelType smart reply dual encoder model. + SMART_REPLY_DUAL_ENCODER_MODEL = 2; + + // ModelType smart reply bert model. + SMART_REPLY_BERT_MODEL = 6; + } + + // ConversationModel resource name. Format: + // `projects//conversationModels/` + string name = 1; + + // Required. The display name of the model. At most 64 bytes long. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Creation time of this model. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Datasets used to create model. + repeated InputDataset datasets = 4 [(google.api.field_behavior) = REQUIRED]; + + // Output only. State of the model. A model can only serve prediction requests + // after it gets deployed. + State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Language code for the conversation model. If not specified, the language + // is en-US. Language at ConversationModel should be set for all non en-us + // languages. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 19; + + // Required. + // The model metadata that is specific to the problem type. + // Must match the metadata type of the dataset used to train the model. + oneof model_metadata { + // Metadata for article suggestion models. + ArticleSuggestionModelMetadata article_suggestion_model_metadata = 8; + + // Metadata for smart reply models. + SmartReplyModelMetadata smart_reply_model_metadata = 9; + } +} + +// Represents evaluation result of a conversation model. +message ConversationModelEvaluation { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationModelEvaluation" + pattern: "projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}" + pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}" + }; + + // The resource name of the evaluation. Format: + // `projects//conversationModels//evaluations/` + string name = 1; + + // Optional. The display name of the model evaluation. At most 64 bytes long. + string display_name = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The configuration of the evaluation task. + EvaluationConfig evaluation_config = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Creation time of this model. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Metrics details. + oneof metrics { + // Output only. Only available when model is for smart reply. + SmartReplyMetrics smart_reply_metrics = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// The configuration for model evaluation. +message EvaluationConfig { + // Smart reply specific configuration for evaluation job. + message SmartReplyConfig { + // The allowlist document resource name. + // Format: `projects//knowledgeBases//documents/`. Only used for smart reply model. + string allowlist_document = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + }]; + + // Required. The model to be evaluated can return multiple results with confidence + // score on each query. These results will be sorted by the descending order + // of the scores and we only keep the first max_result_count results as the + // final results to evaluate. + int32 max_result_count = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Smart compose specific configuration for evaluation job. + message SmartComposeConfig { + // The allowlist document resource name. + // Format: `projects//knowledgeBases//documents/`. Only used for smart compose model. + string allowlist_document = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + }]; + + // Required. The model to be evaluated can return multiple results with confidence + // score on each query. These results will be sorted by the descending order + // of the scores and we only keep the first max_result_count results as the + // final results to evaluate. + int32 max_result_count = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Datasets used for evaluation. + repeated InputDataset datasets = 3 [(google.api.field_behavior) = REQUIRED]; + + // Specific configurations for different models in order to do evaluation. + oneof model_specific_config { + // Configuration for smart reply model evalution. + SmartReplyConfig smart_reply_config = 2; + + // Configuration for smart compose model evalution. + SmartComposeConfig smart_compose_config = 4; + } +} + +// InputDataset used to create model or do evaluation. +// NextID:5 +message InputDataset { + // Required. ConversationDataset resource name. Format: + // `projects//locations//conversationDatasets/` + string dataset = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationDataset" + } + ]; +} + +// Metadata for article suggestion models. +message ArticleSuggestionModelMetadata { + // Optional. Type of the article suggestion model. If not provided, model_type is used. + ConversationModel.ModelType training_model_type = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Metadata for smart reply models. +message SmartReplyModelMetadata { + // Optional. Type of the smart reply model. If not provided, model_type is used. + ConversationModel.ModelType training_model_type = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// The evaluation metrics for smart reply model. +message SmartReplyMetrics { + // Evaluation metrics when retrieving `n` smart replies with the model. + message TopNMetrics { + // Number of retrieved smart replies. For example, when `n` is 3, this + // evaluation contains metrics for when Dialogflow retrieves 3 smart replies + // with the model. + int32 n = 1; + + // Defined as `number of queries whose top n smart replies have at least one + // similar (token match similarity above the defined threshold) reply as the + // real reply` divided by `number of queries with at least one smart reply`. + // Value ranges from 0.0 to 1.0 inclusive. + float recall = 2; + } + + // Percentage of target participant messages in the evaluation dataset for + // which similar messages have appeared at least once in the allowlist. Should + // be [0, 1]. + float allowlist_coverage = 1; + + // Metrics of top n smart replies, sorted by [TopNMetric.n][]. + repeated TopNMetrics top_n_metrics = 2; + + // Total number of conversations used to generate this metric. + int64 conversation_count = 3; +} + +// The request message for +// [ConversationModels.CreateConversationModel][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel] +message CreateConversationModelRequest { + // The project to create conversation model for. Format: + // `projects/` + string parent = 1; + + // Required. The conversation model to create. + ConversationModel conversation_model = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.GetConversationModel][google.cloud.dialogflow.v2.ConversationModels.GetConversationModel] +message GetConversationModelRequest { + // Required. The conversation model to retrieve. Format: + // `projects//conversationModels/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.ListConversationModels][google.cloud.dialogflow.v2.ConversationModels.ListConversationModels] +message ListConversationModelsRequest { + // Required. The project to list all conversation models for. + // Format: `projects/` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Maximum number of conversation models to return in a single + // page. By default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for +// [ConversationModels.ListConversationModels][google.cloud.dialogflow.v2.ConversationModels.ListConversationModels] +message ListConversationModelsResponse { + // The list of models to return. + repeated ConversationModel conversation_models = 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 request message for +// [ConversationModels.DeleteConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel] +message DeleteConversationModelRequest { + // Required. The conversation model to delete. Format: + // `projects//conversationModels/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.DeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel] +message DeployConversationModelRequest { + // Required. The conversation model to deploy. Format: + // `projects//conversationModels/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.UndeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel] +message UndeployConversationModelRequest { + // Required. The conversation model to undeploy. Format: + // `projects//conversationModels/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.GetConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation] +message GetConversationModelEvaluationRequest { + // Required. The conversation model evaluation resource name. Format: + // `projects//conversationModels//evaluations/` + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for +// [ConversationModels.ListConversationModelEvaluations][google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations] +message ListConversationModelEvaluationsRequest { + // Required. The conversation model resource name. Format: + // `projects//conversationModels/` + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Maximum number of evaluations to return in a + // single page. By default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for +// [ConversationModels.ListConversationModelEvaluations][google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations] +message ListConversationModelEvaluationsResponse { + // The list of evaluations to return. + repeated ConversationModelEvaluation conversation_model_evaluations = 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 request message for +// [ConversationModels.CreateConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation] +message CreateConversationModelEvaluationRequest { + // Required. The conversation model resource name. Format: + // `projects//locations//conversationModels/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationModelEvaluation" + } + ]; + + // Required. The conversation model evaluation to be created. + ConversationModelEvaluation conversation_model_evaluation = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata for a [ConversationModels.CreateConversationModel][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel] operation. +message CreateConversationModelOperationMetadata { + // State of CreateConversationModel operation. + enum State { + // Invalid. + STATE_UNSPECIFIED = 0; + + // Request is submitted, but training has not started yet. + // The model may remain in this state until there is enough capacity to + // start training. + PENDING = 1; + + // The training has succeeded. + SUCCEEDED = 2; + + // The training has succeeded. + FAILED = 3; + + // The training has been cancelled. + CANCELLED = 4; + + // The training is in cancelling state. + CANCELLING = 5; + + // Custom model is training. + TRAINING = 6; + } + + // The resource name of the conversation model. Format: + // `projects//conversationModels/` + string conversation_model = 1; + + // State of CreateConversationModel operation. + State state = 2; + + // Timestamp when the request to create conversation model is submitted. The + // time is measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Metadata for a [ConversationModels.DeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel] operation. +message DeployConversationModelOperationMetadata { + // The resource name of the conversation model. Format: + // `projects//conversationModels/` + string conversation_model = 1; + + // Timestamp when request to deploy conversation model was submitted. The time + // is measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Metadata for a [ConversationModels.UndeployConversationModel][google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel] operation. +message UndeployConversationModelOperationMetadata { + // The resource name of the conversation model. Format: + // `projects//conversationModels/` + string conversation_model = 1; + + // Timestamp when the request to undeploy conversation model was submitted. + // The time is measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Metadata for a [ConversationModels.DeleteConversationModel][google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel] operation. +message DeleteConversationModelOperationMetadata { + // The resource name of the conversation model. Format: + // `projects//conversationModels/` + string conversation_model = 1; + + // Timestamp when delete conversation model request was created. The time is + // measured on server side. + google.protobuf.Timestamp create_time = 3; +} + +// Metadata for a +// [ConversationModels.CreateConversationModelEvaluation][google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation] +// operation. +message CreateConversationModelEvaluationOperationMetadata { + // State of CreateConversationModel operation. + enum State { + // Operation status not specified. + STATE_UNSPECIFIED = 0; + + // The operation is being prepared. + INITIALIZING = 1; + + // The operation is running. + RUNNING = 2; + + // The operation is cancelled. + CANCELLED = 3; + + // The operation has succeeded. + SUCCEEDED = 4; + + // The operation has failed. + FAILED = 5; + } + + // The resource name of the conversation model. Format: + // `projects//locations//conversationModels//evaluations/` + string conversation_model_evaluation = 1; + + // The resource name of the conversation model. Format: + // `projects//locations//conversationModels/` + string conversation_model = 4; + + // State of CreateConversationModel operation. + State state = 2; + + // Timestamp when the request to create conversation model was submitted. The + // time is measured on server side. + google.protobuf.Timestamp create_time = 3; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_profile.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_profile.proto new file mode 100644 index 00000000000..d1a33bb8025 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/conversation_profile.proto @@ -0,0 +1,753 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/participant.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationProfileProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/CXSecuritySettings" + pattern: "projects/{project}/locations/{location}/securitySettings/{security_settings}" +}; + +// Service for managing [ConversationProfiles][google.cloud.dialogflow.v2.ConversationProfile]. +service ConversationProfiles { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all conversation profiles in the specified project. + rpc ListConversationProfiles(ListConversationProfilesRequest) returns (ListConversationProfilesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/conversationProfiles" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/conversationProfiles" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified conversation profile. + rpc GetConversationProfile(GetConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversationProfiles/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversationProfiles/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a conversation profile in the specified project. + // + // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] + // aren't populated in the response. You can retrieve them via + // [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile] API. + rpc CreateConversationProfile(CreateConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/conversationProfiles" + body: "conversation_profile" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/conversationProfiles" + body: "conversation_profile" + } + }; + option (google.api.method_signature) = "parent,conversation_profile"; + } + + // Updates the specified conversation profile. + // + // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] + // aren't populated in the response. You can retrieve them via + // [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile] API. + rpc UpdateConversationProfile(UpdateConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + patch: "/v2/{conversation_profile.name=projects/*/conversationProfiles/*}" + body: "conversation_profile" + additional_bindings { + patch: "/v2/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}" + body: "conversation_profile" + } + }; + option (google.api.method_signature) = "conversation_profile,update_mask"; + } + + // Deletes the specified conversation profile. + rpc DeleteConversationProfile(DeleteConversationProfileRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/conversationProfiles/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/conversationProfiles/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Adds or updates a suggestion feature in a conversation profile. + // If the conversation profile contains the type of suggestion feature for + // the participant role, it will update it. Otherwise it will insert the + // suggestion feature. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata] + // - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] + // + // If a long running operation to add or update suggestion feature + // config for the same conversation profile, participant role and suggestion + // feature type exists, please cancel the existing long running operation + // before sending such request, otherwise the request will be rejected. + rpc SetSuggestionFeatureConfig(SetSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig" + body: "*" + additional_bindings { + post: "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig" + body: "*" + } + }; + option (google.api.method_signature) = "conversation_profile"; + option (google.longrunning.operation_info) = { + response_type: "ConversationProfile" + metadata_type: "SetSuggestionFeatureConfigOperationMetadata" + }; + } + + // Clears a suggestion feature from a conversation profile for the given + // participant role. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata] + // - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] + rpc ClearSuggestionFeatureConfig(ClearSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig" + body: "*" + additional_bindings { + post: "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig" + body: "*" + } + }; + option (google.api.method_signature) = "conversation_profile"; + option (google.longrunning.operation_info) = { + response_type: "ConversationProfile" + metadata_type: "ClearSuggestionFeatureConfigOperationMetadata" + }; + } +} + +// Defines the services to connect to incoming Dialogflow conversations. +message ConversationProfile { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationProfile" + pattern: "projects/{project}/conversationProfiles/{conversation_profile}" + pattern: "projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}" + }; + + // The unique identifier of this conversation profile. + // Format: `projects//locations//conversationProfiles/`. + string name = 1; + + // Required. Human readable name for this profile. Max length 1024 bytes. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Create time of the conversation profile. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Update time of the conversation profile. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configuration for an automated agent to use with this profile. + AutomatedAgentConfig automated_agent_config = 3; + + // Configuration for agent assistance to use with this profile. + HumanAgentAssistantConfig human_agent_assistant_config = 4; + + // Configuration for connecting to a live agent. + // + // Currently, this feature is not general available, please contact Google + // to get access. + HumanAgentHandoffConfig human_agent_handoff_config = 5; + + // Configuration for publishing conversation lifecycle events. + NotificationConfig notification_config = 6; + + // Configuration for logging conversation lifecycle events. + LoggingConfig logging_config = 7; + + // Configuration for publishing new message events. Event will be sent in + // format of [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] + NotificationConfig new_message_event_notification_config = 8; + + // Settings for speech transcription. + SpeechToTextConfig stt_config = 9; + + // Language code for the conversation profile. If not specified, the language + // is en-US. Language at ConversationProfile should be set for all non en-US + // languages. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 10; + + // The time zone of this conversational profile from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. Defaults to America/New_York. + string time_zone = 14; + + // Name of the CX SecuritySettings reference for the agent. + // Format: `projects//locations//securitySettings/`. + string security_settings = 13 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/CXSecuritySettings" + }]; +} + +// The request message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles]. +message ListConversationProfilesRequest { + // Required. The project to list all conversation profiles from. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles]. +message ListConversationProfilesResponse { + // The list of project conversation profiles. There is a maximum number + // of items returned based on the page_size field in the request. + repeated ConversationProfile conversation_profiles = 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 request message for [ConversationProfiles.GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile]. +message GetConversationProfileRequest { + // Required. The resource name of the conversation profile. + // Format: `projects//locations//conversationProfiles/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; +} + +// The request message for [ConversationProfiles.CreateConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile]. +message CreateConversationProfileRequest { + // Required. The project to create a conversation profile for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // Required. The conversation profile to create. + ConversationProfile conversation_profile = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.UpdateConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile]. +message UpdateConversationProfileRequest { + // Required. The conversation profile to update. + ConversationProfile conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.DeleteConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile]. +// +// This operation fails if the conversation profile is still referenced from +// a phone number. +message DeleteConversationProfileRequest { + // Required. The name of the conversation profile to delete. + // Format: `projects//locations//conversationProfiles/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; +} + +// Defines the Automated Agent to connect to a conversation. +message AutomatedAgentConfig { + // Required. ID of the Dialogflow agent environment to use. + // + // This project needs to either be the same project as the conversation or you + // need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API + // Service Agent` role in this project. + // + // - For ES agents, use format: `projects//locations//agent/environments/`. If environment is not + // specified, the default `draft` environment is used. Refer to + // [DetectIntentRequest](/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.DetectIntentRequest) + // for more details. + // + // - For CX agents, use format `projects//locations//agents//environments/`. If environment is not specified, the default `draft` environment + // is used. + string agent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// Defines the Human Agent Assist to connect to a conversation. +message HumanAgentAssistantConfig { + // Settings of suggestion trigger. + message SuggestionTriggerSettings { + // Do not trigger if last utterance is small talk. + bool no_smalltalk = 1; + + // Only trigger suggestion if participant role of last utterance is + // END_USER. + bool only_end_user = 2; + } + + // Config for suggestion features. + message SuggestionFeatureConfig { + // The suggestion feature. + SuggestionFeature suggestion_feature = 5; + + // Automatically iterates all participants and tries to compile + // suggestions. + // + // Supported features: ARTICLE_SUGGESTION, FAQ, DIALOGFLOW_ASSIST. + bool enable_event_based_suggestion = 3; + + // Settings of suggestion trigger. + // + // Currently, only ARTICLE_SUGGESTION and FAQ will use this field. + SuggestionTriggerSettings suggestion_trigger_settings = 10; + + // Configs of query. + SuggestionQueryConfig query_config = 6; + + // Configs of custom conversation model. + ConversationModelConfig conversation_model_config = 7; + + // Configs for processing conversation. + ConversationProcessConfig conversation_process_config = 8; + } + + // Detail human agent assistant config. + message SuggestionConfig { + // Configuration of different suggestion features. One feature can have only + // one config. + repeated SuggestionFeatureConfig feature_configs = 2; + + // If `group_suggestion_responses` is false, and there are multiple + // `feature_configs` in `event based suggestion` or + // StreamingAnalyzeContent, we will try to deliver suggestions to customers + // as soon as we get new suggestion. Different type of suggestions based on + // the same context will be in separate Pub/Sub event or + // `StreamingAnalyzeContentResponse`. + // + // If `group_suggestion_responses` set to true. All the suggestions to the + // same participant based on the same context will be grouped into a single + // Pub/Sub event or StreamingAnalyzeContentResponse. + bool group_suggestion_responses = 3; + } + + // Config for suggestion query. + message SuggestionQueryConfig { + // Knowledge base source settings. + // + // Supported features: ARTICLE_SUGGESTION, FAQ. + message KnowledgeBaseQuerySource { + // Required. Knowledge bases to query. Format: + // `projects//locations//knowledgeBases/`. Currently, at most 5 knowledge + // bases are supported. + repeated string knowledge_bases = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + } + + // Document source settings. + // + // Supported features: SMART_REPLY, SMART_COMPOSE. + message DocumentQuerySource { + // Required. Knowledge documents to query from. Format: + // `projects//locations//knowledgeBases//documents/`. + // Currently, at most 5 documents are supported. + repeated string documents = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + } + + // Dialogflow source setting. + // + // Supported feature: DIALOGFLOW_ASSIST. + message DialogflowQuerySource { + // Required. The name of a Dialogflow virtual agent used for end user side intent + // detection and suggestion. Format: `projects//locations//agent`. When multiple agents are allowed in + // the same Dialogflow project. + string agent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; + } + + // Settings that determine how to filter recent conversation context when + // generating suggestions. + message ContextFilterSettings { + // If set to true, the last message from virtual agent (hand off message) + // and the message before it (trigger message of hand off) are dropped. + bool drop_handoff_messages = 1; + + // If set to true, all messages from virtual agent are dropped. + bool drop_virtual_agent_messages = 2; + + // If set to true, all messages from ivr stage are dropped. + bool drop_ivr_messages = 3; + } + + // Source of query. + oneof query_source { + // Query from knowledgebase. It is used by: + // ARTICLE_SUGGESTION, FAQ. + KnowledgeBaseQuerySource knowledge_base_query_source = 1; + + // Query from knowledge base document. It is used by: + // SMART_REPLY, SMART_COMPOSE. + DocumentQuerySource document_query_source = 2; + + // Query from Dialogflow agent. It is used by DIALOGFLOW_ASSIST. + DialogflowQuerySource dialogflow_query_source = 3; + } + + // Maximum number of results to return. Currently, if unset, defaults to 10. + // And the max number is 20. + int32 max_results = 4; + + // Confidence threshold of query result. + // + // Agent Assist gives each suggestion a score in the range [0.0, 1.0], based + // on the relevance between the suggestion and the current conversation + // context. A score of 0.0 has no relevance, while a score of 1.0 has high + // relevance. Only suggestions with a score greater than or equal to the + // value of this field are included in the results. + // + // For a baseline model (the default), the recommended value is in the range + // [0.05, 0.1]. + // + // For a custom model, there is no recommended value. Tune this value by + // starting from a very low value and slowly increasing until you have + // desired results. + // + // If this field is not set, it defaults to 0.0, which means that all + // suggestions are returned. + // + // Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE. + float confidence_threshold = 5; + + // Determines how recent conversation context is filtered when generating + // suggestions. If unspecified, no messages will be dropped. + ContextFilterSettings context_filter_settings = 7; + } + + // Custom conversation models used in agent assist feature. + // + // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY, + // CONVERSATION_SUMMARIZATION. + message ConversationModelConfig { + // Conversation model resource name. Format: `projects//conversationModels/`. + string model = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationModel" + }]; + } + + // Config to process conversation. + message ConversationProcessConfig { + // Number of recent non-small-talk sentences to use as context for article + // and FAQ suggestion + int32 recent_sentences_count = 2; + } + + // Configuration for analyses to run on each conversation message. + message MessageAnalysisConfig { + // Enable entity extraction in conversation messages on [agent assist + // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). + // If unspecified, defaults to false. + // + // Currently, this feature is not general available, please contact Google + // to get access. + bool enable_entity_extraction = 2; + + // Enable sentiment analysis in conversation messages on [agent assist + // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). + // If unspecified, defaults to false. Sentiment analysis inspects user input + // and identifies the prevailing subjective opinion, especially to determine + // a user's attitude as positive, negative, or neutral: + // https://cloud.google.com/natural-language/docs/basics#sentiment_analysis + // For [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] method, result will be in + // [StreamingAnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.message]. + // For [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] method, result will be in + // [AnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2.AnalyzeContentResponse.message] + // For [Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages] method, result will be in + // [ListMessagesResponse.messages.SentimentAnalysisResult][google.cloud.dialogflow.v2.ListMessagesResponse.messages] + // If Pub/Sub notification is configured, result will be in + // [ConversationEvent.new_message_payload.SentimentAnalysisResult][google.cloud.dialogflow.v2.ConversationEvent.new_message_payload]. + bool enable_sentiment_analysis = 3; + } + + // Pub/Sub topic on which to publish new agent assistant events. + NotificationConfig notification_config = 2; + + // Configuration for agent assistance of human agent participant. + SuggestionConfig human_agent_suggestion_config = 3; + + // Configuration for agent assistance of end user participant. + // + // Currently, this feature is not general available, please contact Google + // to get access. + SuggestionConfig end_user_suggestion_config = 4; + + // Configuration for message analysis. + MessageAnalysisConfig message_analysis_config = 5; +} + +// Defines the hand off to a live agent, typically on which external agent +// service provider to connect to a conversation. +// +// Currently, this feature is not general available, please contact Google +// to get access. +message HumanAgentHandoffConfig { + // Configuration specific to LivePerson (https://www.liveperson.com). + message LivePersonConfig { + // Required. Account number of the LivePerson account to connect. This is + // the account number you input at the login page. + string account_number = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Configuration specific to Salesforce Live Agent. + message SalesforceLiveAgentConfig { + // Required. The organization ID of the Salesforce account. + string organization_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Live Agent deployment ID. + string deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Live Agent chat button ID. + string button_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Domain of the Live Agent endpoint for this agent. You can find + // the endpoint URL in the `Live Agent settings` page. For example if URL + // has the form https://d.la4-c2-phx.salesforceliveagent.com/..., + // you should fill in d.la4-c2-phx.salesforceliveagent.com. + string endpoint_domain = 4 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Specifies which agent service to connect for human agent handoff. + oneof agent_service { + // Uses LivePerson (https://www.liveperson.com). + LivePersonConfig live_person_config = 1; + + // Uses Salesforce Live Agent. + SalesforceLiveAgentConfig salesforce_live_agent_config = 2; + } +} + +// Defines notification behavior. +message NotificationConfig { + // Format of cloud pub/sub message. + enum MessageFormat { + // If it is unspecified, PROTO will be used. + MESSAGE_FORMAT_UNSPECIFIED = 0; + + // Pub/Sub message will be serialized proto. + PROTO = 1; + + // Pub/Sub message will be json. + JSON = 2; + } + + // Name of the Pub/Sub topic to publish conversation + // events like + // [CONVERSATION_STARTED][google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED] as + // serialized [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] protos. + // + // For telephony integration to receive notification, make sure either this + // topic is in the same project as the conversation or you grant + // `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow Service + // Agent` role in the topic project. + // + // For chat integration to receive notification, make sure API caller has been + // granted the `Dialogflow Service Agent` role for the topic. + // + // Format: `projects//locations//topics/`. + string topic = 1; + + // Format of message. + MessageFormat message_format = 2; +} + +// Defines logging behavior for conversation lifecycle events. +message LoggingConfig { + // Whether to log conversation events like + // [CONVERSATION_STARTED][google.cloud.dialogflow.v2.ConversationEvent.Type.CONVERSATION_STARTED] to + // Stackdriver in the conversation project as JSON format + // [ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent] protos. + bool enable_stackdriver_logging = 3; +} + +// The type of Human Agent Assistant API suggestion to perform, and the maximum +// number of results to return for that type. Multiple `Feature` objects can +// be specified in the `features` list. +message SuggestionFeature { + // Defines the type of Human Agent Assistant feature. + enum Type { + // Unspecified feature type. + TYPE_UNSPECIFIED = 0; + + // Run article suggestion model for chat. + ARTICLE_SUGGESTION = 1; + + // Run FAQ model for chat. + FAQ = 2; + + // Run smart reply model for chat. + SMART_REPLY = 3; + } + + // Type of Human Agent Assistant API feature to request. + Type type = 1; +} + +// The request message for +// [ConversationProfiles.SetSuggestionFeature][]. +message SetSuggestionFeatureConfigRequest { + // Required. The Conversation Profile to add or update the suggestion feature + // config. Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The participant role to add or update the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The suggestion feature config to add or update. + HumanAgentAssistantConfig.SuggestionFeatureConfig suggestion_feature_config = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.ClearFeature][]. +message ClearSuggestionFeatureConfigRequest { + // Required. The Conversation Profile to add or update the suggestion feature + // config. Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The participant role to remove the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to remove. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata for a [ConversationProfile.SetSuggestionFeatureConfig][] +// operation. +message SetSuggestionFeatureConfigOperationMetadata { + // The resource name of the conversation profile. Format: + // `projects//locations//conversationProfiles/` + string conversation_profile = 1; + + // Required. The participant role to add or update the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to add or update. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp whe the request was created. The time is measured on server side. + google.protobuf.Timestamp create_time = 4; +} + +// Metadata for a [ConversationProfile.ClearSuggestionFeatureConfig][] +// operation. +message ClearSuggestionFeatureConfigOperationMetadata { + // The resource name of the conversation profile. Format: + // `projects//locations//conversationProfiles/` + string conversation_profile = 1; + + // Required. The participant role to remove the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to remove. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp whe the request was created. The time is measured on server side. + google.protobuf.Timestamp create_time = 4; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/document.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/document.proto new file mode 100644 index 00000000000..1241621948f --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/document.proto @@ -0,0 +1,636 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/gcs.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing knowledge [Documents][google.cloud.dialogflow.v2.Document]. +service Documents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all documents of the knowledge base. + rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/knowledgeBases/*}/documents" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + } + additional_bindings { + get: "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified document. + rpc GetDocument(GetDocumentRequest) returns (Document) { + option (google.api.http) = { + get: "/v2/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new document. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2.Document] + rpc CreateDocument(CreateDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/knowledgeBases/*}/documents" + body: "document" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + body: "document" + } + additional_bindings { + post: "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents" + body: "document" + } + }; + option (google.api.method_signature) = "parent,document"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Creates documents by importing data from external sources. + // Dialogflow supports up to 350 documents in each request. If you try to + // import more, Dialogflow will return an error. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse] + rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/knowledgeBases/*}/documents:import" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "ImportDocumentsResponse" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Deletes the specified document. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc DeleteDocument(DeleteDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Updates the specified document. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2.Document] + rpc UpdateDocument(UpdateDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{document.name=projects/*/knowledgeBases/*/documents/*}" + body: "document" + additional_bindings { + patch: "/v2/{document.name=projects/*/locations/*/knowledgeBases/*/documents/*}" + body: "document" + } + additional_bindings { + patch: "/v2/{document.name=projects/*/agent/knowledgeBases/*/documents/*}" + body: "document" + } + }; + option (google.api.method_signature) = "document,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Reloads the specified document from its specified source, content_uri or + // content. The previously loaded content of the document will be deleted. + // Note: Even when the content of the document has not changed, there still + // may be side effects because of internal implementation changes. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2.Document] + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc ReloadDocument(ReloadDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/knowledgeBases/*/documents/*}:reload" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:reload" + body: "*" + } + additional_bindings { + post: "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload" + body: "*" + } + }; + option (google.api.method_signature) = "name,content_uri"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Exports a smart messaging candidate document into the specified + // destination. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2.Document] + rpc ExportDocument(ExportDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/knowledgeBases/*/documents/*}:export" + body: "*" + additional_bindings { + post: "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:export" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } +} + +// A knowledge document to be used by a [KnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBase]. +// +// For more information, see the [knowledge base +// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). +// +// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; +// only use `projects.knowledgeBases.documents`. +message Document { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Document" + pattern: "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}" + pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}" + }; + + // The knowledge type of document content. + enum KnowledgeType { + // The type is unspecified or arbitrary. + KNOWLEDGE_TYPE_UNSPECIFIED = 0; + + // The document content contains question and answer pairs as either HTML or + // CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats + // may fail to be parsed. + // + // CSV must have questions in the first column and answers in the second, + // with no header. Because of this explicit format, they are always parsed + // accurately. + FAQ = 1; + + // Documents for which unstructured text is extracted and used for + // question answering. + EXTRACTIVE_QA = 2; + + // The entire document content as a whole can be used for query results. + // Only for Contact Center Solutions on Dialogflow. + ARTICLE_SUGGESTION = 3; + + // The document contains agent-facing Smart Reply entries. + AGENT_FACING_SMART_REPLY = 4; + } + + // The status of a reload attempt. + message ReloadStatus { + // The time of a reload attempt. + // This reload may have been triggered automatically or manually and may + // not have succeeded. + google.protobuf.Timestamp time = 1; + + // The status of a reload attempt or the initial load. + google.rpc.Status status = 2; + } + + // Possible states of the document + enum State { + // The document state is unspecified. + STATE_UNSPECIFIED = 0; + + // The document creation is in progress. + CREATING = 1; + + // The document is active and ready to use. + ACTIVE = 2; + + // The document updation is in progress. + UPDATING = 3; + + // The document is reloading. + RELOADING = 4; + + // The document deletion is in progress. + DELETING = 5; + } + + // Optional. The document resource name. + // The name must be empty when creating a document. + // Format: `projects//locations//knowledgeBases//documents/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The display name of the document. The name must be 1024 bytes or + // less; otherwise, the creation request fails. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The MIME type of this document. + string mime_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The knowledge type of document content. + repeated KnowledgeType knowledge_types = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. The source of this document. + oneof source { + // The URI where the file content is located. + // + // For documents stored in Google Cloud Storage, these URIs must have + // the form `gs:///`. + // + // NOTE: External URLs must correspond to public webpages, i.e., they must + // be indexed by Google Search. In particular, URLs for showing documents in + // Google Cloud Storage (i.e. the URL in your browser) are not supported. + // Instead use the `gs://` format URI described above. + string content_uri = 5; + + // The raw content of the document. This field is only permitted for + // EXTRACTIVE_QA and FAQ knowledge types. + bytes raw_content = 9; + } + + // Optional. If true, we try to automatically reload the document every day + // (at a time picked by the system). If false or unspecified, we don't try + // to automatically reload the document. + // + // Currently you can only enable automatic reload for documents sourced from + // a public url, see `source` field for the source types. + // + // Reload status can be tracked in `latest_reload_status`. If a reload + // fails, we will keep the document unchanged. + // + // If a reload fails with internal errors, the system will try to reload the + // document on the next day. + // If a reload fails with non-retriable errors (e.g. PERMISION_DENIED), the + // system will not try to reload the document anymore. You need to manually + // reload the document successfully by calling `ReloadDocument` and clear the + // errors. + bool enable_auto_reload = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time and status of the latest reload. + // This reload may have been triggered automatically or manually + // and may not have succeeded. + ReloadStatus latest_reload_status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Metadata for the document. The metadata supports arbitrary + // key-value pairs. Suggested use cases include storing a document's title, + // an external URL distinct from the document's content_uri, etc. + // The max size of a `key` or a `value` of the metadata is 1024 bytes. + map metadata = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The current state of the document. + State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for [Documents.GetDocument][google.cloud.dialogflow.v2.Documents.GetDocument]. +message GetDocumentRequest { + // Required. The name of the document to retrieve. + // Format `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; +} + +// Request message for [Documents.ListDocuments][google.cloud.dialogflow.v2.Documents.ListDocuments]. +message ListDocumentsRequest { + // Required. The knowledge base to list all documents for. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; + + // The filter expression used to filter documents returned by the list method. + // The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * knowledge_types with has(:) operator + // * display_name with has(:) operator + // * state with equals(=) operator + // + // Examples: + // + // * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + // * "display_name:customer" matches documents whose display name contains + // "customer". + // * "state=ACTIVE" matches documents with ACTIVE state. + // * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// Response message for [Documents.ListDocuments][google.cloud.dialogflow.v2.Documents.ListDocuments]. +message ListDocumentsResponse { + // The list of documents. + repeated Document documents = 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 [Documents.CreateDocument][google.cloud.dialogflow.v2.Documents.CreateDocument]. +message CreateDocumentRequest { + // Required. The knowledge base to create a document for. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // Required. The document to create. + Document document = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [Documents.ImportDocuments][google.cloud.dialogflow.v2.Documents.ImportDocuments]. +message ImportDocumentsRequest { + // Required. The knowledge base to import documents into. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // Required. The source to use for importing documents. + // + // If the source captures multiple objects, then multiple documents will be + // created, one corresponding to each object, and all of these documents will + // be created using the same document template. + // + // Dialogflow supports up to 350 documents in each request. If you try to + // import more, Dialogflow will return an error. + oneof source { + // The Google Cloud Storage location for the documents. + // The path can include a wildcard. + // + // These URIs may have the forms + // `gs:///`. + // `gs:////*.`. + GcsSources gcs_source = 2; + } + + // Required. Document template used for importing all the documents. + ImportDocumentTemplate document_template = 3 [(google.api.field_behavior) = REQUIRED]; + + // Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 4; +} + +// The template used for importing documents. +message ImportDocumentTemplate { + // Required. The MIME type of the document. + string mime_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The knowledge type of document content. + repeated Document.KnowledgeType knowledge_types = 2 [(google.api.field_behavior) = REQUIRED]; + + // Metadata for the document. The metadata supports arbitrary + // key-value pairs. Suggested use cases include storing a document's title, + // an external URL distinct from the document's content_uri, etc. + // The max size of a `key` or a `value` of the metadata is 1024 bytes. + map metadata = 3; +} + +// Response message for [Documents.ImportDocuments][google.cloud.dialogflow.v2.Documents.ImportDocuments]. +message ImportDocumentsResponse { + // Includes details about skipped documents or any other warnings. + repeated google.rpc.Status warnings = 1; +} + +// Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2.Documents.DeleteDocument]. +message DeleteDocumentRequest { + // Required. The name of the document to delete. + // Format: `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; +} + +// Request message for [Documents.UpdateDocument][google.cloud.dialogflow.v2.Documents.UpdateDocument]. +message UpdateDocumentRequest { + // Required. The document to update. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Not specified means `update all`. + // Currently, only `display_name` can be updated, an InvalidArgument will be + // returned for attempting to update other fields. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2.Documents.ReloadDocument]. +message ReloadDocumentRequest { + // Required. The name of the document to reload. + // Format: `projects//locations//knowledgeBases//documents/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + + // The source for document reloading. + // If provided, the service will load the contents from the source + // and update document in the knowledge base. + oneof source { + // Optional. The path of gcs source file for reloading document content. For now, + // only gcs uri is supported. + // + // For documents stored in Google Cloud Storage, these URIs must have + // the form `gs:///`. + string content_uri = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When enabled, the reload request is to apply partial update to the smart + // messaging allowlist. + bool smart_messaging_partial_update = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [Documents.ExportDocument][google.cloud.dialogflow.v2.Documents.ExportDocument]. +message ExportDocumentRequest { + // Required. The name of the document to export. + // Format: `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + + // Required. The destination for the export. + oneof destination { + // Cloud Storage file path to export the document. + GcsDestination gcs_destination = 2; + } + + // When enabled, export the full content of the document including empirical + // probability. + bool export_full_content = 3; + + // When enabled, export the smart messaging allowlist document for partial + // update. + bool smart_messaging_partial_update = 5; +} + +// Metadata related to the Export Data Operations (e.g. ExportDocument). +message ExportOperationMetadata { + // Cloud Storage file path of the exported data. + GcsDestination exported_gcs_destination = 1; +} + +// Metadata in google::longrunning::Operation for Knowledge operations. +message KnowledgeOperationMetadata { + // States of the operation. + enum State { + // State unspecified. + STATE_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + } + + // Output only. The current state of this operation. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the knowledge base interacted with during the operation. + string knowledge_base = 3; + + // Additional metadata for the Knowledge operation. + oneof operation_metadata { + // Metadata for the Export Data Operation such as the destination of export. + ExportOperationMetadata export_operation_metadata = 4; + } +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/entity_type.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/entity_type.proto new file mode 100644 index 00000000000..acb5b94f25e --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/entity_type.proto @@ -0,0 +1,613 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "EntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [EntityTypes][google.cloud.dialogflow.v2.EntityType]. +service EntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all entity types in the specified agent. + rpc ListEntityTypes(ListEntityTypesRequest) returns (ListEntityTypesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent}/entityTypes" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent}/entityTypes" + } + }; + option (google.api.method_signature) = "parent"; + option (google.api.method_signature) = "parent,language_code"; + } + + // Retrieves the specified entity type. + rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/entityTypes/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,language_code"; + } + + // Creates an entity type in the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc CreateEntityType(CreateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/entityTypes" + body: "entity_type" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/entityTypes" + body: "entity_type" + } + }; + option (google.api.method_signature) = "parent,entity_type"; + option (google.api.method_signature) = "parent,entity_type,language_code"; + } + + // Updates the specified entity type. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc UpdateEntityType(UpdateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + patch: "/v2/{entity_type.name=projects/*/agent/entityTypes/*}" + body: "entity_type" + additional_bindings { + patch: "/v2/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}" + body: "entity_type" + } + }; + option (google.api.method_signature) = "entity_type"; + option (google.api.method_signature) = "entity_type,language_code"; + } + + // Deletes the specified entity type. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc DeleteEntityType(DeleteEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/entityTypes/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates/Creates multiple entity types in the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse] + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchUpdateEntityTypes(BatchUpdateEntityTypesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/entityTypes:batchUpdate" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes entity types in the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchDeleteEntityTypes(BatchDeleteEntityTypesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/entityTypes:batchDelete" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entity_type_names"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Creates multiple new entities in the specified entity type. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchCreateEntities(BatchCreateEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entities"; + option (google.api.method_signature) = "parent,entities,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Updates or creates multiple entities in the specified entity type. This + // method does not affect entities in the entity type that aren't explicitly + // specified in the request. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + // + rpc BatchUpdateEntities(BatchUpdateEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entities"; + option (google.api.method_signature) = "parent,entities,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes entities in the specified entity type. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchDeleteEntities(BatchDeleteEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entity_values"; + option (google.api.method_signature) = "parent,entity_values,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// Each intent parameter has a type, called the entity type, which dictates +// exactly how data from an end-user expression is extracted. +// +// Dialogflow provides predefined system entities that can match many common +// types of data. For example, there are system entities for matching dates, +// times, colors, email addresses, and so on. You can also create your own +// custom entities for matching custom data. For example, you could define a +// vegetable entity that can match the types of vegetables available for +// purchase with a grocery store agent. +// +// For more information, see the +// [Entity guide](https://cloud.google.com/dialogflow/docs/entities-overview). +message EntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/EntityType" + pattern: "projects/{project}/agent/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/entityTypes/{entity_type}" + }; + + // Represents kinds of entities. + enum Kind { + // Not specified. This value should be never used. + KIND_UNSPECIFIED = 0; + + // Map entity types allow mapping of a group of synonyms to a reference + // value. + KIND_MAP = 1; + + // List entity types contain a set of entries that do not map to reference + // values. However, list entity types can contain references to other entity + // types (with or without aliases). + KIND_LIST = 2; + + // Regexp entity types allow to specify regular expressions in entries + // values. + KIND_REGEXP = 3; + } + + // Represents different entity type expansion modes. Automated expansion + // allows an agent to recognize values that have not been explicitly listed in + // the entity (for example, new kinds of shopping list items). + enum AutoExpansionMode { + // Auto expansion disabled for the entity. + AUTO_EXPANSION_MODE_UNSPECIFIED = 0; + + // Allows an agent to recognize values that have not been explicitly + // listed in the entity. + AUTO_EXPANSION_MODE_DEFAULT = 1; + } + + // An **entity entry** for an associated entity type. + message Entity { + // Required. The primary value associated with this entity entry. + // For example, if the entity type is *vegetable*, the value could be + // *scallions*. + // + // For `KIND_MAP` entity types: + // + // * A reference value to be used in place of synonyms. + // + // For `KIND_LIST` entity types: + // + // * A string that can contain references to other entity types (with or + // without aliases). + string value = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A collection of value synonyms. For example, if the entity type + // is *vegetable*, and `value` is *scallions*, a synonym could be *green + // onions*. + // + // For `KIND_LIST` entity types: + // + // * This collection must contain exactly one synonym equal to `value`. + repeated string synonyms = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // The unique identifier of the entity type. + // Required for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType] and + // [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes] methods. + // Format: `projects//agent/entityTypes/`. + string name = 1; + + // Required. The name of the entity type. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Indicates the kind of entity type. + Kind kind = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates whether the entity type can be automatically + // expanded. + AutoExpansionMode auto_expansion_mode = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of entity entries associated with the entity type. + repeated Entity entities = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Enables fuzzy entity extraction during classification. + bool enable_fuzzy_extraction = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. +message ListEntityTypesRequest { + // Required. The agent to list all entity types from. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes]. +message ListEntityTypesResponse { + // The list of agent entity types. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated EntityType entity_types = 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 request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType]. +message GetEntityTypeRequest { + // Required. The name of the entity type. + // Format: `projects//agent/entityTypes/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2.EntityTypes.CreateEntityType]. +message CreateEntityTypeRequest { + // Required. The agent to create a entity type for. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entity type to create. + EntityType entity_type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType]. +message UpdateEntityTypeRequest { + // Required. The entity type to update. + EntityType entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType]. +message DeleteEntityTypeRequest { + // Required. The name of the entity type to delete. + // Format: `projects//agent/entityTypes/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; +} + +// The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. +message BatchUpdateEntityTypesRequest { + // Required. The name of the agent to update or create entity types in. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // The source of the entity type batch. + // + // For each entity type in the batch: + // + // * If `name` is specified, we update an existing entity type. + // * If `name` is not specified, we create a new entity type. + oneof entity_type_batch { + // The URI to a Google Cloud Storage file containing entity types to update + // or create. The file format can either be a serialized proto (of + // EntityBatch type) or a JSON object. Note: The URI must start with + // "gs://". + string entity_type_batch_uri = 2; + + // The collection of entity types to update or create. + EntityTypeBatch entity_type_batch_inline = 3; + } + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes]. +message BatchUpdateEntityTypesResponse { + // The collection of updated or created entity types. + repeated EntityType entity_types = 1; +} + +// The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes]. +message BatchDeleteEntityTypesRequest { + // Required. The name of the agent to delete all entities types for. Format: + // `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The names entity types to delete. All names must point to the + // same agent as `parent`. + repeated string entity_type_names = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities]. +message BatchCreateEntitiesRequest { + // Required. The name of the entity type to create entities in. Format: + // `projects//agent/entityTypes/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entities to create. + repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities]. +message BatchUpdateEntitiesRequest { + // Required. The name of the entity type to update or create entities in. + // Format: `projects//agent/entityTypes/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entities to update or create. + repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities]. +message BatchDeleteEntitiesRequest { + // Required. The name of the entity type to delete entries for. Format: + // `projects//agent/entityTypes/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The reference `values` of the entities to delete. Note that + // these are not fully-qualified names, i.e. they don't start with + // `projects/`. + repeated string entity_values = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// This message is a wrapper around a collection of entity types. +message EntityTypeBatch { + // A collection of entity types. + repeated EntityType entity_types = 1; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/environment.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/environment.proto new file mode 100644 index 00000000000..f368db3ec84 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/environment.proto @@ -0,0 +1,390 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/fulfillment.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "EnvironmentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Environments][google.cloud.dialogflow.v2.Environment]. +service Environments { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all non-default environments of the specified agent. + rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent}/environments" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent}/environments" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified agent environment. + rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/environments/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/environments/*}" + } + }; + } + + // Creates an agent environment. + rpc CreateEnvironment(CreateEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/environments" + body: "environment" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/environments" + body: "environment" + } + }; + } + + // Updates the specified agent environment. + // + // This method allows you to deploy new agent versions into the environment. + // When an environment is pointed to a new agent version by setting + // `environment.agent_version`, the environment is temporarily set to the + // `LOADING` state. During that time, the environment continues serving the + // previous version of the agent. After the new agent version is done loading, + // the environment is set back to the `RUNNING` state. + // You can use "-" as Environment ID in environment name to update an agent + // version in the default environment. WARNING: this will negate all recent + // changes to the draft agent and can't be undone. You may want to save the + // draft agent to a version before calling this method. + rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + patch: "/v2/{environment.name=projects/*/agent/environments/*}" + body: "environment" + additional_bindings { + patch: "/v2/{environment.name=projects/*/locations/*/agent/environments/*}" + body: "environment" + } + }; + } + + // Deletes the specified agent environment. + rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/environments/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/environments/*}" + } + }; + } + + // Gets the history of the specified environment. + rpc GetEnvironmentHistory(GetEnvironmentHistoryRequest) returns (EnvironmentHistory) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent/environments/*}/history" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/environments/*}/history" + } + }; + } +} + +// You can create multiple versions of your agent and publish them to separate +// environments. +// +// When you edit an agent, you are editing the draft agent. At any point, you +// can save the draft agent as an agent version, which is an immutable snapshot +// of your agent. +// +// When you save the draft agent, it is published to the default environment. +// When you create agent versions, you can publish them to custom environments. +// You can create a variety of custom environments for: +// +// - testing +// - development +// - production +// - etc. +// +// For more information, see the [versions and environments +// guide](https://cloud.google.com/dialogflow/docs/agents-versions). +message Environment { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Environment" + pattern: "projects/{project}/agent/environments/{environment}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}" + }; + + // Represents an environment state. When an environment is pointed to a new + // agent version, the environment is temporarily set to the `LOADING` state. + // During that time, the environment keeps on serving the previous version of + // the agent. After the new agent version is done loading, the environment is + // set back to the `RUNNING` state. + enum State { + // Not specified. This value is not used. + STATE_UNSPECIFIED = 0; + + // Stopped. + STOPPED = 1; + + // Loading. + LOADING = 2; + + // Running. + RUNNING = 3; + } + + // Output only. The unique identifier of this agent environment. + // Supported formats: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The developer-provided description for this environment. + // The maximum length is 500 characters. If exceeded, the request is rejected. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The agent version loaded into this environment. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string agent_version = 3 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; + + // Output only. The state of this environment. This field is read-only, i.e., it cannot be + // set by create and update methods. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time of this environment. This field is read-only, i.e., it + // cannot be set by create and update methods. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Text to speech settings for this environment. + TextToSpeechSettings text_to_speech_settings = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fulfillment settings to use for this environment. + Fulfillment fulfillment = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instructs the speech synthesizer on how to generate the output audio content. +message TextToSpeechSettings { + // Optional. Indicates whether text to speech is enabled. Even when this field is false, + // other settings in this proto are still retained. + bool enable_text_to_speech = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding output_audio_encoding = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The synthesis sample rate (in hertz) for this audio. If not provided, then + // the synthesizer will use the default sample rate based on the audio + // encoding. If this is different from the voice's natural sample rate, then + // the synthesizer will honor this request by converting to the desired sample + // rate (which might result in worse audio quality). + int32 sample_rate_hertz = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration of how speech should be synthesized, mapping from language + // (https://cloud.google.com/dialogflow/docs/reference/language) to + // SynthesizeSpeechConfig. + map synthesize_speech_configs = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. +message ListEnvironmentsRequest { + // Required. The agent to list all environments from. + // Format: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Environments.ListEnvironments][google.cloud.dialogflow.v2.Environments.ListEnvironments]. +message ListEnvironmentsResponse { + // The list of agent environments. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Environment environments = 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 request message for [Environments.GetEnvironment][google.cloud.dialogflow.v2.Environments.GetEnvironment]. +message GetEnvironmentRequest { + // Required. The name of the environment. + // Supported formats: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.CreateEnvironment][google.cloud.dialogflow.v2.Environments.CreateEnvironment]. +message CreateEnvironmentRequest { + // Required. The agent to create an environment for. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Required. The environment to create. + Environment environment = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The unique id of the new environment. + string environment_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Environments.UpdateEnvironment][google.cloud.dialogflow.v2.Environments.UpdateEnvironment]. +message UpdateEnvironmentRequest { + // Required. The environment to update. + Environment environment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. This field is used to prevent accidental overwrite of the default + // environment, which is an operation that cannot be undone. To confirm that + // the caller desires this overwrite, this field must be explicitly set to + // true when updating the default environment (environment ID = `-`). + bool allow_load_to_draft_and_discard_changes = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Environments.DeleteEnvironment][google.cloud.dialogflow.v2.Environments.DeleteEnvironment]. +message DeleteEnvironmentRequest { + // Required. The name of the environment to delete. + // / Format: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory]. +message GetEnvironmentHistoryRequest { + // Required. The name of the environment to retrieve history for. + // Supported formats: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory]. +message EnvironmentHistory { + // Represents an environment history entry. + message Entry { + // The agent version loaded into this environment history entry. + string agent_version = 1; + + // The developer-provided description for this environment history entry. + string description = 2; + + // The creation time of this environment history entry. + google.protobuf.Timestamp create_time = 3; + } + + // Output only. The name of the environment this history is for. + // Supported formats: + // + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + // + // The environment ID for the default environment is `-`. + string parent = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of agent environments. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Entry entries = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/fulfillment.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/fulfillment.proto new file mode 100644 index 00000000000..b1103fe41c0 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/fulfillment.proto @@ -0,0 +1,177 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "FulfillmentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment]. +service Fulfillments { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Retrieves the fulfillment. + rpc GetFulfillment(GetFulfillmentRequest) returns (Fulfillment) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/fulfillment}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/fulfillment}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the fulfillment. + rpc UpdateFulfillment(UpdateFulfillmentRequest) returns (Fulfillment) { + option (google.api.http) = { + patch: "/v2/{fulfillment.name=projects/*/agent/fulfillment}" + body: "fulfillment" + additional_bindings { + patch: "/v2/{fulfillment.name=projects/*/locations/*/agent/fulfillment}" + body: "fulfillment" + } + }; + option (google.api.method_signature) = "fulfillment,update_mask"; + } +} + +// By default, your agent responds to a matched intent with a static response. +// As an alternative, you can provide a more dynamic response by using +// fulfillment. When you enable fulfillment for an intent, Dialogflow responds +// to that intent by calling a service that you define. For example, if an +// end-user wants to schedule a haircut on Friday, your service can check your +// database and respond to the end-user with availability information for +// Friday. +// +// For more information, see the [fulfillment +// guide](https://cloud.google.com/dialogflow/docs/fulfillment-overview). +message Fulfillment { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Fulfillment" + pattern: "projects/{project}/agent/fulfillment" + pattern: "projects/{project}/locations/{location}/agent/fulfillment" + }; + + // Represents configuration for a generic web service. + // Dialogflow supports two mechanisms for authentications: + // + // - Basic authentication with username and password. + // - Authentication with additional authentication headers. + // + // More information could be found at: + // https://cloud.google.com/dialogflow/docs/fulfillment-configure. + message GenericWebService { + // Required. The fulfillment URI for receiving POST requests. + // It must use https protocol. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The user name for HTTP Basic authentication. + string username = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The password for HTTP Basic authentication. + string password = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The HTTP request headers to send together with fulfillment requests. + map request_headers = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates if generic web service is created through Cloud Functions + // integration. Defaults to false. + // + // is_cloud_function is deprecated. Cloud functions can be configured by + // its uri as a regular web service now. + bool is_cloud_function = 5 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + } + + // Whether fulfillment is enabled for the specific feature. + message Feature { + // The type of the feature. + enum Type { + // Feature type not specified. + TYPE_UNSPECIFIED = 0; + + // Fulfillment is enabled for SmallTalk. + SMALLTALK = 1; + } + + // The type of the feature that enabled for fulfillment. + Type type = 1; + } + + // Required. The unique identifier of the fulfillment. + // Supported formats: + // + // - `projects//agent/fulfillment` + // - `projects//locations//agent/fulfillment` + // + // This field is not used for Fulfillment in an Environment. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The human-readable name of the fulfillment, unique within the agent. + // + // This field is not used for Fulfillment in an Environment. + string display_name = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The fulfillment configuration. + oneof fulfillment { + // Configuration for a generic web service. + GenericWebService generic_web_service = 3; + } + + // Optional. Whether fulfillment is enabled. + bool enabled = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The field defines whether the fulfillment is enabled for certain features. + repeated Feature features = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Fulfillments.GetFulfillment][google.cloud.dialogflow.v2.Fulfillments.GetFulfillment]. +message GetFulfillmentRequest { + // Required. The name of the fulfillment. + // Format: `projects//agent/fulfillment`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Fulfillment" + } + ]; +} + +// The request message for [Fulfillments.UpdateFulfillment][google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment]. +message UpdateFulfillmentRequest { + // Required. The fulfillment to update. + Fulfillment fulfillment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. If the mask is not + // present, all fields will be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/gcs.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/gcs.proto new file mode 100644 index 00000000000..6ac9886df90 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/gcs.proto @@ -0,0 +1,45 @@ +// 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.dialogflow.v2; + +import "google/api/field_behavior.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "GcsProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Google Cloud Storage location for the inputs. +message GcsSources { + // Required. Google Cloud Storage URIs for the inputs. A URI is of the form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. + repeated string uris = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Google Cloud Storage location for the output. +message GcsDestination { + // The Google Cloud Storage URIs for the output. A URI is of the + // form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. The requesting + // user must have "write-permission" to the bucket. + string uri = 1; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto new file mode 100644 index 00000000000..0bae8f6834e --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto @@ -0,0 +1,43 @@ +// 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.dialogflow.v2; + +import "google/cloud/dialogflow/v2/participant.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "HumanAgentAssistantEventProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Represents a notification sent to Cloud Pub/Sub subscribers for +// human agent assistant events in a specific conversation. +message HumanAgentAssistantEvent { + // The conversation this notification refers to. + // Format: `projects//conversations/`. + string conversation = 1; + + // The participant that the suggestion is compiled for. + // Format: `projects//conversations//participants/`. It will not be set in legacy workflow. + string participant = 3; + + // The suggestion results payload that this notification refers to. + repeated SuggestionResult suggestion_results = 5; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/intent.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/intent.proto new file mode 100644 index 00000000000..e28e0d312a3 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/intent.proto @@ -0,0 +1,1111 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/context.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "IntentProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Intents][google.cloud.dialogflow.v2.Intent]. +service Intents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all intents in the specified agent. + rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent}/intents" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent}/intents" + } + additional_bindings { + get: "/v2/{parent=projects/*/agent/environments/*}/intents" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/environments/*}/intents" + } + }; + option (google.api.method_signature) = "parent"; + option (google.api.method_signature) = "parent,language_code"; + } + + // Retrieves the specified intent. + rpc GetIntent(GetIntentRequest) returns (Intent) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/intents/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/intents/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,language_code"; + } + + // Creates an intent in the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc CreateIntent(CreateIntentRequest) returns (Intent) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/intents" + body: "intent" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/intents" + body: "intent" + } + }; + option (google.api.method_signature) = "parent,intent"; + option (google.api.method_signature) = "parent,intent,language_code"; + } + + // Updates the specified intent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc UpdateIntent(UpdateIntentRequest) returns (Intent) { + option (google.api.http) = { + patch: "/v2/{intent.name=projects/*/agent/intents/*}" + body: "intent" + additional_bindings { + patch: "/v2/{intent.name=projects/*/locations/*/agent/intents/*}" + body: "intent" + } + }; + option (google.api.method_signature) = "intent,language_code"; + option (google.api.method_signature) = "intent,language_code,update_mask"; + } + + // Deletes the specified intent and its direct or indirect followup intents. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/intents/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/intents/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates/Creates multiple intents in the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse] + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchUpdateIntents(BatchUpdateIntentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/intents:batchUpdate" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/intents:batchUpdate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,intent_batch_uri"; + option (google.api.method_signature) = "parent,intent_batch_inline"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2.BatchUpdateIntentsResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes intents in the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchDeleteIntents(BatchDeleteIntentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/intents:batchDelete" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/intents:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,intents"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// An intent categorizes an end-user's intention for one conversation turn. For +// each agent, you define many intents, where your combined intents can handle a +// complete conversation. When an end-user writes or says something, referred to +// as an end-user expression or end-user input, Dialogflow matches the end-user +// input to the best intent in your agent. Matching an intent is also known as +// intent classification. +// +// For more information, see the [intent +// guide](https://cloud.google.com/dialogflow/docs/intents-overview). +message Intent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Intent" + pattern: "projects/{project}/agent/intents/{intent}" + pattern: "projects/{project}/locations/{location}/agent/intents/{intent}" + }; + + // Represents the different states that webhooks can be in. + enum WebhookState { + // Webhook is disabled in the agent and in the intent. + WEBHOOK_STATE_UNSPECIFIED = 0; + + // Webhook is enabled in the agent and in the intent. + WEBHOOK_STATE_ENABLED = 1; + + // Webhook is enabled in the agent and in the intent. Also, each slot + // filling prompt is forwarded to the webhook. + WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2; + } + + // Represents an example that the agent is trained on. + message TrainingPhrase { + // Represents different types of training phrases. + enum Type { + // Not specified. This value should never be used. + TYPE_UNSPECIFIED = 0; + + // Examples do not contain @-prefixed entity type names, but example parts + // can be annotated with entity types. + EXAMPLE = 1; + + // Templates are not annotated with entity types, but they can contain + // @-prefixed entity type names as substrings. + // Template mode has been deprecated. Example mode is the only supported + // way to create new training phrases. If you have existing training + // phrases that you've created in template mode, those will continue to + // work. + TEMPLATE = 2 [deprecated = true]; + } + + // Represents a part of a training phrase. + message Part { + // Required. The text for this part. + string text = 1; + + // Optional. The entity type name prefixed with `@`. + // This field is required for annotated parts of the training phrase. + string entity_type = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The parameter name for the value extracted from the + // annotated part of the example. + // This field is required for annotated parts of the training phrase. + string alias = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether the text was manually annotated. + // This field is set to true when the Dialogflow Console is used to + // manually annotate the part. When creating an annotated part with the + // API, you must set this to true. + bool user_defined = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Output only. The unique identifier of this training phrase. + string name = 1; + + // Required. The type of the training phrase. + Type type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ordered list of training phrase parts. + // The parts are concatenated in order to form the training phrase. + // + // Note: The API does not automatically annotate training phrases like the + // Dialogflow Console does. + // + // Note: Do not forget to include whitespace at part boundaries, + // so the training phrase is well formatted when the parts are concatenated. + // + // If the training phrase does not need to be annotated with parameters, + // you just need a single part with only the [Part.text][google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.text] field set. + // + // If you want to annotate the training phrase, you must create multiple + // parts, where the fields of each part are populated in one of two ways: + // + // - `Part.text` is set to a part of the phrase that has no parameters. + // - `Part.text` is set to a part of the phrase that you want to annotate, + // and the `entity_type`, `alias`, and `user_defined` fields are all + // set. + repeated Part parts = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates how many times this example was added to + // the intent. Each time a developer adds an existing sample by editing an + // intent or training, this counter is increased. + int32 times_added_count = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents intent parameters. + message Parameter { + // The unique identifier of this parameter. + string name = 1; + + // Required. The name of the parameter. + string display_name = 2; + + // Optional. The definition of the parameter value. It can be: + // + // - a constant string, + // - a parameter value defined as `$parameter_name`, + // - an original parameter value defined as `$parameter_name.original`, + // - a parameter value from some context defined as + // `#context_name.parameter_name`. + string value = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The default value to use when the `value` yields an empty + // result. + // Default values can be extracted from contexts by using the following + // syntax: `#context_name.parameter_name`. + string default_value = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the entity type, prefixed with `@`, that + // describes values of the parameter. If the parameter is + // required, this must be provided. + string entity_type_display_name = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether the parameter is required. That is, + // whether the intent cannot be completed without collecting the parameter + // value. + bool mandatory = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of prompts that the agent can present to the + // user in order to collect a value for the parameter. + repeated string prompts = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether the parameter represents a list of values. + bool is_list = 8 [(google.api.field_behavior) = OPTIONAL]; + } + + // A rich response message. + // Corresponds to the intent `Response` field in the Dialogflow console. + // For more information, see + // [Rich response + // messages](https://cloud.google.com/dialogflow/docs/intents-rich-messages). + message Message { + // The rich response message integration platform. See + // [Integrations](https://cloud.google.com/dialogflow/docs/integrations). + enum Platform { + // Default platform. + PLATFORM_UNSPECIFIED = 0; + + // Facebook. + FACEBOOK = 1; + + // Slack. + SLACK = 2; + + // Telegram. + TELEGRAM = 3; + + // Kik. + KIK = 4; + + // Skype. + SKYPE = 5; + + // Line. + LINE = 6; + + // Viber. + VIBER = 7; + + // Google Assistant + // See [Dialogflow webhook + // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) + ACTIONS_ON_GOOGLE = 8; + + // Google Hangouts. + GOOGLE_HANGOUTS = 11; + } + + // The text response message. + message Text { + // Optional. The collection of the agent's responses. + repeated string text = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // The image response message. + message Image { + // Optional. The public URI to an image file. + string image_uri = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A text description of the image to be used for accessibility, + // e.g., screen readers. + string accessibility_text = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // The quick replies response message. + message QuickReplies { + // Optional. The title of the collection of quick replies. + string title = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of quick replies. + repeated string quick_replies = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // The card response message. + message Card { + // Contains information about a button. + message Button { + // Optional. The text to show on the button. + string text = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The text to send back to the Dialogflow API or a URI to + // open. + string postback = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The title of the card. + string title = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The subtitle of the card. + string subtitle = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The public URI to an image file for the card. + string image_uri = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of card buttons. + repeated Button buttons = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // The simple response message containing speech or text. + message SimpleResponse { + // One of text_to_speech or ssml must be provided. The plain text of the + // speech output. Mutually exclusive with ssml. + string text_to_speech = 1; + + // One of text_to_speech or ssml must be provided. Structured spoken + // response to the user in the SSML format. Mutually exclusive with + // text_to_speech. + string ssml = 2; + + // Optional. The text to display. + string display_text = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // The collection of simple response candidates. + // This message in `QueryResult.fulfillment_messages` and + // `WebhookResponse.fulfillment_messages` should contain only one + // `SimpleResponse`. + message SimpleResponses { + // Required. The list of simple responses. + repeated SimpleResponse simple_responses = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // The basic card message. Useful for displaying information. + message BasicCard { + // The button object that appears at the bottom of a card. + message Button { + // Opens the given URI. + message OpenUriAction { + // Required. The HTTP or HTTPS scheme URI. + string uri = 1; + } + + // Required. The title of the button. + string title = 1; + + // Required. Action to take when a user taps on the button. + OpenUriAction open_uri_action = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Optional. The title of the card. + string title = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The subtitle of the card. + string subtitle = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required, unless image is present. The body text of the card. + string formatted_text = 3; + + // Optional. The image for the card. + Image image = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of card buttons. + repeated Button buttons = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // The suggestion chip message that the user can tap to quickly post a reply + // to the conversation. + message Suggestion { + // Required. The text shown the in the suggestion chip. + string title = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // The collection of suggestions. + message Suggestions { + // Required. The list of suggested replies. + repeated Suggestion suggestions = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // The suggestion chip message that allows the user to jump out to the app + // or website associated with this agent. + message LinkOutSuggestion { + // Required. The name of the app or site this chip is linking to. + string destination_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The URI of the app or site to open when the user taps the + // suggestion chip. + string uri = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // The card for presenting a list of options to select from. + message ListSelect { + // An item in the list. + message Item { + // Required. Additional information about this option. + SelectItemInfo info = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The title of the list item. + string title = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The main text describing the item. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The image to display. + Image image = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The overall title of the list. + string title = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. List items. + repeated Item items = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Subtitle of the list. + string subtitle = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // The card for presenting a carousel of options to select from. + message CarouselSelect { + // An item in the carousel. + message Item { + // Required. Additional info about the option item. + SelectItemInfo info = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Title of the carousel item. + string title = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The body text of the card. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The image to display. + Image image = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Carousel items. + repeated Item items = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Additional info about the select item for when it is triggered in a + // dialog. + message SelectItemInfo { + // Required. A unique key that will be sent back to the agent if this + // response is given. + string key = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A list of synonyms that can also be used to trigger this + // item in dialog. + repeated string synonyms = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // The media content card for Actions on Google. + message MediaContent { + // Format of response media type. + enum ResponseMediaType { + // Unspecified. + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; + + // Response media type is audio. + AUDIO = 1; + } + + // Response media object for media content card. + message ResponseMediaObject { + // Required. Name of media card. + string name = 1; + + // Optional. Description of media card. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Image to show with the media card. + oneof image { + // Optional. Image to display above media content. + Image large_image = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Icon to display above media content. + Image icon = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Url where the media is stored. + string content_url = 5; + } + + // Optional. What type of media is the content (ie "audio"). + ResponseMediaType media_type = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. List of media objects. + repeated ResponseMediaObject media_objects = 2; + } + + // Browse Carousel Card for Actions on Google. + // https://developers.google.com/actions/assistant/responses#browsing_carousel + message BrowseCarouselCard { + // Browsing carousel tile + message BrowseCarouselCardItem { + // Actions on Google action to open a given url. + message OpenUrlAction { + // Type of the URI. + enum UrlTypeHint { + // Unspecified + URL_TYPE_HINT_UNSPECIFIED = 0; + + // Url would be an amp action + AMP_ACTION = 1; + + // URL that points directly to AMP content, or to a canonical URL + // which refers to AMP content via . + AMP_CONTENT = 2; + } + + // Required. URL + string url = 1; + + // Optional. Specifies the type of viewer that is used when opening + // the URL. Defaults to opening via web browser. + UrlTypeHint url_type_hint = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Action to present to the user. + OpenUrlAction open_uri_action = 1; + + // Required. Title of the carousel item. Maximum of two lines of text. + string title = 2; + + // Optional. Description of the carousel item. Maximum of four lines of + // text. + string description = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Hero image for the carousel item. + Image image = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Text that appears at the bottom of the Browse Carousel + // Card. Maximum of one line of text. + string footer = 5 [(google.api.field_behavior) = OPTIONAL]; + } + + // Image display options for Actions on Google. This should be used for + // when the image's aspect ratio does not match the image container's + // aspect ratio. + enum ImageDisplayOptions { + // Fill the gaps between the image and the image container with gray + // bars. + IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0; + + // Fill the gaps between the image and the image container with gray + // bars. + GRAY = 1; + + // Fill the gaps between the image and the image container with white + // bars. + WHITE = 2; + + // Image is scaled such that the image width and height match or exceed + // the container dimensions. This may crop the top and bottom of the + // image if the scaled image height is greater than the container + // height, or crop the left and right of the image if the scaled image + // width is greater than the container width. This is similar to "Zoom + // Mode" on a widescreen TV when playing a 4:3 video. + CROPPED = 3; + + // Pad the gaps between image and image frame with a blurred copy of the + // same image. + BLURRED_BACKGROUND = 4; + } + + // Required. List of items in the Browse Carousel Card. Minimum of two + // items, maximum of ten. + repeated BrowseCarouselCardItem items = 1; + + // Optional. Settings for displaying the image. Applies to every image in + // [items][google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.items]. + ImageDisplayOptions image_display_options = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Table card for Actions on Google. + message TableCard { + // Required. Title of the card. + string title = 1; + + // Optional. Subtitle to the title. + string subtitle = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Image which should be displayed on the card. + Image image = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Display properties for the columns in this table. + repeated ColumnProperties column_properties = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Rows in this table of data. + repeated TableCardRow rows = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. List of buttons for the card. + repeated BasicCard.Button buttons = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // Column properties for [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. + message ColumnProperties { + // Text alignments within a cell. + enum HorizontalAlignment { + // Text is aligned to the leading edge of the column. + HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0; + + // Text is aligned to the leading edge of the column. + LEADING = 1; + + // Text is centered in the column. + CENTER = 2; + + // Text is aligned to the trailing edge of the column. + TRAILING = 3; + } + + // Required. Column heading. + string header = 1; + + // Optional. Defines text alignment for all cells in this column. + HorizontalAlignment horizontal_alignment = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Row of [TableCard][google.cloud.dialogflow.v2.Intent.Message.TableCard]. + message TableCardRow { + // Optional. List of cells that make up this row. + repeated TableCardCell cells = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether to add a visual divider after this row. + bool divider_after = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Cell of [TableCardRow][google.cloud.dialogflow.v2.Intent.Message.TableCardRow]. + message TableCardCell { + // Required. Text in this cell. + string text = 1; + } + + // Required. The rich response message. + oneof message { + // The text response. + Text text = 1; + + // The image response. + Image image = 2; + + // The quick replies response. + QuickReplies quick_replies = 3; + + // The card response. + Card card = 4; + + // A custom platform-specific response. + google.protobuf.Struct payload = 5; + + // The voice and text-only responses for Actions on Google. + SimpleResponses simple_responses = 7; + + // The basic card response for Actions on Google. + BasicCard basic_card = 8; + + // The suggestion chips for Actions on Google. + Suggestions suggestions = 9; + + // The link out suggestion chip for Actions on Google. + LinkOutSuggestion link_out_suggestion = 10; + + // The list card response for Actions on Google. + ListSelect list_select = 11; + + // The carousel card response for Actions on Google. + CarouselSelect carousel_select = 12; + + // Browse carousel card for Actions on Google. + BrowseCarouselCard browse_carousel_card = 22; + + // Table card for Actions on Google. + TableCard table_card = 23; + + // The media content card for Actions on Google. + MediaContent media_content = 24; + } + + // Optional. The platform that this message is intended for. + Platform platform = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents a single followup intent in the chain. + message FollowupIntentInfo { + // The unique identifier of the followup intent. + // Format: `projects//agent/intents/`. + string followup_intent_name = 1; + + // The unique identifier of the followup intent's parent. + // Format: `projects//agent/intents/`. + string parent_followup_intent_name = 2; + } + + // Optional. The unique identifier of this intent. + // Required for [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent] and [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents] + // methods. + // Format: `projects//agent/intents/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The name of this intent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates whether webhooks are enabled for the intent. + WebhookState webhook_state = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The priority of this intent. Higher numbers represent higher + // priorities. + // + // - If the supplied value is unspecified or 0, the service + // translates the value to 500,000, which corresponds to the + // `Normal` priority in the console. + // - If the supplied value is negative, the intent is ignored + // in runtime detect intent requests. + int32 priority = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether this is a fallback intent. + bool is_fallback = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether Machine Learning is disabled for the intent. + // Note: If `ml_disabled` setting is set to true, then this intent is not + // taken into account during inference in `ML ONLY` match mode. Also, + // auto-markup in the UI is turned off. + bool ml_disabled = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates that a live agent should be brought in to handle the + // interaction with the user. In most cases, when you set this flag to true, + // you would also want to set end_interaction to true as well. Default is + // false. + bool live_agent_handoff = 20 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates that this intent ends an interaction. Some integrations + // (e.g., Actions on Google or Dialogflow phone gateway) use this information + // to close interaction with an end user. Default is false. + bool end_interaction = 21 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of context names required for this intent to be + // triggered. + // Format: `projects//agent/sessions/-/contexts/`. + repeated string input_context_names = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of event names that trigger the intent. + // If the collection of input contexts is not empty, all of the contexts must + // be present in the active user session for an event to trigger this intent. + // Event names are limited to 150 characters. + repeated string events = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of examples that the agent is + // trained on. + repeated TrainingPhrase training_phrases = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the action associated with the intent. + // Note: The action name must not contain whitespaces. + string action = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of contexts that are activated when the intent + // is matched. Context messages in this collection should not set the + // parameters field. Setting the `lifespan_count` to 0 will reset the context + // when the intent is matched. + // Format: `projects//agent/sessions/-/contexts/`. + repeated Context output_contexts = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether to delete all contexts in the current + // session when this intent is matched. + bool reset_contexts = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of parameters associated with the intent. + repeated Parameter parameters = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of rich messages corresponding to the + // `Response` field in the Dialogflow console. + repeated Message messages = 14 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of platforms for which the first responses will be + // copied from the messages in PLATFORM_UNSPECIFIED (i.e. default platform). + repeated Message.Platform default_response_platforms = 15 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. + // Read-only. The unique identifier of the root intent in the chain of + // followup intents. It identifies the correct followup intents chain for + // this intent. We populate this field only in the output. + // + // Format: `projects//agent/intents/`. + string root_followup_intent_name = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Read-only after creation. The unique identifier of the parent intent in the + // chain of followup intents. You can set this field when creating an intent, + // for example with [CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent] or + // [BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents], in order to make this + // intent a followup intent. + // + // It identifies the parent followup intent. + // Format: `projects//agent/intents/`. + string parent_followup_intent_name = 17; + + // Output only. Read-only. Information about all followup intents that have this intent as + // a direct or indirect parent. We populate this field only in the output. + repeated FollowupIntentInfo followup_intent_info = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. +message ListIntentsRequest { + // Required. The agent to list all intents from. + // Format: `projects//agent` or `projects//locations//agent`. + // + // Alternatively, you can specify the environment to list intents for. + // Format: `projects//agent/environments/` + // or `projects//locations//agent/environments/`. + // Note: training phrases of the intents will not be returned for non-draft + // environment. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Intents.ListIntents][google.cloud.dialogflow.v2.Intents.ListIntents]. +message ListIntentsResponse { + // The list of agent intents. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Intent intents = 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 request message for [Intents.GetIntent][google.cloud.dialogflow.v2.Intents.GetIntent]. +message GetIntentRequest { + // Required. The name of the intent. + // Format: `projects//agent/intents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2.Intents.CreateIntent]. +message CreateIntentRequest { + // Required. The agent to create a intent for. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The intent to create. + Intent intent = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.v2.Intents.UpdateIntent]. +message UpdateIntentRequest { + // Required. The intent to update. + Intent intent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.v2.Intents.DeleteIntent]. +message DeleteIntentRequest { + // Required. The name of the intent to delete. If this intent has direct or + // indirect followup intents, we also delete them. + // Format: `projects//agent/intents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; +} + +message BatchUpdateIntentsRequest { + // Required. The name of the agent to update or create intents in. + // Format: `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // The source of the intent batch. + oneof intent_batch { + // The URI to a Google Cloud Storage file containing intents to update or + // create. The file format can either be a serialized proto (of IntentBatch + // type) or JSON object. Note: The URI must start with "gs://". + string intent_batch_uri = 2; + + // The collection of intents to update or create. + IntentBatch intent_batch_inline = 3; + } + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2.Intents.BatchUpdateIntents]. +message BatchUpdateIntentsResponse { + // The collection of updated or created intents. + repeated Intent intents = 1; +} + +// The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2.Intents.BatchDeleteIntents]. +message BatchDeleteIntentsRequest { + // Required. The name of the agent to delete all entities types for. Format: + // `projects//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The collection of intents to delete. Only intent `name` must be + // filled in. + repeated Intent intents = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents the options for views of an intent. +// An intent can be a sizable object. Therefore, we provide a resource view that +// does not return training phrases in the response by default. +enum IntentView { + // Training phrases field is not populated in the response. + INTENT_VIEW_UNSPECIFIED = 0; + + // All fields are populated. + INTENT_VIEW_FULL = 1; +} + +// This message is a wrapper around a collection of intents. +message IntentBatch { + // A collection of intents. + repeated Intent intents = 1; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/knowledge_base.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/knowledge_base.proto new file mode 100644 index 00000000000..4f047e2ecde --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/knowledge_base.proto @@ -0,0 +1,262 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "KnowledgeBaseProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [KnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBase]. +service KnowledgeBases { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all knowledge bases of the specified agent. + rpc ListKnowledgeBases(ListKnowledgeBasesRequest) returns (ListKnowledgeBasesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/knowledgeBases" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*}/knowledgeBases" + } + additional_bindings { + get: "/v2/{parent=projects/*/agent}/knowledgeBases" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified knowledge base. + rpc GetKnowledgeBase(GetKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + get: "/v2/{name=projects/*/knowledgeBases/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/knowledgeBases/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/agent/knowledgeBases/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a knowledge base. + rpc CreateKnowledgeBase(CreateKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/knowledgeBases" + body: "knowledge_base" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*}/knowledgeBases" + body: "knowledge_base" + } + additional_bindings { + post: "/v2/{parent=projects/*/agent}/knowledgeBases" + body: "knowledge_base" + } + }; + option (google.api.method_signature) = "parent,knowledge_base"; + } + + // Deletes the specified knowledge base. + rpc DeleteKnowledgeBase(DeleteKnowledgeBaseRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/knowledgeBases/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/knowledgeBases/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/agent/knowledgeBases/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the specified knowledge base. + rpc UpdateKnowledgeBase(UpdateKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + patch: "/v2/{knowledge_base.name=projects/*/knowledgeBases/*}" + body: "knowledge_base" + additional_bindings { + patch: "/v2/{knowledge_base.name=projects/*/locations/*/knowledgeBases/*}" + body: "knowledge_base" + } + additional_bindings { + patch: "/v2/{knowledge_base.name=projects/*/agent/knowledgeBases/*}" + body: "knowledge_base" + } + }; + option (google.api.method_signature) = "knowledge_base,update_mask"; + } +} + +// A knowledge base represents a collection of knowledge documents that you +// provide to Dialogflow. Your knowledge documents contain information that may +// be useful during conversations with end-users. Some Dialogflow features use +// knowledge bases when looking for a response to an end-user input. +// +// For more information, see the [knowledge base +// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). +// +// Note: The `projects.agent.knowledgeBases` resource is deprecated; +// only use `projects.knowledgeBases`. +message KnowledgeBase { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + pattern: "projects/{project}/knowledgeBases/{knowledge_base}" + pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}" + }; + + // The knowledge base resource name. + // The name must be empty when creating a knowledge base. + // Format: `projects//locations//knowledgeBases/`. + string name = 1; + + // Required. The display name of the knowledge base. The name must be 1024 + // bytes or less; otherwise, the creation request fails. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Language which represents the KnowledgeBase. When the KnowledgeBase is + // created/updated, expect this to be present for non en-us languages. When + // unspecified, the default language code en-us applies. + string language_code = 4; +} + +// Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesRequest { + // Required. The project to list of knowledge bases for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; + + // The filter expression used to filter knowledge bases returned by the list + // method. The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * display_name with has(:) operator + // * language_code with equals(=) operator + // + // Examples: + // + // * 'language_code=en-us' matches knowledge bases with en-us language code. + // * 'display_name:articles' matches knowledge bases whose display name + // contains "articles". + // * 'display_name:"Best Articles"' matches knowledge bases whose display + // name contains "Best Articles". + // * 'language_code=en-gb AND display_name=articles' matches all knowledge + // bases whose display name contains "articles" and whose language code is + // "en-gb". + // + // Note: An empty filter string (i.e. "") is a no-op and will result in no + // filtering. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesResponse { + // The list of knowledge bases. + repeated KnowledgeBase knowledge_bases = 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 [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase]. +message GetKnowledgeBaseRequest { + // Required. The name of the knowledge base to retrieve. + // Format `projects//locations//knowledgeBases/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; +} + +// Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase]. +message CreateKnowledgeBaseRequest { + // Required. The project to create a knowledge base for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // Required. The knowledge base to create. + KnowledgeBase knowledge_base = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase]. +message DeleteKnowledgeBaseRequest { + // Required. The name of the knowledge base to delete. + // Format: `projects//locations//knowledgeBases/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // Optional. Force deletes the knowledge base. When set to true, any documents + // in the knowledge base are also deleted. + bool force = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase]. +message UpdateKnowledgeBaseRequest { + // Required. The knowledge base to update. + KnowledgeBase knowledge_base = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Not specified means `update all`. + // Currently, only `display_name` can be updated, an InvalidArgument will be + // returned for attempting to update other fields. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/participant.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/participant.proto new file mode 100644 index 00000000000..a39d49fb527 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/participant.proto @@ -0,0 +1,1000 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/session.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ParticipantProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Participants][google.cloud.dialogflow.v2.Participant]. +service Participants { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a new participant in a conversation. + rpc CreateParticipant(CreateParticipantRequest) returns (Participant) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/conversations/*}/participants" + body: "participant" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/conversations/*}/participants" + body: "participant" + } + }; + option (google.api.method_signature) = "parent,participant"; + } + + // Retrieves a conversation participant. + rpc GetParticipant(GetParticipantRequest) returns (Participant) { + option (google.api.http) = { + get: "/v2/{name=projects/*/conversations/*/participants/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/conversations/*/participants/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Returns the list of all participants in the specified conversation. + rpc ListParticipants(ListParticipantsRequest) returns (ListParticipantsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/conversations/*}/participants" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/conversations/*}/participants" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the specified participant. + rpc UpdateParticipant(UpdateParticipantRequest) returns (Participant) { + option (google.api.http) = { + patch: "/v2/{participant.name=projects/*/conversations/*/participants/*}" + body: "participant" + additional_bindings { + patch: "/v2/{participant.name=projects/*/locations/*/conversations/*/participants/*}" + body: "participant" + } + }; + option (google.api.method_signature) = "participant,update_mask"; + } + + // Adds a text (chat, for example), or audio (phone recording, for example) + // message from a participant into the conversation. + // + // Note: Always use agent versions for production traffic + // sent to virtual agents. See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc AnalyzeContent(AnalyzeContentRequest) returns (AnalyzeContentResponse) { + option (google.api.http) = { + post: "/v2/{participant=projects/*/conversations/*/participants/*}:analyzeContent" + body: "*" + additional_bindings { + post: "/v2/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent" + body: "*" + } + }; + option (google.api.method_signature) = "participant,text_input"; + option (google.api.method_signature) = "participant,event_input"; + } + + // Adds a text (chat, for example), or audio (phone recording, for example) + // message from a participant into the conversation. + // Note: This method is only available through the gRPC API (not REST). + // + // The top-level message sent to the client by the server is + // `StreamingAnalyzeContentResponse`. Multiple response messages can be + // returned in order. The first one or more messages contain the + // `recognition_result` field. Each result represents a more complete + // transcript of what the user said. The next message contains the + // `reply_text` field and potentially the `reply_audio` field. The message can + // also contain the `automated_agent_reply` field. + // + // Note: Always use agent versions for production traffic + // sent to virtual agents. See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc StreamingAnalyzeContent(stream StreamingAnalyzeContentRequest) returns (stream StreamingAnalyzeContentResponse) { + } + + // Gets suggested articles for a participant based on specific historical + // messages. + rpc SuggestArticles(SuggestArticlesRequest) returns (SuggestArticlesResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets suggested faq answers for a participant based on specific historical + // messages. + rpc SuggestFaqAnswers(SuggestFaqAnswersRequest) returns (SuggestFaqAnswersResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets smart replies for a participant based on specific historical + // messages. + rpc SuggestSmartReplies(SuggestSmartRepliesRequest) returns (SuggestSmartRepliesResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Represents a conversation participant (human agent, virtual agent, end-user). +message Participant { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Participant" + pattern: "projects/{project}/conversations/{conversation}/participants/{participant}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" + }; + + // Enumeration of the roles a participant can play in a conversation. + enum Role { + // Participant role not set. + ROLE_UNSPECIFIED = 0; + + // Participant is a human agent. + HUMAN_AGENT = 1; + + // Participant is an automated agent, such as a Dialogflow agent. + AUTOMATED_AGENT = 2; + + // Participant is an end user that has called or chatted with + // Dialogflow services. + END_USER = 3; + } + + // Optional. The unique identifier of this participant. + // Format: `projects//locations//conversations//participants/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Immutable. The role this participant plays in the conversation. This field must be set + // during participant creation and is then immutable. + Role role = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. Label applied to streams representing this participant in SIPREC + // XML metadata and SDP. This is used to assign transcriptions from that + // media stream to this participant. This field can be updated. + string sip_recording_media_label = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Obfuscated user id that should be associated with the created participant. + // + // You can specify a user id as follows: + // + // 1. If you set this field in + // [CreateParticipantRequest][google.cloud.dialogflow.v2.CreateParticipantRequest.participant] or + // [UpdateParticipantRequest][google.cloud.dialogflow.v2.UpdateParticipantRequest.participant], + // Dialogflow adds the obfuscated user id with the participant. + // + // 2. If you set this field in + // [AnalyzeContent][google.cloud.dialogflow.v2.AnalyzeContentRequest.obfuscated_external_user_id] or + // [StreamingAnalyzeContent][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.obfuscated_external_user_id], + // Dialogflow will update [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2.Participant.obfuscated_external_user_id]. + // + // Dialogflow returns an error if you try to add a user id for a + // non-[END_USER][google.cloud.dialogflow.v2.Participant.Role.END_USER] participant. + // + // Dialogflow uses this user id for billing and measurement purposes. For + // example, Dialogflow determines whether a user in one conversation returned + // in a later conversation. + // + // Note: + // + // * Please never pass raw user ids to Dialogflow. Always obfuscate your user + // id first. + // * Dialogflow only accepts a UTF-8 encoded string, e.g., a hex digest of a + // hash function like SHA-512. + // * The length of the user id must be <= 256 characters. + string obfuscated_external_user_id = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Key-value filters on the metadata of documents returned by article + // suggestion. If specified, article suggestion only returns suggested + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` + map documents_metadata_filters = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a message posted into a conversation. +message Message { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Message" + pattern: "projects/{project}/conversations/{conversation}/messages/{message}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}" + }; + + // Optional. The unique identifier of the message. + // Format: `projects//locations//conversations//messages/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The message content. + string content = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The message language. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The participant that sends this message. + string participant = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The role of the participant. + Participant.Role participant_role = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the message was created in Contact Center AI. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The time when the message was sent. + google.protobuf.Timestamp send_time = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The annotation for the message. + MessageAnnotation message_annotation = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The sentiment analysis result for the message. + SentimentAnalysisResult sentiment_analysis = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Participants.CreateParticipant][google.cloud.dialogflow.v2.Participants.CreateParticipant]. +message CreateParticipantRequest { + // Required. Resource identifier of the conversation adding the participant. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Required. The participant to create. + Participant participant = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Participants.GetParticipant][google.cloud.dialogflow.v2.Participants.GetParticipant]. +message GetParticipantRequest { + // Required. The name of the participant. Format: + // `projects//locations//conversations//participants/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; +} + +// The request message for [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants]. +message ListParticipantsRequest { + // Required. The conversation to list all participants from. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Participants.ListParticipants][google.cloud.dialogflow.v2.Participants.ListParticipants]. +message ListParticipantsResponse { + // The list of participants. There is a maximum number of items + // returned based on the page_size field in the request. + repeated Participant participants = 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 request message for [Participants.UpdateParticipant][google.cloud.dialogflow.v2.Participants.UpdateParticipant]. +message UpdateParticipantRequest { + // Required. The participant to update. + Participant participant = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to specify which fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]. +message AnalyzeContentRequest { + // Required. The name of the participant this text comes from. + // Format: `projects//locations//conversations//participants/`. + string participant = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Required. The input content. + oneof input { + // The natural language text to be processed. + TextInput text_input = 6; + + // An input event to send to Dialogflow. + EventInput event_input = 8; + } + + // Speech synthesis configuration. + // The speech synthesis settings for a virtual agent that may be configured + // for the associated conversation profile are not used when calling + // AnalyzeContent. If this configuration is not supplied, speech synthesis + // is disabled. + OutputAudioConfig reply_audio_config = 5; + + // Parameters for a Dialogflow virtual-agent query. + QueryParameters query_params = 9; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 14; + + // Additional parameters to be put into Dialogflow CX session parameters. To + // remove a parameter from the session, clients should explicitly set the + // parameter value to null. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + google.protobuf.Struct cx_parameters = 18; + + // A unique identifier for this request. Restricted to 36 ASCII characters. + // A random UUID is recommended. + // This request is only idempotent if a `request_id` is provided. + string request_id = 11; +} + +// The message in the response that indicates the parameters of DTMF. +message DtmfParameters { + // Indicates whether DTMF input can be handled in the next request. + bool accepts_dtmf_input = 1; +} + +// The response message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent]. +message AnalyzeContentResponse { + // The output text content. + // This field is set if the automated agent responded with text to show to + // the user. + string reply_text = 1; + + // The audio data bytes encoded as specified in the request. + // This field is set if: + // + // - `reply_audio_config` was specified in the request, or + // - The automated agent responded with audio to play to the user. In such + // case, `reply_audio.config` contains settings used to synthesize the + // speech. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + OutputAudio reply_audio = 2; + + // Only set if a Dialogflow automated agent has responded. + // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][] + // and [AutomatedAgentReply.detect_intent_response.output_audio_config][] + // are always empty, use [reply_audio][google.cloud.dialogflow.v2.AnalyzeContentResponse.reply_audio] instead. + AutomatedAgentReply automated_agent_reply = 3; + + // Message analyzed by CCAI. + Message message = 5; + + // The suggestions for most recent human agent. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config]. + // + // Note that any failure of Agent Assist features will not lead to the overall + // failure of an AnalyzeContent API call. Instead, the features will + // fail silently with the error field set in the corresponding + // SuggestionResult. + repeated SuggestionResult human_agent_suggestion_results = 6; + + // The suggestions for end user. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config]. + // + // Same as human_agent_suggestion_results, any failure of Agent Assist + // features will not lead to the overall failure of an AnalyzeContent API + // call. Instead, the features will fail silently with the error field set in + // the corresponding SuggestionResult. + repeated SuggestionResult end_user_suggestion_results = 7; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 9; +} + +// The top-level message sent by the client to the +// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] method. +// +// Multiple request messages should be sent in order: +// +// 1. The first message must contain +// [participant][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.participant], +// [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] and optionally +// [query_params][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.query_params]. If you want +// to receive an audio response, it should also contain +// [reply_audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.reply_audio_config]. +// The message must not contain +// [input][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input]. +// +// 2. If [config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] in the first message +// was set to [audio_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.audio_config], +// all subsequent messages must contain +// [input_audio][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_audio] to continue +// with Speech recognition. +// However, note that: +// +// * Dialogflow will bill you for the audio so far. +// * Dialogflow discards all Speech recognition results in favor of the +// text input. +// +// 3. If [StreamingAnalyzeContentRequest.config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.config] in the first message was set +// to [StreamingAnalyzeContentRequest.text_config][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.text_config], then the second message +// must contain only [input_text][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.input_text]. +// Moreover, you must not send more than two messages. +// +// After you sent all input, you must half-close or abort the request stream. +message StreamingAnalyzeContentRequest { + // Required. The name of the participant this text comes from. + // Format: `projects//locations//conversations//participants/`. + string participant = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // The input config. + oneof config { + // Instructs the speech recognizer how to process the speech audio. + InputAudioConfig audio_config = 2; + + // The natural language text to be processed. + InputTextConfig text_config = 3; + } + + // Speech synthesis configuration. + // The speech synthesis settings for a virtual agent that may be configured + // for the associated conversation profile are not used when calling + // StreamingAnalyzeContent. If this configuration is not supplied, speech + // synthesis is disabled. + OutputAudioConfig reply_audio_config = 4; + + // The input. + oneof input { + // The input audio content to be recognized. Must be sent if `audio_config` + // is set in the first message. The complete audio over all streaming + // messages must not exceed 1 minute. + bytes input_audio = 5; + + // The UTF-8 encoded natural language text to be processed. Must be sent if + // `text_config` is set in the first message. Text length must not exceed + // 256 bytes for virtual agent interactions. The `input_text` field can be + // only sent once. + string input_text = 6; + + // The DTMF digits used to invoke intent and fill in parameter value. + // + // This input is ignored if the previous response indicated that DTMF input + // is not accepted. + TelephonyDtmfEvents input_dtmf = 9; + } + + // Parameters for a Dialogflow virtual-agent query. + QueryParameters query_params = 7; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 8; + + // Additional parameters to be put into Dialogflow CX session parameters. To + // remove a parameter from the session, clients should explicitly set the + // parameter value to null. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + google.protobuf.Struct cx_parameters = 13; + + // Enable partial virtual agent responses. If this flag is not enabled, + // response stream still contains only one final response even if some + // `Fulfillment`s in Dialogflow virtual agent have been configured to return + // partial responses. + bool enable_partial_automated_agent_reply = 12; +} + +// The top-level message returned from the `StreamingAnalyzeContent` method. +// +// Multiple response messages can be returned in order: +// +// 1. If the input was set to streaming audio, the first one or more messages +// contain `recognition_result`. Each `recognition_result` represents a more +// complete transcript of what the user said. The last `recognition_result` +// has `is_final` set to `true`. +// +// 2. In virtual agent stage: if `enable_partial_automated_agent_reply` is +// true, the following N (currently 1 <= N <= 4) messages +// contain `automated_agent_reply` and optionally `reply_audio` +// returned by the virtual agent. The first (N-1) +// `automated_agent_reply`s will have `automated_agent_reply_type` set to +// `PARTIAL`. The last `automated_agent_reply` has +// `automated_agent_reply_type` set to `FINAL`. +// If `enable_partial_automated_agent_reply` is not enabled, response stream +// only contains the final reply. +// +// In human assist stage: the following N (N >= 1) messages contain +// `human_agent_suggestion_results`, `end_user_suggestion_results` or +// `message`. +message StreamingAnalyzeContentResponse { + // The result of speech recognition. + StreamingRecognitionResult recognition_result = 1; + + // The output text content. + // This field is set if an automated agent responded with a text for the user. + string reply_text = 2; + + // The audio data bytes encoded as specified in the request. + // This field is set if: + // + // - The `reply_audio_config` field is specified in the request. + // - The automated agent, which this output comes from, responded with audio. + // In such case, the `reply_audio.config` field contains settings used to + // synthesize the speech. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + OutputAudio reply_audio = 3; + + // Only set if a Dialogflow automated agent has responded. + // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][] + // and [AutomatedAgentReply.detect_intent_response.output_audio_config][] + // are always empty, use [reply_audio][google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.reply_audio] instead. + AutomatedAgentReply automated_agent_reply = 4; + + // Message analyzed by CCAI. + Message message = 6; + + // The suggestions for most recent human agent. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.human_agent_suggestion_config]. + repeated SuggestionResult human_agent_suggestion_results = 7; + + // The suggestions for end user. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2.HumanAgentAssistantConfig.end_user_suggestion_config]. + repeated SuggestionResult end_user_suggestion_results = 8; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 10; +} + +// The request message for [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles]. +message SuggestArticlesRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Max number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message] to use as context + // when compiling the suggestion. By default 20 and at most 50. + int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 4; +} + +// The response message for [Participants.SuggestArticles][google.cloud.dialogflow.v2.Participants.SuggestArticles]. +message SuggestArticlesResponse { + // Articles ordered by score in descending order. + repeated ArticleAnswer article_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2.SuggestArticlesResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestArticlesRequest.context_size][google.cloud.dialogflow.v2.SuggestArticlesRequest.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers]. +message SuggestFaqAnswersRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. By default 20 and at most 50. + int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 4; +} + +// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers]. +message SuggestFaqAnswersResponse { + // Answers extracted from FAQ documents. + repeated FaqAnswer faq_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestFaqAnswersRequest.context_size][google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// The request message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2.Participants.SuggestSmartReplies]. +message SuggestSmartRepliesRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // The current natural language text segment to compile suggestion + // for. This provides a way for user to get follow up smart reply suggestion + // after a smart reply selection, without sending a text message. + TextInput current_text_input = 4; + + // The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. By default 20 and at most 50. + int32 context_size = 3; +} + +// The response message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2.Participants.SuggestSmartReplies]. +message SuggestSmartRepliesResponse { + // Output only. Multiple reply options provided by smart reply service. The + // order is based on the rank of the model prediction. + // The maximum number of the returned replies is set in SmartReplyConfig. + repeated SmartReplyAnswer smart_reply_answers = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// Represents the natural language speech audio to be played to the end user. +message OutputAudio { + // Instructs the speech synthesizer how to generate the speech + // audio. + OutputAudioConfig config = 1; + + // The natural language speech audio. + bytes audio = 2; +} + +// Represents a response from an automated agent. +message AutomatedAgentReply { + // Represents different automated agent reply types. + enum AutomatedAgentReplyType { + // Not specified. This should never happen. + AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED = 0; + + // Partial reply. e.g. Aggregated responses in a `Fulfillment` that enables + // `return_partial_response` can be returned as partial reply. + // WARNING: partial reply is not eligible for barge-in. + PARTIAL = 1; + + // Final reply. + FINAL = 2; + } + + // Response of the Dialogflow [Sessions.DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] call. + DetectIntentResponse detect_intent_response = 1; + + // AutomatedAgentReply type. + AutomatedAgentReplyType automated_agent_reply_type = 7; + + // Indicates whether the partial automated agent reply is interruptible when a + // later reply message arrives. e.g. if the agent specified some music as + // partial response, it can be cancelled. + bool allow_cancellation = 8; +} + +// Represents article answer. +message ArticleAnswer { + // The article title. + string title = 1; + + // The article URI. + string uri = 2; + + // Article snippets. + repeated string snippets = 3; + + // Article match confidence. + // The system's confidence score that this article is a good match for this + // conversation, as a value from 0.0 (completely uncertain) to 1.0 + // (completely certain). + float confidence = 4; + + // A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; +} + +// Represents answer from "frequently asked questions". +message FaqAnswer { + // The piece of text from the `source` knowledge base document. + string answer = 1; + + // The system's confidence score that this Knowledge answer is a good match + // for this conversational query, range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + float confidence = 2; + + // The corresponding FAQ question. + string question = 3; + + // Indicates which Knowledge Document this answer was extracted + // from. + // Format: `projects//locations//agent/knowledgeBases//documents/`. + string source = 4; + + // A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; +} + +// Represents a smart reply answer. +message SmartReplyAnswer { + // The content of the reply. + string reply = 1; + + // Smart reply confidence. + // The system's confidence score that this reply is a good match for + // this conversation, as a value from 0.0 (completely uncertain) to 1.0 + // (completely certain). + float confidence = 2; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 3 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/AnswerRecord" + }]; +} + +// One response of different type of suggestion response which is used in +// the response of [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and +// [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent], as well as [HumanAgentAssistantEvent][google.cloud.dialogflow.v2.HumanAgentAssistantEvent]. +message SuggestionResult { + // Different type of suggestion response. + oneof suggestion_response { + // Error status if the request failed. + google.rpc.Status error = 1; + + // SuggestArticlesResponse if request is for ARTICLE_SUGGESTION. + SuggestArticlesResponse suggest_articles_response = 2; + + // SuggestFaqAnswersResponse if request is for FAQ_ANSWER. + SuggestFaqAnswersResponse suggest_faq_answers_response = 3; + + // SuggestSmartRepliesResponse if request is for SMART_REPLY. + SuggestSmartRepliesResponse suggest_smart_replies_response = 4; + } +} + +// Defines the language used in the input text. +message InputTextConfig { + // Required. The language of this conversational query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. + string language_code = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents a part of a message possibly annotated with an entity. The part +// can be an entity or purely a part of the message between two entities or +// message start/end. +message AnnotatedMessagePart { + // A part of a message possibly annotated with an entity. + string text = 1; + + // The [Dialogflow system entity + // type](https://cloud.google.com/dialogflow/docs/reference/system-entities) + // of this message part. If this is empty, Dialogflow could not annotate the + // phrase part with a system entity. + string entity_type = 2; + + // The [Dialogflow system entity formatted value + // ](https://cloud.google.com/dialogflow/docs/reference/system-entities) of + // this message part. For example for a system entity of type + // `@sys.unit-currency`, this may contain: + //
+  // {
+  //   "amount": 5,
+  //   "currency": "USD"
+  // }
+  // 
+ google.protobuf.Value formatted_value = 3; +} + +// Represents the result of annotation for the message. +message MessageAnnotation { + // The collection of annotated message parts ordered by their + // position in the message. You can recover the annotated message by + // concatenating [AnnotatedMessagePart.text]. + repeated AnnotatedMessagePart parts = 1; + + // Indicates whether the text message contains entities. + bool contain_entities = 2; +} + +// Represents the parameters of human assist query. +message AssistQueryParameters { + // Key-value filters on the metadata of documents returned by article + // suggestion. If specified, article suggestion only returns suggested + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` + map documents_metadata_filters = 1; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session.proto new file mode 100644 index 00000000000..107e02060a3 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session.proto @@ -0,0 +1,701 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/audio_config.proto"; +import "google/cloud/dialogflow/v2/context.proto"; +import "google/cloud/dialogflow/v2/intent.proto"; +import "google/cloud/dialogflow/v2/session_entity_type.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/rpc/status.proto"; +import "google/type/latlng.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "SessionProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/Session" + pattern: "projects/{project}/agent/sessions/{session}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}" +}; + +// A service used for session interactions. +// +// For more information, see the [API interactions +// guide](https://cloud.google.com/dialogflow/docs/api-overview). +service Sessions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Processes a natural language query and returns structured, actionable data + // as a result. This method is not idempotent, because it may cause contexts + // and session entity types to be updated, which in turn might affect + // results of future queries. + // + // If you might use + // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + // or other CCAI products now or in the future, consider using + // [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] + // instead of `DetectIntent`. `AnalyzeContent` has additional + // functionality for Agent Assist and other CCAI products. + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) { + option (google.api.http) = { + post: "/v2/{session=projects/*/agent/sessions/*}:detectIntent" + body: "*" + additional_bindings { + post: "/v2/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent" + body: "*" + } + additional_bindings { + post: "/v2/{session=projects/*/locations/*/agent/sessions/*}:detectIntent" + body: "*" + } + additional_bindings { + post: "/v2/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent" + body: "*" + } + }; + option (google.api.method_signature) = "session,query_input"; + } + + // Processes a natural language query in audio format in a streaming fashion + // and returns structured, actionable data as a result. This method is only + // available via the gRPC API (not REST). + // + // If you might use + // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + // or other CCAI products now or in the future, consider using + // [StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] + // instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has + // additional functionality for Agent Assist and other CCAI products. + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) { + } +} + +// The request to detect user's intent. +message DetectIntentRequest { + // Required. The name of the session this query is sent to. Format: + // `projects//agent/sessions/`, or + // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + // default 'draft' environment (`Environment ID` might be referred to as + // environment name at some places). If `User ID` is not specified, we are + // using "-". It's up to the API caller to choose an appropriate `Session ID` + // and `User Id`. They can be a random number or some type of user and session + // identifiers (preferably hashed). The length of the `Session ID` and + // `User ID` must not exceed 36 characters. + // + // For more information, see the [API interactions + // guide](https://cloud.google.com/dialogflow/docs/api-overview). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + string session = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. It can be set to: + // + // 1. an audio config + // which instructs the speech recognizer how to process the speech audio, + // + // 2. a conversational query in the form of text, or + // + // 3. an event that specifies which intent to trigger. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 4; + + // Mask for [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] indicating which settings in this + // request-level config should override speech synthesizer settings defined at + // agent-level. + // + // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config] replaces the agent-level + // config in its entirety. + google.protobuf.FieldMask output_audio_config_mask = 7; + + // The natural language speech audio to be processed. This field + // should be populated iff `query_input` is set to an input audio config. + // A single request can contain up to 1 minute of speech audio data. + bytes input_audio = 5; +} + +// The message returned from the DetectIntent method. +message DetectIntentResponse { + // The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The selected results of the conversational query or event processing. + // See `alternative_query_results` for additional potential results. + QueryResult query_result = 2; + + // Specifies the status of the webhook request. + google.rpc.Status webhook_status = 3; + + // The audio data bytes encoded as specified in the request. + // Note: The output audio is generated based on the values of default platform + // text responses found in the `query_result.fulfillment_messages` field. If + // multiple default text responses exist, they will be concatenated when + // generating audio. If no default platform text responses exist, the + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 4; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 6; +} + +// Represents the parameters of the conversational query. +message QueryParameters { + // The time zone of this conversational query from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. If not provided, the time zone specified in + // agent settings is used. + string time_zone = 1; + + // The geo location of this conversational query. + google.type.LatLng geo_location = 2; + + // The collection of contexts to be activated before this query is + // executed. + repeated Context contexts = 3; + + // Specifies whether to delete all contexts in the current session + // before the new ones are activated. + bool reset_contexts = 4; + + // Additional session entity types to replace or extend developer + // entity types with. The entity synonyms apply to all languages and persist + // for the session of this query. + repeated SessionEntityType session_entity_types = 5; + + // This field can be used to pass custom data to your webhook. + // Arbitrary JSON objects are supported. + // If supplied, the value is used to populate the + // `WebhookRequest.original_detect_intent_request.payload` + // field sent to your webhook. + google.protobuf.Struct payload = 6; + + // Configures the type of sentiment analysis to perform. If not + // provided, sentiment analysis is not performed. + SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; + + // This field can be used to pass HTTP headers for a webhook + // call. These headers will be sent to webhook along with the headers that + // have been configured through the Dialogflow web console. The headers + // defined within this field will overwrite the headers configured through the + // Dialogflow console if there is a conflict. Header names are + // case-insensitive. Google's specified headers are not allowed. Including: + // "Host", "Content-Length", "Connection", "From", "User-Agent", + // "Accept-Encoding", "If-Modified-Since", "If-None-Match", "X-Forwarded-For", + // etc. + map webhook_headers = 14; +} + +// Represents the query input. It can contain either: +// +// 1. An audio config which +// instructs the speech recognizer how to process the speech audio. +// +// 2. A conversational query in the form of text,. +// +// 3. An event that specifies which intent to trigger. +message QueryInput { + // Required. The input specification. + oneof input { + // Instructs the speech recognizer how to process the speech audio. + InputAudioConfig audio_config = 1; + + // The natural language text to be processed. Text length must not exceed + // 256 character for virtual agent interactions. + TextInput text = 2; + + // The event to be processed. + EventInput event = 3; + } +} + +// Represents the result of conversational query or event processing. +message QueryResult { + // The original conversational query text: + // + // - If natural language text was provided as input, `query_text` contains + // a copy of the input. + // - If natural language speech audio was provided as input, `query_text` + // contains the speech recognition result. If speech recognizer produced + // multiple alternatives, a particular one is picked. + // - If automatic spell correction is enabled, `query_text` will contain the + // corrected user input. + string query_text = 1; + + // The language that was triggered during intent detection. + // See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. + string language_code = 15; + + // The Speech recognition confidence between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. The default of 0.0 is a sentinel value indicating that confidence + // was not set. + // + // This field is not guaranteed to be accurate or set. In particular this + // field isn't set for StreamingDetectIntent since the streaming endpoint has + // separate confidence estimates per portion of the audio in + // StreamingRecognitionResult. + float speech_recognition_confidence = 2; + + // The action name from the matched intent. + string action = 3; + + // The collection of extracted parameters. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 4; + + // This field is set to: + // + // - `false` if the matched intent has required parameters and not all of + // the required parameter values have been collected. + // - `true` if all required parameter values have been collected, or if the + // matched intent doesn't contain any required parameters. + bool all_required_params_present = 5; + + // Indicates whether the conversational query triggers a cancellation for slot + // filling. For more information, see the [cancel slot filling + // documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel). + bool cancels_slot_filling = 21; + + // The text to be pronounced to the user or shown on the screen. + // Note: This is a legacy field, `fulfillment_messages` should be preferred. + string fulfillment_text = 6; + + // The collection of rich messages to present to the user. + repeated Intent.Message fulfillment_messages = 7; + + // If the query was fulfilled by a webhook call, this field is set to the + // value of the `source` field returned in the webhook response. + string webhook_source = 8; + + // If the query was fulfilled by a webhook call, this field is set to the + // value of the `payload` field returned in the webhook response. + google.protobuf.Struct webhook_payload = 9; + + // The collection of output contexts. If applicable, + // `output_contexts.parameters` contains entries with name + // `.original` containing the original parameter values + // before the query. + repeated Context output_contexts = 10; + + // The intent that matched the conversational query. Some, not + // all fields are filled in this message, including but not limited to: + // `name`, `display_name`, `end_interaction` and `is_fallback`. + Intent intent = 11; + + // The intent detection confidence. Values range from 0.0 + // (completely uncertain) to 1.0 (completely certain). + // This value is for informational purpose only and is only used to + // help match the best intent within the classification threshold. + // This value may change for the same end-user expression at any time due to a + // model retraining or change in implementation. + // If there are `multiple knowledge_answers` messages, this value is set to + // the greatest `knowledgeAnswers.match_confidence` value in the list. + float intent_detection_confidence = 12; + + // Free-form diagnostic information for the associated detect intent request. + // The fields of this data can change without notice, so you should not write + // code that depends on its structure. + // The data may contain: + // + // - webhook call latency + // - webhook errors + google.protobuf.Struct diagnostic_info = 14; + + // The sentiment analysis result, which depends on the + // `sentiment_analysis_request_config` specified in the request. + SentimentAnalysisResult sentiment_analysis_result = 17; +} + +// The top-level message sent by the client to the +// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent] method. +// +// Multiple request messages should be sent in order: +// +// 1. The first message must contain +// [session][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.session], +// [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] plus optionally +// [query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. If the client +// wants to receive an audio response, it should also contain +// [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config]. +// The message must not contain +// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio]. +// 2. If [query_input][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_input] was set to +// [query_input.audio_config][google.cloud.dialogflow.v2.InputAudioConfig], all subsequent +// messages must contain +// [input_audio][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.input_audio] to continue with +// Speech recognition. +// If you decide to rather detect an intent from text input after you +// already started Speech recognition, please send a message with +// [query_input.text][google.cloud.dialogflow.v2.QueryInput.text]. +// +// However, note that: +// +// * Dialogflow will bill you for the audio duration so far. +// * Dialogflow discards all Speech recognition results in favor of the +// input text. +// * Dialogflow will use the language code from the first message. +// +// After you sent all input, you must half-close or abort the request stream. +message StreamingDetectIntentRequest { + // Required. The name of the session the query is sent to. + // Format of the session name: + // `projects//agent/sessions/`, or + // `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + // default 'draft' environment. If `User ID` is not specified, we are using + // "-". It's up to the API caller to choose an appropriate `Session ID` and + // `User Id`. They can be a random number or some type of user and session + // identifiers (preferably hashed). The length of the `Session ID` and + // `User ID` must not exceed 36 characters. + // + // For more information, see the [API interactions + // guide](https://cloud.google.com/dialogflow/docs/api-overview). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + string session = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. It can be set to: + // + // 1. an audio config which instructs the speech recognizer how to process + // the speech audio, + // + // 2. a conversational query in the form of text, or + // + // 3. an event that specifies which intent to trigger. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2.InputAudioConfig.single_utterance] instead. + // If `false` (default), recognition does not cease until + // the client closes the stream. If `true`, the recognizer will detect a + // single spoken utterance in input audio. Recognition ceases when it detects + // the audio's voice has stopped or paused. In this case, once a detected + // intent is received, the client should close the stream and start a new + // request with a new stream as needed. + // This setting is ignored when `query_input` is a piece of text or an event. + bool single_utterance = 4 [deprecated = true]; + + // Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 5; + + // Mask for [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this + // request-level config should override speech synthesizer settings defined at + // agent-level. + // + // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level + // config in its entirety. + google.protobuf.FieldMask output_audio_config_mask = 7; + + // The input audio content to be recognized. Must be sent if + // `query_input` was set to a streaming input audio config. The complete audio + // over all streaming messages must not exceed 1 minute. + bytes input_audio = 6; +} + +// The top-level message returned from the +// `StreamingDetectIntent` method. +// +// Multiple response messages can be returned in order: +// +// 1. If the `StreamingDetectIntentRequest.input_audio` field was +// set, the `recognition_result` field is populated for one +// or more messages. +// See the [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] message for details +// about the result message sequence. +// +// 2. The next message contains `response_id`, `query_result` +// and optionally `webhook_status` if a WebHook was called. +message StreamingDetectIntentResponse { + // The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The result of speech recognition. + StreamingRecognitionResult recognition_result = 2; + + // The result of the conversational query or event processing. + QueryResult query_result = 3; + + // Specifies the status of the webhook request. + google.rpc.Status webhook_status = 4; + + // The audio data bytes encoded as specified in the request. + // Note: The output audio is generated based on the values of default platform + // text responses found in the `query_result.fulfillment_messages` field. If + // multiple default text responses exist, they will be concatenated when + // generating audio. If no default platform text responses exist, the + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 5; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 6; +} + +// Contains a speech recognition result corresponding to a portion of the audio +// that is currently being processed or an indication that this is the end +// of the single requested utterance. +// +// While end-user audio is being processed, Dialogflow sends a series of +// results. Each result may contain a `transcript` value. A transcript +// represents a portion of the utterance. While the recognizer is processing +// audio, transcript values may be interim values or finalized values. +// Once a transcript is finalized, the `is_final` value is set to true and +// processing continues for the next transcript. +// +// If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance` +// was true, and the recognizer has completed processing audio, +// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the +// following (last) result contains the last finalized transcript. +// +// The complete end-user utterance is determined by concatenating the +// finalized transcript values received for the series of results. +// +// In the following example, single utterance is enabled. In the case where +// single utterance is not enabled, result 7 would not occur. +// +// ``` +// Num | transcript | message_type | is_final +// --- | ----------------------- | ----------------------- | -------- +// 1 | "tube" | TRANSCRIPT | false +// 2 | "to be a" | TRANSCRIPT | false +// 3 | "to be" | TRANSCRIPT | false +// 4 | "to be or not to be" | TRANSCRIPT | true +// 5 | "that's" | TRANSCRIPT | false +// 6 | "that is | TRANSCRIPT | false +// 7 | unset | END_OF_SINGLE_UTTERANCE | unset +// 8 | " that is the question" | TRANSCRIPT | true +// ``` +// +// Concatenating the finalized transcripts with `is_final` set to true, +// the complete utterance becomes "to be or not to be that is the question". +message StreamingRecognitionResult { + // Type of the response message. + enum MessageType { + // Not specified. Should never be used. + MESSAGE_TYPE_UNSPECIFIED = 0; + + // Message contains a (possibly partial) transcript. + TRANSCRIPT = 1; + + // Event indicates that the server has detected the end of the user's speech + // utterance and expects no additional inputs. + // Therefore, the server will not process additional audio (although it may subsequently return additional results). The + // client should stop sending additional audio data, half-close the gRPC + // connection, and wait for any additional results until the server closes + // the gRPC connection. This message is only sent if `single_utterance` was + // set to `true`, and is not used otherwise. + END_OF_SINGLE_UTTERANCE = 2; + } + + // Type of the result message. + MessageType message_type = 1; + + // Transcript text representing the words that the user spoke. + // Populated if and only if `message_type` = `TRANSCRIPT`. + string transcript = 2; + + // If `false`, the `StreamingRecognitionResult` represents an + // interim result that may change. If `true`, the recognizer will not return + // any further hypotheses about this piece of the audio. May only be populated + // for `message_type` = `TRANSCRIPT`. + bool is_final = 3; + + // The Speech confidence between 0.0 and 1.0 for the current portion of audio. + // A higher number indicates an estimated greater likelihood that the + // recognized words are correct. The default of 0.0 is a sentinel value + // indicating that confidence was not set. + // + // This field is typically only provided if `is_final` is true and you should + // not rely on it being accurate or even set. + float confidence = 4; + + // Word-specific information for the words recognized by Speech in + // [transcript][google.cloud.dialogflow.v2.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and + // [InputAudioConfig.enable_word_info] is set. + repeated SpeechWordInfo speech_word_info = 7; + + // Time offset of the end of this Speech recognition result relative to the + // beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`. + google.protobuf.Duration speech_end_offset = 8; + + // Detected language code for the transcript. + string language_code = 10; +} + +// ============================================================================ +// Auxiliary proto messages. +// +// Represents the natural language text to be processed. +message TextInput { + // Required. The UTF-8 encoded natural language text to be processed. + // Text length must not exceed 256 characters for virtual agent interactions. + string text = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The language of this conversational query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Events allow for matching intents by event name instead of the natural +// language input. For instance, input `` can trigger a personalized welcome response. +// The parameter `name` may be used by the agent in the response: +// `"Hello #welcome_event.name! What can I do for you today?"`. +message EventInput { + // Required. The unique identifier of the event. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The collection of parameters associated with the event. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 2; + + // Required. The language of this query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + // + // This field is ignored when used in the context of a + // [WebhookResponse.followup_event_input][google.cloud.dialogflow.v2.WebhookResponse.followup_event_input] field, + // because the language was already defined in the originating detect + // intent request. + string language_code = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Configures the types of sentiment analysis to perform. +message SentimentAnalysisRequestConfig { + // Instructs the service to perform sentiment analysis on + // `query_text`. If not provided, sentiment analysis is not performed on + // `query_text`. + bool analyze_query_text_sentiment = 1; +} + +// The result of sentiment analysis. Sentiment analysis inspects user input +// and identifies the prevailing subjective opinion, especially to determine a +// user's attitude as positive, negative, or neutral. +// For [Participants.DetectIntent][], it needs to be configured in +// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2.DetectIntentRequest.query_params]. For +// [Participants.StreamingDetectIntent][], it needs to be configured in +// [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2.StreamingDetectIntentRequest.query_params]. +// And for [Participants.AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] and +// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent], it needs to be configured in +// [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2.ConversationProfile.human_agent_assistant_config] +message SentimentAnalysisResult { + // The sentiment analysis result for `query_text`. + Sentiment query_text_sentiment = 1; +} + +// The sentiment, such as positive/negative feeling or association, for a unit +// of analysis, such as the query text. +message Sentiment { + // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive + // sentiment). + float score = 1; + + // A non-negative number in the [0, +inf) range, which represents the absolute + // magnitude of sentiment, regardless of score (positive or negative). + float magnitude = 2; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session_entity_type.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session_entity_type.proto new file mode 100644 index 00000000000..00cceba1cc5 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/session_entity_type.proto @@ -0,0 +1,313 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2/entity_type.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "SessionEntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityType]. +service SessionEntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all session entity types in the specified session. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc ListSessionEntityTypes(ListSessionEntityTypesRequest) returns (ListSessionEntityTypesResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent/sessions/*}/entityTypes" + additional_bindings { + get: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + } + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc GetSessionEntityType(GetSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}" + additional_bindings { + get: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + } + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a session entity type. + // + // If the specified session entity type already exists, overrides the session + // entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc CreateSessionEntityType(CreateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent/sessions/*}/entityTypes" + body: "session_entity_type" + additional_bindings { + post: "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + body: "session_entity_type" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + body: "session_entity_type" + } + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "parent,session_entity_type"; + } + + // Updates the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc UpdateSessionEntityType(UpdateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + patch: "/v2/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}" + body: "session_entity_type" + additional_bindings { + patch: "/v2/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + additional_bindings { + patch: "/v2/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + additional_bindings { + patch: "/v2/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "session_entity_type"; + option (google.api.method_signature) = "session_entity_type,update_mask"; + } + + // Deletes the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc DeleteSessionEntityType(DeleteSessionEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}" + additional_bindings { + delete: "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + } + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// A session represents a conversation between a Dialogflow agent and an +// end-user. You can create special entities, called session entities, during a +// session. Session entities can extend or replace custom entity types and only +// exist during the session that they were created for. All session data, +// including session entities, is stored by Dialogflow for 20 minutes. +// +// For more information, see the [session entity +// guide](https://cloud.google.com/dialogflow/docs/entities-session). +message SessionEntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/SessionEntityType" + pattern: "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + }; + + // The types of modifications for a session entity type. + enum EntityOverrideMode { + // Not specified. This value should be never used. + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0; + + // The collection of session entities overrides the collection of entities + // in the corresponding custom entity type. + ENTITY_OVERRIDE_MODE_OVERRIDE = 1; + + // The collection of session entities extends the collection of entities in + // the corresponding custom entity type. + // + // Note: Even in this override mode calls to `ListSessionEntityTypes`, + // `GetSessionEntityType`, `CreateSessionEntityType` and + // `UpdateSessionEntityType` only return the additional entities added in + // this session entity type. If you want to get the supplemented list, + // please call [EntityTypes.GetEntityType][google.cloud.dialogflow.v2.EntityTypes.GetEntityType] on the custom entity type + // and merge. + ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2; + } + + // Required. The unique identifier of this session entity type. Format: + // `projects//agent/sessions//entityTypes/`, or `projects//agent/environments//users//sessions//entityTypes/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + // + // `` must be the display name of an existing entity + // type in the same agent that will be overridden or supplemented. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Indicates whether the additional data should override or + // supplement the custom entity type definition. + EntityOverrideMode entity_override_mode = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The collection of entities associated with this session entity + // type. + repeated EntityType.Entity entities = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesRequest { + // Required. The session to list all session entity types from. + // Format: `projects//agent/sessions/` or + // `projects//agent/environments//users// + // sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesResponse { + // The list of session entity types. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated SessionEntityType session_entity_types = 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 request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType]. +message GetSessionEntityTypeRequest { + // Required. The name of the session entity type. Format: + // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} + +// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType]. +message CreateSessionEntityTypeRequest { + // Required. The session to create a session entity type for. + // Format: `projects//agent/sessions/` or + // `projects//agent/environments//users// + // sessions/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // Required. The session entity type to create. + SessionEntityType session_entity_type = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType]. +message UpdateSessionEntityTypeRequest { + // Required. The session entity type to update. + SessionEntityType session_entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType]. +message DeleteSessionEntityTypeRequest { + // Required. The name of the entity type to delete. Format: + // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/validation_result.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/validation_result.proto new file mode 100644 index 00000000000..a4c77a9993f --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/validation_result.proto @@ -0,0 +1,74 @@ +// 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.dialogflow.v2; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ValidationResultProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Represents a single validation error. +message ValidationError { + // Represents a level of severity. + enum Severity { + // Not specified. This value should never be used. + SEVERITY_UNSPECIFIED = 0; + + // The agent doesn't follow Dialogflow best practices. + INFO = 1; + + // The agent may not behave as expected. + WARNING = 2; + + // The agent may experience partial failures. + ERROR = 3; + + // The agent may completely fail. + CRITICAL = 4; + } + + // The severity of the error. + Severity severity = 1; + + // The names of the entries that the error is associated with. + // Format: + // + // - "projects//agent", if the error is associated with the entire + // agent. + // - "projects//agent/intents/", if the error is + // associated with certain intents. + // - "projects//agent/intents//trainingPhrases/", if the + // error is associated with certain intent training phrases. + // - "projects//agent/intents//parameters/", if the error is associated with certain intent parameters. + // - "projects//agent/entities/", if the error is + // associated with certain entities. + repeated string entries = 3; + + // The detailed error message. + string error_message = 4; +} + +// Represents the output of agent validation. +message ValidationResult { + // Contains all validation errors. + repeated ValidationError validation_errors = 1; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/version.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/version.proto new file mode 100644 index 00000000000..8244c547bd7 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/version.proto @@ -0,0 +1,267 @@ +// 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.dialogflow.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "VersionProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// Service for managing [Versions][google.cloud.dialogflow.v2.Version]. +service Versions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all versions of the specified agent. + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/agent}/versions" + additional_bindings { + get: "/v2/{parent=projects/*/locations/*/agent}/versions" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified agent version. + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { + get: "/v2/{name=projects/*/agent/versions/*}" + additional_bindings { + get: "/v2/{name=projects/*/locations/*/agent/versions/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates an agent version. + // + // The new version points to the agent instance in the "default" environment. + rpc CreateVersion(CreateVersionRequest) returns (Version) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/agent}/versions" + body: "version" + additional_bindings { + post: "/v2/{parent=projects/*/locations/*/agent}/versions" + body: "version" + } + }; + option (google.api.method_signature) = "parent,version"; + } + + // Updates the specified agent version. + // + // Note that this method does not allow you to update the state of the agent + // the given version points to. It allows you to update only mutable + // properties of the version resource. + rpc UpdateVersion(UpdateVersionRequest) returns (Version) { + option (google.api.http) = { + patch: "/v2/{version.name=projects/*/agent/versions/*}" + body: "version" + additional_bindings { + patch: "/v2/{version.name=projects/*/locations/*/agent/versions/*}" + body: "version" + } + }; + option (google.api.method_signature) = "version,update_mask"; + } + + // Delete the specified agent version. + rpc DeleteVersion(DeleteVersionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/agent/versions/*}" + additional_bindings { + delete: "/v2/{name=projects/*/locations/*/agent/versions/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// You can create multiple versions of your agent and publish them to separate +// environments. +// +// When you edit an agent, you are editing the draft agent. At any point, you +// can save the draft agent as an agent version, which is an immutable snapshot +// of your agent. +// +// When you save the draft agent, it is published to the default environment. +// When you create agent versions, you can publish them to custom environments. +// You can create a variety of custom environments for: +// +// - testing +// - development +// - production +// - etc. +// +// For more information, see the [versions and environments +// guide](https://cloud.google.com/dialogflow/docs/agents-versions). +message Version { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Version" + pattern: "projects/{project}/agent/versions/{version}" + pattern: "projects/{project}/locations/{location}/agent/versions/{version}" + }; + + // The status of a version. + enum VersionStatus { + // Not specified. This value is not used. + VERSION_STATUS_UNSPECIFIED = 0; + + // Version is not ready to serve (e.g. training is in progress). + IN_PROGRESS = 1; + + // Version is ready to serve. + READY = 2; + + // Version training failed. + FAILED = 3; + } + + // Output only. The unique identifier of this agent version. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The developer-provided description of this version. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The sequential number of this version. This field is read-only which means + // it cannot be set by create and update methods. + int32 version_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time of this version. This field is read-only, i.e., it cannot + // be set by create and update methods. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The status of this version. This field is read-only and cannot be set by + // create and update methods. + VersionStatus status = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Versions.ListVersions][google.cloud.dialogflow.v2.Versions.ListVersions]. +message ListVersionsRequest { + // Required. The agent to list all versions from. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Versions.ListVersions][google.cloud.dialogflow.v2.Versions.ListVersions]. +message ListVersionsResponse { + // The list of agent versions. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Version versions = 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 request message for [Versions.GetVersion][google.cloud.dialogflow.v2.Versions.GetVersion]. +message GetVersionRequest { + // Required. The name of the version. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} + +// The request message for [Versions.CreateVersion][google.cloud.dialogflow.v2.Versions.CreateVersion]. +message CreateVersionRequest { + // Required. The agent to create a version for. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // Required. The version to create. + Version version = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.UpdateVersion][google.cloud.dialogflow.v2.Versions.UpdateVersion]. +message UpdateVersionRequest { + // Required. The version to update. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + Version version = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.DeleteVersion][google.cloud.dialogflow.v2.Versions.DeleteVersion]. +message DeleteVersionRequest { + // Required. The name of the version to delete. + // Supported formats: + // + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/webhook.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/webhook.proto new file mode 100644 index 00000000000..a672ff7150c --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2/webhook.proto @@ -0,0 +1,144 @@ +// 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.dialogflow.v2; + +import "google/cloud/dialogflow/v2/context.proto"; +import "google/cloud/dialogflow/v2/intent.proto"; +import "google/cloud/dialogflow/v2/session.proto"; +import "google/cloud/dialogflow/v2/session_entity_type.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "WebhookProto"; +option java_package = "com.google.cloud.dialogflow.v2"; +option objc_class_prefix = "DF"; + +// The request message for a webhook call. +message WebhookRequest { + // The unique identifier of detectIntent request session. + // Can be used to identify end-user inside webhook implementation. + // Format: `projects//agent/sessions/`, or + // `projects//agent/environments//users//sessions/`. + string session = 4; + + // The unique identifier of the response. Contains the same value as + // `[Streaming]DetectIntentResponse.response_id`. + string response_id = 1; + + // The result of the conversational query or event processing. Contains the + // same value as `[Streaming]DetectIntentResponse.query_result`. + QueryResult query_result = 2; + + // Optional. The contents of the original request that was passed to + // `[Streaming]DetectIntent` call. + OriginalDetectIntentRequest original_detect_intent_request = 3; +} + +// The response message for a webhook call. +// +// This response is validated by the Dialogflow server. If validation fails, +// an error will be returned in the [QueryResult.diagnostic_info][google.cloud.dialogflow.v2.QueryResult.diagnostic_info] field. +// Setting JSON fields to an empty value with the wrong type is a common error. +// To avoid this error: +// +// - Use `""` for empty strings +// - Use `{}` or `null` for empty objects +// - Use `[]` or `null` for empty arrays +// +// For more information, see the +// [Protocol Buffers Language +// Guide](https://developers.google.com/protocol-buffers/docs/proto3#json). +message WebhookResponse { + // Optional. The text response message intended for the end-user. + // It is recommended to use `fulfillment_messages.text.text[0]` instead. + // When provided, Dialogflow uses this field to populate + // [QueryResult.fulfillment_text][google.cloud.dialogflow.v2.QueryResult.fulfillment_text] sent to the integration or API caller. + string fulfillment_text = 1; + + // Optional. The rich response messages intended for the end-user. + // When provided, Dialogflow uses this field to populate + // [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2.QueryResult.fulfillment_messages] sent to the integration or API caller. + repeated Intent.Message fulfillment_messages = 2; + + // Optional. A custom field used to identify the webhook source. + // Arbitrary strings are supported. + // When provided, Dialogflow uses this field to populate + // [QueryResult.webhook_source][google.cloud.dialogflow.v2.QueryResult.webhook_source] sent to the integration or API caller. + string source = 3; + + // Optional. This field can be used to pass custom data from your webhook to the + // integration or API caller. Arbitrary JSON objects are supported. + // When provided, Dialogflow uses this field to populate + // [QueryResult.webhook_payload][google.cloud.dialogflow.v2.QueryResult.webhook_payload] sent to the integration or API caller. + // This field is also used by the + // [Google Assistant + // integration](https://cloud.google.com/dialogflow/docs/integrations/aog) + // for rich response messages. + // See the format definition at [Google Assistant Dialogflow webhook + // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) + google.protobuf.Struct payload = 4; + + // Optional. The collection of output contexts that will overwrite currently + // active contexts for the session and reset their lifespans. + // When provided, Dialogflow uses this field to populate + // [QueryResult.output_contexts][google.cloud.dialogflow.v2.QueryResult.output_contexts] sent to the integration or API caller. + repeated Context output_contexts = 5; + + // Optional. Invokes the supplied events. + // When this field is set, Dialogflow ignores the `fulfillment_text`, + // `fulfillment_messages`, and `payload` fields. + EventInput followup_event_input = 6; + + // Optional. Additional session entity types to replace or extend developer + // entity types with. The entity synonyms apply to all languages and persist + // for the session. Setting this data from a webhook overwrites + // the session entity types that have been set using `detectIntent`, + // `streamingDetectIntent` or [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType] management methods. + repeated SessionEntityType session_entity_types = 10; +} + +// Represents the contents of the original request that was passed to +// the `[Streaming]DetectIntent` call. +message OriginalDetectIntentRequest { + // The source of this request, e.g., `google`, `facebook`, `slack`. It is set + // by Dialogflow-owned servers. + string source = 1; + + // Optional. The version of the protocol used for this request. + // This field is AoG-specific. + string version = 2; + + // Optional. This field is set to the value of the `QueryParameters.payload` + // field passed in the request. Some integrations that query a Dialogflow + // agent may provide additional information in the payload. + // + // In particular, for the Dialogflow Phone Gateway integration, this field has + // the form: + //
{
+  //  "telephony": {
+  //    "caller_id": "+18558363987"
+  //  }
+  // }
+ // Note: The caller ID field (`caller_id`) will be redacted for Trial + // Edition agents and populated with the caller ID in [E.164 + // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents. + google.protobuf.Struct payload = 3; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/agent.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/agent.proto new file mode 100644 index 00000000000..95b3933a6d4 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/agent.proto @@ -0,0 +1,578 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/validation_result.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AgentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Agents][google.cloud.dialogflow.v2beta1.Agent]. +service Agents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Retrieves the specified agent. + rpc GetAgent(GetAgentRequest) returns (Agent) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/agent" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/agent" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Creates/updates the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc SetAgent(SetAgentRequest) returns (Agent) { + option (google.api.http) = { + post: "/v2beta1/{agent.parent=projects/*}/agent" + body: "agent" + additional_bindings { + post: "/v2beta1/{agent.parent=projects/*/locations/*}/agent" + body: "agent" + } + }; + option (google.api.method_signature) = "agent"; + } + + // Deletes the specified agent. + rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{parent=projects/*}/agent" + additional_bindings { + delete: "/v2beta1/{parent=projects/*/locations/*}/agent" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Returns the list of agents. + // Since there is at most one conversational agent per project, this method is + // useful primarily for listing all agents across projects the caller has + // access to. One can achieve that with a wildcard project collection id "-". + // Refer to [List + // Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). + rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/agent:search" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/agent:search" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Trains the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/agent:train" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/agent:train" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Exports the specified agent to a ZIP file. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse] + rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/agent:export" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/agent:export" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2beta1.ExportAgentResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Imports the specified agent from a ZIP file. + // + // Uploads new intents and entity types without deleting the existing ones. + // Intents and entity types with the same name are replaced with the new + // versions from [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the imported draft + // agent will be trained automatically (unless disabled in agent settings). + // However, once the import is done, training may not be completed yet. Please + // call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train + // explicitly. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // The operation only tracks when importing is complete, not when it is done + // training. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/agent:import" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/agent:import" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Restores the specified agent from a ZIP file. + // + // Replaces the current agent version with a new one. All the intents and + // entity types in the older version are deleted. After the restore, the + // restored draft agent will be trained automatically (unless disabled in + // agent settings). However, once the restore is done, training may not be + // completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it + // returns in order to train explicitly. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // The operation only tracks when restoring is complete, not when it is done + // training. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/agent:restore" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/agent:restore" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Gets agent validation result. Agent validation is performed during + // training time and is updated automatically when training is completed. + rpc GetValidationResult(GetValidationResultRequest) returns (ValidationResult) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/agent/validationResult" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/agent/validationResult" + } + }; + } +} + +// A Dialogflow agent is a virtual agent that handles conversations with your +// end-users. It is a natural language understanding module that understands the +// nuances of human language. Dialogflow translates end-user text or audio +// during a conversation to structured data that your apps and services can +// understand. You design and build a Dialogflow agent to handle the types of +// conversations required for your system. +// +// For more information about agents, see the +// [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview). +// +message Agent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Agent" + pattern: "projects/{project}/agent" + pattern: "projects/{project}/locations/{location}/agent" + }; + + // Match mode determines how intents are detected from user queries. + enum MatchMode { + // Not specified. + MATCH_MODE_UNSPECIFIED = 0; + + // Best for agents with a small number of examples in intents and/or wide + // use of templates syntax and composite entities. + MATCH_MODE_HYBRID = 1; + + // Can be used for agents with a large number of examples in intents, + // especially the ones using @sys.any or very large custom entities. + MATCH_MODE_ML_ONLY = 2; + } + + // API version for the agent. + enum ApiVersion { + // Not specified. + API_VERSION_UNSPECIFIED = 0; + + // Legacy V1 API. + API_VERSION_V1 = 1; + + // V2 API. + API_VERSION_V2 = 2; + + // V2beta1 API. + API_VERSION_V2_BETA_1 = 3; + } + + // Represents the agent tier. + enum Tier { + // Not specified. This value should never be used. + TIER_UNSPECIFIED = 0; + + // Trial Edition, previously known as Standard Edition. + TIER_STANDARD = 1; + + // Essentials Edition, previously known as Enterprise Essential Edition. + TIER_ENTERPRISE = 2; + + // Essentials Edition (same as TIER_ENTERPRISE), previously known as + // Enterprise Plus Edition. + TIER_ENTERPRISE_PLUS = 3 [deprecated = true]; + } + + // Required. The project of this agent. + // Format: `projects/` or + // `projects//locations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. The name of this agent. + string display_name = 2; + + // Required. The default language of the agent as a language tag. See + // [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. This field cannot be + // set by the `Update` method. + string default_language_code = 3; + + // Optional. The list of all languages supported by this agent (except for the + // `default_language_code`). + repeated string supported_language_codes = 4; + + // Required. The time zone of this agent from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. + string time_zone = 5; + + // Optional. The description of this agent. + // The maximum length is 500 characters. If exceeded, the request is rejected. + string description = 6; + + // Optional. The URI of the agent's avatar. + // Avatars are used throughout the Dialogflow console and in the self-hosted + // [Web + // Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) + // integration. + string avatar_uri = 7; + + // Optional. Determines whether this agent should log conversation queries. + bool enable_logging = 8; + + // Optional. Determines how intents are detected from user queries. + MatchMode match_mode = 9 [deprecated = true]; + + // Optional. To filter out false positive results and still get variety in + // matched natural language inputs for your agent, you can tune the machine + // learning classification threshold. If the returned score value is less than + // the threshold value, then a fallback intent will be triggered or, if there + // are no fallback intents defined, no intent will be triggered. The score + // values range from 0.0 (completely uncertain) to 1.0 (completely certain). + // If set to 0.0, the default of 0.3 is used. + float classification_threshold = 10; + + // Optional. API version displayed in Dialogflow console. If not specified, + // V2 API is assumed. Clients are free to query different service endpoints + // for different API versions. However, bots connectors and webhook calls will + // follow the specified API version. + ApiVersion api_version = 14; + + // Optional. The agent tier. If not specified, TIER_STANDARD is assumed. + Tier tier = 15; +} + +// The request message for [Agents.GetAgent][google.cloud.dialogflow.v2beta1.Agents.GetAgent]. +message GetAgentRequest { + // Required. The project that the agent to fetch is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.SetAgent][google.cloud.dialogflow.v2beta1.Agents.SetAgent]. +message SetAgentRequest { + // Required. The agent to update. + Agent agent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request message for [Agents.DeleteAgent][google.cloud.dialogflow.v2beta1.Agents.DeleteAgent]. +message DeleteAgentRequest { + // Required. The project that the agent to delete is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// Contains basic configuration for a sub-agent. +message SubAgent { + // Required. The project of this agent. + // Format: `projects/` or + // `projects//locations/`. + string project = 1; + + // Optional. The unique identifier (`environment name` in dialogflow console) + // of this sub-agent environment. Assumes draft environment if `environment` + // is not set. + string environment = 2; +} + +// The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. +message SearchAgentsRequest { + // Required. The project to list agents from. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2beta1.Agents.SearchAgents]. +message SearchAgentsResponse { + // The list of agents. There will be a maximum number of items returned based + // on the page_size field in the request. + repeated Agent agents = 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 request message for [Agents.TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent]. +message TrainAgentRequest { + // Required. The project that the agent to train is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. +message ExportAgentRequest { + // Required. The project that the agent to export is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The + // [Google Cloud Storage](https://cloud.google.com/storage/docs/) + // URI to export the agent to. + // The format of this URI must be `gs:///`. + // If left unspecified, the serialized agent is returned inline. + // + // Dialogflow performs a write operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have write permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + string agent_uri = 2; +} + +// The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent]. +message ExportAgentResponse { + // The exported agent. + oneof agent { + // The URI to a file containing the exported agent. This field is populated + // only if `agent_uri` is specified in `ExportAgentRequest`. + string agent_uri = 1; + + // Zip compressed raw byte content for agent. + bytes agent_content = 2; + } +} + +// The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2beta1.Agents.ImportAgent]. +message ImportAgentRequest { + // Required. The project that the agent to import is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to import. + oneof agent { + // The URI to a Google Cloud Storage file containing the agent to import. + // Note: The URI must start with "gs://". + // + // Dialogflow performs a read operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have read permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + string agent_uri = 2; + + // Zip compressed raw byte content for agent. + bytes agent_content = 3; + } +} + +// The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2beta1.Agents.RestoreAgent]. +message RestoreAgentRequest { + // Required. The project that the agent to restore is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Required. The agent to restore. + oneof agent { + // The URI to a Google Cloud Storage file containing the agent to restore. + // Note: The URI must start with "gs://". + // + // Dialogflow performs a read operation for the Cloud Storage object + // on the caller's behalf, so your request authentication must + // have read permissions for the object. For more information, see + // [Dialogflow access + // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + string agent_uri = 2; + + // Zip compressed raw byte content for agent. + bytes agent_content = 3; + } +} + +// The request message for [Agents.GetValidationResult][google.cloud.dialogflow.v2beta1.Agents.GetValidationResult]. +message GetValidationResultRequest { + // Required. The project that the agent is associated with. + // Format: `projects/` or + // `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Agent" + } + ]; + + // Optional. The language for which you want a validation result. If not + // specified, the agent's default language is used. [Many + // languages](https://cloud.google.com/dialogflow/docs/reference/language) + // are supported. Note: languages must be enabled in the agent before they can + // be used. + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/answer_record.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/answer_record.proto new file mode 100644 index 00000000000..1193f90c617 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/answer_record.proto @@ -0,0 +1,325 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/participant.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AnswerRecordsProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [AnswerRecords][google.cloud.dialogflow.v2beta1.AnswerRecord]. +service AnswerRecords { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Deprecated. + // Retrieves a specific answer record. + rpc GetAnswerRecord(GetAnswerRecordRequest) returns (AnswerRecord) { + option deprecated = true; + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/answerRecords/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/answerRecords/*}" + } + }; + } + + // Returns the list of all answer records in the specified project in reverse + // chronological order. + rpc ListAnswerRecords(ListAnswerRecordsRequest) returns (ListAnswerRecordsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/answerRecords" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/answerRecords" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the specified answer record. + rpc UpdateAnswerRecord(UpdateAnswerRecordRequest) returns (AnswerRecord) { + option (google.api.http) = { + patch: "/v2beta1/{answer_record.name=projects/*/answerRecords/*}" + body: "answer_record" + additional_bindings { + patch: "/v2beta1/{answer_record.name=projects/*/locations/*/answerRecords/*}" + body: "answer_record" + } + }; + option (google.api.method_signature) = "answer_record,update_mask"; + } +} + +// Answer records are records to manage answer history and feedbacks for +// Dialogflow. +// +// Currently, answer record includes: +// +// - human agent assistant article suggestion +// - human agent assistant faq article +// +// It doesn't include: +// +// - `DetectIntent` intent matching +// - `DetectIntent` knowledge +// +// Answer records are not related to the conversation history in the +// Dialogflow Console. A Record is generated even when the end-user disables +// conversation history in the console. Records are created when there's a human +// agent assistant suggestion generated. +// +// A typical workflow for customers provide feedback to an answer is: +// +// 1. For human agent assistant, customers get suggestion via ListSuggestions +// API. Together with the answers, [AnswerRecord.name][google.cloud.dialogflow.v2beta1.AnswerRecord.name] are returned to the +// customers. +// 2. The customer uses the [AnswerRecord.name][google.cloud.dialogflow.v2beta1.AnswerRecord.name] to call the +// [UpdateAnswerRecord][] method to send feedback about a specific answer +// that they believe is wrong. +message AnswerRecord { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/AnswerRecord" + pattern: "projects/{project}/answerRecords/{answer_record}" + pattern: "projects/{project}/locations/{location}/answerRecords/{answer_record}" + }; + + // The unique identifier of this answer record. + // Required for [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord] method. + // Format: `projects//locations//answerRecords/`. + string name = 1; + + // Optional. The AnswerFeedback for this record. You can set this with + // [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord] in order to give us feedback about + // this answer. + AnswerFeedback answer_feedback = 3; + + // Output only. The record for this answer. + oneof record { + // Output only. The record for human agent assistant. + AgentAssistantRecord agent_assistant_record = 4; + } +} + +// Represents a record of a human agent assistant answer. +message AgentAssistantRecord { + // Output only. The agent assistant answer. + oneof answer { + // Output only. The article suggestion answer. + ArticleAnswer article_suggestion_answer = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The FAQ answer. + FaqAnswer faq_answer = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + } +} + +// Represents feedback the customer has about the quality & correctness of a +// certain answer in a conversation. +message AnswerFeedback { + // The correctness level of an answer. + enum CorrectnessLevel { + // Correctness level unspecified. + CORRECTNESS_LEVEL_UNSPECIFIED = 0; + + // Answer is totally wrong. + NOT_CORRECT = 1; + + // Answer is partially correct. + PARTIALLY_CORRECT = 2; + + // Answer is fully correct. + FULLY_CORRECT = 3; + } + + // The correctness level of the specific answer. + CorrectnessLevel correctness_level = 1; + + // Normally, detail feedback is provided when answer is not fully correct. + oneof detail_feedback { + // Optional. Detail feedback of agent assistant suggestions. + AgentAssistantFeedback agent_assistant_detail_feedback = 2; + } + + // Indicates whether the answer/item was clicked by the human agent + // or not. Default to false. + bool clicked = 3; + + // Time when the answer/item was clicked. + google.protobuf.Timestamp click_time = 5; + + // Indicates whether the answer/item was displayed to the human + // agent in the agent desktop UI. Default to false. + bool displayed = 4; + + // Time when the answer/item was displayed. + google.protobuf.Timestamp display_time = 6; +} + +// Detail feedback of Agent Assistant result. +message AgentAssistantFeedback { + // Relevance of an answer. + enum AnswerRelevance { + // Answer relevance unspecified. + ANSWER_RELEVANCE_UNSPECIFIED = 0; + + // Answer is irrelevant to query. + IRRELEVANT = 1; + + // Answer is relevant to query. + RELEVANT = 2; + } + + // Correctness of document. + enum DocumentCorrectness { + // Document correctness unspecified. + DOCUMENT_CORRECTNESS_UNSPECIFIED = 0; + + // Information in document is incorrect. + INCORRECT = 1; + + // Information in document is correct. + CORRECT = 2; + } + + // Efficiency of document. + enum DocumentEfficiency { + // Document efficiency unspecified. + DOCUMENT_EFFICIENCY_UNSPECIFIED = 0; + + // Document is inefficient. + INEFFICIENT = 1; + + // Document is efficient. + EFFICIENT = 2; + } + + // Feedback for conversation summarization. + message SummarizationFeedback { + // Timestamp when composing of the summary starts. + google.protobuf.Timestamp start_timestamp = 1; + + // Timestamp when the summary was submitted. + google.protobuf.Timestamp submit_timestamp = 2; + + // Text of actual submitted summary. + string summary_text = 3; + } + + // Optional. Whether or not the suggested answer is relevant. + // + // For example: + // + // * Query: "Can I change my mailing address?" + // * Suggested document says: "Items must be returned/exchanged within 60 + // days of the purchase date." + // * [answer_relevance][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.answer_relevance]: [AnswerRelevance.IRRELEVANT][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance.IRRELEVANT] + AnswerRelevance answer_relevance = 1; + + // Optional. Whether or not the information in the document is correct. + // + // For example: + // + // * Query: "Can I return the package in 2 days once received?" + // * Suggested document says: "Items must be returned/exchanged within 60 + // days of the purchase date." + // * Ground truth: "No return or exchange is allowed." + // * [document_correctness]: INCORRECT + DocumentCorrectness document_correctness = 2; + + // Optional. Whether or not the suggested document is efficient. For example, + // if the document is poorly written, hard to understand, hard to use or + // too long to find useful information, [document_efficiency][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.document_efficiency] is + // [DocumentEfficiency.INEFFICIENT][google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency.INEFFICIENT]. + DocumentEfficiency document_efficiency = 3; + + // Feedback for conversation summarization. + SummarizationFeedback summarization_feedback = 4; +} + +// Request message for [AnswerRecords.GetAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecord]. +message GetAnswerRecordRequest { + // Required. The name of the answer record to retrieve. + // Format: `projects//locations//answerRecords/`. + string name = 1; +} + +// Request message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords]. +message ListAnswerRecordsRequest { + // Required. The project to list all answer records for in reverse + // chronological order. Format: `projects//locations/`. + string parent = 1 [(google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/AnswerRecord" + }]; + + // Optional. Filters to restrict results to specific answer records. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 2 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. The maximum number of records to return in a single page. + // The server may return fewer records than this. If unspecified, we use 10. + // The maximum is 100. + int32 page_size = 3; + + // Optional. The + // [ListAnswerRecordsResponse.next_page_token][google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token] + // value returned from a previous list request used to continue listing on + // the next page. + string page_token = 4; +} + +// Response message for [AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords]. +message ListAnswerRecordsResponse { + // The list of answer records. + repeated AnswerRecord answer_records = 1; + + // A token to retrieve next page of results. Or empty if there are no more + // results. + // Pass this value in the + // [ListAnswerRecordsRequest.page_token][google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.page_token] + // field in the subsequent call to `ListAnswerRecords` method to retrieve the + // next page of results. + string next_page_token = 2; +} + +// Request message for [AnswerRecords.UpdateAnswerRecord][google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord]. +message UpdateAnswerRecordRequest { + // Required. Answer record to update. + AnswerRecord answer_record = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto new file mode 100644 index 00000000000..b9e83b20bef --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/audio_config.proto @@ -0,0 +1,462 @@ +// 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.dialogflow.v2beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AudioConfigProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "automl.googleapis.com/Model" + pattern: "projects/{project}/locations/{location}/models/{model}" +}; + +// Audio encoding of the audio content sent in the conversational query request. +// Refer to the +// [Cloud Speech API +// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more +// details. +enum AudioEncoding { + // Not specified. + AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + AUDIO_ENCODING_LINEAR_16 = 1; + + // [`FLAC`](https://xiph.org/flac/documentation.html) (Free Lossless Audio + // Codec) is the recommended encoding because it is lossless (therefore + // recognition is not compromised) and requires only about half the + // bandwidth of `LINEAR16`. `FLAC` stream encoding supports 16-bit and + // 24-bit samples, however, not all fields in `STREAMINFO` are supported. + AUDIO_ENCODING_FLAC = 2; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + AUDIO_ENCODING_MULAW = 3; + + // Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + AUDIO_ENCODING_AMR = 4; + + // Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_AMR_WB = 5; + + // Opus encoded audio frames in Ogg container + // ([OggOpus](https://wiki.xiph.org/OggOpus)). + // `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_OGG_OPUS = 6; + + // Although the use of lossy encodings is not recommended, if a very low + // bitrate encoding is required, `OGG_OPUS` is highly preferred over + // Speex encoding. The [Speex](https://speex.org/) encoding supported by + // Dialogflow API has a header byte in each block, as in MIME type + // `audio/x-speex-with-header-byte`. + // It is a variant of the RTP Speex encoding defined in + // [RFC 5574](https://tools.ietf.org/html/rfc5574). + // The stream is a sequence of blocks, one block per RTP packet. Each block + // starts with a byte containing the length of the block, in bytes, followed + // by one or more frames of Speex data, padded to an integral number of + // bytes (octets) as specified in RFC 5574. In other words, each RTP header + // is replaced with a single byte containing the block length. Only Speex + // wideband is supported. `sample_rate_hertz` must be 16000. + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; +} + +// Hints for the speech recognizer to help with recognition in a specific +// conversation state. +message SpeechContext { + // Optional. A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // This list can be used to: + // + // * improve accuracy for words and phrases you expect the user to say, + // e.g. typical commands for your Dialogflow agent + // * add additional words to the speech recognizer vocabulary + // * ... + // + // See the [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/quotas) for usage + // limits. + repeated string phrases = 1; + + // Optional. Boost for this context compared to other contexts: + // + // * If the boost is positive, Dialogflow will increase the probability that + // the phrases in this context are recognized over similar sounding phrases. + // * If the boost is unspecified or non-positive, Dialogflow will not apply + // any boost. + // + // Dialogflow recommends that you use boosts in the range (0, 20] and that you + // find a value that fits your use case with binary search. + float boost = 2; +} + +// Variant of the specified [Speech +// model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] to use. +// +// See the [Cloud Speech +// documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) +// for which models have different variants. For example, the "phone_call" model +// has both a standard and an enhanced variant. When you use an enhanced model, +// you will generally receive higher quality results than for a standard model. +enum SpeechModelVariant { + // No model variant specified. In this case Dialogflow defaults to + // USE_BEST_AVAILABLE. + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0; + + // Use the best available variant of the [Speech + // model][InputAudioConfig.model] that the caller is eligible for. + // + // Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) for + // how to make your project eligible for enhanced models. + USE_BEST_AVAILABLE = 1; + + // Use standard model variant even if an enhanced model is available. See the + // [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // for details about enhanced models. + USE_STANDARD = 2; + + // Use an enhanced model variant: + // + // * If an enhanced variant does not exist for the given + // [model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] and + // request language, Dialogflow falls back to the standard variant. + // + // The [Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/enhanced-models) + // describes which models have enhanced variants. + // + // * If the API caller isn't eligible for enhanced models, Dialogflow returns + // an error. Please see the [Dialogflow + // docs](https://cloud.google.com/dialogflow/docs/data-logging) + // for how to make your project eligible. + USE_ENHANCED = 3; +} + +// Information for a word recognized by the speech recognizer. +message SpeechWordInfo { + // The word this info is for. + string word = 3; + + // Time offset relative to the beginning of the audio that corresponds to the + // start of the spoken word. This is an experimental feature and the accuracy + // of the time offset can vary. + google.protobuf.Duration start_offset = 1; + + // Time offset relative to the beginning of the audio that corresponds to the + // end of the spoken word. This is an experimental feature and the accuracy of + // the time offset can vary. + google.protobuf.Duration end_offset = 2; + + // The Speech confidence between 0.0 and 1.0 for this word. A higher number + // indicates an estimated greater likelihood that the recognized word is + // correct. The default of 0.0 is a sentinel value indicating that confidence + // was not set. + // + // This field is not guaranteed to be fully stable over time for the same + // audio input. Users should also not rely on it to always be provided. + float confidence = 4; +} + +// Instructs the speech recognizer on how to process the audio content. +message InputAudioConfig { + // Required. Audio encoding of the audio content to process. + AudioEncoding audio_encoding = 1; + + // Required. Sample rate (in Hertz) of the audio content sent in the query. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics) for + // more details. + int32 sample_rate_hertz = 2; + + // Required. The language of the supplied audio. Dialogflow does not do + // translations. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 3; + + // If `true`, Dialogflow returns + // [SpeechWordInfo][google.cloud.dialogflow.v2beta1.SpeechWordInfo] in + // [StreamingRecognitionResult][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult] + // with information about the recognized speech words, e.g. start and end time + // offsets. If false or unspecified, Speech doesn't return any word-level + // information. + bool enable_word_info = 13; + + // A list of strings containing words and phrases that the speech + // recognizer should recognize with higher likelihood. + // + // See [the Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + // for more details. + // + // This field is deprecated. Please use [speech_contexts]() instead. If you + // specify both [phrase_hints]() and [speech_contexts](), Dialogflow will + // treat the [phrase_hints]() as a single additional [SpeechContext](). + repeated string phrase_hints = 4 [deprecated = true]; + + // Context information to assist speech recognition. + // + // See [the Cloud Speech + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + // for more details. + repeated SpeechContext speech_contexts = 11; + + // Which Speech model to select for the given request. Select the + // model best suited to your domain to get best results. If a model is not + // explicitly specified, then we auto-select a model based on the parameters + // in the InputAudioConfig. + // If enhanced speech model is enabled for the agent and an enhanced + // version of the specified model for the language does not exist, then the + // speech is recognized using the standard version of the specified model. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 7; + + // Which variant of the [Speech + // model][google.cloud.dialogflow.v2beta1.InputAudioConfig.model] to use. + SpeechModelVariant model_variant = 10; + + // If `false` (default), recognition does not cease until the + // client closes the stream. + // If `true`, the recognizer will detect a single spoken utterance in input + // audio. Recognition ceases when it detects the audio's voice has + // stopped or paused. In this case, once a detected intent is received, the + // client should close the stream and start a new request with a new stream as + // needed. + // Note: This setting is relevant only for streaming methods. + // Note: When specified, InputAudioConfig.single_utterance takes precedence + // over StreamingDetectIntentRequest.single_utterance. + bool single_utterance = 8; + + // Only used in + // [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] + // and + // [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent]. + // If `false` and recognition doesn't return any result, trigger + // `NO_SPEECH_RECOGNIZED` event to Dialogflow agent. + bool disable_no_speech_recognized_event = 14; +} + +// Gender of the voice as described in +// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). +enum SsmlVoiceGender { + // An unspecified gender, which means that the client doesn't care which + // gender the selected voice will have. + SSML_VOICE_GENDER_UNSPECIFIED = 0; + + // A male voice. + SSML_VOICE_GENDER_MALE = 1; + + // A female voice. + SSML_VOICE_GENDER_FEMALE = 2; + + // A gender-neutral voice. + SSML_VOICE_GENDER_NEUTRAL = 3; +} + +// Description of which voice to use for speech synthesis. +message VoiceSelectionParams { + // Optional. The name of the voice. If not set, the service will choose a + // voice based on the other parameters such as language_code and + // [ssml_gender][google.cloud.dialogflow.v2beta1.VoiceSelectionParams.ssml_gender]. + // + // For the list of available voices, please refer to [Supported voices and + // languages](https://cloud.google.com/text-to-speech/docs/voices). + string name = 1; + + // Optional. The preferred gender of the voice. If not set, the service will + // choose a voice based on the other parameters such as language_code and + // [name][google.cloud.dialogflow.v2beta1.VoiceSelectionParams.name]. Note + // that this is only a preference, not requirement. If a voice of the + // appropriate gender is not available, the synthesizer should substitute a + // voice with a different gender rather than failing the request. + SsmlVoiceGender ssml_gender = 2; +} + +// Configuration of how speech should be synthesized. +message SynthesizeSpeechConfig { + // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal + // native speed supported by the specific voice. 2.0 is twice as fast, and + // 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any + // other values < 0.25 or > 4.0 will return an error. + double speaking_rate = 1; + + // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 + // semitones from the original pitch. -20 means decrease 20 semitones from the + // original pitch. + double pitch = 2; + + // Optional. Volume gain (in dB) of the normal native volume supported by the + // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of + // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) + // will play at approximately half the amplitude of the normal native signal + // amplitude. A value of +6.0 (dB) will play at approximately twice the + // amplitude of the normal native signal amplitude. We strongly recommend not + // to exceed +10 (dB) as there's usually no effective increase in loudness for + // any value greater than that. + double volume_gain_db = 3; + + // Optional. An identifier which selects 'audio effects' profiles that are + // applied on (post synthesized) text to speech. Effects are applied on top of + // each other in the order they are given. + repeated string effects_profile_id = 5; + + // Optional. The desired voice of the synthesized audio. + VoiceSelectionParams voice = 4; +} + +// Audio encoding of the output audio format in Text-To-Speech. +enum OutputAudioEncoding { + // Not specified. + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // Audio content returned as LINEAR16 also contains a WAV header. + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; + + // MP3 audio at 32kbps. + OUTPUT_AUDIO_ENCODING_MP3 = 2; + + // MP3 audio at 64kbps. + OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; + + // Opus encoded audio wrapped in an ogg container. The result will be a + // file which can be played natively on Android, and in browsers (at least + // Chrome and Firefox). The quality of the encoding is considerably higher + // than MP3 while using approximately the same bitrate. + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; + + // 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + OUTPUT_AUDIO_ENCODING_MULAW = 5; +} + +// Instructs the speech synthesizer how to generate the output audio content. +// If this audio config is supplied in a request, it overrides all existing +// text-to-speech settings applied to the agent. +message OutputAudioConfig { + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding audio_encoding = 1 + [(google.api.field_behavior) = REQUIRED]; + + // The synthesis sample rate (in hertz) for this audio. If not + // provided, then the synthesizer will use the default sample rate based on + // the audio encoding. If this is different from the voice's natural sample + // rate, then the synthesizer will honor this request by converting to the + // desired sample rate (which might result in worse audio quality). + int32 sample_rate_hertz = 2; + + // Configuration of how speech should be synthesized. + SynthesizeSpeechConfig synthesize_speech_config = 3; +} + +// [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling) +// digit in Telephony Gateway. +enum TelephonyDtmf { + // Not specified. This value may be used to indicate an absent digit. + TELEPHONY_DTMF_UNSPECIFIED = 0; + + // Number: '1'. + DTMF_ONE = 1; + + // Number: '2'. + DTMF_TWO = 2; + + // Number: '3'. + DTMF_THREE = 3; + + // Number: '4'. + DTMF_FOUR = 4; + + // Number: '5'. + DTMF_FIVE = 5; + + // Number: '6'. + DTMF_SIX = 6; + + // Number: '7'. + DTMF_SEVEN = 7; + + // Number: '8'. + DTMF_EIGHT = 8; + + // Number: '9'. + DTMF_NINE = 9; + + // Number: '0'. + DTMF_ZERO = 10; + + // Letter: 'A'. + DTMF_A = 11; + + // Letter: 'B'. + DTMF_B = 12; + + // Letter: 'C'. + DTMF_C = 13; + + // Letter: 'D'. + DTMF_D = 14; + + // Asterisk/star: '*'. + DTMF_STAR = 15; + + // Pound/diamond/hash/square/gate/octothorpe: '#'. + DTMF_POUND = 16; +} + +// A wrapper of repeated TelephonyDtmf digits. +message TelephonyDtmfEvents { + // A sequence of TelephonyDtmf digits. + repeated TelephonyDtmf dtmf_events = 1; +} + +// Configures speech transcription for +// [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]. +message SpeechToTextConfig { + // The speech model used in speech to text. + // `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as + // `USE_ENHANCED`. It can be overridden in + // [AnalyzeContentRequest][google.cloud.dialogflow.v2beta1.AnalyzeContentRequest] + // and + // [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest] + // request. If enhanced model variant is specified and an enhanced version of + // the specified model for the language does not exist, then it would emit an + // error. + SpeechModelVariant speech_model_variant = 1; + + // Which Speech model to select. Select the model best suited to your domain + // to get best results. If a model is not explicitly specified, then a default + // model is used. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 2; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/context.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/context.proto new file mode 100644 index 00000000000..a8e8c21f91f --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/context.proto @@ -0,0 +1,375 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ContextProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Contexts][google.cloud.dialogflow.v2beta1.Context]. +service Contexts { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all contexts in the specified session. + rpc ListContexts(ListContextsRequest) returns (ListContextsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts" + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified context. + rpc GetContext(GetContextRequest) returns (Context) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a context. + // + // If the specified context already exists, overrides the context. + rpc CreateContext(CreateContextRequest) returns (Context) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts" + body: "context" + additional_bindings { + post: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + body: "context" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + body: "context" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + body: "context" + } + }; + option (google.api.method_signature) = "parent,context"; + } + + // Updates the specified context. + rpc UpdateContext(UpdateContextRequest) returns (Context) { + option (google.api.http) = { + patch: "/v2beta1/{context.name=projects/*/agent/sessions/*/contexts/*}" + body: "context" + additional_bindings { + patch: "/v2beta1/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + body: "context" + } + additional_bindings { + patch: "/v2beta1/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}" + body: "context" + } + additional_bindings { + patch: "/v2beta1/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + body: "context" + } + }; + option (google.api.method_signature) = "context,update_mask"; + option (google.api.method_signature) = "context"; + } + + // Deletes the specified context. + rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes all active contexts in the specified session. + rpc DeleteAllContexts(DeleteAllContextsRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts" + additional_bindings { + delete: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + } + additional_bindings { + delete: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + } + additional_bindings { + delete: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + }; + option (google.api.method_signature) = "parent"; + } +} + +// Dialogflow contexts are similar to natural language context. If a person says +// to you "they are orange", you need context in order to understand what "they" +// is referring to. Similarly, for Dialogflow to handle an end-user expression +// like that, it needs to be provided with context in order to correctly match +// an intent. +// +// Using contexts, you can control the flow of a conversation. You can configure +// contexts for an intent by setting input and output contexts, which are +// identified by string names. When an intent is matched, any configured output +// contexts for that intent become active. While any contexts are active, +// Dialogflow is more likely to match intents that are configured with input +// contexts that correspond to the currently active contexts. +// +// For more information about context, see the +// [Contexts guide](https://cloud.google.com/dialogflow/docs/contexts-overview). +message Context { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Context" + pattern: "projects/{project}/agent/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + }; + + // Required. The unique identifier of the context. Supported formats: + // - `projects//agent/sessions//contexts/`, + // - `projects//locations//agent/sessions//contexts/`, + // - `projects//agent/environments//users//sessions//contexts/`, + // - `projects//locations//agent/environments//users//sessions//contexts/`, + // + // The `Context ID` is always converted to lowercase, may only contain + // characters in a-zA-Z0-9_-% and may be at most 250 bytes long. + // + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. + // + // The following context names are reserved for internal use by Dialogflow. + // You should not use these contexts or create contexts with these names: + // + // * `__system_counters__` + // * `*_id_dialog_context` + // * `*_dialog_params_size` + string name = 1; + + // Optional. The number of conversational query requests after which the + // context expires. The default is `0`. If set to `0`, the context expires + // immediately. Contexts expire automatically after 20 minutes if there + // are no matching queries. + int32 lifespan_count = 2; + + // Optional. The collection of parameters associated with this context. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 3; +} + +// The request message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. +message ListContextsRequest { + // Required. The session to list all contexts from. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts]. +message ListContextsResponse { + // The list of contexts. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Context contexts = 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 request message for [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext]. +message GetContextRequest { + // Required. The name of the context. Supported formats: + // - `projects//agent/sessions//contexts/`, + // - `projects//locations//agent/sessions//contexts/`, + // - `projects//agent/environments//users//sessions//contexts/`, + // - `projects//locations//agent/environments//users//sessions//contexts/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Context" + } + ]; +} + +// The request message for [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext]. +message CreateContextRequest { + // Required. The session to create a context for. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; + + // Required. The context to create. + Context context = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext]. +message UpdateContextRequest { + // Required. The context to update. + Context context = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext]. +message DeleteContextRequest { + // Required. The name of the context to delete. Supported formats: + // - `projects//agent/sessions//contexts/`, + // - `projects//locations//agent/sessions//contexts/`, + // - `projects//agent/environments//users//sessions//contexts/`, + // - `projects//locations//agent/environments//users//sessions//contexts/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Context" + } + ]; +} + +// The request message for [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts]. +message DeleteAllContextsRequest { + // Required. The name of the session to delete all contexts from. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified we assume default 'draft' environment. If + // `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Context" + } + ]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/conversation.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/conversation.proto new file mode 100644 index 00000000000..432d8c08024 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/conversation.proto @@ -0,0 +1,494 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/participant.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Conversations][google.cloud.dialogflow.v2beta1.Conversation]. +service Conversations { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a new conversation. Conversations are auto-completed after 24 + // hours. + // + // Conversation Lifecycle: + // There are two stages during a conversation: Automated Agent Stage and + // Assist Stage. + // + // For Automated Agent Stage, there will be a dialogflow agent responding to + // user queries. + // + // For Assist Stage, there's no dialogflow agent responding to user queries. + // But we will provide suggestions which are generated from conversation. + // + // If [Conversation.conversation_profile][google.cloud.dialogflow.v2beta1.Conversation.conversation_profile] is configured for a dialogflow + // agent, conversation will start from `Automated Agent Stage`, otherwise, it + // will start from `Assist Stage`. And during `Automated Agent Stage`, once an + // [Intent][google.cloud.dialogflow.v2beta1.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2beta1.Intent.live_agent_handoff] is triggered, conversation + // will transfer to Assist Stage. + rpc CreateConversation(CreateConversationRequest) returns (Conversation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/conversations" + body: "conversation" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/conversations" + body: "conversation" + } + }; + option (google.api.method_signature) = "parent,conversation"; + } + + // Returns the list of all conversations in the specified project. + rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/conversations" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/conversations" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specific conversation. + rpc GetConversation(GetConversationRequest) returns (Conversation) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/conversations/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/conversations/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Completes the specified conversation. Finished conversations are purged + // from the database after 30 days. + rpc CompleteConversation(CompleteConversationRequest) returns (Conversation) { + option (google.api.http) = { + post: "/v2beta1/{name=projects/*/conversations/*}:complete" + body: "*" + additional_bindings { + post: "/v2beta1/{name=projects/*/locations/*/conversations/*}:complete" + body: "*" + } + }; + option (google.api.method_signature) = "name"; + } + + // Batch ingests messages to conversation. Customers can use this RPC to + // ingest historical messages to conversation. + rpc BatchCreateMessages(BatchCreateMessagesRequest) returns (BatchCreateMessagesResponse) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*}/messages:batchCreate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages:batchCreate" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Lists messages that belong to a given conversation. + // `messages` are ordered by `create_time` in descending order. To fetch + // updates without duplication, send request with filter + // `create_time_epoch_microseconds > + // [first item's create_time of previous request]` and empty page_token. + rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/conversations/*}/messages" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Suggest summary for a conversation based on specific historical messages. + // The range of the messages to be used for summary can be specified in the + // request. + rpc SuggestConversationSummary(SuggestConversationSummaryRequest) returns (SuggestConversationSummaryResponse) { + option (google.api.http) = { + post: "/v2beta1/{conversation=projects/*/conversations/*}/suggestions:suggestConversationSummary" + body: "*" + additional_bindings { + post: "/v2beta1/{conversation=projects/*/locations/*/conversations/*}/suggestions:suggestConversationSummary" + body: "*" + } + }; + option (google.api.method_signature) = "conversation"; + } +} + +// Represents a conversation. +// A conversation is an interaction between an agent, including live agents +// and Dialogflow agents, and a support customer. Conversations can +// include phone calls and text-based chat sessions. +message Conversation { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Conversation" + pattern: "projects/{project}/conversations/{conversation}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}" + }; + + // Enumeration of the completion status of the conversation. + enum LifecycleState { + // Unknown. + LIFECYCLE_STATE_UNSPECIFIED = 0; + + // Conversation is currently open for media analysis. + IN_PROGRESS = 1; + + // Conversation has been completed. + COMPLETED = 2; + } + + // Enumeration of the different conversation stages a conversation can be in. + // Reference: + // https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages + enum ConversationStage { + // Unknown. Should never be used after a conversation is successfully + // created. + CONVERSATION_STAGE_UNSPECIFIED = 0; + + // The conversation should return virtual agent responses into the + // conversation. + VIRTUAL_AGENT_STAGE = 1; + + // The conversation should not provide responses, just listen and provide + // suggestions. + HUMAN_ASSIST_STAGE = 2; + } + + // Output only. The unique identifier of this conversation. + // Format: `projects//locations//conversations/`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the Conversation. + LifecycleState lifecycle_state = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. The Conversation Profile to be used to configure this + // Conversation. This field cannot be updated. + // Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // Output only. Required if the conversation is to be connected over + // telephony. + ConversationPhoneNumber phone_number = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The stage of a conversation. It indicates whether the virtual agent or a + // human agent is handling the conversation. + // + // If the conversation is created with the conversation profile that has + // Dialogflow config set, defaults to + // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]; Otherwise, defaults to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. + // + // If the conversation is created with the conversation profile that has + // Dialogflow config set but explicitly sets conversation_stage to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE], it skips + // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE] stage and directly goes to + // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE]. + ConversationStage conversation_stage = 7; + + // Output only. The time the conversation was started. + google.protobuf.Timestamp start_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the conversation was finished. + google.protobuf.Timestamp end_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represents a phone number for telephony integration. It allows for connecting +// a particular conversation over telephony. +message ConversationPhoneNumber { + // Output only. The phone number to connect to this conversation. + string phone_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Conversations.CreateConversation][google.cloud.dialogflow.v2beta1.Conversations.CreateConversation]. +message CreateConversationRequest { + // Required. Resource identifier of the project creating the conversation. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Required. The conversation to create. + Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Identifier of the conversation. Generally it's auto generated by Google. + // Only set it if you cannot wait for the response to return a + // auto-generated one to you. + // + // The conversation ID must be compliant with the regression fomula + // "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64]. + // If the field is provided, the caller is resposible for + // 1. the uniqueness of the ID, otherwise the request will be rejected. + // 2. the consistency for whether to use custom ID or not under a project to + // better ensure uniqueness. + string conversation_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Conversations.ListConversations][google.cloud.dialogflow.v2beta1.Conversations.ListConversations]. +message ListConversationsRequest { + // Required. The project from which to list all conversation. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; + + // A filter expression that filters conversations listed in the response. In + // general, the expression must specify the field name, a comparison operator, + // and the value to use for filtering: + //
    + //
  • The value must be a string, a number, or a boolean.
  • + //
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + //
  • To filter on multiple expressions, separate the + // expressions with `AND` or `OR` (omitting both implies `AND`).
  • + //
  • For clarity, expressions can be enclosed in parentheses.
  • + //
+ // Only `lifecycle_state` can be filtered on in this way. For example, + // the following expression only returns `COMPLETED` conversations: + // + // `lifecycle_state = "COMPLETED"` + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// The response message for [Conversations.ListConversations][google.cloud.dialogflow.v2beta1.Conversations.ListConversations]. +message ListConversationsResponse { + // The list of conversations. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Conversation conversations = 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 request message for [Conversations.GetConversation][google.cloud.dialogflow.v2beta1.Conversations.GetConversation]. +message GetConversationRequest { + // Required. The name of the conversation. Format: + // `projects//locations//conversations/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; +} + +// The request message for [Conversations.CompleteConversation][google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation]. +message CompleteConversationRequest { + // Required. Resource identifier of the conversation to close. + // Format: `projects//locations//conversations/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; +} + +// The request message to create one Message. Currently it is only used in +// BatchCreateMessagesRequest. +message CreateMessageRequest { + // Required. Resource identifier of the conversation to create message. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Required. The message to create. + // [Message.participant][google.cloud.dialogflow.v2beta1.Message.participant] is required. + Message message = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Conversations.BatchCreateMessagesRequest][]. +message BatchCreateMessagesRequest { + // Required. Resource identifier of the conversation to create message. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // Required. A maximum of 1000 Messages can be created in a batch. + // [CreateMessageRequest.message.send_time][] is required. All created + // messages will have identical [Message.create_time][google.cloud.dialogflow.v2beta1.Message.create_time]. + repeated CreateMessageRequest requests = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Conversations.BatchCreateMessagesResponse][]. +message BatchCreateMessagesResponse { + // Messages created. + repeated Message messages = 1; +} + +// The request message for [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages]. +message ListMessagesRequest { + // Required. The name of the conversation to list messages for. + // Format: `projects//locations//conversations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Filter on message fields. Currently predicates on `create_time` + // and `create_time_epoch_microseconds` are supported. `create_time` only + // support milliseconds accuracy. E.g., + // `create_time_epoch_microseconds > 1551790877964485` or + // `create_time > "2017-01-15T01:30:15.01Z"`. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages]. +message ListMessagesResponse { + // Required. The list of messages. There will be a maximum number of items + // returned based on the page_size field in the request. + // `messages` is sorted by `create_time` in descending order. + repeated Message messages = 1; + + // Optional. 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 request message for [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary]. +message SuggestConversationSummaryRequest { + // Required. The conversation to fetch suggestion for. + // Format: `projects//locations//conversations/`. + string conversation = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Conversation" + } + ]; + + // The name of the latest conversation message used as context for + // compiling suggestion. If empty, the latest message of the conversation will + // be used. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 3 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. By default 500 and at most 1000. + int32 context_size = 4; +} + +// The response message for [Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary]. +message SuggestConversationSummaryResponse { + // Generated summary for a conversation. + message Summary { + // The summary content that is concatenated into one string. + string text = 1; + + // The summary content that is divided into sections. The key is the + // section's name and the value is the section's content. There is no + // specific format for the key or value. + map text_sections = 4; + + // The name of the answer record. Format: + // "projects//answerRecords/" + string answer_record = 3 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/AnswerRecord" + }]; + } + + // Generated summary. + Summary summary = 1; + + // The name of the latest conversation message used as context for + // compiling suggestion. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Number of messages prior to and including + // [last_conversation_message][] used to compile the suggestion. It may be + // smaller than the [SuggestSummaryRequest.context_size][] field in the + // request if there weren't that many messages in the conversation. + int32 context_size = 3; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto new file mode 100644 index 00000000000..7f47dcee08a --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/conversation_event.proto @@ -0,0 +1,85 @@ +// 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.dialogflow.v2beta1; + +import "google/cloud/dialogflow/v2beta1/participant.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationEventProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Represents a notification sent to Pub/Sub subscribers for conversation +// lifecycle events. +message ConversationEvent { + // Enumeration of the types of events available. + enum Type { + // Type not set. + TYPE_UNSPECIFIED = 0; + + // A new conversation has been opened. This is fired when a telephone call + // is answered, or a conversation is created via the API. + CONVERSATION_STARTED = 1; + + // An existing conversation has closed. This is fired when a telephone call + // is terminated, or a conversation is closed via the API. + CONVERSATION_FINISHED = 2; + + // An existing conversation has received notification from Dialogflow that + // human intervention is required. + HUMAN_INTERVENTION_NEEDED = 3; + + // An existing conversation has received a new message, either from API or + // telephony. It is configured in + // [ConversationProfile.new_message_event_notification_config][google.cloud.dialogflow.v2beta1.ConversationProfile.new_message_event_notification_config] + NEW_MESSAGE = 5; + + // Unrecoverable error during a telephone call. + // + // In general non-recoverable errors only occur if something was + // misconfigured in the ConversationProfile corresponding to the call. After + // a non-recoverable error, Dialogflow may stop responding. + // + // We don't fire this event: + // + // * in an API call because we can directly return the error, or, + // * when we can recover from an error. + UNRECOVERABLE_ERROR = 4; + } + + // Required. The unique identifier of the conversation this notification + // refers to. + // Format: `projects//conversations/`. + string conversation = 1; + + // Required. The type of the event that this notification refers to. + Type type = 2; + + // Optional. More detailed information about an error. Only set for type + // UNRECOVERABLE_ERROR_IN_PHONE_CALL. + google.rpc.Status error_status = 3; + + // Payload of conversation event. + oneof payload { + // Payload of NEW_MESSAGE event. + Message new_message_payload = 4; + } +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto new file mode 100644 index 00000000000..0c1f5529620 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto @@ -0,0 +1,735 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; +import "google/cloud/dialogflow/v2beta1/participant.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ConversationProfileProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/CXSecuritySettings" + pattern: "projects/{project}/locations/{location}/securitySettings/{security_settings}" +}; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/ConversationModel" + pattern: "projects/{project}/locations/{location}/conversationModels/{conversation_model}" +}; + +// Service for managing [ConversationProfiles][google.cloud.dialogflow.v2beta1.ConversationProfile]. +service ConversationProfiles { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all conversation profiles in the specified project. + rpc ListConversationProfiles(ListConversationProfilesRequest) returns (ListConversationProfilesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/conversationProfiles" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified conversation profile. + rpc GetConversationProfile(GetConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/conversationProfiles/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a conversation profile in the specified project. + // + // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] + // aren't populated in the response. You can retrieve them via + // [GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile] API. + rpc CreateConversationProfile(CreateConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/conversationProfiles" + body: "conversation_profile" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles" + body: "conversation_profile" + } + }; + option (google.api.method_signature) = "parent,conversation_profile"; + } + + // Updates the specified conversation profile. + // + // [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] + // aren't populated in the response. You can retrieve them via + // [GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile] API. + rpc UpdateConversationProfile(UpdateConversationProfileRequest) returns (ConversationProfile) { + option (google.api.http) = { + patch: "/v2beta1/{conversation_profile.name=projects/*/conversationProfiles/*}" + body: "conversation_profile" + additional_bindings { + patch: "/v2beta1/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}" + body: "conversation_profile" + } + }; + option (google.api.method_signature) = "conversation_profile,update_mask"; + } + + // Deletes the specified conversation profile. + rpc DeleteConversationProfile(DeleteConversationProfileRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/conversationProfiles/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Adds or updates a suggestion feature in a conversation profile. + // If the conversation profile contains the type of suggestion feature for + // the participant role, it will update it. Otherwise it will insert the + // suggestion feature. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata] + // - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile] + // + // If a long running operation to add or update suggestion feature + // config for the same conversation profile, participant role and suggestion + // feature type exists, please cancel the existing long running operation + // before sending such request, otherwise the request will be rejected. + rpc SetSuggestionFeatureConfig(SetSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig" + body: "*" + additional_bindings { + post: "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig" + body: "*" + } + }; + option (google.api.method_signature) = "conversation_profile"; + option (google.longrunning.operation_info) = { + response_type: "ConversationProfile" + metadata_type: "SetSuggestionFeatureConfigOperationMetadata" + }; + } + + // Clears a suggestion feature from a conversation profile for the given + // participant role. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata] + // - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile] + rpc ClearSuggestionFeatureConfig(ClearSuggestionFeatureConfigRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig" + body: "*" + additional_bindings { + post: "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig" + body: "*" + } + }; + option (google.api.method_signature) = "conversation_profile"; + option (google.longrunning.operation_info) = { + response_type: "ConversationProfile" + metadata_type: "ClearSuggestionFeatureConfigOperationMetadata" + }; + } +} + +// Defines the services to connect to incoming Dialogflow conversations. +message ConversationProfile { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/ConversationProfile" + pattern: "projects/{project}/conversationProfiles/{conversation_profile}" + pattern: "projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}" + }; + + // The unique identifier of this conversation profile. + // Format: `projects//locations//conversationProfiles/`. + string name = 1; + + // Required. Human readable name for this profile. Max length 1024 bytes. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Create time of the conversation profile. + google.protobuf.Timestamp create_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Update time of the conversation profile. + google.protobuf.Timestamp update_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configuration for an automated agent to use with this profile. + AutomatedAgentConfig automated_agent_config = 3; + + // Configuration for agent assistance to use with this profile. + HumanAgentAssistantConfig human_agent_assistant_config = 4; + + // Configuration for connecting to a live agent. + // + // Currently, this feature is not general available, please contact Google + // to get access. + HumanAgentHandoffConfig human_agent_handoff_config = 5; + + // Configuration for publishing conversation lifecycle events. + NotificationConfig notification_config = 6; + + // Configuration for logging conversation lifecycle events. + LoggingConfig logging_config = 7; + + // Configuration for publishing new message events. Event will be sent in + // format of [ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent] + NotificationConfig new_message_event_notification_config = 8; + + // Settings for speech transcription. + SpeechToTextConfig stt_config = 9; + + // Language code for the conversation profile. If not specified, the language + // is en-US. Language at ConversationProfile should be set for all non en-us + // languages. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 10; + + // The time zone of this conversational profile from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. Defaults to America/New_York. + string time_zone = 14; + + // Name of the CX SecuritySettings reference for the agent. + // Format: `projects//locations//securitySettings/`. + string security_settings = 13 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/CXSecuritySettings" + }]; +} + +// Defines the Automated Agent to connect to a conversation. +message AutomatedAgentConfig { + // Required. ID of the Dialogflow agent environment to use. + // + // This project needs to either be the same project as the conversation or you + // need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API + // Service Agent` role in this project. + // + // - For ES agents, use format: `projects//locations//agent/environments/`. If environment is not + // specified, the default `draft` environment is used. Refer to + // [DetectIntentRequest](/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2beta1#google.cloud.dialogflow.v2beta1.DetectIntentRequest) + // for more details. + // + // - For CX agents, use format `projects//locations//agents//environments/`. If environment is not specified, the default `draft` environment + // is used. + string agent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; +} + +// Defines the Human Agent Assistant to connect to a conversation. +message HumanAgentAssistantConfig { + // Settings of suggestion trigger. + message SuggestionTriggerSettings { + // Do not trigger if last utterance is small talk. + bool no_small_talk = 1; + + // Only trigger suggestion if participant role of last utterance is + // END_USER. + bool only_end_user = 2; + } + + // Config for suggestion features. + message SuggestionFeatureConfig { + // The suggestion feature. + SuggestionFeature suggestion_feature = 5; + + // Automatically iterates all participants and tries to compile + // suggestions. + // + // Supported features: ARTICLE_SUGGESTION, FAQ, DIALOGFLOW_ASSIST. + bool enable_event_based_suggestion = 3; + + // Settings of suggestion trigger. + // + // Currently, only ARTICLE_SUGGESTION, FAQ, and DIALOGFLOW_ASSIST will use + // this field. + SuggestionTriggerSettings suggestion_trigger_settings = 10; + + // Configs of query. + SuggestionQueryConfig query_config = 6; + + // Configs of custom conversation model. + ConversationModelConfig conversation_model_config = 7; + + // Configs for processing conversation. + ConversationProcessConfig conversation_process_config = 8; + } + + // Detail human agent assistant config. + message SuggestionConfig { + // Configuration of different suggestion features. One feature can have only + // one config. + repeated SuggestionFeatureConfig feature_configs = 2; + + // If `group_suggestion_responses` is false, and there are multiple + // `feature_configs` in `event based suggestion` or + // StreamingAnalyzeContent, we will try to deliver suggestions to customers + // as soon as we get new suggestion. Different type of suggestions based on + // the same context will be in separate Pub/Sub event or + // `StreamingAnalyzeContentResponse`. + // + // If `group_suggestion_responses` set to true. All the suggestions to the + // same participant based on the same context will be grouped into a single + // Pub/Sub event or StreamingAnalyzeContentResponse. + bool group_suggestion_responses = 3; + } + + // Config for suggestion query. + message SuggestionQueryConfig { + // Knowledge base source settings. + // + // Supported features: ARTICLE_SUGGESTION, FAQ. + message KnowledgeBaseQuerySource { + // Required. Knowledge bases to query. Format: + // `projects//locations//knowledgeBases/`. Currently, only one knowledge + // base is supported. + repeated string knowledge_bases = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + } + + // Document source settings. + // + // Supported features: SMART_REPLY, SMART_COMPOSE. + message DocumentQuerySource { + // Required. Knowledge documents to query from. Format: + // `projects//locations//knowledgeBases//documents/`. + // Currently, only one document is supported. + repeated string documents = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + } + + // Dialogflow source setting. + // + // Supported feature: DIALOGFLOW_ASSIST. + message DialogflowQuerySource { + // Required. The name of a dialogflow virtual agent used for end user side intent + // detection and suggestion. Format: `projects//locations//agent`. When multiple agents are allowed in + // the same Dialogflow project. + string agent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Agent" + } + ]; + } + + // Settings that determine how to filter recent conversation context when + // generating suggestions. + message ContextFilterSettings { + // If set to true, the last message from virtual agent (hand off message) + // and the message before it (trigger message of hand off) are dropped. + bool drop_handoff_messages = 1; + + // If set to true, all messages from virtual agent are dropped. + bool drop_virtual_agent_messages = 2; + + // If set to true, all messages from ivr stage are dropped. + bool drop_ivr_messages = 3; + } + + // Source of query. + oneof query_source { + // Query from knowledgebase. It is used by: + // ARTICLE_SUGGESTION, FAQ. + KnowledgeBaseQuerySource knowledge_base_query_source = 1; + + // Query from knowledge base document. It is used by: + // SMART_REPLY, SMART_COMPOSE. + DocumentQuerySource document_query_source = 2; + + // Query from Dialogflow agent. It is used by DIALOGFLOW_ASSIST. + DialogflowQuerySource dialogflow_query_source = 3; + } + + // Maximum number of results to return. Currently, if unset, defaults to 10. + // And the max number is 20. + int32 max_results = 4; + + // Confidence threshold of query result. + // + // Agent Assist gives each suggestion a score in the range [0.0, 1.0], based + // on the relevance between the suggestion and the current conversation + // context. A score of 0.0 has no relevance, while a score of 1.0 has high + // relevance. Only suggestions with a score greater than or equal to the + // value of this field are included in the results. + // + // For a baseline model (the default), the recommended value is in the range + // [0.05, 0.1]. + // + // For a custom model, there is no recommended value. Tune this value by + // starting from a very low value and slowly increasing until you have + // desired results. + // + // If this field is not set, it is default to 0.0, which means that all + // suggestions are returned. + // + // Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE. + float confidence_threshold = 5; + + // Determines how recent conversation context is filtered when generating + // suggestions. If unspecified, no messages will be dropped. + ContextFilterSettings context_filter_settings = 7; + } + + // Custom conversation models used in agent assist feature. + // + // Supported feature: ARTICLE_SUGGESTION, SMART_COMPOSE, SMART_REPLY, + // CONVERSATION_SUMMARIZATION. + message ConversationModelConfig { + // Conversation model resource name. Format: `projects//conversationModels/`. + string model = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationModel" + }]; + } + + // Config to process conversation. + message ConversationProcessConfig { + // Number of recent non-small-talk sentences to use as context for article + // and FAQ suggestion + int32 recent_sentences_count = 2; + } + + // Configuration for analyses to run on each conversation message. + message MessageAnalysisConfig { + // Enable entity extraction in conversation messages on [agent assist + // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). + // If unspecified, defaults to false. + // + // Currently, this feature is not general available, please contact Google + // to get access. + bool enable_entity_extraction = 2; + + // Enable sentiment analysis in conversation messages on [agent assist + // stage](https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages). + // If unspecified, defaults to false. Sentiment analysis inspects user input + // and identifies the prevailing subjective opinion, especially to determine + // a user's attitude as positive, negative, or neutral: + // https://cloud.google.com/natural-language/docs/basics#sentiment_analysis + // For [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] method, result will be in + // [StreamingAnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.message]. + // For [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] method, result will be in + // [AnalyzeContentResponse.message.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.message] + // For [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages] method, result will be in + // [ListMessagesResponse.messages.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.ListMessagesResponse.messages] + // If Pub/Sub notification is configured, result will be in + // [ConversationEvent.new_message_payload.SentimentAnalysisResult][google.cloud.dialogflow.v2beta1.ConversationEvent.new_message_payload]. + bool enable_sentiment_analysis = 3; + } + + // Pub/Sub topic on which to publish new agent assistant events. + NotificationConfig notification_config = 2; + + // Configuration for agent assistance of human agent participant. + SuggestionConfig human_agent_suggestion_config = 3; + + // Configuration for agent assistance of end user participant. + // + // Currently, this feature is not general available, please contact Google + // to get access. + SuggestionConfig end_user_suggestion_config = 4; + + // Configuration for message analysis. + MessageAnalysisConfig message_analysis_config = 5; +} + +// Defines the hand off to a live agent, typically on which external agent +// service provider to connect to a conversation. +// +// Currently, this feature is not general available, please contact Google +// to get access. +message HumanAgentHandoffConfig { + // Configuration specific to LivePerson (https://www.liveperson.com). + message LivePersonConfig { + // Required. Account number of the LivePerson account to connect. This is + // the account number you input at the login page. + string account_number = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // Configuration specific to Salesforce Live Agent. + message SalesforceLiveAgentConfig { + // Required. The organization ID of the Salesforce account. + string organization_id = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Live Agent deployment ID. + string deployment_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Live Agent chat button ID. + string button_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Domain of the Live Agent endpoint for this agent. You can find + // the endpoint URL in the `Live Agent settings` page. For example if URL + // has the form https://d.la4-c2-phx.salesforceliveagent.com/..., + // you should fill in d.la4-c2-phx.salesforceliveagent.com. + string endpoint_domain = 4 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Specifies which agent service to connect for human agent handoff. + oneof agent_service { + // Uses LivePerson (https://www.liveperson.com). + LivePersonConfig live_person_config = 1; + + // Uses Salesforce Live Agent. + SalesforceLiveAgentConfig salesforce_live_agent_config = 2; + } +} + +// Defines notification behavior. +message NotificationConfig { + // Format of cloud pub/sub message. + enum MessageFormat { + // If it is unspecified, PROTO will be used. + MESSAGE_FORMAT_UNSPECIFIED = 0; + + // Pubsub message will be serialized proto. + PROTO = 1; + + // Pubsub message will be json. + JSON = 2; + } + + // Name of the Pub/Sub topic to publish conversation + // events like + // [CONVERSATION_STARTED][google.cloud.dialogflow.v2beta1.ConversationEvent.Type.CONVERSATION_STARTED] as + // serialized [ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent] protos. + // + // For telephony integration to receive notification, make sure either this + // topic is in the same project as the conversation or you grant + // `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow Service + // Agent` role in the topic project. + // + // For chat integration to receive notification, make sure API caller has been + // granted the `Dialogflow Service Agent` role for the topic. + // + // Format: `projects//locations//topics/`. + string topic = 1; + + // Format of message. + MessageFormat message_format = 2; +} + +// Defines logging behavior for conversation lifecycle events. +message LoggingConfig { + // Whether to log conversation events like + // [CONVERSATION_STARTED][google.cloud.dialogflow.v2beta1.ConversationEvent.Type.CONVERSATION_STARTED] to + // Stackdriver in the conversation project as JSON format + // [ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent] protos. + bool enable_stackdriver_logging = 3; +} + +// The request message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles]. +message ListConversationProfilesRequest { + // Required. The project to list all conversation profiles from. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles]. +message ListConversationProfilesResponse { + // The list of project conversation profiles. There is a maximum number + // of items returned based on the page_size field in the request. + repeated ConversationProfile conversation_profiles = 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 request message for [ConversationProfiles.GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile]. +message GetConversationProfileRequest { + // Required. The resource name of the conversation profile. + // Format: `projects//locations//conversationProfiles/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; +} + +// The request message for [ConversationProfiles.CreateConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfile]. +message CreateConversationProfileRequest { + // Required. The project to create a conversation profile for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; + + // Required. The conversation profile to create. + ConversationProfile conversation_profile = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.UpdateConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfile]. +message UpdateConversationProfileRequest { + // Required. The conversation profile to update. + ConversationProfile conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.DeleteConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfile]. +// +// This operation fails if the conversation profile is still referenced from +// a phone number. +message DeleteConversationProfileRequest { + // Required. The name of the conversation profile to delete. + // Format: `projects//locations//conversationProfiles/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/ConversationProfile" + } + ]; +} + +// The request message for +// [ConversationProfiles.SetSuggestionFeature][]. +message SetSuggestionFeatureConfigRequest { + // Required. The Conversation Profile to add or update the suggestion feature + // config. Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The participant role to add or update the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The suggestion feature config to add or update. + HumanAgentAssistantConfig.SuggestionFeatureConfig suggestion_feature_config = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [ConversationProfiles.ClearFeature][]. +message ClearSuggestionFeatureConfigRequest { + // Required. The Conversation Profile to add or update the suggestion feature + // config. Format: `projects//locations//conversationProfiles/`. + string conversation_profile = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The participant role to remove the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to remove. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata for a [ConversationProfile.SetSuggestionFeatureConfig][] +// operation. +message SetSuggestionFeatureConfigOperationMetadata { + // The resource name of the conversation profile. Format: + // `projects//locations//conversationProfiles/` + string conversation_profile = 1; + + // Required. The participant role to add or update the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to add or update. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp whe the request was created. The time is measured on server side. + google.protobuf.Timestamp create_time = 4; +} + +// Metadata for a [ConversationProfile.ClearSuggestionFeatureConfig][] +// operation. +message ClearSuggestionFeatureConfigOperationMetadata { + // The resource name of the conversation profile. Format: + // `projects//locations//conversationProfiles/` + string conversation_profile = 1; + + // Required. The participant role to remove the suggestion feature + // config. Only HUMAN_AGENT or END_USER can be used. + Participant.Role participant_role = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The type of the suggestion feature to remove. + SuggestionFeature.Type suggestion_feature_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Timestamp whe the request was created. The time is measured on server side. + google.protobuf.Timestamp create_time = 4; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/document.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/document.proto new file mode 100644 index 00000000000..9ecdb5fb54c --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/document.proto @@ -0,0 +1,612 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/gcs.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing knowledge [Documents][google.cloud.dialogflow.v2beta1.Document]. +service Documents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all documents of the knowledge base. + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified document. + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc GetDocument(GetDocumentRequest) returns (Document) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new document. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc CreateDocument(CreateDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents" + body: "document" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + body: "document" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" + body: "document" + } + }; + option (google.api.method_signature) = "parent,document"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Create documents by importing data from external sources. + // Dialogflow supports up to 350 documents in each request. If you try to + // import more, Dialogflow will return an error. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2beta1.ImportDocumentsResponse] + rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents:import" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "ImportDocumentsResponse" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Deletes the specified document. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc DeleteDocument(DeleteDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Updates the specified document. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc UpdateDocument(UpdateDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2beta1/{document.name=projects/*/knowledgeBases/*/documents/*}" + body: "document" + additional_bindings { + patch: "/v2beta1/{document.name=projects/*/locations/*/knowledgeBases/*/documents/*}" + body: "document" + } + additional_bindings { + patch: "/v2beta1/{document.name=projects/*/agent/knowledgeBases/*/documents/*}" + body: "document" + } + }; + option (google.api.method_signature) = "document,update_mask"; + option (google.api.method_signature) = "document"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } + + // Reloads the specified document from its specified source, content_uri or + // content. The previously loaded content of the document will be deleted. + // Note: Even when the content of the document has not changed, there still + // may be side effects because of internal implementation changes. + // Note: If the document source is Google Cloud Storage URI, its metadata will + // be replaced with the custom metadata from Google Cloud Storage if the + // `import_gcs_custom_metadata` field is set to true in the request. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] + // - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] + // + // Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + // only use `projects.knowledgeBases.documents`. + rpc ReloadDocument(ReloadDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}:reload" + body: "*" + additional_bindings { + post: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:reload" + body: "*" + } + additional_bindings { + post: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload" + body: "*" + } + }; + option (google.api.method_signature) = "name,gcs_source"; + option (google.longrunning.operation_info) = { + response_type: "Document" + metadata_type: "KnowledgeOperationMetadata" + }; + } +} + +// A knowledge document to be used by a [KnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBase]. +// +// For more information, see the [knowledge base +// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). +// +// Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; +// only use `projects.knowledgeBases.documents`. +message Document { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Document" + pattern: "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}" + pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}" + }; + + // The knowledge type of document content. + enum KnowledgeType { + option allow_alias = true; + + // The type is unspecified or arbitrary. + KNOWLEDGE_TYPE_UNSPECIFIED = 0; + + // The document content contains question and answer pairs as either HTML or + // CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats + // may fail to be parsed. + // + // CSV must have questions in the first column and answers in the second, + // with no header. Because of this explicit format, they are always parsed + // accurately. + FAQ = 1; + + // Documents for which unstructured text is extracted and used for + // question answering. + EXTRACTIVE_QA = 2; + + // The entire document content as a whole can be used for query results. + // Only for Contact Center Solutions on Dialogflow. + ARTICLE_SUGGESTION = 3; + + // The document contains agent-facing Smart Reply entries. + AGENT_FACING_SMART_REPLY = 4; + + // The legacy enum for agent-facing smart reply feature. + SMART_REPLY = 4; + } + + // The status of a reload attempt. + message ReloadStatus { + // Output only. The time of a reload attempt. + // This reload may have been triggered automatically or manually and may + // not have succeeded. + google.protobuf.Timestamp time = 1; + + // Output only. The status of a reload attempt or the initial load. + google.rpc.Status status = 2; + } + + // Possible states of the document + enum State { + // The document state is unspecified. + STATE_UNSPECIFIED = 0; + + // The document creation is in progress. + CREATING = 1; + + // The document is active and ready to use. + ACTIVE = 2; + + // The document updation is in progress. + UPDATING = 3; + + // The document is reloading. + RELOADING = 4; + + // The document deletion is in progress. + DELETING = 5; + } + + // Optional. The document resource name. + // The name must be empty when creating a document. + // Format: `projects//locations//knowledgeBases//documents/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The display name of the document. The name must be 1024 bytes or + // less; otherwise, the creation request fails. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The MIME type of this document. + string mime_type = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. The knowledge type of document content. + repeated KnowledgeType knowledge_types = 4 [(google.api.field_behavior) = REQUIRED]; + + // The source of this document. + oneof source { + // The URI where the file content is located. + // + // For documents stored in Google Cloud Storage, these URIs must have + // the form `gs:///`. + // + // NOTE: External URLs must correspond to public webpages, i.e., they must + // be indexed by Google Search. In particular, URLs for showing documents in + // Google Cloud Storage (i.e. the URL in your browser) are not supported. + // Instead use the `gs://` format URI described above. + string content_uri = 5; + + // The raw content of the document. This field is only permitted for + // EXTRACTIVE_QA and FAQ knowledge types. + // Note: This field is in the process of being deprecated, please use + // raw_content instead. + string content = 6 [deprecated = true]; + + // The raw content of the document. This field is only permitted for + // EXTRACTIVE_QA and FAQ knowledge types. + bytes raw_content = 9; + } + + // Optional. If true, we try to automatically reload the document every day + // (at a time picked by the system). If false or unspecified, we don't try + // to automatically reload the document. + // + // Currently you can only enable automatic reload for documents sourced from + // a public url, see `source` field for the source types. + // + // Reload status can be tracked in `latest_reload_status`. If a reload + // fails, we will keep the document unchanged. + // + // If a reload fails with internal errors, the system will try to reload the + // document on the next day. + // If a reload fails with non-retriable errors (e.g. PERMISSION_DENIED), the + // system will not try to reload the document anymore. You need to manually + // reload the document successfully by calling `ReloadDocument` and clear the + // errors. + bool enable_auto_reload = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The time and status of the latest reload. + // This reload may have been triggered automatically or manually + // and may not have succeeded. + ReloadStatus latest_reload_status = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Metadata for the document. The metadata supports arbitrary + // key-value pairs. Suggested use cases include storing a document's title, + // an external URL distinct from the document's content_uri, etc. + // The max size of a `key` or a `value` of the metadata is 1024 bytes. + map metadata = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The current state of the document. + State state = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request message for [Documents.GetDocument][google.cloud.dialogflow.v2beta1.Documents.GetDocument]. +message GetDocumentRequest { + // Required. The name of the document to retrieve. + // Format `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; +} + +// Request message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. +message ListDocumentsRequest { + // Required. The knowledge base to list all documents for. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; + + // The filter expression used to filter documents returned by the list method. + // The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * knowledge_types with has(:) operator + // * display_name with has(:) operator + // * state with equals(=) operator + // + // Examples: + // + // * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + // * "display_name:customer" matches documents whose display name contains + // "customer". + // * "state=ACTIVE" matches documents with ACTIVE state. + // * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// Response message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. +message ListDocumentsResponse { + // The list of documents. + repeated Document documents = 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 [Documents.CreateDocument][google.cloud.dialogflow.v2beta1.Documents.CreateDocument]. +message CreateDocumentRequest { + // Required. The knowledge base to create a document for. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // Required. The document to create. + Document document = 2 [(google.api.field_behavior) = REQUIRED]; + + // Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 3; +} + +// Request message for [Documents.ImportDocuments][google.cloud.dialogflow.v2beta1.Documents.ImportDocuments]. +message ImportDocumentsRequest { + // Required. The knowledge base to import documents into. + // Format: `projects//locations//knowledgeBases/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Document" + } + ]; + + // Required. The source to use for importing documents. + // + // If the source captures multiple objects, then multiple documents will be + // created, one corresponding to each object, and all of these documents will + // be created using the same document template. + // + // Dialogflow supports up to 350 documents in each request. If you try to + // import more, Dialogflow will return an error. + oneof source { + // The Google Cloud Storage location for the documents. + // The path can include a wildcard. + // + // These URIs may have the forms + // `gs:///`. + // `gs:////*.`. + GcsSources gcs_source = 2; + } + + // Required. Document template used for importing all the documents. + ImportDocumentTemplate document_template = 3 [(google.api.field_behavior) = REQUIRED]; + + // Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 4; +} + +// The template used for importing documents. +message ImportDocumentTemplate { + // Required. The MIME type of the document. + string mime_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The knowledge type of document content. + repeated Document.KnowledgeType knowledge_types = 2 [(google.api.field_behavior) = REQUIRED]; + + // Metadata for the document. The metadata supports arbitrary + // key-value pairs. Suggested use cases include storing a document's title, + // an external URL distinct from the document's content_uri, etc. + // The max size of a `key` or a `value` of the metadata is 1024 bytes. + map metadata = 3; +} + +// Response message for [Documents.ImportDocuments][google.cloud.dialogflow.v2beta1.Documents.ImportDocuments]. +message ImportDocumentsResponse { + // Includes details about skipped documents or any other warnings. + repeated google.rpc.Status warnings = 1; +} + +// Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2beta1.Documents.DeleteDocument]. +message DeleteDocumentRequest { + // Required. The name of the document to delete. + // Format: `projects//locations//knowledgeBases//documents/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; +} + +// Request message for [Documents.UpdateDocument][google.cloud.dialogflow.v2beta1.Documents.UpdateDocument]. +message UpdateDocumentRequest { + // Required. The document to update. + Document document = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Not specified means `update all`. + // Currently, only `display_name` can be updated, an InvalidArgument will be + // returned for attempting to update other fields. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Metadata related to the Export Data Operations (e.g. ExportDocument). +message ExportOperationMetadata { + // Cloud Storage file path of the exported data. + GcsDestination exported_gcs_destination = 1; +} + +// Metadata in google::longrunning::Operation for Knowledge operations. +message KnowledgeOperationMetadata { + // States of the operation. + enum State { + // State unspecified. + STATE_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + } + + // Required. Output only. The current state of this operation. + State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The name of the knowledge base interacted with during the operation. + string knowledge_base = 3; + + // Additional metadata for the Knowledge operation. + oneof operation_metadata { + // Metadata for the Export Data Operation such as the destination of export. + ExportOperationMetadata export_operation_metadata = 4; + } +} + +// Request message for [Documents.ReloadDocument][google.cloud.dialogflow.v2beta1.Documents.ReloadDocument]. +message ReloadDocumentRequest { + // Required. The name of the document to reload. + // Format: `projects//locations//knowledgeBases//documents/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + } + ]; + + // The source for document reloading. + // Optional. If provided, the service will load the contents from the source + // and update document in the knowledge base. + oneof source { + // The path for a Cloud Storage source file for reloading document content. + // If not provided, the Document's existing source will be reloaded. + GcsSource gcs_source = 3; + } + + // Whether to import custom metadata from Google Cloud Storage. + // Only valid when the document source is Google Cloud Storage URI. + bool import_gcs_custom_metadata = 4; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/entity_type.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/entity_type.proto new file mode 100644 index 00000000000..7bffded54b6 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/entity_type.proto @@ -0,0 +1,639 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "EntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [EntityTypes][google.cloud.dialogflow.v2beta1.EntityType]. +service EntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all entity types in the specified agent. + rpc ListEntityTypes(ListEntityTypesRequest) returns (ListEntityTypesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent}/entityTypes" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes" + } + }; + option (google.api.method_signature) = "parent"; + option (google.api.method_signature) = "parent,language_code"; + } + + // Retrieves the specified entity type. + rpc GetEntityType(GetEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/entityTypes/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,language_code"; + } + + // Creates an entity type in the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc CreateEntityType(CreateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/entityTypes" + body: "entity_type" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes" + body: "entity_type" + } + }; + option (google.api.method_signature) = "parent,entity_type"; + option (google.api.method_signature) = "parent,entity_type,language_code"; + } + + // Updates the specified entity type. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc UpdateEntityType(UpdateEntityTypeRequest) returns (EntityType) { + option (google.api.http) = { + patch: "/v2beta1/{entity_type.name=projects/*/agent/entityTypes/*}" + body: "entity_type" + additional_bindings { + patch: "/v2beta1/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}" + body: "entity_type" + } + }; + option (google.api.method_signature) = "entity_type"; + option (google.api.method_signature) = "entity_type,language_code"; + option (google.api.method_signature) = "entity_type,language_code,update_mask"; + } + + // Deletes the specified entity type. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc DeleteEntityType(DeleteEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/entityTypes/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates/Creates multiple entity types in the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse] + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchUpdateEntityTypes(BatchUpdateEntityTypesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/entityTypes:batchUpdate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate" + body: "*" + } + }; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes entity types in the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchDeleteEntityTypes(BatchDeleteEntityTypesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/entityTypes:batchDelete" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entity_type_names"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Creates multiple new entities in the specified entity type. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchCreateEntities(BatchCreateEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entities"; + option (google.api.method_signature) = "parent,entities,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Updates or creates multiple entities in the specified entity type. This + // method does not affect entities in the entity type that aren't explicitly + // specified in the request. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + rpc BatchUpdateEntities(BatchUpdateEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entities"; + option (google.api.method_signature) = "parent,entities,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes entities in the specified entity type. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchDeleteEntities(BatchDeleteEntitiesRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,entity_values"; + option (google.api.method_signature) = "parent,entity_values,language_code"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// Each intent parameter has a type, called the entity type, which dictates +// exactly how data from an end-user expression is extracted. +// +// Dialogflow provides predefined system entities that can match many common +// types of data. For example, there are system entities for matching dates, +// times, colors, email addresses, and so on. You can also create your own +// custom entities for matching custom data. For example, you could define a +// vegetable entity that can match the types of vegetables available for +// purchase with a grocery store agent. +// +// For more information, see the +// [Entity guide](https://cloud.google.com/dialogflow/docs/entities-overview). +message EntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/EntityType" + pattern: "projects/{project}/agent/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/entityTypes/{entity_type}" + }; + + // Represents kinds of entities. + enum Kind { + // Not specified. This value should be never used. + KIND_UNSPECIFIED = 0; + + // Map entity types allow mapping of a group of synonyms to a reference + // value. + KIND_MAP = 1; + + // List entity types contain a set of entries that do not map to reference + // values. However, list entity types can contain references to other entity + // types (with or without aliases). + KIND_LIST = 2; + + // Regexp entity types allow to specify regular expressions in entries + // values. + KIND_REGEXP = 3; + } + + // Represents different entity type expansion modes. Automated expansion + // allows an agent to recognize values that have not been explicitly listed in + // the entity (for example, new kinds of shopping list items). + enum AutoExpansionMode { + // Auto expansion disabled for the entity. + AUTO_EXPANSION_MODE_UNSPECIFIED = 0; + + // Allows an agent to recognize values that have not been explicitly + // listed in the entity. + AUTO_EXPANSION_MODE_DEFAULT = 1; + } + + // An **entity entry** for an associated entity type. + message Entity { + // Required. The primary value associated with this entity entry. + // For example, if the entity type is *vegetable*, the value could be + // *scallions*. + // + // For `KIND_MAP` entity types: + // + // * A reference value to be used in place of synonyms. + // + // For `KIND_LIST` entity types: + // + // * A string that can contain references to other entity types (with or + // without aliases). + string value = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A collection of value synonyms. For example, if the entity type + // is *vegetable*, and `value` is *scallions*, a synonym could be *green + // onions*. + // + // For `KIND_LIST` entity types: + // + // * This collection must contain exactly one synonym equal to `value`. + repeated string synonyms = 2; + } + + // The unique identifier of the entity type. + // Required for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType] and + // [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes] methods. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string name = 1; + + // Required. The name of the entity type. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Indicates the kind of entity type. + Kind kind = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates whether the entity type can be automatically + // expanded. + AutoExpansionMode auto_expansion_mode = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of entity entries associated with the entity type. + repeated Entity entities = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Enables fuzzy entity extraction during classification. + bool enable_fuzzy_extraction = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. +message ListEntityTypesRequest { + // Required. The agent to list all entity types from. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [EntityTypes.ListEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes]. +message ListEntityTypesResponse { + // The list of agent entity types. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated EntityType entity_types = 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 request message for [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType]. +message GetEntityTypeRequest { + // Required. The name of the entity type. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.CreateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType]. +message CreateEntityTypeRequest { + // Required. The agent to create a entity type for. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entity type to create. + EntityType entity_type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.UpdateEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType]. +message UpdateEntityTypeRequest { + // Required. The entity type to update. + EntityType entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.DeleteEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType]. +message DeleteEntityTypeRequest { + // Required. The name of the entity type to delete. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; +} + +// The request message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. +message BatchUpdateEntityTypesRequest { + // Required. The name of the agent to update or create entity types in. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // The source of the entity type batch. + // + // For each entity type in the batch: + // + // * If `name` is specified, we update an existing entity type. + // * If `name` is not specified, we create a new entity type. + oneof entity_type_batch { + // The URI to a Google Cloud Storage file containing entity types to update + // or create. The file format can either be a serialized proto (of + // EntityBatch type) or a JSON object. Note: The URI must start with + // "gs://". + string entity_type_batch_uri = 2; + + // The collection of entity types to update or create. + EntityTypeBatch entity_type_batch_inline = 3; + } + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [EntityTypes.BatchUpdateEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes]. +message BatchUpdateEntityTypesResponse { + // The collection of updated or created entity types. + repeated EntityType entity_types = 1; +} + +// The request message for [EntityTypes.BatchDeleteEntityTypes][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes]. +message BatchDeleteEntityTypesRequest { + // Required. The name of the agent to delete all entities types for. + // Supported formats: + // - `projects//agent`, + // - `projects//locations//agent`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The names entity types to delete. All names must point to the + // same agent as `parent`. + repeated string entity_type_names = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [EntityTypes.BatchCreateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities]. +message BatchCreateEntitiesRequest { + // Required. The name of the entity type to create entities in. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entities to create. + repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [EntityTypes.BatchUpdateEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities]. +message BatchUpdateEntitiesRequest { + // Required. The name of the entity type to update or create entities in. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The entities to update or create. + repeated EntityType.Entity entities = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 4; +} + +// The request message for [EntityTypes.BatchDeleteEntities][google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities]. +message BatchDeleteEntitiesRequest { + // Required. The name of the entity type to delete entries for. + // Supported formats: + // - `projects//agent/entityTypes/` + // - `projects//locations//agent/entityTypes/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/EntityType" + } + ]; + + // Required. The reference `values` of the entities to delete. Note that + // these are not fully-qualified names, i.e. they don't start with + // `projects/`. + repeated string entity_values = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// This message is a wrapper around a collection of entity types. +message EntityTypeBatch { + // A collection of entity types. + repeated EntityType entity_types = 1; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/environment.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/environment.proto new file mode 100644 index 00000000000..dd95cab9af3 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/environment.proto @@ -0,0 +1,372 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; +import "google/cloud/dialogflow/v2beta1/fulfillment.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "EnvironmentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Environments][google.cloud.dialogflow.v2beta1.Environment]. +service Environments { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all non-draft environments of the specified agent. + rpc ListEnvironments(ListEnvironmentsRequest) returns (ListEnvironmentsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent}/environments" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent}/environments" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified agent environment. + rpc GetEnvironment(GetEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/environments/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" + } + }; + } + + // Creates an agent environment. + rpc CreateEnvironment(CreateEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/environments" + body: "environment" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/environments" + body: "environment" + } + }; + } + + // Updates the specified agent environment. + // + // This method allows you to deploy new agent versions into the environment. + // When an environment is pointed to a new agent version by setting + // `environment.agent_version`, the environment is temporarily set to the + // `LOADING` state. During that time, the environment keeps on serving the + // previous version of the agent. After the new agent version is done loading, + // the environment is set back to the `RUNNING` state. + // You can use "-" as Environment ID in environment name to update version + // in "draft" environment. WARNING: this will negate all recent changes to + // draft and can't be undone. You may want to save the draft to a version + // before calling this function. + rpc UpdateEnvironment(UpdateEnvironmentRequest) returns (Environment) { + option (google.api.http) = { + patch: "/v2beta1/{environment.name=projects/*/agent/environments/*}" + body: "environment" + additional_bindings { + patch: "/v2beta1/{environment.name=projects/*/locations/*/agent/environments/*}" + body: "environment" + } + }; + } + + // Deletes the specified agent environment. + rpc DeleteEnvironment(DeleteEnvironmentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/environments/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" + } + }; + } + + // Gets the history of the specified environment. + rpc GetEnvironmentHistory(GetEnvironmentHistoryRequest) returns (EnvironmentHistory) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent/environments/*}/history" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/history" + } + }; + } +} + +// You can create multiple versions of your agent and publish them to separate +// environments. +// +// When you edit an agent, you are editing the draft agent. At any point, you +// can save the draft agent as an agent version, which is an immutable snapshot +// of your agent. +// +// When you save the draft agent, it is published to the default environment. +// When you create agent versions, you can publish them to custom environments. +// You can create a variety of custom environments for: +// +// - testing +// - development +// - production +// - etc. +// +// For more information, see the [versions and environments +// guide](https://cloud.google.com/dialogflow/docs/agents-versions). +message Environment { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Environment" + pattern: "projects/{project}/agent/environments/{environment}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}" + }; + + // Represents an environment state. When an environment is pointed to a new + // agent version, the environment is temporarily set to the `LOADING` state. + // During that time, the environment keeps on serving the previous version of + // the agent. After the new agent version is done loading, the environment is + // set back to the `RUNNING` state. + enum State { + // Not specified. This value is not used. + STATE_UNSPECIFIED = 0; + + // Stopped. + STOPPED = 1; + + // Loading. + LOADING = 2; + + // Running. + RUNNING = 3; + } + + // Output only. The unique identifier of this agent environment. + // Supported formats: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The developer-provided description for this environment. + // The maximum length is 500 characters. If exceeded, the request is rejected. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The agent version loaded into this environment. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string agent_version = 3 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; + + // Output only. The state of this environment. This field is read-only, i.e., it cannot be + // set by create and update methods. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time of this environment. This field is read-only, i.e., it + // cannot be set by create and update methods. + google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Text to speech settings for this environment. + TextToSpeechSettings text_to_speech_settings = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fulfillment settings to use for this environment. + Fulfillment fulfillment = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instructs the speech synthesizer on how to generate the output audio content. +message TextToSpeechSettings { + // Optional. Indicates whether text to speech is enabled. Even when this field is false, + // other settings in this proto are still retained. + bool enable_text_to_speech = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding output_audio_encoding = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The synthesis sample rate (in hertz) for this audio. If not provided, then + // the synthesizer will use the default sample rate based on the audio + // encoding. If this is different from the voice's natural sample rate, then + // the synthesizer will honor this request by converting to the desired sample + // rate (which might result in worse audio quality). + int32 sample_rate_hertz = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Configuration of how speech should be synthesized, mapping from language + // (https://cloud.google.com/dialogflow/docs/reference/language) to + // SynthesizeSpeechConfig. + map synthesize_speech_configs = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. +message ListEnvironmentsRequest { + // Required. The agent to list all environments from. + // Format: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Environments.ListEnvironments][google.cloud.dialogflow.v2beta1.Environments.ListEnvironments]. +message ListEnvironmentsResponse { + // The list of agent environments. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Environment environments = 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 request message for [Environments.GetEnvironment][google.cloud.dialogflow.v2beta1.Environments.GetEnvironment]. +message GetEnvironmentRequest { + // Required. The name of the environment. + // Supported formats: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.CreateEnvironment][google.cloud.dialogflow.v2beta1.Environments.CreateEnvironment]. +message CreateEnvironmentRequest { + // Required. The agent to create an environment for. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Required. The environment to create. + Environment environment = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The unique id of the new environment. + string environment_id = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Environments.UpdateEnvironment][google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironment]. +message UpdateEnvironmentRequest { + // Required. The environment to update. + Environment environment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. This field is used to prevent accidental overwrite of the draft + // environment, which is an operation that cannot be undone. To confirm that + // the caller desires this overwrite, this field must be explicitly set to + // true when updating the draft environment (environment ID = `-`). + bool allow_load_to_draft_and_discard_changes = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Environments.DeleteEnvironment][google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironment]. +message DeleteEnvironmentRequest { + // Required. The name of the environment to delete. + // / Format: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; +} + +// The request message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory]. +message GetEnvironmentHistoryRequest { + // Required. The name of the environment to retrieve history for. + // Supported formats: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Environment" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Environments.GetEnvironmentHistory][google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory]. +message EnvironmentHistory { + // Represents an environment history entry. + message Entry { + // The agent version loaded into this environment history entry. + string agent_version = 1; + + // The developer-provided description for this environment history entry. + string description = 2; + + // The creation time of this environment history entry. + google.protobuf.Timestamp create_time = 3; + } + + // Output only. The name of the environment this history is for. + // Supported formats: + // - `projects//agent/environments/` + // - `projects//locations//agent/environments/` + string parent = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of agent environments. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Entry entries = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto new file mode 100644 index 00000000000..8efe32af2f0 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/fulfillment.proto @@ -0,0 +1,180 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "FulfillmentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Fulfillments][google.cloud.dialogflow.v2beta1.Fulfillment]. +service Fulfillments { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Retrieves the fulfillment. + rpc GetFulfillment(GetFulfillmentRequest) returns (Fulfillment) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/fulfillment}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/fulfillment}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the fulfillment. + rpc UpdateFulfillment(UpdateFulfillmentRequest) returns (Fulfillment) { + option (google.api.http) = { + patch: "/v2beta1/{fulfillment.name=projects/*/agent/fulfillment}" + body: "fulfillment" + additional_bindings { + patch: "/v2beta1/{fulfillment.name=projects/*/locations/*/agent/fulfillment}" + body: "fulfillment" + } + }; + option (google.api.method_signature) = "fulfillment,update_mask"; + } +} + +// By default, your agent responds to a matched intent with a static response. +// As an alternative, you can provide a more dynamic response by using +// fulfillment. When you enable fulfillment for an intent, Dialogflow responds +// to that intent by calling a service that you define. For example, if an +// end-user wants to schedule a haircut on Friday, your service can check your +// database and respond to the end-user with availability information for +// Friday. +// +// For more information, see the [fulfillment +// guide](https://cloud.google.com/dialogflow/docs/fulfillment-overview). +message Fulfillment { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Fulfillment" + pattern: "projects/{project}/agent/fulfillment" + pattern: "projects/{project}/locations/{location}/agent/fulfillment" + }; + + // Represents configuration for a generic web service. + // Dialogflow supports two mechanisms for authentications: + // + // - Basic authentication with username and password. + // - Authentication with additional authentication headers. + // + // More information could be found at: + // https://cloud.google.com/dialogflow/docs/fulfillment-configure. + message GenericWebService { + // Required. The fulfillment URI for receiving POST requests. + // It must use https protocol. + string uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // The user name for HTTP Basic authentication. + string username = 2; + + // The password for HTTP Basic authentication. + string password = 3; + + // The HTTP request headers to send together with fulfillment requests. + map request_headers = 4; + + // Optional. Indicates if generic web service is created through Cloud Functions + // integration. Defaults to false. + // + // is_cloud_function is deprecated. Cloud functions can be configured by + // its uri as a regular web service now. + bool is_cloud_function = 5 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + } + + // Whether fulfillment is enabled for the specific feature. + message Feature { + // The type of the feature. + enum Type { + // Feature type not specified. + TYPE_UNSPECIFIED = 0; + + // Fulfillment is enabled for SmallTalk. + SMALLTALK = 1; + } + + // The type of the feature that enabled for fulfillment. + Type type = 1; + } + + // Required. The unique identifier of the fulfillment. + // Supported formats: + // + // - `projects//agent/fulfillment` + // - `projects//locations//agent/fulfillment` + // + // This field is not used for Fulfillment in an Environment. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The human-readable name of the fulfillment, unique within the agent. + // + // This field is not used for Fulfillment in an Environment. + string display_name = 2; + + // Required. The fulfillment configuration. + oneof fulfillment { + // Configuration for a generic web service. + GenericWebService generic_web_service = 3; + } + + // Whether fulfillment is enabled. + bool enabled = 4; + + // The field defines whether the fulfillment is enabled for certain features. + repeated Feature features = 5; +} + +// The request message for [Fulfillments.GetFulfillment][google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillment]. +message GetFulfillmentRequest { + // Required. The name of the fulfillment. + // Supported formats: + // + // - `projects//agent/fulfillment` + // - `projects//locations//agent/fulfillment` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Fulfillment" + } + ]; +} + +// The request message for [Fulfillments.UpdateFulfillment][google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillment]. +message UpdateFulfillmentRequest { + // Required. The fulfillment to update. + Fulfillment fulfillment = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. If the mask is not + // present, all fields will be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/gcs.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/gcs.proto new file mode 100644 index 00000000000..debb5786c06 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/gcs.proto @@ -0,0 +1,55 @@ +// 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.dialogflow.v2beta1; + +import "google/api/field_behavior.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "GcsProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Google Cloud Storage locations for the inputs. +message GcsSources { + // Required. Google Cloud Storage URIs for the inputs. A URI is of the + // form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. + repeated string uris = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Google Cloud Storage location for single input. +message GcsSource { + // Required. The Google Cloud Storage URIs for the inputs. A URI is of the + // form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. + string uri = 1; +} + +// Google Cloud Storage location for the output. +message GcsDestination { + // Required. The Google Cloud Storage URIs for the output. A URI is of the + // form: + // gs://bucket/object-prefix-or-name + // Whether a prefix or name is used depends on the use case. The requesting + // user must have "write-permission" to the bucket. + string uri = 1; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto new file mode 100644 index 00000000000..9716f74e5b0 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto @@ -0,0 +1,50 @@ +// 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.dialogflow.v2beta1; + +import "google/cloud/dialogflow/v2beta1/participant.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "HumanAgentAssistantEventProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Output only. Represents a notification sent to Pub/Sub subscribers for +// agent assistant events in a specific conversation. +message HumanAgentAssistantEvent { + // The conversation this notification refers to. + // Format: `projects//conversations/`. + string conversation = 1; + + // The participant that the suggestion is compiled for. And This field is used + // to call [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] API. Format: + // `projects//conversations//participants/`. + // It will not be set in legacy workflow. + // [HumanAgentAssistantConfig.name][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name] for more + // information. + string participant = 3; + + // The suggestion results payload that this notification refers to. It will + // only be set when + // [HumanAgentAssistantConfig.SuggestionConfig.group_suggestion_responses][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.group_suggestion_responses] + // sets to true. + repeated SuggestionResult suggestion_results = 5; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/intent.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/intent.proto new file mode 100644 index 00000000000..99e9cafd762 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/intent.proto @@ -0,0 +1,1453 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/context.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "IntentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Intents][google.cloud.dialogflow.v2beta1.Intent]. +service Intents { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all intents in the specified agent. + rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent}/intents" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent}/intents" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent/environments/*}/intents" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/intents" + } + }; + option (google.api.method_signature) = "parent"; + option (google.api.method_signature) = "parent,language_code"; + } + + // Retrieves the specified intent. + rpc GetIntent(GetIntentRequest) returns (Intent) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/intents/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/intents/*}" + } + }; + option (google.api.method_signature) = "name"; + option (google.api.method_signature) = "name,language_code"; + } + + // Creates an intent in the specified agent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc CreateIntent(CreateIntentRequest) returns (Intent) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/intents" + body: "intent" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/intents" + body: "intent" + } + }; + option (google.api.method_signature) = "parent,intent"; + option (google.api.method_signature) = "parent,intent,language_code"; + } + + // Updates the specified intent. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc UpdateIntent(UpdateIntentRequest) returns (Intent) { + option (google.api.http) = { + patch: "/v2beta1/{intent.name=projects/*/agent/intents/*}" + body: "intent" + additional_bindings { + patch: "/v2beta1/{intent.name=projects/*/locations/*/agent/intents/*}" + body: "intent" + } + }; + option (google.api.method_signature) = "intent,update_mask"; + option (google.api.method_signature) = "intent"; + option (google.api.method_signature) = "intent,language_code"; + option (google.api.method_signature) = "intent,language_code,update_mask"; + } + + // Deletes the specified intent and its direct or indirect followup intents. + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/intents/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/intents/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates/Creates multiple intents in the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse] + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchUpdateIntents(BatchUpdateIntentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/intents:batchUpdate" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchUpdate" + body: "*" + } + }; + option (google.api.method_signature) = "parent,intent_batch_uri"; + option (google.api.method_signature) = "parent,intent_batch_inline"; + option (google.longrunning.operation_info) = { + response_type: "google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse" + metadata_type: "google.protobuf.Struct" + }; + } + + // Deletes intents in the specified agent. + // + // This method is a [long-running + // operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + // The returned `Operation` type has the following method-specific fields: + // + // - `metadata`: An empty [Struct + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + // - `response`: An [Empty + // message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + // + // Note: You should always train an agent prior to sending it queries. See the + // [training + // documentation](https://cloud.google.com/dialogflow/es/docs/training). + rpc BatchDeleteIntents(BatchDeleteIntentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/intents:batchDelete" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchDelete" + body: "*" + } + }; + option (google.api.method_signature) = "parent,intents"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.protobuf.Struct" + }; + } +} + +// An intent categorizes an end-user's intention for one conversation turn. For +// each agent, you define many intents, where your combined intents can handle a +// complete conversation. When an end-user writes or says something, referred to +// as an end-user expression or end-user input, Dialogflow matches the end-user +// input to the best intent in your agent. Matching an intent is also known as +// intent classification. +// +// For more information, see the [intent +// guide](https://cloud.google.com/dialogflow/docs/intents-overview). +message Intent { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Intent" + pattern: "projects/{project}/agent/intents/{intent}" + pattern: "projects/{project}/locations/{location}/agent/intents/{intent}" + }; + + // Represents the different states that webhooks can be in. + enum WebhookState { + // Webhook is disabled in the agent and in the intent. + WEBHOOK_STATE_UNSPECIFIED = 0; + + // Webhook is enabled in the agent and in the intent. + WEBHOOK_STATE_ENABLED = 1; + + // Webhook is enabled in the agent and in the intent. Also, each slot + // filling prompt is forwarded to the webhook. + WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2; + } + + // Represents an example that the agent is trained on. + message TrainingPhrase { + // Represents different types of training phrases. + enum Type { + // Not specified. This value should never be used. + TYPE_UNSPECIFIED = 0; + + // Examples do not contain @-prefixed entity type names, but example parts + // can be annotated with entity types. + EXAMPLE = 1; + + // Templates are not annotated with entity types, but they can contain + // @-prefixed entity type names as substrings. + // Note: Template mode has been deprecated. Example mode is the only + // supported way to create new training phrases. If you have existing + // training phrases in template mode, they will be removed during training + // and it can cause a drop in agent performance. + TEMPLATE = 2 [deprecated = true]; + } + + // Represents a part of a training phrase. + message Part { + // Required. The text for this part. + string text = 1; + + // Optional. The entity type name prefixed with `@`. + // This field is required for annotated parts of the training phrase. + string entity_type = 2; + + // Optional. The parameter name for the value extracted from the + // annotated part of the example. + // This field is required for annotated parts of the training phrase. + string alias = 3; + + // Optional. Indicates whether the text was manually annotated. + // This field is set to true when the Dialogflow Console is used to + // manually annotate the part. When creating an annotated part with the + // API, you must set this to true. + bool user_defined = 4; + } + + // Output only. The unique identifier of this training phrase. + string name = 1; + + // Required. The type of the training phrase. + Type type = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ordered list of training phrase parts. + // The parts are concatenated in order to form the training phrase. + // + // Note: The API does not automatically annotate training phrases like the + // Dialogflow Console does. + // + // Note: Do not forget to include whitespace at part boundaries, + // so the training phrase is well formatted when the parts are concatenated. + // + // If the training phrase does not need to be annotated with parameters, + // you just need a single part with only the [Part.text][google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.text] field set. + // + // If you want to annotate the training phrase, you must create multiple + // parts, where the fields of each part are populated in one of two ways: + // + // - `Part.text` is set to a part of the phrase that has no parameters. + // - `Part.text` is set to a part of the phrase that you want to annotate, + // and the `entity_type`, `alias`, and `user_defined` fields are all + // set. + repeated Part parts = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates how many times this example was added to + // the intent. Each time a developer adds an existing sample by editing an + // intent or training, this counter is increased. + int32 times_added_count = 4 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents intent parameters. + message Parameter { + // The unique identifier of this parameter. + string name = 1; + + // Required. The name of the parameter. + string display_name = 2; + + // Optional. The definition of the parameter value. It can be: + // + // - a constant string, + // - a parameter value defined as `$parameter_name`, + // - an original parameter value defined as `$parameter_name.original`, + // - a parameter value from some context defined as + // `#context_name.parameter_name`. + string value = 3; + + // Optional. The default value to use when the `value` yields an empty + // result. + // Default values can be extracted from contexts by using the following + // syntax: `#context_name.parameter_name`. + string default_value = 4; + + // Optional. The name of the entity type, prefixed with `@`, that + // describes values of the parameter. If the parameter is + // required, this must be provided. + string entity_type_display_name = 5; + + // Optional. Indicates whether the parameter is required. That is, + // whether the intent cannot be completed without collecting the parameter + // value. + bool mandatory = 6; + + // Optional. The collection of prompts that the agent can present to the + // user in order to collect a value for the parameter. + repeated string prompts = 7; + + // Optional. Indicates whether the parameter represents a list of values. + bool is_list = 8; + } + + // Corresponds to the `Response` field in the Dialogflow console. + message Message { + // Represents different platforms that a rich message can be intended for. + enum Platform { + // Not specified. + PLATFORM_UNSPECIFIED = 0; + + // Facebook. + FACEBOOK = 1; + + // Slack. + SLACK = 2; + + // Telegram. + TELEGRAM = 3; + + // Kik. + KIK = 4; + + // Skype. + SKYPE = 5; + + // Line. + LINE = 6; + + // Viber. + VIBER = 7; + + // Google Assistant + // See [Dialogflow webhook + // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) + ACTIONS_ON_GOOGLE = 8; + + // Telephony Gateway. + TELEPHONY = 10; + + // Google Hangouts. + GOOGLE_HANGOUTS = 11; + } + + // The text response message. + message Text { + // Optional. The collection of the agent's responses. + repeated string text = 1; + } + + // The image response message. + message Image { + // Optional. The public URI to an image file. + string image_uri = 1; + + // A text description of the image to be used for accessibility, + // e.g., screen readers. Required if image_uri is set for CarouselSelect. + string accessibility_text = 2; + } + + // The quick replies response message. + message QuickReplies { + // Optional. The title of the collection of quick replies. + string title = 1; + + // Optional. The collection of quick replies. + repeated string quick_replies = 2; + } + + // The card response message. + message Card { + // Optional. Contains information about a button. + message Button { + // Optional. The text to show on the button. + string text = 1; + + // Optional. The text to send back to the Dialogflow API or a URI to + // open. + string postback = 2; + } + + // Optional. The title of the card. + string title = 1; + + // Optional. The subtitle of the card. + string subtitle = 2; + + // Optional. The public URI to an image file for the card. + string image_uri = 3; + + // Optional. The collection of card buttons. + repeated Button buttons = 4; + } + + // The simple response message containing speech or text. + message SimpleResponse { + // One of text_to_speech or ssml must be provided. The plain text of the + // speech output. Mutually exclusive with ssml. + string text_to_speech = 1; + + // One of text_to_speech or ssml must be provided. Structured spoken + // response to the user in the SSML format. Mutually exclusive with + // text_to_speech. + string ssml = 2; + + // Optional. The text to display. + string display_text = 3; + } + + // The collection of simple response candidates. + // This message in `QueryResult.fulfillment_messages` and + // `WebhookResponse.fulfillment_messages` should contain only one + // `SimpleResponse`. + message SimpleResponses { + // Required. The list of simple responses. + repeated SimpleResponse simple_responses = 1; + } + + // The basic card message. Useful for displaying information. + message BasicCard { + // The button object that appears at the bottom of a card. + message Button { + // Opens the given URI. + message OpenUriAction { + // Required. The HTTP or HTTPS scheme URI. + string uri = 1; + } + + // Required. The title of the button. + string title = 1; + + // Required. Action to take when a user taps on the button. + OpenUriAction open_uri_action = 2; + } + + // Optional. The title of the card. + string title = 1; + + // Optional. The subtitle of the card. + string subtitle = 2; + + // Required, unless image is present. The body text of the card. + string formatted_text = 3; + + // Optional. The image for the card. + Image image = 4; + + // Optional. The collection of card buttons. + repeated Button buttons = 5; + } + + // The suggestion chip message that the user can tap to quickly post a reply + // to the conversation. + message Suggestion { + // Required. The text shown the in the suggestion chip. + string title = 1; + } + + // The collection of suggestions. + message Suggestions { + // Required. The list of suggested replies. + repeated Suggestion suggestions = 1; + } + + // The suggestion chip message that allows the user to jump out to the app + // or website associated with this agent. + message LinkOutSuggestion { + // Required. The name of the app or site this chip is linking to. + string destination_name = 1; + + // Required. The URI of the app or site to open when the user taps the + // suggestion chip. + string uri = 2; + } + + // The card for presenting a list of options to select from. + message ListSelect { + // An item in the list. + message Item { + // Required. Additional information about this option. + SelectItemInfo info = 1; + + // Required. The title of the list item. + string title = 2; + + // Optional. The main text describing the item. + string description = 3; + + // Optional. The image to display. + Image image = 4; + } + + // Optional. The overall title of the list. + string title = 1; + + // Required. List items. + repeated Item items = 2; + + // Optional. Subtitle of the list. + string subtitle = 3 [(google.api.field_behavior) = OPTIONAL]; + } + + // The card for presenting a carousel of options to select from. + message CarouselSelect { + // An item in the carousel. + message Item { + // Required. Additional info about the option item. + SelectItemInfo info = 1; + + // Required. Title of the carousel item. + string title = 2; + + // Optional. The body text of the card. + string description = 3; + + // Optional. The image to display. + Image image = 4; + } + + // Required. Carousel items. + repeated Item items = 1; + } + + // Additional info about the select item for when it is triggered in a + // dialog. + message SelectItemInfo { + // Required. A unique key that will be sent back to the agent if this + // response is given. + string key = 1; + + // Optional. A list of synonyms that can also be used to trigger this + // item in dialog. + repeated string synonyms = 2; + } + + // Plays audio from a file in Telephony Gateway. + message TelephonyPlayAudio { + // Required. URI to a Google Cloud Storage object containing the audio to + // play, e.g., "gs://bucket/object". The object must contain a single + // channel (mono) of linear PCM audio (2 bytes / sample) at 8kHz. + // + // This object must be readable by the `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` service account + // where is the number of the Telephony Gateway project + // (usually the same as the Dialogflow agent project). If the Google Cloud + // Storage bucket is in the Telephony Gateway project, this permission is + // added by default when enabling the Dialogflow V2 API. + // + // For audio from other sources, consider using the + // `TelephonySynthesizeSpeech` message with SSML. + string audio_uri = 1; + } + + // Synthesizes speech and plays back the synthesized audio to the caller in + // Telephony Gateway. + // + // Telephony Gateway takes the synthesizer settings from + // `DetectIntentResponse.output_audio_config` which can either be set + // at request-level or can come from the agent-level synthesizer config. + message TelephonySynthesizeSpeech { + // Required. The source to be synthesized. + oneof source { + // The raw text to be synthesized. + string text = 1; + + // The SSML to be synthesized. For more information, see + // [SSML](https://developers.google.com/actions/reference/ssml). + string ssml = 2; + } + } + + // Transfers the call in Telephony Gateway. + message TelephonyTransferCall { + // Required. The phone number to transfer the call to + // in [E.164 format](https://en.wikipedia.org/wiki/E.164). + // + // We currently only allow transferring to US numbers (+1xxxyyyzzzz). + string phone_number = 1; + } + + // Rich Business Messaging (RBM) text response with suggestions. + message RbmText { + // Required. Text sent and displayed to the user. + string text = 1; + + // Optional. One or more suggestions to show to the user. + repeated RbmSuggestion rbm_suggestion = 2; + } + + // Carousel Rich Business Messaging (RBM) rich card. + // + // Rich cards allow you to respond to users with more vivid content, e.g. + // with media and suggestions. + // + // If you want to show a single card with more control over the layout, + // please use [RbmStandaloneCard][google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard] instead. + message RbmCarouselCard { + // The width of the cards in the carousel. + enum CardWidth { + // Not specified. + CARD_WIDTH_UNSPECIFIED = 0; + + // 120 DP. Note that tall media cannot be used. + SMALL = 1; + + // 232 DP. + MEDIUM = 2; + } + + // Required. The width of the cards in the carousel. + CardWidth card_width = 1; + + // Required. The cards in the carousel. A carousel must have at least + // 2 cards and at most 10. + repeated RbmCardContent card_contents = 2; + } + + // Standalone Rich Business Messaging (RBM) rich card. + // + // Rich cards allow you to respond to users with more vivid content, e.g. + // with media and suggestions. + // + // You can group multiple rich cards into one using [RbmCarouselCard][google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard] but + // carousel cards will give you less control over the card layout. + message RbmStandaloneCard { + // Orientation of the card. + enum CardOrientation { + // Not specified. + CARD_ORIENTATION_UNSPECIFIED = 0; + + // Horizontal layout. + HORIZONTAL = 1; + + // Vertical layout. + VERTICAL = 2; + } + + // Thumbnail preview alignment for standalone cards with horizontal + // layout. + enum ThumbnailImageAlignment { + // Not specified. + THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED = 0; + + // Thumbnail preview is left-aligned. + LEFT = 1; + + // Thumbnail preview is right-aligned. + RIGHT = 2; + } + + // Required. Orientation of the card. + CardOrientation card_orientation = 1; + + // Required if orientation is horizontal. + // Image preview alignment for standalone cards with horizontal layout. + ThumbnailImageAlignment thumbnail_image_alignment = 2; + + // Required. Card content. + RbmCardContent card_content = 3; + } + + // Rich Business Messaging (RBM) Card content + message RbmCardContent { + // Rich Business Messaging (RBM) Media displayed in Cards + // The following media-types are currently supported: + // + // Image Types + // + // * image/jpeg + // * image/jpg' + // * image/gif + // * image/png + // + // Video Types + // + // * video/h263 + // * video/m4v + // * video/mp4 + // * video/mpeg + // * video/mpeg4 + // * video/webm + message RbmMedia { + // Media height + enum Height { + // Not specified. + HEIGHT_UNSPECIFIED = 0; + + // 112 DP. + SHORT = 1; + + // 168 DP. + MEDIUM = 2; + + // 264 DP. Not available for rich card carousels when the card width + // is set to small. + TALL = 3; + } + + // Required. Publicly reachable URI of the file. The RBM platform + // determines the MIME type of the file from the content-type field in + // the HTTP headers when the platform fetches the file. The content-type + // field must be present and accurate in the HTTP response from the URL. + string file_uri = 1; + + // Optional. Publicly reachable URI of the thumbnail.If you don't + // provide a thumbnail URI, the RBM platform displays a blank + // placeholder thumbnail until the user's device downloads the file. + // Depending on the user's setting, the file may not download + // automatically and may require the user to tap a download button. + string thumbnail_uri = 2; + + // Required for cards with vertical orientation. The height of the media + // within a rich card with a vertical layout. + // For a standalone card with horizontal layout, height is not + // customizable, and this field is ignored. + Height height = 3; + } + + // Optional. Title of the card (at most 200 bytes). + // + // At least one of the title, description or media must be set. + string title = 1; + + // Optional. Description of the card (at most 2000 bytes). + // + // At least one of the title, description or media must be set. + string description = 2; + + // Optional. However at least one of the title, description or media must + // be set. Media (image, GIF or a video) to include in the card. + RbmMedia media = 3; + + // Optional. List of suggestions to include in the card. + repeated RbmSuggestion suggestions = 4; + } + + // Rich Business Messaging (RBM) suggestion. Suggestions allow user to + // easily select/click a predefined response or perform an action (like + // opening a web uri). + message RbmSuggestion { + // Predefined suggested response or action for user to choose + oneof suggestion { + // Predefined replies for user to select instead of typing + RbmSuggestedReply reply = 1; + + // Predefined client side actions that user can choose + RbmSuggestedAction action = 2; + } + } + + // Rich Business Messaging (RBM) suggested reply that the user can click + // instead of typing in their own response. + message RbmSuggestedReply { + // Suggested reply text. + string text = 1; + + // Opaque payload that the Dialogflow receives in a user event + // when the user taps the suggested reply. This data will be also + // forwarded to webhook to allow performing custom business logic. + string postback_data = 2; + } + + // Rich Business Messaging (RBM) suggested client-side action that the user + // can choose from the card. + message RbmSuggestedAction { + // Opens the user's default dialer app with the specified phone number + // but does not dial automatically. + message RbmSuggestedActionDial { + // Required. The phone number to fill in the default dialer app. + // This field should be in [E.164](https://en.wikipedia.org/wiki/E.164) + // format. An example of a correctly formatted phone number: + // +15556767888. + string phone_number = 1; + } + + // Opens the user's default web browser app to the specified uri + // If the user has an app installed that is + // registered as the default handler for the URL, then this app will be + // opened instead, and its icon will be used in the suggested action UI. + message RbmSuggestedActionOpenUri { + // Required. The uri to open on the user device + string uri = 1; + } + + // Opens the device's location chooser so the user can pick a location + // to send back to the agent. + message RbmSuggestedActionShareLocation { + + } + + // Text to display alongside the action. + string text = 1; + + // Opaque payload that the Dialogflow receives in a user event + // when the user taps the suggested action. This data will be also + // forwarded to webhook to allow performing custom business logic. + string postback_data = 2; + + // Action that needs to be triggered. + oneof action { + // Suggested client side action: Dial a phone number + RbmSuggestedActionDial dial = 3; + + // Suggested client side action: Open a URI on device + RbmSuggestedActionOpenUri open_url = 4; + + // Suggested client side action: Share user location + RbmSuggestedActionShareLocation share_location = 5; + } + } + + // The media content card for Actions on Google. + message MediaContent { + // Format of response media type. + enum ResponseMediaType { + // Unspecified. + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0; + + // Response media type is audio. + AUDIO = 1; + } + + // Response media object for media content card. + message ResponseMediaObject { + // Required. Name of media card. + string name = 1; + + // Optional. Description of media card. + string description = 2; + + // Image to show with the media card. + oneof image { + // Optional. Image to display above media content. + Image large_image = 3; + + // Optional. Icon to display above media content. + Image icon = 4; + } + + // Required. Url where the media is stored. + string content_url = 5; + } + + // Optional. What type of media is the content (ie "audio"). + ResponseMediaType media_type = 1; + + // Required. List of media objects. + repeated ResponseMediaObject media_objects = 2; + } + + // Browse Carousel Card for Actions on Google. + // https://developers.google.com/actions/assistant/responses#browsing_carousel + message BrowseCarouselCard { + // Browsing carousel tile + message BrowseCarouselCardItem { + // Actions on Google action to open a given url. + message OpenUrlAction { + // Type of the URI. + enum UrlTypeHint { + // Unspecified + URL_TYPE_HINT_UNSPECIFIED = 0; + + // Url would be an amp action + AMP_ACTION = 1; + + // URL that points directly to AMP content, or to a canonical URL + // which refers to AMP content via . + AMP_CONTENT = 2; + } + + // Required. URL + string url = 1; + + // Optional. Specifies the type of viewer that is used when opening + // the URL. Defaults to opening via web browser. + UrlTypeHint url_type_hint = 3; + } + + // Required. Action to present to the user. + OpenUrlAction open_uri_action = 1; + + // Required. Title of the carousel item. Maximum of two lines of text. + string title = 2; + + // Optional. Description of the carousel item. Maximum of four lines of + // text. + string description = 3; + + // Optional. Hero image for the carousel item. + Image image = 4; + + // Optional. Text that appears at the bottom of the Browse Carousel + // Card. Maximum of one line of text. + string footer = 5; + } + + // Image display options for Actions on Google. This should be used for + // when the image's aspect ratio does not match the image container's + // aspect ratio. + enum ImageDisplayOptions { + // Fill the gaps between the image and the image container with gray + // bars. + IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0; + + // Fill the gaps between the image and the image container with gray + // bars. + GRAY = 1; + + // Fill the gaps between the image and the image container with white + // bars. + WHITE = 2; + + // Image is scaled such that the image width and height match or exceed + // the container dimensions. This may crop the top and bottom of the + // image if the scaled image height is greater than the container + // height, or crop the left and right of the image if the scaled image + // width is greater than the container width. This is similar to "Zoom + // Mode" on a widescreen TV when playing a 4:3 video. + CROPPED = 3; + + // Pad the gaps between image and image frame with a blurred copy of the + // same image. + BLURRED_BACKGROUND = 4; + } + + // Required. List of items in the Browse Carousel Card. Minimum of two + // items, maximum of ten. + repeated BrowseCarouselCardItem items = 1; + + // Optional. Settings for displaying the image. Applies to every image in + // [items][google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.items]. + ImageDisplayOptions image_display_options = 2; + } + + // Table card for Actions on Google. + message TableCard { + // Required. Title of the card. + string title = 1; + + // Optional. Subtitle to the title. + string subtitle = 2; + + // Optional. Image which should be displayed on the card. + Image image = 3; + + // Optional. Display properties for the columns in this table. + repeated ColumnProperties column_properties = 4; + + // Optional. Rows in this table of data. + repeated TableCardRow rows = 5; + + // Optional. List of buttons for the card. + repeated BasicCard.Button buttons = 6; + } + + // Column properties for [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. + message ColumnProperties { + // Text alignments within a cell. + enum HorizontalAlignment { + // Text is aligned to the leading edge of the column. + HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0; + + // Text is aligned to the leading edge of the column. + LEADING = 1; + + // Text is centered in the column. + CENTER = 2; + + // Text is aligned to the trailing edge of the column. + TRAILING = 3; + } + + // Required. Column heading. + string header = 1; + + // Optional. Defines text alignment for all cells in this column. + HorizontalAlignment horizontal_alignment = 2; + } + + // Row of [TableCard][google.cloud.dialogflow.v2beta1.Intent.Message.TableCard]. + message TableCardRow { + // Optional. List of cells that make up this row. + repeated TableCardCell cells = 1; + + // Optional. Whether to add a visual divider after this row. + bool divider_after = 2; + } + + // Cell of [TableCardRow][google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow]. + message TableCardCell { + // Required. Text in this cell. + string text = 1; + } + + // Required. The rich response message. + oneof message { + // Returns a text response. + Text text = 1; + + // Displays an image. + Image image = 2; + + // Displays quick replies. + QuickReplies quick_replies = 3; + + // Displays a card. + Card card = 4; + + // A custom platform-specific response. + google.protobuf.Struct payload = 5; + + // Returns a voice or text-only response for Actions on Google. + SimpleResponses simple_responses = 7; + + // Displays a basic card for Actions on Google. + BasicCard basic_card = 8; + + // Displays suggestion chips for Actions on Google. + Suggestions suggestions = 9; + + // Displays a link out suggestion chip for Actions on Google. + LinkOutSuggestion link_out_suggestion = 10; + + // Displays a list card for Actions on Google. + ListSelect list_select = 11; + + // Displays a carousel card for Actions on Google. + CarouselSelect carousel_select = 12; + + // Plays audio from a file in Telephony Gateway. + TelephonyPlayAudio telephony_play_audio = 13; + + // Synthesizes speech in Telephony Gateway. + TelephonySynthesizeSpeech telephony_synthesize_speech = 14; + + // Transfers the call in Telephony Gateway. + TelephonyTransferCall telephony_transfer_call = 15; + + // Rich Business Messaging (RBM) text response. + // + // RBM allows businesses to send enriched and branded versions of SMS. See + // https://jibe.google.com/business-messaging. + RbmText rbm_text = 18; + + // Standalone Rich Business Messaging (RBM) rich card response. + RbmStandaloneCard rbm_standalone_rich_card = 19; + + // Rich Business Messaging (RBM) carousel rich card response. + RbmCarouselCard rbm_carousel_rich_card = 20; + + // Browse carousel card for Actions on Google. + BrowseCarouselCard browse_carousel_card = 22; + + // Table card for Actions on Google. + TableCard table_card = 23; + + // The media content card for Actions on Google. + MediaContent media_content = 24; + } + + // Optional. The platform that this message is intended for. + Platform platform = 6 [(google.api.field_behavior) = OPTIONAL]; + } + + // Represents a single followup intent in the chain. + message FollowupIntentInfo { + // The unique identifier of the followup intent. + // Format: `projects//agent/intents/`. + string followup_intent_name = 1; + + // The unique identifier of the followup intent's parent. + // Format: `projects//agent/intents/`. + string parent_followup_intent_name = 2; + } + + // Optional. The unique identifier of this intent. + // Required for [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent] and [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents] + // methods. + // Supported formats: + // + // - `projects//agent/intents/` + // - `projects//locations//agent/intents/` + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The name of this intent. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates whether webhooks are enabled for the intent. + WebhookState webhook_state = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The priority of this intent. Higher numbers represent higher + // priorities. + // + // - If the supplied value is unspecified or 0, the service + // translates the value to 500,000, which corresponds to the + // `Normal` priority in the console. + // - If the supplied value is negative, the intent is ignored + // in runtime detect intent requests. + int32 priority = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether this is a fallback intent. + bool is_fallback = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether Machine Learning is enabled for the intent. + // Note: If `ml_enabled` setting is set to false, then this intent is not + // taken into account during inference in `ML ONLY` match mode. Also, + // auto-markup in the UI is turned off. + // DEPRECATED! Please use `ml_disabled` field instead. + // NOTE: If both `ml_enabled` and `ml_disabled` are either not set or false, + // then the default value is determined as follows: + // + // - Before April 15th, 2018 the default is: + // ml_enabled = false / ml_disabled = true. + // - After April 15th, 2018 the default is: + // ml_enabled = true / ml_disabled = false. + bool ml_enabled = 5 [ + deprecated = true, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. Indicates whether Machine Learning is disabled for the intent. + // Note: If `ml_disabled` setting is set to true, then this intent is not + // taken into account during inference in `ML ONLY` match mode. Also, + // auto-markup in the UI is turned off. + bool ml_disabled = 19 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates that a live agent should be brought in to handle the + // interaction with the user. In most cases, when you set this flag to true, + // you would also want to set end_interaction to true as well. Default is + // false. + bool live_agent_handoff = 20 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates that this intent ends an interaction. Some integrations + // (e.g., Actions on Google or Dialogflow phone gateway) use this information + // to close interaction with an end user. Default is false. + bool end_interaction = 21 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of context names required for this intent to be + // triggered. + // Formats: + // + // - `projects//agent/sessions/-/contexts/` + // - `projects//locations//agent/sessions/-/contexts/` + repeated string input_context_names = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of event names that trigger the intent. + // If the collection of input contexts is not empty, all of the contexts must + // be present in the active user session for an event to trigger this intent. + // Event names are limited to 150 characters. + repeated string events = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of examples that the agent is + // trained on. + repeated TrainingPhrase training_phrases = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the action associated with the intent. + // Note: The action name must not contain whitespaces. + string action = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of contexts that are activated when the intent + // is matched. Context messages in this collection should not set the + // parameters field. Setting the `lifespan_count` to 0 will reset the context + // when the intent is matched. + // Format: `projects//agent/sessions/-/contexts/`. + repeated Context output_contexts = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether to delete all contexts in the current + // session when this intent is matched. + bool reset_contexts = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of parameters associated with the intent. + repeated Parameter parameters = 13 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The collection of rich messages corresponding to the + // `Response` field in the Dialogflow console. + repeated Message messages = 14; + + // Optional. The list of platforms for which the first responses will be + // copied from the messages in PLATFORM_UNSPECIFIED (i.e. default platform). + repeated Message.Platform default_response_platforms = 15 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The unique identifier of the root intent in the chain of + // followup intents. It identifies the correct followup intents chain for + // this intent. + // + // Format: `projects//agent/intents/`. + string root_followup_intent_name = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The unique identifier of the parent intent in the + // chain of followup intents. You can set this field when creating an intent, + // for example with [CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent] or + // [BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents], in order to make this + // intent a followup intent. + // + // It identifies the parent followup intent. + // Format: `projects//agent/intents/`. + string parent_followup_intent_name = 17 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Information about all followup intents that have this intent as + // a direct or indirect parent. We populate this field only in the output. + repeated FollowupIntentInfo followup_intent_info = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. +message ListIntentsRequest { + // Required. The agent to list all intents from. + // Format: `projects//agent` or `projects//locations//agent`. + // + // Alternatively, you can specify the environment to list intents for. + // Format: `projects//agent/environments/` + // or `projects//locations//agent/environments/`. + // Note: training phrases of the intents will not be returned for non-draft + // environment. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 3; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 4; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 5; +} + +// The response message for [Intents.ListIntents][google.cloud.dialogflow.v2beta1.Intents.ListIntents]. +message ListIntentsResponse { + // The list of agent intents. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Intent intents = 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 request message for [Intents.GetIntent][google.cloud.dialogflow.v2beta1.Intents.GetIntent]. +message GetIntentRequest { + // Required. The name of the intent. + // Supported formats: + // + // - `projects//agent/intents/` + // - `projects//locations//agent/intents/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 3; +} + +// The request message for [Intents.CreateIntent][google.cloud.dialogflow.v2beta1.Intents.CreateIntent]. +message CreateIntentRequest { + // Required. The agent to create a intent for. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The intent to create. + Intent intent = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 4; +} + +// The request message for [Intents.UpdateIntent][google.cloud.dialogflow.v2beta1.Intents.UpdateIntent]. +message UpdateIntentRequest { + // Required. The intent to update. + Intent intent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 4; +} + +// The request message for [Intents.DeleteIntent][google.cloud.dialogflow.v2beta1.Intents.DeleteIntent]. +message DeleteIntentRequest { + // Required. The name of the intent to delete. If this intent has direct or + // indirect followup intents, we also delete them. + // + // Supported formats: + // + // - `projects//agent/intents/` + // - `projects//locations//agent/intents/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + } + ]; +} + +// The request message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. +message BatchUpdateIntentsRequest { + // Required. The name of the agent to update or create intents in. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The source of the intent batch. + // + // For each intent in the batch: + // + // * If `name` is specified, we update an existing intent. + // * If `name` is not specified, we create a new intent. + oneof intent_batch { + // The URI to a Google Cloud Storage file containing intents to update or + // create. The file format can either be a serialized proto (of IntentBatch + // type) or JSON object. Note: The URI must start with "gs://". + string intent_batch_uri = 2; + + // The collection of intents to update or create. + IntentBatch intent_batch_inline = 3; + } + + // Optional. The language used to access language-specific data. + // If not specified, the agent's default language is used. + // For more information, see + // [Multilingual intent and entity + // data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + string language_code = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 5; + + // Optional. The resource view to apply to the returned intent. + IntentView intent_view = 6; +} + +// The response message for [Intents.BatchUpdateIntents][google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents]. +message BatchUpdateIntentsResponse { + // The collection of updated or created intents. + repeated Intent intents = 1; +} + +// The request message for [Intents.BatchDeleteIntents][google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents]. +message BatchDeleteIntentsRequest { + // Required. The name of the agent to delete all entities types for. + // Supported formats: + // + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Intent" + } + ]; + + // Required. The collection of intents to delete. Only intent `name` must be + // filled in. + repeated Intent intents = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents the options for views of an intent. +// An intent can be a sizable object. Therefore, we provide a resource view that +// does not return training phrases in the response by default. +enum IntentView { + // Training phrases field is not populated in the response. + INTENT_VIEW_UNSPECIFIED = 0; + + // All fields are populated. + INTENT_VIEW_FULL = 1; +} + +// This message is a wrapper around a collection of intents. +message IntentBatch { + // A collection of intents. + repeated Intent intents = 1; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto new file mode 100644 index 00000000000..cf5c21ddee4 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto @@ -0,0 +1,278 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "KnowledgeBaseProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [KnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBase]. +service KnowledgeBases { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all knowledge bases of the specified agent. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.knowledgeBases`. + rpc ListKnowledgeBases(ListKnowledgeBasesRequest) returns (ListKnowledgeBasesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/knowledgeBases" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent}/knowledgeBases" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified knowledge base. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.knowledgeBases`. + rpc GetKnowledgeBase(GetKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/knowledgeBases/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a knowledge base. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.knowledgeBases`. + rpc CreateKnowledgeBase(CreateKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/knowledgeBases" + body: "knowledge_base" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases" + body: "knowledge_base" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/agent}/knowledgeBases" + body: "knowledge_base" + } + }; + option (google.api.method_signature) = "parent,knowledge_base"; + } + + // Deletes the specified knowledge base. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.knowledgeBases`. + rpc DeleteKnowledgeBase(DeleteKnowledgeBaseRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/knowledgeBases/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Updates the specified knowledge base. + // + // Note: The `projects.agent.knowledgeBases` resource is deprecated; + // only use `projects.knowledgeBases`. + rpc UpdateKnowledgeBase(UpdateKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + patch: "/v2beta1/{knowledge_base.name=projects/*/knowledgeBases/*}" + body: "knowledge_base" + additional_bindings { + patch: "/v2beta1/{knowledge_base.name=projects/*/locations/*/knowledgeBases/*}" + body: "knowledge_base" + } + additional_bindings { + patch: "/v2beta1/{knowledge_base.name=projects/*/agent/knowledgeBases/*}" + body: "knowledge_base" + } + }; + option (google.api.method_signature) = "knowledge_base,update_mask"; + option (google.api.method_signature) = "knowledge_base"; + } +} + +// A knowledge base represents a collection of knowledge documents that you +// provide to Dialogflow. Your knowledge documents contain information that may +// be useful during conversations with end-users. Some Dialogflow features use +// knowledge bases when looking for a response to an end-user input. +// +// For more information, see the [knowledge base +// guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases). +// +// Note: The `projects.agent.knowledgeBases` resource is deprecated; +// only use `projects.knowledgeBases`. +message KnowledgeBase { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + pattern: "projects/{project}/knowledgeBases/{knowledge_base}" + pattern: "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}" + }; + + // The knowledge base resource name. + // The name must be empty when creating a knowledge base. + // Format: `projects//locations//knowledgeBases/`. + string name = 1; + + // Required. The display name of the knowledge base. The name must be 1024 + // bytes or less; otherwise, the creation request fails. + string display_name = 2 [(google.api.field_behavior) = REQUIRED]; + + // Language which represents the KnowledgeBase. When the KnowledgeBase is + // created/updated, this is populated for all non en-us languages. If not + // populated, the default language en-us applies. + string language_code = 4; +} + +// Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesRequest { + // Required. The project to list of knowledge bases for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // The next_page_token value returned from a previous list request. + string page_token = 3; + + // The filter expression used to filter knowledge bases returned by the list + // method. The expression has the following syntax: + // + // [AND ] ... + // + // The following fields and operators are supported: + // + // * display_name with has(:) operator + // * language_code with equals(=) operator + // + // Examples: + // + // * 'language_code=en-us' matches knowledge bases with en-us language code. + // * 'display_name:articles' matches knowledge bases whose display name + // contains "articles". + // * 'display_name:"Best Articles"' matches knowledge bases whose display + // name contains "Best Articles". + // * 'language_code=en-gb AND display_name=articles' matches all knowledge + // bases whose display name contains "articles" and whose language code is + // "en-gb". + // + // Note: An empty filter string (i.e. "") is a no-op and will result in no + // filtering. + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesResponse { + // The list of knowledge bases. + repeated KnowledgeBase knowledge_bases = 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 [KnowledgeBases.GetKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase]. +message GetKnowledgeBaseRequest { + // Required. The name of the knowledge base to retrieve. + // Format `projects//locations//knowledgeBases/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; +} + +// Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. +message CreateKnowledgeBaseRequest { + // Required. The project to create a knowledge base for. + // Format: `projects//locations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // Required. The knowledge base to create. + KnowledgeBase knowledge_base = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. +message DeleteKnowledgeBaseRequest { + // Required. The name of the knowledge base to delete. + // Format: `projects//locations//knowledgeBases/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/KnowledgeBase" + } + ]; + + // Optional. Force deletes the knowledge base. When set to true, any documents + // in the knowledge base are also deleted. + bool force = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [KnowledgeBases.UpdateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase]. +message UpdateKnowledgeBaseRequest { + // Required. The knowledge base to update. + KnowledgeBase knowledge_base = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Not specified means `update all`. + // Currently, only `display_name` can be updated, an InvalidArgument will be + // returned for attempting to update other fields. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto new file mode 100644 index 00000000000..1f7309b6e3a --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/participant.proto @@ -0,0 +1,1424 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; +import "google/cloud/dialogflow/v2beta1/session.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ParticipantProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Participants][google.cloud.dialogflow.v2beta1.Participant]. +service Participants { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Creates a new participant in a conversation. + rpc CreateParticipant(CreateParticipantRequest) returns (Participant) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*}/participants" + body: "participant" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants" + body: "participant" + } + }; + option (google.api.method_signature) = "parent,participant"; + } + + // Retrieves a conversation participant. + rpc GetParticipant(GetParticipantRequest) returns (Participant) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/conversations/*/participants/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/conversations/*/participants/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Returns the list of all participants in the specified conversation. + rpc ListParticipants(ListParticipantsRequest) returns (ListParticipantsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/conversations/*}/participants" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the specified participant. + rpc UpdateParticipant(UpdateParticipantRequest) returns (Participant) { + option (google.api.http) = { + patch: "/v2beta1/{participant.name=projects/*/conversations/*/participants/*}" + body: "participant" + additional_bindings { + patch: "/v2beta1/{participant.name=projects/*/locations/*/conversations/*/participants/*}" + body: "participant" + } + }; + option (google.api.method_signature) = "participant,update_mask"; + } + + // Adds a text (chat, for example), or audio (phone recording, for example) + // message from a participant into the conversation. + // + // Note: Always use agent versions for production traffic + // sent to virtual agents. See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc AnalyzeContent(AnalyzeContentRequest) returns (AnalyzeContentResponse) { + option (google.api.http) = { + post: "/v2beta1/{participant=projects/*/conversations/*/participants/*}:analyzeContent" + body: "*" + additional_bindings { + post: "/v2beta1/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent" + body: "*" + } + }; + option (google.api.method_signature) = "participant,text_input"; + option (google.api.method_signature) = "participant,audio_input"; + option (google.api.method_signature) = "participant,event_input"; + } + + // Adds a text (e.g., chat) or audio (e.g., phone recording) message from a + // participant into the conversation. + // Note: This method is only available through the gRPC API (not REST). + // + // The top-level message sent to the client by the server is + // `StreamingAnalyzeContentResponse`. Multiple response messages can be + // returned in order. The first one or more messages contain the + // `recognition_result` field. Each result represents a more complete + // transcript of what the user said. The next message contains the + // `reply_text` field, and potentially the `reply_audio` and/or the + // `automated_agent_reply` fields. + // + // Note: Always use agent versions for production traffic + // sent to virtual agents. See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc StreamingAnalyzeContent(stream StreamingAnalyzeContentRequest) returns (stream StreamingAnalyzeContentResponse) { + } + + // Gets suggested articles for a participant based on specific historical + // messages. + // + // Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated + // suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion + // based on the provided conversation context in the real time. + rpc SuggestArticles(SuggestArticlesRequest) returns (SuggestArticlesResponse) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets suggested faq answers for a participant based on specific historical + // messages. + rpc SuggestFaqAnswers(SuggestFaqAnswersRequest) returns (SuggestFaqAnswersResponse) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets smart replies for a participant based on specific historical + // messages. + rpc SuggestSmartReplies(SuggestSmartRepliesRequest) returns (SuggestSmartRepliesResponse) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" + body: "*" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies" + body: "*" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Deprecated: Use inline suggestion, event based suggestion or + // Suggestion* API instead. + // See [HumanAgentAssistantConfig.name][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name] for more + // details. + // Removal Date: 2020-09-01. + // + // Retrieves suggestions for live agents. + // + // This method should be used by human agent client software to fetch auto + // generated suggestions in real-time, while the conversation with an end user + // is in progress. The functionality is implemented in terms of the + // [list + // pagination](https://cloud.google.com/apis/design/design_patterns#list_pagination) + // design pattern. The client app should use the `next_page_token` field + // to fetch the next batch of suggestions. `suggestions` are sorted by + // `create_time` in descending order. + // To fetch latest suggestion, just set `page_size` to 1. + // To fetch new suggestions without duplication, send request with filter + // `create_time_epoch_microseconds > [first item's create_time of previous + // request]` and empty page_token. + rpc ListSuggestions(ListSuggestionsRequest) returns (ListSuggestionsResponse) { + option deprecated = true; + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions" + }; + } + + // Deprecated. use [SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles] and [SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers] instead. + // + // Gets suggestions for a participant based on specific historical + // messages. + // + // Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated + // suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion + // based on the provided conversation context in the real time. + rpc CompileSuggestion(CompileSuggestionRequest) returns (CompileSuggestionResponse) { + option deprecated = true; + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:compile" + body: "*" + }; + } +} + +// Represents a conversation participant (human agent, virtual agent, end-user). +message Participant { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Participant" + pattern: "projects/{project}/conversations/{conversation}/participants/{participant}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" + }; + + // Enumeration of the roles a participant can play in a conversation. + enum Role { + // Participant role not set. + ROLE_UNSPECIFIED = 0; + + // Participant is a human agent. + HUMAN_AGENT = 1; + + // Participant is an automated agent, such as a Dialogflow agent. + AUTOMATED_AGENT = 2; + + // Participant is an end user that has called or chatted with + // Dialogflow services. + END_USER = 3; + } + + // Optional. The unique identifier of this participant. + // Format: `projects//locations//conversations//participants/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Immutable. The role this participant plays in the conversation. This field must be set + // during participant creation and is then immutable. + Role role = 2 [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. Obfuscated user id that should be associated with the created participant. + // + // You can specify a user id as follows: + // + // 1. If you set this field in + // [CreateParticipantRequest][google.cloud.dialogflow.v2beta1.CreateParticipantRequest.participant] or + // [UpdateParticipantRequest][google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.participant], + // Dialogflow adds the obfuscated user id with the participant. + // + // 2. If you set this field in + // [AnalyzeContent][google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.obfuscated_external_user_id] or + // [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.obfuscated_external_user_id], + // Dialogflow will update [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2beta1.Participant.obfuscated_external_user_id]. + // + // Dialogflow uses this user id for following purposes: + // 1) Billing and measurement. If user with the same + // obfuscated_external_user_id is created in a later conversation, dialogflow + // will know it's the same user. 2) Agent assist suggestion personalization. + // For example, Dialogflow can use it to provide personalized smart reply + // suggestions for this user. + // + // Note: + // + // * Please never pass raw user ids to Dialogflow. Always obfuscate your user + // id first. + // * Dialogflow only accepts a UTF-8 encoded string, e.g., a hex digest of a + // hash function like SHA-512. + // * The length of the user id must be <= 256 characters. + string obfuscated_external_user_id = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Key-value filters on the metadata of documents returned by article + // suggestion. If specified, article suggestion only returns suggested + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` + map documents_metadata_filters = 8 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a message posted into a conversation. +message Message { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Message" + pattern: "projects/{project}/conversations/{conversation}/messages/{message}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}" + }; + + // Optional. The unique identifier of the message. + // Format: `projects//locations//conversations//messages/`. + string name = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The message content. + string content = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The message language. + // This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag. Example: "en-US". + string language_code = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The participant that sends this message. + string participant = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The role of the participant. + Participant.Role participant_role = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time when the message was created in Contact Center AI. + google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The time when the message was sent. + google.protobuf.Timestamp send_time = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The annotation for the message. + MessageAnnotation message_annotation = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The sentiment analysis result for the message. + SentimentAnalysisResult sentiment_analysis = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Participants.CreateParticipant][google.cloud.dialogflow.v2beta1.Participants.CreateParticipant]. +message CreateParticipantRequest { + // Required. Resource identifier of the conversation adding the participant. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Required. The participant to create. + Participant participant = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Participants.GetParticipant][google.cloud.dialogflow.v2beta1.Participants.GetParticipant]. +message GetParticipantRequest { + // Required. The name of the participant. Format: + // `projects//locations//conversations//participants/`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; +} + +// The request message for [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. +message ListParticipantsRequest { + // Required. The conversation to list all participants from. + // Format: `projects//locations//conversations/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. +message ListParticipantsResponse { + // The list of participants. There is a maximum number of items + // returned based on the page_size field in the request. + repeated Participant participants = 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 request message for [Participants.UpdateParticipant][google.cloud.dialogflow.v2beta1.Participants.UpdateParticipant]. +message UpdateParticipantRequest { + // Required. The participant to update. + Participant participant = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to specify which fields to update. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents the natural language speech audio to be processed. +message AudioInput { + // Required. Instructs the speech recognizer how to process the speech audio. + InputAudioConfig config = 1; + + // Required. The natural language speech audio to be processed. + // A single request can contain up to 1 minute of speech audio data. + // The transcribed text cannot contain more than 256 bytes for virtual agent + // interactions. + bytes audio = 2; +} + +// Represents the natural language speech audio to be played to the end user. +message OutputAudio { + // Required. Instructs the speech synthesizer how to generate the speech + // audio. + OutputAudioConfig config = 1; + + // Required. The natural language speech audio. + bytes audio = 2; +} + +// Represents a response from an automated agent. +message AutomatedAgentReply { + // Represents different automated agent reply types. + enum AutomatedAgentReplyType { + // Not specified. This should never happen. + AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED = 0; + + // Partial reply. e.g. Aggregated responses in a `Fulfillment` that enables + // `return_partial_response` can be returned as partial reply. + // WARNING: partial reply is not eligible for barge-in. + PARTIAL = 1; + + // Final reply. + FINAL = 2; + } + + // Required. + oneof response { + // Response of the Dialogflow [Sessions.DetectIntent][google.cloud.dialogflow.v2beta1.Sessions.DetectIntent] call. + DetectIntentResponse detect_intent_response = 1; + } + + // Response messages from the automated agent. + repeated ResponseMessage response_messages = 3; + + // Info on the query match for the automated agent response. + oneof match { + // Name of the intent if an intent is matched for the query. + // For a V2 query, the value format is `projects//locations/ + // /agent/intents/`. + // For a V3 query, the value format is `projects//locations/ + // /agents//intents/`. + string intent = 4 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Intent" + }]; + + // Event name if an event is triggered for the query. + string event = 5; + } + + // The confidence of the match. Values range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + // This value is for informational purpose only and is only used to help match + // the best intent within the classification threshold. This value may change + // for the same end-user expression at any time due to a model retraining or + // change in implementation. + float match_confidence = 9; + + // The collection of current parameters at the time of this response. + google.protobuf.Struct parameters = 10; + + // The collection of current Dialogflow CX agent session parameters at the + // time of this response. + // Deprecated: Use `parameters` instead. + google.protobuf.Struct cx_session_parameters = 6 [deprecated = true]; + + // AutomatedAgentReply type. + AutomatedAgentReplyType automated_agent_reply_type = 7; + + // Indicates whether the partial automated agent reply is interruptible when a + // later reply message arrives. e.g. if the agent specified some music as + // partial response, it can be cancelled. + bool allow_cancellation = 8; +} + +// The type of Human Agent Assistant API suggestion to perform, and the maximum +// number of results to return for that type. Multiple `Feature` objects can +// be specified in the `features` list. +message SuggestionFeature { + // Defines the type of Human Agent Assistant feature. + enum Type { + // Unspecified feature type. + TYPE_UNSPECIFIED = 0; + + // Run article suggestion model for chat. + ARTICLE_SUGGESTION = 1; + + // Run FAQ model. + FAQ = 2; + + // Run smart reply model for chat. + SMART_REPLY = 3; + + // Run conversation summarization model for chat. + CONVERSATION_SUMMARIZATION = 8; + } + + // Type of Human Agent Assistant API feature to request. + Type type = 1; +} + +// Represents the parameters of human assist query. +message AssistQueryParameters { + // Key-value filters on the metadata of documents returned by article + // suggestion. If specified, article suggestion only returns suggested + // documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. Multiple + // values for a metadata key should be concatenated by comma. For example, + // filters to match all documents that have 'US' or 'CA' in their market + // metadata values and 'agent' in their user metadata values will be + // ``` + // documents_metadata_filters { + // key: "market" + // value: "US,CA" + // } + // documents_metadata_filters { + // key: "user" + // value: "agent" + // } + // ``` + map documents_metadata_filters = 1; +} + +// The request message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. +message AnalyzeContentRequest { + // Required. The name of the participant this text comes from. + // Format: `projects//locations//conversations//participants/`. + string participant = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Required. The input content. + oneof input { + // The natural language text to be processed. + TextInput text_input = 6; + + // The natural language speech audio to be processed. + AudioInput audio_input = 7; + + // An input event to send to Dialogflow. + EventInput event_input = 8; + } + + // Speech synthesis configuration. + // The speech synthesis settings for a virtual agent that may be configured + // for the associated conversation profile are not used when calling + // AnalyzeContent. If this configuration is not supplied, speech synthesis + // is disabled. + OutputAudioConfig reply_audio_config = 5; + + // Parameters for a Dialogflow virtual-agent query. + QueryParameters query_params = 9; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 14; + + // Additional parameters to be put into Dialogflow CX session parameters. To + // remove a parameter from the session, clients should explicitly set the + // parameter value to null. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + google.protobuf.Struct cx_parameters = 18; + + // The unique identifier of the CX page to override the `current_page` in the + // session. + // Format: `projects//locations//agents//flows//pages/`. + // + // If `cx_current_page` is specified, the previous state of the session will + // be ignored by Dialogflow CX, including the [previous + // page][QueryResult.current_page] and the [previous session + // parameters][QueryResult.parameters]. In most cases, `cx_current_page` and + // `cx_parameters` should be configured together to direct a session to a + // specific state. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + string cx_current_page = 20; + + // Optional. The send time of the message from end user or human agent's + // perspective. It is used for identifying the same message under one + // participant. + // + // Given two messages under the same participant: + // - If send time are different regardless of whether the content of the + // messages are exactly the same, the conversation will regard them as + // two distinct messages sent by the participant. + // - If send time is the same regardless of whether the content of the + // messages are exactly the same, the conversation will regard them as + // same message, and ignore the message received later. + // + // If the value is not provided, a new request will always be regarded as a + // new message without any de-duplication. + google.protobuf.Timestamp message_send_time = 10; + + // A unique identifier for this request. Restricted to 36 ASCII characters. + // A random UUID is recommended. + // This request is only idempotent if a `request_id` is provided. + string request_id = 11; +} + +// The message in the response that indicates the parameters of DTMF. +message DtmfParameters { + // Indicates whether DTMF input can be handled in the next request. + bool accepts_dtmf_input = 1; +} + +// The response message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. +message AnalyzeContentResponse { + // Output only. The output text content. + // This field is set if the automated agent responded with text to show to + // the user. + string reply_text = 1; + + // Optional. The audio data bytes encoded as specified in the request. + // This field is set if: + // + // - `reply_audio_config` was specified in the request, or + // - The automated agent responded with audio to play to the user. In such + // case, `reply_audio.config` contains settings used to synthesize the + // speech. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + OutputAudio reply_audio = 2; + + // Optional. Only set if a Dialogflow automated agent has responded. + // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][] + // and [AutomatedAgentReply.detect_intent_response.output_audio_config][] + // are always empty, use [reply_audio][google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.reply_audio] instead. + AutomatedAgentReply automated_agent_reply = 3; + + // Output only. Message analyzed by CCAI. + Message message = 5; + + // The suggestions for most recent human agent. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.human_agent_suggestion_config]. + // + // Note that any failure of Agent Assist features will not lead to the overall + // failure of an AnalyzeContent API call. Instead, the features will + // fail silently with the error field set in the corresponding + // SuggestionResult. + repeated SuggestionResult human_agent_suggestion_results = 6; + + // The suggestions for end user. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.end_user_suggestion_config]. + // + // Same as human_agent_suggestion_results, any failure of Agent Assist + // features will not lead to the overall failure of an AnalyzeContent API + // call. Instead, the features will fail silently with the error field set in + // the corresponding SuggestionResult. + repeated SuggestionResult end_user_suggestion_results = 7; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 9; +} + +// Defines the language used in the input text. +message InputTextConfig { + // Required. The language of this conversational query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. + string language_code = 1; +} + +// The top-level message sent by the client to the +// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] method. +// +// Multiple request messages should be sent in order: +// +// 1. The first message must contain +// [participant][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.participant], +// [config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.config] and optionally +// [query_params][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.query_params]. If you want +// to receive an audio response, it should also contain +// [reply_audio_config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.reply_audio_config]. +// The message must not contain +// [input][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input]. +// +// 2. If [config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.config] in the first message +// was set to [audio_config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.audio_config], +// all subsequent messages must contain +// [input_audio][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input_audio] to continue +// with Speech recognition. +// If you decide to rather analyze text input after you already started +// Speech recognition, please send a message with +// [StreamingAnalyzeContentRequest.input_text][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input_text]. +// +// However, note that: +// +// * Dialogflow will bill you for the audio so far. +// * Dialogflow discards all Speech recognition results in favor of the +// text input. +// +// 3. If [StreamingAnalyzeContentRequest.config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.config] in the first message was set +// to [StreamingAnalyzeContentRequest.text_config][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.text_config], then the second message +// must contain only [input_text][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.input_text]. +// Moreover, you must not send more than two messages. +// +// After you sent all input, you must half-close or abort the request stream. +message StreamingAnalyzeContentRequest { + // Required. The name of the participant this text comes from. + // Format: `projects//locations//conversations//participants/`. + string participant = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Required. The input config. + oneof config { + // Instructs the speech recognizer how to process the speech audio. + InputAudioConfig audio_config = 2; + + // The natural language text to be processed. + InputTextConfig text_config = 3; + } + + // Speech synthesis configuration. + // The speech synthesis settings for a virtual agent that may be configured + // for the associated conversation profile are not used when calling + // StreamingAnalyzeContent. If this configuration is not supplied, speech + // synthesis is disabled. + OutputAudioConfig reply_audio_config = 4; + + // Required. The input. + oneof input { + // The input audio content to be recognized. Must be sent if `audio_config` + // is set in the first message. The complete audio over all streaming + // messages must not exceed 1 minute. + bytes input_audio = 5; + + // The UTF-8 encoded natural language text to be processed. Must be sent if + // `text_config` is set in the first message. Text length must not exceed + // 256 bytes for virtual agent interactions. The `input_text` field can be + // only sent once. + string input_text = 6; + + // The DTMF digits used to invoke intent and fill in parameter value. + // + // This input is ignored if the previous response indicated that DTMF input + // is not accepted. + TelephonyDtmfEvents input_dtmf = 9; + } + + // Parameters for a Dialogflow virtual-agent query. + QueryParameters query_params = 7; + + // Parameters for a human assist query. + AssistQueryParameters assist_query_params = 8; + + // Additional parameters to be put into Dialogflow CX session parameters. To + // remove a parameter from the session, clients should explicitly set the + // parameter value to null. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + google.protobuf.Struct cx_parameters = 13; + + // The unique identifier of the CX page to override the `current_page` in the + // session. + // Format: `projects//locations//agents//flows//pages/`. + // + // If `cx_current_page` is specified, the previous state of the session will + // be ignored by Dialogflow CX, including the [previous + // page][QueryResult.current_page] and the [previous session + // parameters][QueryResult.parameters]. In most cases, `cx_current_page` and + // `cx_parameters` should be configured together to direct a session to a + // specific state. + // + // Note: this field should only be used if you are connecting to a Dialogflow + // CX agent. + string cx_current_page = 15; + + // Enable partial virtual agent responses. If this flag is not enabled, + // response stream still contains only one final response even if some + // `Fulfillment`s in Dialogflow virtual agent have been configured to return + // partial responses. + bool enable_partial_automated_agent_reply = 12; +} + +// The top-level message returned from the `StreamingAnalyzeContent` method. +// +// Multiple response messages can be returned in order: +// +// 1. If the input was set to streaming audio, the first one or more messages +// contain `recognition_result`. Each `recognition_result` represents a more +// complete transcript of what the user said. The last `recognition_result` +// has `is_final` set to `true`. +// +// 2. In virtual agent stage: if `enable_partial_automated_agent_reply` is +// true, the following N (currently 1 <= N <= 4) messages +// contain `automated_agent_reply` and optionally `reply_audio` +// returned by the virtual agent. The first (N-1) +// `automated_agent_reply`s will have `automated_agent_reply_type` set to +// `PARTIAL`. The last `automated_agent_reply` has +// `automated_agent_reply_type` set to `FINAL`. +// If `enable_partial_automated_agent_reply` is not enabled, response stream +// only contains the final reply. +// +// In human assist stage: the following N (N >= 1) messages contain +// `human_agent_suggestion_results`, `end_user_suggestion_results` or +// `message`. +message StreamingAnalyzeContentResponse { + // The result of speech recognition. + StreamingRecognitionResult recognition_result = 1; + + // Optional. The output text content. + // This field is set if an automated agent responded with a text for the user. + string reply_text = 2; + + // Optional. The audio data bytes encoded as specified in the request. + // This field is set if: + // + // - The `reply_audio_config` field is specified in the request. + // - The automated agent, which this output comes from, responded with audio. + // In such case, the `reply_audio.config` field contains settings used to + // synthesize the speech. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + OutputAudio reply_audio = 3; + + // Optional. Only set if a Dialogflow automated agent has responded. + // Note that: [AutomatedAgentReply.detect_intent_response.output_audio][] + // and [AutomatedAgentReply.detect_intent_response.output_audio_config][] + // are always empty, use [reply_audio][google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.reply_audio] instead. + AutomatedAgentReply automated_agent_reply = 4; + + // Output only. Message analyzed by CCAI. + Message message = 6; + + // The suggestions for most recent human agent. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.human_agent_suggestion_config][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.human_agent_suggestion_config]. + repeated SuggestionResult human_agent_suggestion_results = 7; + + // The suggestions for end user. The order is the same as + // [HumanAgentAssistantConfig.SuggestionConfig.feature_configs][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.feature_configs] of + // [HumanAgentAssistantConfig.end_user_suggestion_config][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.end_user_suggestion_config]. + repeated SuggestionResult end_user_suggestion_results = 8; + + // Indicates the parameters of DTMF. + DtmfParameters dtmf_parameters = 10; +} + +// Represents a part of a message possibly annotated with an entity. The part +// can be an entity or purely a part of the message between two entities or +// message start/end. +message AnnotatedMessagePart { + // Required. A part of a message possibly annotated with an entity. + string text = 1; + + // Optional. The [Dialogflow system entity + // type](https://cloud.google.com/dialogflow/docs/reference/system-entities) + // of this message part. If this is empty, Dialogflow could not annotate the + // phrase part with a system entity. + string entity_type = 2; + + // Optional. The [Dialogflow system entity formatted value + // ](https://cloud.google.com/dialogflow/docs/reference/system-entities) of + // this message part. For example for a system entity of type + // `@sys.unit-currency`, this may contain: + //
+  // {
+  //   "amount": 5,
+  //   "currency": "USD"
+  // }
+  // 
+ google.protobuf.Value formatted_value = 3; +} + +// Represents the result of annotation for the message. +message MessageAnnotation { + // Optional. The collection of annotated message parts ordered by their + // position in the message. You can recover the annotated message by + // concatenating [AnnotatedMessagePart.text]. + repeated AnnotatedMessagePart parts = 1; + + // Required. Indicates whether the text message contains entities. + bool contain_entities = 2; +} + +// Represents article answer. +message ArticleAnswer { + // The article title. + string title = 1; + + // The article URI. + string uri = 2; + + // Output only. Article snippets. + repeated string snippets = 3; + + // A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; +} + +// Represents answer from "frequently asked questions". +message FaqAnswer { + // The piece of text from the `source` knowledge base document. + string answer = 1; + + // The system's confidence score that this Knowledge answer is a good match + // for this conversational query, range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + float confidence = 2; + + // The corresponding FAQ question. + string question = 3; + + // Indicates which Knowledge Document this answer was extracted + // from. + // Format: `projects//locations//agent/knowledgeBases//documents/`. + string source = 4; + + // A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; +} + +// Represents a smart reply answer. +message SmartReplyAnswer { + // The content of the reply. + string reply = 1; + + // Smart reply confidence. + // The system's confidence score that this reply is a good match for + // this conversation, as a value from 0.0 (completely uncertain) to 1.0 + // (completely certain). + float confidence = 2; + + // The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 3 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/AnswerRecord" + }]; +} + +// One response of different type of suggestion response which is used in +// the response of [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and +// [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent], as well as [HumanAgentAssistantEvent][google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent]. +message SuggestionResult { + // Different type of suggestion response. + oneof suggestion_response { + // Error status if the request failed. + google.rpc.Status error = 1; + + // SuggestArticlesResponse if request is for ARTICLE_SUGGESTION. + SuggestArticlesResponse suggest_articles_response = 2; + + // SuggestFaqAnswersResponse if request is for FAQ_ANSWER. + SuggestFaqAnswersResponse suggest_faq_answers_response = 3; + + // SuggestSmartRepliesResponse if request is for SMART_REPLY. + SuggestSmartRepliesResponse suggest_smart_replies_response = 4; + } +} + +// The request message for [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. +message SuggestArticlesRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Max number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message] to use as context + // when compiling the suggestion. By default 20 and at most 50. + int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Parameters for a human assist query. + AssistQueryParameters assist_query_params = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. +message SuggestArticlesResponse { + // Output only. Articles ordered by score in descending order. + repeated ArticleAnswer article_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestArticlesResponse.context_size][google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. +message SuggestFaqAnswersRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // Optional. The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + } + ]; + + // Optional. Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. By default 20 and at most 50. + int32 context_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Parameters for a human assist query. + AssistQueryParameters assist_query_params = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// The request message for [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. +message SuggestFaqAnswersResponse { + // Output only. Answers extracted from FAQ documents. + repeated FaqAnswer faq_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestFaqAnswersRequest.context_size][google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// The request message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. +message SuggestSmartRepliesRequest { + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + } + ]; + + // The current natural language text segment to compile suggestion + // for. This provides a way for user to get follow up smart reply suggestion + // after a smart reply selection, without sending a text message. + TextInput current_text_input = 4; + + // The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Optional. Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. By default 20 and at most 50. + int32 context_size = 3; +} + +// The response message for [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. +message SuggestSmartRepliesResponse { + // Output only. Multiple reply options provided by smart reply service. The + // order is based on the rank of the model prediction. + // The maximum number of the returned replies is set in SmartReplyConfig. + repeated SmartReplyAnswer smart_reply_answers = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Message" + }]; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.latest_message] to compile the + // suggestion. It may be smaller than the + // [SuggestSmartRepliesRequest.context_size][google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.context_size] field in the request if there + // aren't that many messages in the conversation. + int32 context_size = 3; +} + +// Represents a suggestion for a human agent. +message Suggestion { + option deprecated = true; + + // Represents suggested article. + message Article { + // Output only. The article title. + string title = 1; + + // Output only. The article URI. + string uri = 2; + + // Output only. Article snippets. + repeated string snippets = 3; + + // Output only. A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // Output only. The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; + } + + // Represents suggested answer from "frequently asked questions". + message FaqAnswer { + // Output only. The piece of text from the `source` knowledge base document. + string answer = 1; + + // The system's confidence score that this Knowledge answer is a good match + // for this conversational query, range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + float confidence = 2; + + // Output only. The corresponding FAQ question. + string question = 3; + + // Output only. Indicates which Knowledge Document this answer was extracted + // from. + // Format: `projects//locations//agent/knowledgeBases//documents/`. + string source = 4; + + // Output only. A map that contains metadata about the answer and the + // document from which it originates. + map metadata = 5; + + // Output only. The name of answer record, in the format of + // "projects//locations//answerRecords/" + string answer_record = 6; + } + + // Output only. The name of this suggestion. + // Format: + // `projects//locations//conversations//participants/*/suggestions/`. + string name = 1; + + // Output only. Articles ordered by score in descending order. + repeated Article articles = 2; + + // Output only. Answers extracted from FAQ documents. + repeated FaqAnswer faq_answers = 4; + + // Output only. The time the suggestion was created. + google.protobuf.Timestamp create_time = 5; + + // Output only. Latest message used as context to compile this suggestion. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 7; +} + +// The request message for [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. +message ListSuggestionsRequest { + option deprecated = true; + + // Required. The name of the participant to fetch suggestions for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1; + + // Optional. The maximum number of items to return in a single page. The + // default value is 100; the maximum value is 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; + + // Optional. Filter on suggestions fields. Currently predicates on + // `create_time` and `create_time_epoch_microseconds` are supported. + // `create_time` only support milliseconds accuracy. E.g., + // `create_time_epoch_microseconds > 1551790877964485` or + // `create_time > "2017-01-15T01:30:15.01Z"` + // + // For more information about filtering, see + // [API Filtering](https://aip.dev/160). + string filter = 4; +} + +// The response message for [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. +message ListSuggestionsResponse { + option deprecated = true; + + // Required. The list of suggestions. There will be a maximum number of items + // returned based on the page_size field in the request. `suggestions` is + // sorted by `create_time` in descending order. + repeated Suggestion suggestions = 1; + + // Optional. 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 request message for [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. +message CompileSuggestionRequest { + option deprecated = true; + + // Required. The name of the participant to fetch suggestion for. + // Format: `projects//locations//conversations//participants/`. + string parent = 1; + + // Optional. The name of the latest conversation message to compile suggestion + // for. If empty, it will be the latest message of the conversation. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Optional. Max number of messages prior to and including + // [latest_message] to use as context when compiling the + // suggestion. If zero or less than zero, 20 is used. + int32 context_size = 3; +} + +// The response message for [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. +message CompileSuggestionResponse { + option deprecated = true; + + // The compiled suggestion. + Suggestion suggestion = 1; + + // The name of the latest conversation message used to compile + // suggestion for. + // + // Format: `projects//locations//conversations//messages/`. + string latest_message = 2; + + // Number of messages prior to and including + // [latest_message][google.cloud.dialogflow.v2beta1.CompileSuggestionResponse.latest_message] + // to compile the suggestion. It may be smaller than the + // [CompileSuggestionRequest.context_size][google.cloud.dialogflow.v2beta1.CompileSuggestionRequest.context_size] field in the request if + // there aren't that many messages in the conversation. + int32 context_size = 3; +} + +// Response messages from an automated agent. +message ResponseMessage { + // The text response message. + message Text { + // A collection of text responses. + repeated string text = 1; + } + + // Indicates that the conversation should be handed off to a human agent. + // + // Dialogflow only uses this to determine which conversations were handed off + // to a human agent for measurement purposes. What else to do with this signal + // is up to you and your handoff procedures. + // + // You may set this, for example: + // * In the entry fulfillment of a CX Page if entering the page indicates + // something went extremely wrong in the conversation. + // * In a webhook response when you determine that the customer issue can only + // be handled by a human. + message LiveAgentHandoff { + // Custom metadata for your handoff procedure. Dialogflow doesn't impose + // any structure on this. + google.protobuf.Struct metadata = 1; + } + + // Indicates that interaction with the Dialogflow agent has ended. + message EndInteraction { + + } + + // Represents an audio message that is composed of both segments + // synthesized from the Dialogflow agent prompts and ones hosted externally + // at the specified URIs. + message MixedAudio { + // Represents one segment of audio. + message Segment { + // Content of the segment. + oneof content { + // Raw audio synthesized from the Dialogflow agent's response using + // the output config specified in the request. + bytes audio = 1; + + // Client-specific URI that points to an audio clip accessible to the + // client. + string uri = 2; + } + + // Whether the playback of this segment can be interrupted by the end + // user's speech and the client should then start the next Dialogflow + // request. + bool allow_playback_interruption = 3; + } + + // Segments this audio response is composed of. + repeated Segment segments = 1; + } + + // Represents the signal that telles the client to transfer the phone call + // connected to the agent to a third-party endpoint. + message TelephonyTransferCall { + // Endpoint to transfer the call to. + oneof endpoint { + // Transfer the call to a phone number + // in [E.164 format](https://en.wikipedia.org/wiki/E.164). + string phone_number = 1; + + // Transfer the call to a SIP endpoint. + string sip_uri = 2; + } + } + + // Required. The rich response message. + oneof message { + // Returns a text response. + Text text = 1; + + // Returns a response containing a custom, platform-specific payload. + google.protobuf.Struct payload = 2; + + // Hands off conversation to a live agent. + LiveAgentHandoff live_agent_handoff = 3; + + // A signal that indicates the interaction with the Dialogflow agent has + // ended. + EndInteraction end_interaction = 4; + + // An audio response message composed of both the synthesized Dialogflow + // agent responses and the audios hosted in places known to the client. + MixedAudio mixed_audio = 5; + + // A signal that the client should transfer the phone call connected to + // this agent to a third-party endpoint. + TelephonyTransferCall telephony_transfer_call = 6; + } +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto new file mode 100644 index 00000000000..ac64e712789 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session.proto @@ -0,0 +1,839 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/agent.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; +import "google/cloud/dialogflow/v2beta1/context.proto"; +import "google/cloud/dialogflow/v2beta1/intent.proto"; +import "google/cloud/dialogflow/v2beta1/session_entity_type.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/rpc/status.proto"; +import "google/type/latlng.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "SessionProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/Session" + pattern: "projects/{project}/agent/sessions/{session}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}" +}; + +// A service used for session interactions. +// +// For more information, see the [API interactions +// guide](https://cloud.google.com/dialogflow/docs/api-overview). +service Sessions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Processes a natural language query and returns structured, actionable data + // as a result. This method is not idempotent, because it may cause contexts + // and session entity types to be updated, which in turn might affect + // results of future queries. + // + // If you might use + // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + // or other CCAI products now or in the future, consider using + // [AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] + // instead of `DetectIntent`. `AnalyzeContent` has additional + // functionality for Agent Assist and other CCAI products. + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc DetectIntent(DetectIntentRequest) returns (DetectIntentResponse) { + option (google.api.http) = { + post: "/v2beta1/{session=projects/*/agent/sessions/*}:detectIntent" + body: "*" + additional_bindings { + post: "/v2beta1/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent" + body: "*" + } + additional_bindings { + post: "/v2beta1/{session=projects/*/locations/*/agent/sessions/*}:detectIntent" + body: "*" + } + additional_bindings { + post: "/v2beta1/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent" + body: "*" + } + }; + option (google.api.method_signature) = "session,query_input"; + } + + // Processes a natural language query in audio format in a streaming fashion + // and returns structured, actionable data as a result. This method is only + // available via the gRPC API (not REST). + // + // If you might use + // [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + // or other CCAI products now or in the future, consider using + // [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] + // instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has + // additional functionality for Agent Assist and other CCAI products. + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) { + } +} + +// The request to detect user's intent. +message DetectIntentRequest { + // Required. The name of the session this query is sent to. Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment + // (`Environment ID` might be referred to as environment name at some places). + // If `User ID` is not specified, we are using "-". It's up to the API caller + // to choose an appropriate `Session ID` and `User Id`. They can be a random + // number or some type of user and session identifiers (preferably hashed). + // The length of the `Session ID` and `User ID` must not exceed 36 characters. + // For more information, see the [API interactions + // guide](https://cloud.google.com/dialogflow/docs/api-overview). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + string session = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. It can be set to: + // + // 1. an audio config + // which instructs the speech recognizer how to process the speech audio, + // + // 2. a conversational query in the form of text, or + // + // 3. an event that specifies which intent to trigger. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 4; + + // Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] indicating which settings in this + // request-level config should override speech synthesizer settings defined at + // agent-level. + // + // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config] replaces the agent-level + // config in its entirety. + google.protobuf.FieldMask output_audio_config_mask = 7; + + // The natural language speech audio to be processed. This field + // should be populated iff `query_input` is set to an input audio config. + // A single request can contain up to 1 minute of speech audio data. + bytes input_audio = 5; +} + +// The message returned from the DetectIntent method. +message DetectIntentResponse { + // The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The selected results of the conversational query or event processing. + // See `alternative_query_results` for additional potential results. + QueryResult query_result = 2; + + // If Knowledge Connectors are enabled, there could be more than one result + // returned for a given query or event, and this field will contain all + // results except for the top one, which is captured in query_result. The + // alternative results are ordered by decreasing + // `QueryResult.intent_detection_confidence`. If Knowledge Connectors are + // disabled, this field will be empty until multiple responses for regular + // intents are supported, at which point those additional results will be + // surfaced here. + repeated QueryResult alternative_query_results = 5; + + // Specifies the status of the webhook request. + google.rpc.Status webhook_status = 3; + + // The audio data bytes encoded as specified in the request. + // Note: The output audio is generated based on the values of default platform + // text responses found in the `query_result.fulfillment_messages` field. If + // multiple default text responses exist, they will be concatenated when + // generating audio. If no default platform text responses exist, the + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 4; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 6; +} + +// Represents the parameters of the conversational query. +message QueryParameters { + // The time zone of this conversational query from the + // [time zone database](https://www.iana.org/time-zones), e.g., + // America/New_York, Europe/Paris. If not provided, the time zone specified in + // agent settings is used. + string time_zone = 1; + + // The geo location of this conversational query. + google.type.LatLng geo_location = 2; + + // The collection of contexts to be activated before this query is + // executed. + repeated Context contexts = 3; + + // Specifies whether to delete all contexts in the current session + // before the new ones are activated. + bool reset_contexts = 4; + + // Additional session entity types to replace or extend developer + // entity types with. The entity synonyms apply to all languages and persist + // for the session of this query. + repeated SessionEntityType session_entity_types = 5; + + // This field can be used to pass custom data to your webhook. + // Arbitrary JSON objects are supported. + // If supplied, the value is used to populate the + // `WebhookRequest.original_detect_intent_request.payload` + // field sent to your webhook. + google.protobuf.Struct payload = 6; + + // KnowledgeBases to get alternative results from. If not set, the + // KnowledgeBases enabled in the agent (through UI) will be used. + // Format: `projects//knowledgeBases/`. + repeated string knowledge_base_names = 12; + + // Configures the type of sentiment analysis to perform. If not + // provided, sentiment analysis is not performed. + // Note: Sentiment Analysis is only currently available for Essentials Edition + // agents. + SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; + + // For mega agent query, directly specify which sub agents to query. + // If any specified sub agent is not linked to the mega agent, an error will + // be returned. If empty, Dialogflow will decide which sub agents to query. + // If specified for a non-mega-agent query, will be silently ignored. + repeated SubAgent sub_agents = 13; + + // This field can be used to pass HTTP headers for a webhook + // call. These headers will be sent to webhook along with the headers that + // have been configured through Dialogflow web console. The headers defined + // within this field will overwrite the headers configured through Dialogflow + // console if there is a conflict. Header names are case-insensitive. + // Google's specified headers are not allowed. Including: "Host", + // "Content-Length", "Connection", "From", "User-Agent", "Accept-Encoding", + // "If-Modified-Since", "If-None-Match", "X-Forwarded-For", etc. + map webhook_headers = 14; +} + +// Represents the query input. It can contain either: +// +// 1. An audio config which +// instructs the speech recognizer how to process the speech audio. +// +// 2. A conversational query in the form of text. +// +// 3. An event that specifies which intent to trigger. +message QueryInput { + // Required. The input specification. + oneof input { + // Instructs the speech recognizer how to process the speech audio. + InputAudioConfig audio_config = 1; + + // The natural language text to be processed. + TextInput text = 2; + + // The event to be processed. + EventInput event = 3; + + // The DTMF digits used to invoke intent and fill in parameter value. + TelephonyDtmfEvents dtmf = 4; + } +} + +// Represents the result of conversational query or event processing. +message QueryResult { + // The original conversational query text: + // + // - If natural language text was provided as input, `query_text` contains + // a copy of the input. + // - If natural language speech audio was provided as input, `query_text` + // contains the speech recognition result. If speech recognizer produced + // multiple alternatives, a particular one is picked. + // - If automatic spell correction is enabled, `query_text` will contain the + // corrected user input. + string query_text = 1; + + // The language that was triggered during intent detection. + // See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. + string language_code = 15; + + // The Speech recognition confidence between 0.0 and 1.0. A higher number + // indicates an estimated greater likelihood that the recognized words are + // correct. The default of 0.0 is a sentinel value indicating that confidence + // was not set. + // + // This field is not guaranteed to be accurate or set. In particular this + // field isn't set for StreamingDetectIntent since the streaming endpoint has + // separate confidence estimates per portion of the audio in + // StreamingRecognitionResult. + float speech_recognition_confidence = 2; + + // The action name from the matched intent. + string action = 3; + + // The collection of extracted parameters. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 4; + + // This field is set to: + // + // - `false` if the matched intent has required parameters and not all of + // the required parameter values have been collected. + // - `true` if all required parameter values have been collected, or if the + // matched intent doesn't contain any required parameters. + bool all_required_params_present = 5; + + // Indicates whether the conversational query triggers a cancellation for slot + // filling. For more information, see the [cancel slot filling + // documentation](https://cloud.google.com/dialogflow/es/docs/intents-actions-parameters#cancel). + bool cancels_slot_filling = 21; + + // The text to be pronounced to the user or shown on the screen. + // Note: This is a legacy field, `fulfillment_messages` should be preferred. + string fulfillment_text = 6; + + // The collection of rich messages to present to the user. + repeated Intent.Message fulfillment_messages = 7; + + // If the query was fulfilled by a webhook call, this field is set to the + // value of the `source` field returned in the webhook response. + string webhook_source = 8; + + // If the query was fulfilled by a webhook call, this field is set to the + // value of the `payload` field returned in the webhook response. + google.protobuf.Struct webhook_payload = 9; + + // The collection of output contexts. If applicable, + // `output_contexts.parameters` contains entries with name + // `.original` containing the original parameter values + // before the query. + repeated Context output_contexts = 10; + + // The intent that matched the conversational query. Some, not + // all fields are filled in this message, including but not limited to: + // `name`, `display_name`, `end_interaction` and `is_fallback`. + Intent intent = 11; + + // The intent detection confidence. Values range from 0.0 + // (completely uncertain) to 1.0 (completely certain). + // This value is for informational purpose only and is only used to + // help match the best intent within the classification threshold. + // This value may change for the same end-user expression at any time due to a + // model retraining or change in implementation. + // If there are `multiple knowledge_answers` messages, this value is set to + // the greatest `knowledgeAnswers.match_confidence` value in the list. + float intent_detection_confidence = 12; + + // Free-form diagnostic information for the associated detect intent request. + // The fields of this data can change without notice, so you should not write + // code that depends on its structure. + // The data may contain: + // + // - webhook call latency + // - webhook errors + google.protobuf.Struct diagnostic_info = 14; + + // The sentiment analysis result, which depends on the + // `sentiment_analysis_request_config` specified in the request. + SentimentAnalysisResult sentiment_analysis_result = 17; + + // The result from Knowledge Connector (if any), ordered by decreasing + // `KnowledgeAnswers.match_confidence`. + KnowledgeAnswers knowledge_answers = 18; +} + +// Represents the result of querying a Knowledge base. +message KnowledgeAnswers { + // An answer from Knowledge Connector. + message Answer { + // Represents the system's confidence that this knowledge answer is a good + // match for this conversational query. + enum MatchConfidenceLevel { + // Not specified. + MATCH_CONFIDENCE_LEVEL_UNSPECIFIED = 0; + + // Indicates that the confidence is low. + LOW = 1; + + // Indicates our confidence is medium. + MEDIUM = 2; + + // Indicates our confidence is high. + HIGH = 3; + } + + // Indicates which Knowledge Document this answer was extracted from. + // Format: `projects//knowledgeBases//documents/`. + string source = 1 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Document" + }]; + + // The corresponding FAQ question if the answer was extracted from a FAQ + // Document, empty otherwise. + string faq_question = 2; + + // The piece of text from the `source` knowledge base document that answers + // this conversational query. + string answer = 3; + + // The system's confidence level that this knowledge answer is a good match + // for this conversational query. + // NOTE: The confidence level for a given `` pair may change + // without notice, as it depends on models that are constantly being + // improved. However, it will change less frequently than the confidence + // score below, and should be preferred for referencing the quality of an + // answer. + MatchConfidenceLevel match_confidence_level = 4; + + // The system's confidence score that this Knowledge answer is a good match + // for this conversational query. + // The range is from 0.0 (completely uncertain) to 1.0 (completely certain). + // Note: The confidence score is likely to vary somewhat (possibly even for + // identical requests), as the underlying model is under constant + // improvement. It may be deprecated in the future. We recommend using + // `match_confidence_level` which should be generally more stable. + float match_confidence = 5; + } + + // A list of answers from Knowledge Connector. + repeated Answer answers = 1; +} + +// The top-level message sent by the client to the +// [Sessions.StreamingDetectIntent][google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent] method. +// +// Multiple request messages should be sent in order: +// +// 1. The first message must contain +// [session][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.session], +// [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] plus optionally +// [query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. If the client +// wants to receive an audio response, it should also contain +// [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config]. +// The message must not contain +// [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio]. +// 2. If [query_input][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_input] was set to +// [query_input.audio_config][google.cloud.dialogflow.v2beta1.InputAudioConfig], all subsequent +// messages must contain +// [input_audio][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.input_audio] to continue with +// Speech recognition. +// If you decide to rather detect an intent from text input after you +// already started Speech recognition, please send a message with +// [query_input.text][google.cloud.dialogflow.v2beta1.QueryInput.text]. +// +// However, note that: +// +// * Dialogflow will bill you for the audio duration so far. +// * Dialogflow discards all Speech recognition results in favor of the +// input text. +// * Dialogflow will use the language code from the first message. +// +// After you sent all input, you must half-close or abort the request stream. +message StreamingDetectIntentRequest { + // Required. The name of the session the query is sent to. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we are using "-". It's up to the API caller + // to choose an appropriate `Session ID` and `User Id`. They can be a random + // number or some type of user and session identifiers (preferably hashed). + // The length of the `Session ID` and `User ID` must not exceed 36 characters. + // + // For more information, see the [API interactions + // guide](https://cloud.google.com/dialogflow/docs/api-overview). + // + // Note: Always use agent versions for production traffic. + // See [Versions and + // environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + string session = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Session" + } + ]; + + // The parameters of this query. + QueryParameters query_params = 2; + + // Required. The input specification. It can be set to: + // + // 1. an audio config which instructs the speech recognizer how to process + // the speech audio, + // + // 2. a conversational query in the form of text, or + // + // 3. an event that specifies which intent to trigger. + QueryInput query_input = 3 [(google.api.field_behavior) = REQUIRED]; + + // DEPRECATED. Please use [InputAudioConfig.single_utterance][google.cloud.dialogflow.v2beta1.InputAudioConfig.single_utterance] instead. + // If `false` (default), recognition does not cease until the + // client closes the stream. + // If `true`, the recognizer will detect a single spoken utterance in input + // audio. Recognition ceases when it detects the audio's voice has + // stopped or paused. In this case, once a detected intent is received, the + // client should close the stream and start a new request with a new stream as + // needed. + // This setting is ignored when `query_input` is a piece of text or an event. + bool single_utterance = 4 [deprecated = true]; + + // Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 5; + + // Mask for [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] indicating which settings in this + // request-level config should override speech synthesizer settings defined at + // agent-level. + // + // If unspecified or empty, [output_audio_config][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config] replaces the agent-level + // config in its entirety. + google.protobuf.FieldMask output_audio_config_mask = 7; + + // The input audio content to be recognized. Must be sent if + // `query_input` was set to a streaming input audio config. The complete audio + // over all streaming messages must not exceed 1 minute. + bytes input_audio = 6; +} + +// The top-level message returned from the +// `StreamingDetectIntent` method. +// +// Multiple response messages can be returned in order: +// +// 1. If the `StreamingDetectIntentRequest.input_audio` field was +// set, the `recognition_result` field is populated for one +// or more messages. +// See the [StreamingRecognitionResult][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult] message for details +// about the result message sequence. +// +// 2. The next message contains `response_id`, `query_result`, +// `alternative_query_results` and optionally `webhook_status` if a WebHook +// was called. +// +// 3. If `output_audio_config` was specified in the request or agent-level +// speech synthesizer is configured, all subsequent messages contain +// `output_audio` and `output_audio_config`. +message StreamingDetectIntentResponse { + // The unique identifier of the response. It can be used to + // locate a response in the training example set or for reporting issues. + string response_id = 1; + + // The result of speech recognition. + StreamingRecognitionResult recognition_result = 2; + + // The selected results of the conversational query or event processing. + // See `alternative_query_results` for additional potential results. + QueryResult query_result = 3; + + // If Knowledge Connectors are enabled, there could be more than one result + // returned for a given query or event, and this field will contain all + // results except for the top one, which is captured in query_result. The + // alternative results are ordered by decreasing + // `QueryResult.intent_detection_confidence`. If Knowledge Connectors are + // disabled, this field will be empty until multiple responses for regular + // intents are supported, at which point those additional results will be + // surfaced here. + repeated QueryResult alternative_query_results = 7; + + // Specifies the status of the webhook request. + google.rpc.Status webhook_status = 4; + + // The audio data bytes encoded as specified in the request. + // Note: The output audio is generated based on the values of default platform + // text responses found in the `query_result.fulfillment_messages` field. If + // multiple default text responses exist, they will be concatenated when + // generating audio. If no default platform text responses exist, the + // generated audio content will be empty. + // + // In some scenarios, multiple output audio fields may be present in the + // response structure. In these cases, only the top-most-level audio output + // has content. + bytes output_audio = 5; + + // The config used by the speech synthesizer to generate the output audio. + OutputAudioConfig output_audio_config = 6; +} + +// Contains a speech recognition result corresponding to a portion of the audio +// that is currently being processed or an indication that this is the end +// of the single requested utterance. +// +// While end-user audio is being processed, Dialogflow sends a series of +// results. Each result may contain a `transcript` value. A transcript +// represents a portion of the utterance. While the recognizer is processing +// audio, transcript values may be interim values or finalized values. +// Once a transcript is finalized, the `is_final` value is set to true and +// processing continues for the next transcript. +// +// If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance` +// was true, and the recognizer has completed processing audio, +// the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the +// following (last) result contains the last finalized transcript. +// +// The complete end-user utterance is determined by concatenating the +// finalized transcript values received for the series of results. +// +// In the following example, single utterance is enabled. In the case where +// single utterance is not enabled, result 7 would not occur. +// +// ``` +// Num | transcript | message_type | is_final +// --- | ----------------------- | ----------------------- | -------- +// 1 | "tube" | TRANSCRIPT | false +// 2 | "to be a" | TRANSCRIPT | false +// 3 | "to be" | TRANSCRIPT | false +// 4 | "to be or not to be" | TRANSCRIPT | true +// 5 | "that's" | TRANSCRIPT | false +// 6 | "that is | TRANSCRIPT | false +// 7 | unset | END_OF_SINGLE_UTTERANCE | unset +// 8 | " that is the question" | TRANSCRIPT | true +// ``` +// +// Concatenating the finalized transcripts with `is_final` set to true, +// the complete utterance becomes "to be or not to be that is the question". +message StreamingRecognitionResult { + // Type of the response message. + enum MessageType { + // Not specified. Should never be used. + MESSAGE_TYPE_UNSPECIFIED = 0; + + // Message contains a (possibly partial) transcript. + TRANSCRIPT = 1; + + // Message contains DTMF digits. When the client gets the message, it + // should stop sending additional data, half-close the gRPC connection, and + // wait for any additional results until the server closes the gRPC. + // connection. + DTMF_DIGITS = 3; + + // Event indicates that the server has detected the end of the user's speech + // utterance and expects no additional speech. Therefore, the server will + // not process additional audio (although it may subsequently return + // additional results). The client should stop sending additional audio + // data, half-close the gRPC connection, and wait for any additional results + // until the server closes the gRPC connection. This message is only sent if + // `single_utterance` was set to `true`, and is not used otherwise. + END_OF_SINGLE_UTTERANCE = 2; + + // Message contains DTMF digits. Before a message with DTMF_DIGITS is sent, + // a message with PARTIAL_DTMF_DIGITS may be sent with DTMF digits collected + // up to the time of sending, which represents an intermediate result. + PARTIAL_DTMF_DIGITS = 4; + } + + // Type of the result message. + MessageType message_type = 1; + + // Transcript text representing the words that the user spoke. + // Populated if and only if `message_type` = `TRANSCRIPT`. + string transcript = 2; + + // If `false`, the `StreamingRecognitionResult` represents an + // interim result that may change. If `true`, the recognizer will not return + // any further hypotheses about this piece of the audio. May only be populated + // for `message_type` = `TRANSCRIPT`. + bool is_final = 3; + + // The Speech confidence between 0.0 and 1.0 for the current portion of audio. + // A higher number indicates an estimated greater likelihood that the + // recognized words are correct. The default of 0.0 is a sentinel value + // indicating that confidence was not set. + // + // This field is typically only provided if `is_final` is true and you should + // not rely on it being accurate or even set. + float confidence = 4; + + // An estimate of the likelihood that the speech recognizer will + // not change its guess about this interim recognition result: + // + // * If the value is unspecified or 0.0, Dialogflow didn't compute the + // stability. In particular, Dialogflow will only provide stability for + // `TRANSCRIPT` results with `is_final = false`. + // * Otherwise, the value is in (0.0, 1.0] where 0.0 means completely + // unstable and 1.0 means completely stable. + float stability = 6; + + // Word-specific information for the words recognized by Speech in + // [transcript][google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.transcript]. Populated if and only if `message_type` = `TRANSCRIPT` and + // [InputAudioConfig.enable_word_info] is set. + repeated SpeechWordInfo speech_word_info = 7; + + // Time offset of the end of this Speech recognition result relative to the + // beginning of the audio. Only populated for `message_type` = `TRANSCRIPT`. + google.protobuf.Duration speech_end_offset = 8; + + // Detected language code for the transcript. + string language_code = 10; + + // DTMF digits. Populated if and only if `message_type` = `DTMF_DIGITS`. + TelephonyDtmfEvents dtmf_digits = 5; +} + +// Represents the natural language text to be processed. +message TextInput { + // Required. The UTF-8 encoded natural language text to be processed. + // Text length must not exceed 256 characters for virtual agent interactions. + string text = 1; + + // Required. The language of this conversational query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + string language_code = 2; +} + +// Events allow for matching intents by event name instead of the natural +// language input. For instance, input `` can trigger a personalized welcome response. +// The parameter `name` may be used by the agent in the response: +// `"Hello #welcome_event.name! What can I do for you today?"`. +message EventInput { + // Required. The unique identifier of the event. + string name = 1; + + // The collection of parameters associated with the event. + // + // Depending on your protocol or client library language, this is a + // map, associative array, symbol table, dictionary, or JSON object + // composed of a collection of (MapKey, MapValue) pairs: + // + // - MapKey type: string + // - MapKey value: parameter name + // - MapValue type: + // - If parameter's entity type is a composite entity: map + // - Else: depending on parameter value type, could be one of string, + // number, boolean, null, list or map + // - MapValue value: + // - If parameter's entity type is a composite entity: + // map from composite entity property names to property values + // - Else: parameter value + google.protobuf.Struct parameters = 2; + + // Required. The language of this query. See [Language + // Support](https://cloud.google.com/dialogflow/docs/reference/language) + // for a list of the currently supported language codes. Note that queries in + // the same session do not necessarily need to specify the same language. + // + // This field is ignored when used in the context of a + // [WebhookResponse.followup_event_input][google.cloud.dialogflow.v2beta1.WebhookResponse.followup_event_input] field, + // because the language was already defined in the originating detect + // intent request. + string language_code = 3; +} + +// Configures the types of sentiment analysis to perform. +message SentimentAnalysisRequestConfig { + // Instructs the service to perform sentiment analysis on + // `query_text`. If not provided, sentiment analysis is not performed on + // `query_text`. + bool analyze_query_text_sentiment = 1; +} + +// The result of sentiment analysis. Sentiment analysis inspects user input +// and identifies the prevailing subjective opinion, especially to determine a +// user's attitude as positive, negative, or neutral. +// For [Participants.DetectIntent][], it needs to be configured in +// [DetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.DetectIntentRequest.query_params]. For +// [Participants.StreamingDetectIntent][], it needs to be configured in +// [StreamingDetectIntentRequest.query_params][google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.query_params]. +// And for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] and +// [Participants.StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent], it needs to be configured in +// [ConversationProfile.human_agent_assistant_config][google.cloud.dialogflow.v2beta1.ConversationProfile.human_agent_assistant_config] +message SentimentAnalysisResult { + // The sentiment analysis result for `query_text`. + Sentiment query_text_sentiment = 1; +} + +// The sentiment, such as positive/negative feeling or association, for a unit +// of analysis, such as the query text. +message Sentiment { + // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive + // sentiment). + float score = 1; + + // A non-negative number in the [0, +inf) range, which represents the absolute + // magnitude of sentiment, regardless of score (positive or negative). + float magnitude = 2; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto new file mode 100644 index 00000000000..4b1c5873d26 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto @@ -0,0 +1,351 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/dialogflow/v2beta1/entity_type.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "SessionEntityTypeProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [SessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityType]. +service SessionEntityTypes { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all session entity types in the specified session. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc ListSessionEntityTypes(ListSessionEntityTypesRequest) returns (ListSessionEntityTypesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes" + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + } + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc GetSessionEntityType(GetSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + } + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates a session entity type. + // + // If the specified session entity type already exists, overrides the + // session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc CreateSessionEntityType(CreateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes" + body: "session_entity_type" + additional_bindings { + post: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + body: "session_entity_type" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + body: "session_entity_type" + } + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "parent,session_entity_type"; + } + + // Updates the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc UpdateSessionEntityType(UpdateSessionEntityTypeRequest) returns (SessionEntityType) { + option (google.api.http) = { + patch: "/v2beta1/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}" + body: "session_entity_type" + additional_bindings { + patch: "/v2beta1/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + additional_bindings { + patch: "/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + additional_bindings { + patch: "/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + body: "session_entity_type" + } + }; + option (google.api.method_signature) = "session_entity_type"; + option (google.api.method_signature) = "session_entity_type,update_mask"; + } + + // Deletes the specified session entity type. + // + // This method doesn't work with Google Assistant integration. + // Contact Dialogflow support if you need to use session entities + // with Google Assistant integration. + rpc DeleteSessionEntityType(DeleteSessionEntityTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + } + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// A session represents a conversation between a Dialogflow agent and an +// end-user. You can create special entities, called session entities, during a +// session. Session entities can extend or replace custom entity types and only +// exist during the session that they were created for. All session data, +// including session entities, is stored by Dialogflow for 20 minutes. +// +// For more information, see the [session entity +// guide](https://cloud.google.com/dialogflow/docs/entities-session). +message SessionEntityType { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/SessionEntityType" + pattern: "projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + pattern: "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + }; + + // The types of modifications for a session entity type. + enum EntityOverrideMode { + // Not specified. This value should be never used. + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0; + + // The collection of session entities overrides the collection of entities + // in the corresponding custom entity type. + ENTITY_OVERRIDE_MODE_OVERRIDE = 1; + + // The collection of session entities extends the collection of entities in + // the corresponding custom entity type. + // + // Note: Even in this override mode calls to `ListSessionEntityTypes`, + // `GetSessionEntityType`, `CreateSessionEntityType` and + // `UpdateSessionEntityType` only return the additional entities added in + // this session entity type. If you want to get the supplemented list, + // please call [EntityTypes.GetEntityType][google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType] on the custom entity type + // and merge. + ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2; + } + + // Required. The unique identifier of this session entity type. Supported + // formats: + // - `projects//agent/sessions//entityTypes/` + // - `projects//locations//agent/sessions//entityTypes/` + // - `projects//agent/environments//users//sessions//entityTypes/` + // - `projects//locations//agent/environments/ + // /users//sessions//entityTypes/` + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + // `` must be the display name of an existing entity + // type in the same agent that will be overridden or supplemented. + string name = 1; + + // Required. Indicates whether the additional data should override or + // supplement the custom entity type definition. + EntityOverrideMode entity_override_mode = 2; + + // Required. The collection of entities associated with this session entity + // type. + repeated EntityType.Entity entities = 3; +} + +// The request message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesRequest { + // Required. The session to list all session entity types from. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // Optional. The maximum number of items to return in a single page. By + // default 100 and at most 1000. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// The response message for [SessionEntityTypes.ListSessionEntityTypes][google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes]. +message ListSessionEntityTypesResponse { + // The list of session entity types. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated SessionEntityType session_entity_types = 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 request message for [SessionEntityTypes.GetSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType]. +message GetSessionEntityTypeRequest { + // Required. The name of the session entity type. Supported formats: + // - `projects//agent/sessions//entityTypes/` + // - `projects//locations//agent/sessions//entityTypes/` + // - `projects//agent/environments//users//sessions//entityTypes/` + // - `projects//locations//agent/environments/ + // /users//sessions//entityTypes/` + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} + +// The request message for [SessionEntityTypes.CreateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType]. +message CreateSessionEntityTypeRequest { + // Required. The session to create a session entity type for. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; + + // Required. The session entity type to create. + SessionEntityType session_entity_type = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [SessionEntityTypes.UpdateSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType]. +message UpdateSessionEntityTypeRequest { + // Required. The session entity type to update. + SessionEntityType session_entity_type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request message for [SessionEntityTypes.DeleteSessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType]. +message DeleteSessionEntityTypeRequest { + // Required. The name of the entity type to delete. + // Supported formats: + // - `projects//agent/sessions//entityTypes/` + // - `projects//locations//agent/sessions//entityTypes/` + // - `projects//agent/environments//users//sessions//entityTypes/` + // - `projects//locations//agent/environments/ + // /users//sessions//entityTypes/` + // + // If `Location ID` is not specified we assume default 'us' location. If + // `Environment ID` is not specified, we assume default 'draft' environment. + // If `User ID` is not specified, we assume default '-' user. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/SessionEntityType" + } + ]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/validation_result.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/validation_result.proto new file mode 100644 index 00000000000..d3882b9fae2 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/validation_result.proto @@ -0,0 +1,74 @@ +// 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.dialogflow.v2beta1; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "ValidationResultProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Represents a single validation error. +message ValidationError { + // Represents a level of severity. + enum Severity { + // Not specified. This value should never be used. + SEVERITY_UNSPECIFIED = 0; + + // The agent doesn't follow Dialogflow best practices. + INFO = 1; + + // The agent may not behave as expected. + WARNING = 2; + + // The agent may experience partial failures. + ERROR = 3; + + // The agent may completely fail. + CRITICAL = 4; + } + + // The severity of the error. + Severity severity = 1; + + // The names of the entries that the error is associated with. + // Format: + // + // - "projects//agent", if the error is associated with the entire + // agent. + // - "projects//agent/intents/", if the error is + // associated with certain intents. + // - "projects//agent/intents//trainingPhrases/", if the + // error is associated with certain intent training phrases. + // - "projects//agent/intents//parameters/", if the error is associated with certain intent parameters. + // - "projects//agent/entities/", if the error is + // associated with certain entities. + repeated string entries = 3; + + // The detailed error message. + string error_message = 4; +} + +// Represents the output of agent validation. +message ValidationResult { + // Contains all validation errors. + repeated ValidationError validation_errors = 1; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/version.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/version.proto new file mode 100644 index 00000000000..58b4b5bbf71 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/version.proto @@ -0,0 +1,261 @@ +// 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.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "VersionProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// Service for managing [Versions][google.cloud.dialogflow.v2beta1.Version]. +service Versions { + option (google.api.default_host) = "dialogflow.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/dialogflow"; + + // Returns the list of all versions of the specified agent. + rpc ListVersions(ListVersionsRequest) returns (ListVersionsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/agent}/versions" + additional_bindings { + get: "/v2beta1/{parent=projects/*/locations/*/agent}/versions" + } + }; + option (google.api.method_signature) = "parent"; + } + + // Retrieves the specified agent version. + rpc GetVersion(GetVersionRequest) returns (Version) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/agent/versions/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/locations/*/agent/versions/*}" + } + }; + option (google.api.method_signature) = "name"; + } + + // Creates an agent version. + // + // The new version points to the agent instance in the "default" environment. + rpc CreateVersion(CreateVersionRequest) returns (Version) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/agent}/versions" + body: "version" + additional_bindings { + post: "/v2beta1/{parent=projects/*/locations/*/agent}/versions" + body: "version" + } + }; + option (google.api.method_signature) = "parent,version"; + } + + // Updates the specified agent version. + // + // Note that this method does not allow you to update the state of the agent + // the given version points to. It allows you to update only mutable + // properties of the version resource. + rpc UpdateVersion(UpdateVersionRequest) returns (Version) { + option (google.api.http) = { + patch: "/v2beta1/{version.name=projects/*/agent/versions/*}" + body: "version" + additional_bindings { + patch: "/v2beta1/{version.name=projects/*/locations/*/agent/versions/*}" + body: "version" + } + }; + option (google.api.method_signature) = "version,update_mask"; + } + + // Delete the specified agent version. + rpc DeleteVersion(DeleteVersionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/agent/versions/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/locations/*/agent/versions/*}" + } + }; + option (google.api.method_signature) = "name"; + } +} + +// You can create multiple versions of your agent and publish them to separate +// environments. +// +// When you edit an agent, you are editing the draft agent. At any point, you +// can save the draft agent as an agent version, which is an immutable snapshot +// of your agent. +// +// When you save the draft agent, it is published to the default environment. +// When you create agent versions, you can publish them to custom environments. +// You can create a variety of custom environments for: +// +// - testing +// - development +// - production +// - etc. +// +// For more information, see the [versions and environments +// guide](https://cloud.google.com/dialogflow/docs/agents-versions). +message Version { + option (google.api.resource) = { + type: "dialogflow.googleapis.com/Version" + pattern: "projects/{project}/agent/versions/{version}" + pattern: "projects/{project}/locations/{location}/agent/versions/{version}" + }; + + // The status of a version. + enum VersionStatus { + // Not specified. This value is not used. + VERSION_STATUS_UNSPECIFIED = 0; + + // Version is not ready to serve (e.g. training is in progress). + IN_PROGRESS = 1; + + // Version is ready to serve. + READY = 2; + + // Version training failed. + FAILED = 3; + } + + // Output only. The unique identifier of this agent version. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The developer-provided description of this version. + string description = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The sequential number of this version. This field is read-only which means + // it cannot be set by create and update methods. + int32 version_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time of this version. This field is read-only, i.e., it cannot + // be set by create and update methods. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The status of this version. This field is read-only and cannot be set by + // create and update methods. + VersionStatus status = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The request message for [Versions.ListVersions][google.cloud.dialogflow.v2beta1.Versions.ListVersions]. +message ListVersionsRequest { + // Required. The agent to list all versions from. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // Optional. The maximum number of items to return in a single page. By default 100 and + // at most 1000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The response message for [Versions.ListVersions][google.cloud.dialogflow.v2beta1.Versions.ListVersions]. +message ListVersionsResponse { + // The list of agent versions. There will be a maximum number of items + // returned based on the page_size field in the request. + repeated Version versions = 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 request message for [Versions.GetVersion][google.cloud.dialogflow.v2beta1.Versions.GetVersion]. +message GetVersionRequest { + // Required. The name of the version. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} + +// The request message for [Versions.CreateVersion][google.cloud.dialogflow.v2beta1.Versions.CreateVersion]. +message CreateVersionRequest { + // Required. The agent to create a version for. + // Supported formats: + // - `projects//agent` + // - `projects//locations//agent` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "dialogflow.googleapis.com/Version" + } + ]; + + // Required. The version to create. + Version version = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.UpdateVersion][google.cloud.dialogflow.v2beta1.Versions.UpdateVersion]. +message UpdateVersionRequest { + // Required. The version to update. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + Version version = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for [Versions.DeleteVersion][google.cloud.dialogflow.v2beta1.Versions.DeleteVersion]. +message DeleteVersionRequest { + // Required. The name of the version to delete. + // Supported formats: + // - `projects//agent/versions/` + // - `projects//locations//agent/versions/` + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Version" + } + ]; +} diff --git a/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/webhook.proto b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/webhook.proto new file mode 100644 index 00000000000..a566c5ccc8e --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/google/cloud/dialogflow/v2beta1/webhook.proto @@ -0,0 +1,164 @@ +// 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.dialogflow.v2beta1; + +import "google/cloud/dialogflow/v2beta1/context.proto"; +import "google/cloud/dialogflow/v2beta1/intent.proto"; +import "google/cloud/dialogflow/v2beta1/session.proto"; +import "google/cloud/dialogflow/v2beta1/session_entity_type.proto"; +import "google/protobuf/struct.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "WebhookProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + +// The request message for a webhook call. +message WebhookRequest { + // The unique identifier of detectIntent request session. + // Can be used to identify end-user inside webhook implementation. + // Supported formats: + // - `projects//agent/sessions/, + // - `projects//locations//agent/sessions/`, + // - `projects//agent/environments//users//sessions/`, + // - `projects//locations//agent/environments//users//sessions/`, + string session = 4; + + // The unique identifier of the response. Contains the same value as + // `[Streaming]DetectIntentResponse.response_id`. + string response_id = 1; + + // The result of the conversational query or event processing. Contains the + // same value as `[Streaming]DetectIntentResponse.query_result`. + QueryResult query_result = 2; + + // Alternative query results from KnowledgeService. + repeated QueryResult alternative_query_results = 5; + + // Optional. The contents of the original request that was passed to + // `[Streaming]DetectIntent` call. + OriginalDetectIntentRequest original_detect_intent_request = 3; +} + +// The response message for a webhook call. +// +// This response is validated by the Dialogflow server. If validation fails, +// an error will be returned in the [QueryResult.diagnostic_info][google.cloud.dialogflow.v2beta1.QueryResult.diagnostic_info] field. +// Setting JSON fields to an empty value with the wrong type is a common error. +// To avoid this error: +// +// - Use `""` for empty strings +// - Use `{}` or `null` for empty objects +// - Use `[]` or `null` for empty arrays +// +// For more information, see the +// [Protocol Buffers Language +// Guide](https://developers.google.com/protocol-buffers/docs/proto3#json). +message WebhookResponse { + // Optional. The text response message intended for the end-user. + // It is recommended to use `fulfillment_messages.text.text[0]` instead. + // When provided, Dialogflow uses this field to populate + // [QueryResult.fulfillment_text][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_text] sent to the integration or API caller. + string fulfillment_text = 1; + + // Optional. The rich response messages intended for the end-user. + // When provided, Dialogflow uses this field to populate + // [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_messages] sent to the integration or API caller. + repeated Intent.Message fulfillment_messages = 2; + + // Optional. A custom field used to identify the webhook source. + // Arbitrary strings are supported. + // When provided, Dialogflow uses this field to populate + // [QueryResult.webhook_source][google.cloud.dialogflow.v2beta1.QueryResult.webhook_source] sent to the integration or API caller. + string source = 3; + + // Optional. This field can be used to pass custom data from your webhook to the + // integration or API caller. Arbitrary JSON objects are supported. + // When provided, Dialogflow uses this field to populate + // [QueryResult.webhook_payload][google.cloud.dialogflow.v2beta1.QueryResult.webhook_payload] sent to the integration or API caller. + // This field is also used by the + // [Google Assistant + // integration](https://cloud.google.com/dialogflow/docs/integrations/aog) + // for rich response messages. + // See the format definition at [Google Assistant Dialogflow webhook + // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) + google.protobuf.Struct payload = 4; + + // Optional. The collection of output contexts that will overwrite currently + // active contexts for the session and reset their lifespans. + // When provided, Dialogflow uses this field to populate + // [QueryResult.output_contexts][google.cloud.dialogflow.v2beta1.QueryResult.output_contexts] sent to the integration or API caller. + repeated Context output_contexts = 5; + + // Optional. Invokes the supplied events. + // When this field is set, Dialogflow ignores the `fulfillment_text`, + // `fulfillment_messages`, and `payload` fields. + EventInput followup_event_input = 6; + + // Indicates that a live agent should be brought in to handle the + // interaction with the user. In most cases, when you set this flag to true, + // you would also want to set end_interaction to true as well. Default is + // false. + bool live_agent_handoff = 7; + + // Optional. Indicates that this intent ends an interaction. Some integrations + // (e.g., Actions on Google or Dialogflow phone gateway) use this information + // to close interaction with an end user. Default is false. + bool end_interaction = 8; + + // Optional. Additional session entity types to replace or extend developer + // entity types with. The entity synonyms apply to all languages and persist + // for the session. Setting this data from a webhook overwrites + // the session entity types that have been set using `detectIntent`, + // `streamingDetectIntent` or [SessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityType] management methods. + repeated SessionEntityType session_entity_types = 10; +} + +// Represents the contents of the original request that was passed to +// the `[Streaming]DetectIntent` call. +message OriginalDetectIntentRequest { + // The source of this request, e.g., `google`, `facebook`, `slack`. It is set + // by Dialogflow-owned servers. + string source = 1; + + // Optional. The version of the protocol used for this request. + // This field is AoG-specific. + string version = 2; + + // Optional. This field is set to the value of the `QueryParameters.payload` + // field passed in the request. Some integrations that query a Dialogflow + // agent may provide additional information in the payload. + // + // In particular, for the Dialogflow Phone Gateway integration, this field has + // the form: + //
{
+  //  "telephony": {
+  //    "caller_id": "+18558363987"
+  //  }
+  // }
+ // Note: The caller ID field (`caller_id`) will be redacted for Trial + // Edition agents and populated with the caller ID in [E.164 + // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents. + google.protobuf.Struct payload = 3; +} diff --git a/packages/google-cloud-dialogflow/protos/protos.d.ts b/packages/google-cloud-dialogflow/protos/protos.d.ts new file mode 100644 index 00000000000..e01ea55f797 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/protos.d.ts @@ -0,0 +1,71944 @@ +// 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. + +import type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); +/** Namespace google. */ +export namespace google { + + /** Namespace cloud. */ + namespace cloud { + + /** Namespace dialogflow. */ + namespace dialogflow { + + /** Namespace v2. */ + namespace v2 { + + /** Represents an Agents */ + class Agents extends $protobuf.rpc.Service { + + /** + * Constructs a new Agents 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 Agents 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): Agents; + + /** + * Calls GetAgent. + * @param request GetAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Agent + */ + public getAgent(request: google.cloud.dialogflow.v2.IGetAgentRequest, callback: google.cloud.dialogflow.v2.Agents.GetAgentCallback): void; + + /** + * Calls GetAgent. + * @param request GetAgentRequest message or plain object + * @returns Promise + */ + public getAgent(request: google.cloud.dialogflow.v2.IGetAgentRequest): Promise; + + /** + * Calls SetAgent. + * @param request SetAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Agent + */ + public setAgent(request: google.cloud.dialogflow.v2.ISetAgentRequest, callback: google.cloud.dialogflow.v2.Agents.SetAgentCallback): void; + + /** + * Calls SetAgent. + * @param request SetAgentRequest message or plain object + * @returns Promise + */ + public setAgent(request: google.cloud.dialogflow.v2.ISetAgentRequest): Promise; + + /** + * Calls DeleteAgent. + * @param request DeleteAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteAgent(request: google.cloud.dialogflow.v2.IDeleteAgentRequest, callback: google.cloud.dialogflow.v2.Agents.DeleteAgentCallback): void; + + /** + * Calls DeleteAgent. + * @param request DeleteAgentRequest message or plain object + * @returns Promise + */ + public deleteAgent(request: google.cloud.dialogflow.v2.IDeleteAgentRequest): Promise; + + /** + * Calls SearchAgents. + * @param request SearchAgentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchAgentsResponse + */ + public searchAgents(request: google.cloud.dialogflow.v2.ISearchAgentsRequest, callback: google.cloud.dialogflow.v2.Agents.SearchAgentsCallback): void; + + /** + * Calls SearchAgents. + * @param request SearchAgentsRequest message or plain object + * @returns Promise + */ + public searchAgents(request: google.cloud.dialogflow.v2.ISearchAgentsRequest): Promise; + + /** + * Calls TrainAgent. + * @param request TrainAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public trainAgent(request: google.cloud.dialogflow.v2.ITrainAgentRequest, callback: google.cloud.dialogflow.v2.Agents.TrainAgentCallback): void; + + /** + * Calls TrainAgent. + * @param request TrainAgentRequest message or plain object + * @returns Promise + */ + public trainAgent(request: google.cloud.dialogflow.v2.ITrainAgentRequest): Promise; + + /** + * Calls ExportAgent. + * @param request ExportAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public exportAgent(request: google.cloud.dialogflow.v2.IExportAgentRequest, callback: google.cloud.dialogflow.v2.Agents.ExportAgentCallback): void; + + /** + * Calls ExportAgent. + * @param request ExportAgentRequest message or plain object + * @returns Promise + */ + public exportAgent(request: google.cloud.dialogflow.v2.IExportAgentRequest): Promise; + + /** + * Calls ImportAgent. + * @param request ImportAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importAgent(request: google.cloud.dialogflow.v2.IImportAgentRequest, callback: google.cloud.dialogflow.v2.Agents.ImportAgentCallback): void; + + /** + * Calls ImportAgent. + * @param request ImportAgentRequest message or plain object + * @returns Promise + */ + public importAgent(request: google.cloud.dialogflow.v2.IImportAgentRequest): Promise; + + /** + * Calls RestoreAgent. + * @param request RestoreAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public restoreAgent(request: google.cloud.dialogflow.v2.IRestoreAgentRequest, callback: google.cloud.dialogflow.v2.Agents.RestoreAgentCallback): void; + + /** + * Calls RestoreAgent. + * @param request RestoreAgentRequest message or plain object + * @returns Promise + */ + public restoreAgent(request: google.cloud.dialogflow.v2.IRestoreAgentRequest): Promise; + + /** + * Calls GetValidationResult. + * @param request GetValidationResultRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ValidationResult + */ + public getValidationResult(request: google.cloud.dialogflow.v2.IGetValidationResultRequest, callback: google.cloud.dialogflow.v2.Agents.GetValidationResultCallback): void; + + /** + * Calls GetValidationResult. + * @param request GetValidationResultRequest message or plain object + * @returns Promise + */ + public getValidationResult(request: google.cloud.dialogflow.v2.IGetValidationResultRequest): Promise; + } + + namespace Agents { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|getAgent}. + * @param error Error, if any + * @param [response] Agent + */ + type GetAgentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Agent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|setAgent}. + * @param error Error, if any + * @param [response] Agent + */ + type SetAgentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Agent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|deleteAgent}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteAgentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|searchAgents}. + * @param error Error, if any + * @param [response] SearchAgentsResponse + */ + type SearchAgentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.SearchAgentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|trainAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type TrainAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|exportAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|importAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|restoreAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type RestoreAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|getValidationResult}. + * @param error Error, if any + * @param [response] ValidationResult + */ + type GetValidationResultCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ValidationResult) => void; + } + + /** Properties of an Agent. */ + interface IAgent { + + /** Agent parent */ + parent?: (string|null); + + /** Agent displayName */ + displayName?: (string|null); + + /** Agent defaultLanguageCode */ + defaultLanguageCode?: (string|null); + + /** Agent supportedLanguageCodes */ + supportedLanguageCodes?: (string[]|null); + + /** Agent timeZone */ + timeZone?: (string|null); + + /** Agent description */ + description?: (string|null); + + /** Agent avatarUri */ + avatarUri?: (string|null); + + /** Agent enableLogging */ + enableLogging?: (boolean|null); + + /** Agent matchMode */ + matchMode?: (google.cloud.dialogflow.v2.Agent.MatchMode|keyof typeof google.cloud.dialogflow.v2.Agent.MatchMode|null); + + /** Agent classificationThreshold */ + classificationThreshold?: (number|null); + + /** Agent apiVersion */ + apiVersion?: (google.cloud.dialogflow.v2.Agent.ApiVersion|keyof typeof google.cloud.dialogflow.v2.Agent.ApiVersion|null); + + /** Agent tier */ + tier?: (google.cloud.dialogflow.v2.Agent.Tier|keyof typeof google.cloud.dialogflow.v2.Agent.Tier|null); + } + + /** Represents an Agent. */ + class Agent implements IAgent { + + /** + * Constructs a new Agent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAgent); + + /** Agent parent. */ + public parent: string; + + /** Agent displayName. */ + public displayName: string; + + /** Agent defaultLanguageCode. */ + public defaultLanguageCode: string; + + /** Agent supportedLanguageCodes. */ + public supportedLanguageCodes: string[]; + + /** Agent timeZone. */ + public timeZone: string; + + /** Agent description. */ + public description: string; + + /** Agent avatarUri. */ + public avatarUri: string; + + /** Agent enableLogging. */ + public enableLogging: boolean; + + /** Agent matchMode. */ + public matchMode: (google.cloud.dialogflow.v2.Agent.MatchMode|keyof typeof google.cloud.dialogflow.v2.Agent.MatchMode); + + /** Agent classificationThreshold. */ + public classificationThreshold: number; + + /** Agent apiVersion. */ + public apiVersion: (google.cloud.dialogflow.v2.Agent.ApiVersion|keyof typeof google.cloud.dialogflow.v2.Agent.ApiVersion); + + /** Agent tier. */ + public tier: (google.cloud.dialogflow.v2.Agent.Tier|keyof typeof google.cloud.dialogflow.v2.Agent.Tier); + + /** + * Creates a new Agent instance using the specified properties. + * @param [properties] Properties to set + * @returns Agent instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAgent): google.cloud.dialogflow.v2.Agent; + + /** + * Encodes the specified Agent message. Does not implicitly {@link google.cloud.dialogflow.v2.Agent.verify|verify} messages. + * @param message Agent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Agent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Agent.verify|verify} messages. + * @param message Agent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Agent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Agent; + + /** + * Decodes an Agent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Agent; + + /** + * Verifies an Agent message. + * @param message Plain 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 Agent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Agent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Agent; + + /** + * Creates a plain object from an Agent message. Also converts values to other types if specified. + * @param message Agent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Agent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Agent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Agent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Agent { + + /** MatchMode enum. */ + enum MatchMode { + MATCH_MODE_UNSPECIFIED = 0, + MATCH_MODE_HYBRID = 1, + MATCH_MODE_ML_ONLY = 2 + } + + /** ApiVersion enum. */ + enum ApiVersion { + API_VERSION_UNSPECIFIED = 0, + API_VERSION_V1 = 1, + API_VERSION_V2 = 2, + API_VERSION_V2_BETA_1 = 3 + } + + /** Tier enum. */ + enum Tier { + TIER_UNSPECIFIED = 0, + TIER_STANDARD = 1, + TIER_ENTERPRISE = 2, + TIER_ENTERPRISE_PLUS = 3 + } + } + + /** Properties of a GetAgentRequest. */ + interface IGetAgentRequest { + + /** GetAgentRequest parent */ + parent?: (string|null); + } + + /** Represents a GetAgentRequest. */ + class GetAgentRequest implements IGetAgentRequest { + + /** + * Constructs a new GetAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetAgentRequest); + + /** GetAgentRequest parent. */ + public parent: string; + + /** + * Creates a new GetAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetAgentRequest): google.cloud.dialogflow.v2.GetAgentRequest; + + /** + * Encodes the specified GetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetAgentRequest.verify|verify} messages. + * @param message GetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetAgentRequest.verify|verify} messages. + * @param message GetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetAgentRequest; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetAgentRequest; + + /** + * Verifies a GetAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetAgentRequest; + + /** + * Creates a plain object from a GetAgentRequest message. Also converts values to other types if specified. + * @param message GetAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SetAgentRequest. */ + interface ISetAgentRequest { + + /** SetAgentRequest agent */ + agent?: (google.cloud.dialogflow.v2.IAgent|null); + + /** SetAgentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a SetAgentRequest. */ + class SetAgentRequest implements ISetAgentRequest { + + /** + * Constructs a new SetAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISetAgentRequest); + + /** SetAgentRequest agent. */ + public agent?: (google.cloud.dialogflow.v2.IAgent|null); + + /** SetAgentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new SetAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISetAgentRequest): google.cloud.dialogflow.v2.SetAgentRequest; + + /** + * Encodes the specified SetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SetAgentRequest.verify|verify} messages. + * @param message SetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SetAgentRequest.verify|verify} messages. + * @param message SetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SetAgentRequest; + + /** + * Decodes a SetAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SetAgentRequest; + + /** + * Verifies a SetAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SetAgentRequest; + + /** + * Creates a plain object from a SetAgentRequest message. Also converts values to other types if specified. + * @param message SetAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SetAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteAgentRequest. */ + interface IDeleteAgentRequest { + + /** DeleteAgentRequest parent */ + parent?: (string|null); + } + + /** Represents a DeleteAgentRequest. */ + class DeleteAgentRequest implements IDeleteAgentRequest { + + /** + * Constructs a new DeleteAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteAgentRequest); + + /** DeleteAgentRequest parent. */ + public parent: string; + + /** + * Creates a new DeleteAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteAgentRequest): google.cloud.dialogflow.v2.DeleteAgentRequest; + + /** + * Encodes the specified DeleteAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteAgentRequest.verify|verify} messages. + * @param message DeleteAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteAgentRequest.verify|verify} messages. + * @param message DeleteAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteAgentRequest; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteAgentRequest; + + /** + * Verifies a DeleteAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteAgentRequest; + + /** + * Creates a plain object from a DeleteAgentRequest message. Also converts values to other types if specified. + * @param message DeleteAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchAgentsRequest. */ + interface ISearchAgentsRequest { + + /** SearchAgentsRequest parent */ + parent?: (string|null); + + /** SearchAgentsRequest pageSize */ + pageSize?: (number|null); + + /** SearchAgentsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a SearchAgentsRequest. */ + class SearchAgentsRequest implements ISearchAgentsRequest { + + /** + * Constructs a new SearchAgentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISearchAgentsRequest); + + /** SearchAgentsRequest parent. */ + public parent: string; + + /** SearchAgentsRequest pageSize. */ + public pageSize: number; + + /** SearchAgentsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new SearchAgentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchAgentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISearchAgentsRequest): google.cloud.dialogflow.v2.SearchAgentsRequest; + + /** + * Encodes the specified SearchAgentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SearchAgentsRequest.verify|verify} messages. + * @param message SearchAgentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISearchAgentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchAgentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SearchAgentsRequest.verify|verify} messages. + * @param message SearchAgentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISearchAgentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchAgentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SearchAgentsRequest; + + /** + * Decodes a SearchAgentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SearchAgentsRequest; + + /** + * Verifies a SearchAgentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchAgentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchAgentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SearchAgentsRequest; + + /** + * Creates a plain object from a SearchAgentsRequest message. Also converts values to other types if specified. + * @param message SearchAgentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SearchAgentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchAgentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchAgentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchAgentsResponse. */ + interface ISearchAgentsResponse { + + /** SearchAgentsResponse agents */ + agents?: (google.cloud.dialogflow.v2.IAgent[]|null); + + /** SearchAgentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a SearchAgentsResponse. */ + class SearchAgentsResponse implements ISearchAgentsResponse { + + /** + * Constructs a new SearchAgentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISearchAgentsResponse); + + /** SearchAgentsResponse agents. */ + public agents: google.cloud.dialogflow.v2.IAgent[]; + + /** SearchAgentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new SearchAgentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchAgentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISearchAgentsResponse): google.cloud.dialogflow.v2.SearchAgentsResponse; + + /** + * Encodes the specified SearchAgentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.SearchAgentsResponse.verify|verify} messages. + * @param message SearchAgentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISearchAgentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchAgentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SearchAgentsResponse.verify|verify} messages. + * @param message SearchAgentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISearchAgentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchAgentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SearchAgentsResponse; + + /** + * Decodes a SearchAgentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SearchAgentsResponse; + + /** + * Verifies a SearchAgentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchAgentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchAgentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SearchAgentsResponse; + + /** + * Creates a plain object from a SearchAgentsResponse message. Also converts values to other types if specified. + * @param message SearchAgentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SearchAgentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchAgentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchAgentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TrainAgentRequest. */ + interface ITrainAgentRequest { + + /** TrainAgentRequest parent */ + parent?: (string|null); + } + + /** Represents a TrainAgentRequest. */ + class TrainAgentRequest implements ITrainAgentRequest { + + /** + * Constructs a new TrainAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ITrainAgentRequest); + + /** TrainAgentRequest parent. */ + public parent: string; + + /** + * Creates a new TrainAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TrainAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ITrainAgentRequest): google.cloud.dialogflow.v2.TrainAgentRequest; + + /** + * Encodes the specified TrainAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.TrainAgentRequest.verify|verify} messages. + * @param message TrainAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ITrainAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TrainAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.TrainAgentRequest.verify|verify} messages. + * @param message TrainAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ITrainAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TrainAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TrainAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.TrainAgentRequest; + + /** + * Decodes a TrainAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TrainAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.TrainAgentRequest; + + /** + * Verifies a TrainAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TrainAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TrainAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.TrainAgentRequest; + + /** + * Creates a plain object from a TrainAgentRequest message. Also converts values to other types if specified. + * @param message TrainAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.TrainAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TrainAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TrainAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportAgentRequest. */ + interface IExportAgentRequest { + + /** ExportAgentRequest parent */ + parent?: (string|null); + + /** ExportAgentRequest agentUri */ + agentUri?: (string|null); + } + + /** Represents an ExportAgentRequest. */ + class ExportAgentRequest implements IExportAgentRequest { + + /** + * Constructs a new ExportAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IExportAgentRequest); + + /** ExportAgentRequest parent. */ + public parent: string; + + /** ExportAgentRequest agentUri. */ + public agentUri: string; + + /** + * Creates a new ExportAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IExportAgentRequest): google.cloud.dialogflow.v2.ExportAgentRequest; + + /** + * Encodes the specified ExportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportAgentRequest.verify|verify} messages. + * @param message ExportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IExportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportAgentRequest.verify|verify} messages. + * @param message ExportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IExportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ExportAgentRequest; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ExportAgentRequest; + + /** + * Verifies an ExportAgentRequest message. + * @param message Plain 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 ExportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ExportAgentRequest; + + /** + * Creates a plain object from an ExportAgentRequest message. Also converts values to other types if specified. + * @param message ExportAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ExportAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportAgentResponse. */ + interface IExportAgentResponse { + + /** ExportAgentResponse agentUri */ + agentUri?: (string|null); + + /** ExportAgentResponse agentContent */ + agentContent?: (Uint8Array|string|null); + } + + /** Represents an ExportAgentResponse. */ + class ExportAgentResponse implements IExportAgentResponse { + + /** + * Constructs a new ExportAgentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IExportAgentResponse); + + /** ExportAgentResponse agentUri. */ + public agentUri?: (string|null); + + /** ExportAgentResponse agentContent. */ + public agentContent?: (Uint8Array|string|null); + + /** ExportAgentResponse agent. */ + public agent?: ("agentUri"|"agentContent"); + + /** + * Creates a new ExportAgentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportAgentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IExportAgentResponse): google.cloud.dialogflow.v2.ExportAgentResponse; + + /** + * Encodes the specified ExportAgentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportAgentResponse.verify|verify} messages. + * @param message ExportAgentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IExportAgentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportAgentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportAgentResponse.verify|verify} messages. + * @param message ExportAgentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IExportAgentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ExportAgentResponse; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ExportAgentResponse; + + /** + * Verifies an ExportAgentResponse message. + * @param message Plain 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 ExportAgentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportAgentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ExportAgentResponse; + + /** + * Creates a plain object from an ExportAgentResponse message. Also converts values to other types if specified. + * @param message ExportAgentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ExportAgentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportAgentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportAgentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportAgentRequest. */ + interface IImportAgentRequest { + + /** ImportAgentRequest parent */ + parent?: (string|null); + + /** ImportAgentRequest agentUri */ + agentUri?: (string|null); + + /** ImportAgentRequest agentContent */ + agentContent?: (Uint8Array|string|null); + } + + /** Represents an ImportAgentRequest. */ + class ImportAgentRequest implements IImportAgentRequest { + + /** + * Constructs a new ImportAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IImportAgentRequest); + + /** ImportAgentRequest parent. */ + public parent: string; + + /** ImportAgentRequest agentUri. */ + public agentUri?: (string|null); + + /** ImportAgentRequest agentContent. */ + public agentContent?: (Uint8Array|string|null); + + /** ImportAgentRequest agent. */ + public agent?: ("agentUri"|"agentContent"); + + /** + * Creates a new ImportAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IImportAgentRequest): google.cloud.dialogflow.v2.ImportAgentRequest; + + /** + * Encodes the specified ImportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportAgentRequest.verify|verify} messages. + * @param message ImportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IImportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportAgentRequest.verify|verify} messages. + * @param message ImportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IImportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ImportAgentRequest; + + /** + * Decodes an ImportAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ImportAgentRequest; + + /** + * Verifies an ImportAgentRequest message. + * @param message Plain 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 ImportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ImportAgentRequest; + + /** + * Creates a plain object from an ImportAgentRequest message. Also converts values to other types if specified. + * @param message ImportAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ImportAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RestoreAgentRequest. */ + interface IRestoreAgentRequest { + + /** RestoreAgentRequest parent */ + parent?: (string|null); + + /** RestoreAgentRequest agentUri */ + agentUri?: (string|null); + + /** RestoreAgentRequest agentContent */ + agentContent?: (Uint8Array|string|null); + } + + /** Represents a RestoreAgentRequest. */ + class RestoreAgentRequest implements IRestoreAgentRequest { + + /** + * Constructs a new RestoreAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IRestoreAgentRequest); + + /** RestoreAgentRequest parent. */ + public parent: string; + + /** RestoreAgentRequest agentUri. */ + public agentUri?: (string|null); + + /** RestoreAgentRequest agentContent. */ + public agentContent?: (Uint8Array|string|null); + + /** RestoreAgentRequest agent. */ + public agent?: ("agentUri"|"agentContent"); + + /** + * Creates a new RestoreAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RestoreAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IRestoreAgentRequest): google.cloud.dialogflow.v2.RestoreAgentRequest; + + /** + * Encodes the specified RestoreAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.RestoreAgentRequest.verify|verify} messages. + * @param message RestoreAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IRestoreAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RestoreAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.RestoreAgentRequest.verify|verify} messages. + * @param message RestoreAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IRestoreAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.RestoreAgentRequest; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.RestoreAgentRequest; + + /** + * Verifies a RestoreAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RestoreAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RestoreAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.RestoreAgentRequest; + + /** + * Creates a plain object from a RestoreAgentRequest message. Also converts values to other types if specified. + * @param message RestoreAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.RestoreAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RestoreAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RestoreAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetValidationResultRequest. */ + interface IGetValidationResultRequest { + + /** GetValidationResultRequest parent */ + parent?: (string|null); + + /** GetValidationResultRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a GetValidationResultRequest. */ + class GetValidationResultRequest implements IGetValidationResultRequest { + + /** + * Constructs a new GetValidationResultRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetValidationResultRequest); + + /** GetValidationResultRequest parent. */ + public parent: string; + + /** GetValidationResultRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new GetValidationResultRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetValidationResultRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetValidationResultRequest): google.cloud.dialogflow.v2.GetValidationResultRequest; + + /** + * Encodes the specified GetValidationResultRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetValidationResultRequest.verify|verify} messages. + * @param message GetValidationResultRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetValidationResultRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetValidationResultRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetValidationResultRequest.verify|verify} messages. + * @param message GetValidationResultRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetValidationResultRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetValidationResultRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetValidationResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetValidationResultRequest; + + /** + * Decodes a GetValidationResultRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetValidationResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetValidationResultRequest; + + /** + * Verifies a GetValidationResultRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetValidationResultRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetValidationResultRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetValidationResultRequest; + + /** + * Creates a plain object from a GetValidationResultRequest message. Also converts values to other types if specified. + * @param message GetValidationResultRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetValidationResultRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetValidationResultRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetValidationResultRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ValidationError. */ + interface IValidationError { + + /** ValidationError severity */ + severity?: (google.cloud.dialogflow.v2.ValidationError.Severity|keyof typeof google.cloud.dialogflow.v2.ValidationError.Severity|null); + + /** ValidationError entries */ + entries?: (string[]|null); + + /** ValidationError errorMessage */ + errorMessage?: (string|null); + } + + /** Represents a ValidationError. */ + class ValidationError implements IValidationError { + + /** + * Constructs a new ValidationError. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IValidationError); + + /** ValidationError severity. */ + public severity: (google.cloud.dialogflow.v2.ValidationError.Severity|keyof typeof google.cloud.dialogflow.v2.ValidationError.Severity); + + /** ValidationError entries. */ + public entries: string[]; + + /** ValidationError errorMessage. */ + public errorMessage: string; + + /** + * Creates a new ValidationError instance using the specified properties. + * @param [properties] Properties to set + * @returns ValidationError instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IValidationError): google.cloud.dialogflow.v2.ValidationError; + + /** + * Encodes the specified ValidationError message. Does not implicitly {@link google.cloud.dialogflow.v2.ValidationError.verify|verify} messages. + * @param message ValidationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IValidationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ValidationError message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ValidationError.verify|verify} messages. + * @param message ValidationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IValidationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValidationError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ValidationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ValidationError; + + /** + * Decodes a ValidationError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ValidationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ValidationError; + + /** + * Verifies a ValidationError message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ValidationError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ValidationError + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ValidationError; + + /** + * Creates a plain object from a ValidationError message. Also converts values to other types if specified. + * @param message ValidationError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ValidationError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ValidationError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ValidationError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ValidationError { + + /** Severity enum. */ + enum Severity { + SEVERITY_UNSPECIFIED = 0, + INFO = 1, + WARNING = 2, + ERROR = 3, + CRITICAL = 4 + } + } + + /** Properties of a ValidationResult. */ + interface IValidationResult { + + /** ValidationResult validationErrors */ + validationErrors?: (google.cloud.dialogflow.v2.IValidationError[]|null); + } + + /** Represents a ValidationResult. */ + class ValidationResult implements IValidationResult { + + /** + * Constructs a new ValidationResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IValidationResult); + + /** ValidationResult validationErrors. */ + public validationErrors: google.cloud.dialogflow.v2.IValidationError[]; + + /** + * Creates a new ValidationResult instance using the specified properties. + * @param [properties] Properties to set + * @returns ValidationResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IValidationResult): google.cloud.dialogflow.v2.ValidationResult; + + /** + * Encodes the specified ValidationResult message. Does not implicitly {@link google.cloud.dialogflow.v2.ValidationResult.verify|verify} messages. + * @param message ValidationResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IValidationResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ValidationResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ValidationResult.verify|verify} messages. + * @param message ValidationResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IValidationResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValidationResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ValidationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ValidationResult; + + /** + * Decodes a ValidationResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ValidationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ValidationResult; + + /** + * Verifies a ValidationResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ValidationResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ValidationResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ValidationResult; + + /** + * Creates a plain object from a ValidationResult message. Also converts values to other types if specified. + * @param message ValidationResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ValidationResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ValidationResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ValidationResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents an AnswerRecords */ + class AnswerRecords extends $protobuf.rpc.Service { + + /** + * Constructs a new AnswerRecords 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 AnswerRecords 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): AnswerRecords; + + /** + * Calls ListAnswerRecords. + * @param request ListAnswerRecordsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListAnswerRecordsResponse + */ + public listAnswerRecords(request: google.cloud.dialogflow.v2.IListAnswerRecordsRequest, callback: google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecordsCallback): void; + + /** + * Calls ListAnswerRecords. + * @param request ListAnswerRecordsRequest message or plain object + * @returns Promise + */ + public listAnswerRecords(request: google.cloud.dialogflow.v2.IListAnswerRecordsRequest): Promise; + + /** + * Calls UpdateAnswerRecord. + * @param request UpdateAnswerRecordRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AnswerRecord + */ + public updateAnswerRecord(request: google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, callback: google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecordCallback): void; + + /** + * Calls UpdateAnswerRecord. + * @param request UpdateAnswerRecordRequest message or plain object + * @returns Promise + */ + public updateAnswerRecord(request: google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest): Promise; + } + + namespace AnswerRecords { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.AnswerRecords|listAnswerRecords}. + * @param error Error, if any + * @param [response] ListAnswerRecordsResponse + */ + type ListAnswerRecordsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListAnswerRecordsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.AnswerRecords|updateAnswerRecord}. + * @param error Error, if any + * @param [response] AnswerRecord + */ + type UpdateAnswerRecordCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.AnswerRecord) => void; + } + + /** Properties of an AnswerRecord. */ + interface IAnswerRecord { + + /** AnswerRecord name */ + name?: (string|null); + + /** AnswerRecord answerFeedback */ + answerFeedback?: (google.cloud.dialogflow.v2.IAnswerFeedback|null); + + /** AnswerRecord agentAssistantRecord */ + agentAssistantRecord?: (google.cloud.dialogflow.v2.IAgentAssistantRecord|null); + } + + /** Represents an AnswerRecord. */ + class AnswerRecord implements IAnswerRecord { + + /** + * Constructs a new AnswerRecord. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAnswerRecord); + + /** AnswerRecord name. */ + public name: string; + + /** AnswerRecord answerFeedback. */ + public answerFeedback?: (google.cloud.dialogflow.v2.IAnswerFeedback|null); + + /** AnswerRecord agentAssistantRecord. */ + public agentAssistantRecord?: (google.cloud.dialogflow.v2.IAgentAssistantRecord|null); + + /** AnswerRecord record. */ + public record?: "agentAssistantRecord"; + + /** + * Creates a new AnswerRecord instance using the specified properties. + * @param [properties] Properties to set + * @returns AnswerRecord instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAnswerRecord): google.cloud.dialogflow.v2.AnswerRecord; + + /** + * Encodes the specified AnswerRecord message. Does not implicitly {@link google.cloud.dialogflow.v2.AnswerRecord.verify|verify} messages. + * @param message AnswerRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAnswerRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnswerRecord message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnswerRecord.verify|verify} messages. + * @param message AnswerRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAnswerRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnswerRecord message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnswerRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AnswerRecord; + + /** + * Decodes an AnswerRecord message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnswerRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AnswerRecord; + + /** + * Verifies an AnswerRecord message. + * @param message Plain 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 AnswerRecord message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnswerRecord + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AnswerRecord; + + /** + * Creates a plain object from an AnswerRecord message. Also converts values to other types if specified. + * @param message AnswerRecord + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AnswerRecord, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnswerRecord to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnswerRecord + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListAnswerRecordsRequest. */ + interface IListAnswerRecordsRequest { + + /** ListAnswerRecordsRequest parent */ + parent?: (string|null); + + /** ListAnswerRecordsRequest filter */ + filter?: (string|null); + + /** ListAnswerRecordsRequest pageSize */ + pageSize?: (number|null); + + /** ListAnswerRecordsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListAnswerRecordsRequest. */ + class ListAnswerRecordsRequest implements IListAnswerRecordsRequest { + + /** + * Constructs a new ListAnswerRecordsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListAnswerRecordsRequest); + + /** ListAnswerRecordsRequest parent. */ + public parent: string; + + /** ListAnswerRecordsRequest filter. */ + public filter: string; + + /** ListAnswerRecordsRequest pageSize. */ + public pageSize: number; + + /** ListAnswerRecordsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListAnswerRecordsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAnswerRecordsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListAnswerRecordsRequest): google.cloud.dialogflow.v2.ListAnswerRecordsRequest; + + /** + * Encodes the specified ListAnswerRecordsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListAnswerRecordsRequest.verify|verify} messages. + * @param message ListAnswerRecordsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListAnswerRecordsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAnswerRecordsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListAnswerRecordsRequest.verify|verify} messages. + * @param message ListAnswerRecordsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListAnswerRecordsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAnswerRecordsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAnswerRecordsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListAnswerRecordsRequest; + + /** + * Decodes a ListAnswerRecordsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAnswerRecordsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListAnswerRecordsRequest; + + /** + * Verifies a ListAnswerRecordsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListAnswerRecordsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAnswerRecordsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListAnswerRecordsRequest; + + /** + * Creates a plain object from a ListAnswerRecordsRequest message. Also converts values to other types if specified. + * @param message ListAnswerRecordsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListAnswerRecordsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAnswerRecordsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListAnswerRecordsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListAnswerRecordsResponse. */ + interface IListAnswerRecordsResponse { + + /** ListAnswerRecordsResponse answerRecords */ + answerRecords?: (google.cloud.dialogflow.v2.IAnswerRecord[]|null); + + /** ListAnswerRecordsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListAnswerRecordsResponse. */ + class ListAnswerRecordsResponse implements IListAnswerRecordsResponse { + + /** + * Constructs a new ListAnswerRecordsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListAnswerRecordsResponse); + + /** ListAnswerRecordsResponse answerRecords. */ + public answerRecords: google.cloud.dialogflow.v2.IAnswerRecord[]; + + /** ListAnswerRecordsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListAnswerRecordsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAnswerRecordsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListAnswerRecordsResponse): google.cloud.dialogflow.v2.ListAnswerRecordsResponse; + + /** + * Encodes the specified ListAnswerRecordsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.verify|verify} messages. + * @param message ListAnswerRecordsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListAnswerRecordsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAnswerRecordsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.verify|verify} messages. + * @param message ListAnswerRecordsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListAnswerRecordsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAnswerRecordsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAnswerRecordsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListAnswerRecordsResponse; + + /** + * Decodes a ListAnswerRecordsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAnswerRecordsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListAnswerRecordsResponse; + + /** + * Verifies a ListAnswerRecordsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListAnswerRecordsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAnswerRecordsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListAnswerRecordsResponse; + + /** + * Creates a plain object from a ListAnswerRecordsResponse message. Also converts values to other types if specified. + * @param message ListAnswerRecordsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListAnswerRecordsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAnswerRecordsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListAnswerRecordsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateAnswerRecordRequest. */ + interface IUpdateAnswerRecordRequest { + + /** UpdateAnswerRecordRequest answerRecord */ + answerRecord?: (google.cloud.dialogflow.v2.IAnswerRecord|null); + + /** UpdateAnswerRecordRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateAnswerRecordRequest. */ + class UpdateAnswerRecordRequest implements IUpdateAnswerRecordRequest { + + /** + * Constructs a new UpdateAnswerRecordRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest); + + /** UpdateAnswerRecordRequest answerRecord. */ + public answerRecord?: (google.cloud.dialogflow.v2.IAnswerRecord|null); + + /** UpdateAnswerRecordRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateAnswerRecordRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateAnswerRecordRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest): google.cloud.dialogflow.v2.UpdateAnswerRecordRequest; + + /** + * Encodes the specified UpdateAnswerRecordRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateAnswerRecordRequest.verify|verify} messages. + * @param message UpdateAnswerRecordRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateAnswerRecordRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateAnswerRecordRequest.verify|verify} messages. + * @param message UpdateAnswerRecordRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateAnswerRecordRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateAnswerRecordRequest; + + /** + * Decodes an UpdateAnswerRecordRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateAnswerRecordRequest; + + /** + * Verifies an UpdateAnswerRecordRequest message. + * @param message Plain 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 UpdateAnswerRecordRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateAnswerRecordRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateAnswerRecordRequest; + + /** + * Creates a plain object from an UpdateAnswerRecordRequest message. Also converts values to other types if specified. + * @param message UpdateAnswerRecordRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateAnswerRecordRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateAnswerRecordRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateAnswerRecordRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnswerFeedback. */ + interface IAnswerFeedback { + + /** AnswerFeedback correctnessLevel */ + correctnessLevel?: (google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel|keyof typeof google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel|null); + + /** AnswerFeedback agentAssistantDetailFeedback */ + agentAssistantDetailFeedback?: (google.cloud.dialogflow.v2.IAgentAssistantFeedback|null); + + /** AnswerFeedback clicked */ + clicked?: (boolean|null); + + /** AnswerFeedback clickTime */ + clickTime?: (google.protobuf.ITimestamp|null); + + /** AnswerFeedback displayed */ + displayed?: (boolean|null); + + /** AnswerFeedback displayTime */ + displayTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an AnswerFeedback. */ + class AnswerFeedback implements IAnswerFeedback { + + /** + * Constructs a new AnswerFeedback. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAnswerFeedback); + + /** AnswerFeedback correctnessLevel. */ + public correctnessLevel: (google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel|keyof typeof google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel); + + /** AnswerFeedback agentAssistantDetailFeedback. */ + public agentAssistantDetailFeedback?: (google.cloud.dialogflow.v2.IAgentAssistantFeedback|null); + + /** AnswerFeedback clicked. */ + public clicked: boolean; + + /** AnswerFeedback clickTime. */ + public clickTime?: (google.protobuf.ITimestamp|null); + + /** AnswerFeedback displayed. */ + public displayed: boolean; + + /** AnswerFeedback displayTime. */ + public displayTime?: (google.protobuf.ITimestamp|null); + + /** AnswerFeedback detailFeedback. */ + public detailFeedback?: "agentAssistantDetailFeedback"; + + /** + * Creates a new AnswerFeedback instance using the specified properties. + * @param [properties] Properties to set + * @returns AnswerFeedback instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAnswerFeedback): google.cloud.dialogflow.v2.AnswerFeedback; + + /** + * Encodes the specified AnswerFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2.AnswerFeedback.verify|verify} messages. + * @param message AnswerFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAnswerFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnswerFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnswerFeedback.verify|verify} messages. + * @param message AnswerFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAnswerFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnswerFeedback message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnswerFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AnswerFeedback; + + /** + * Decodes an AnswerFeedback message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnswerFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AnswerFeedback; + + /** + * Verifies an AnswerFeedback message. + * @param message Plain 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 AnswerFeedback message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnswerFeedback + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AnswerFeedback; + + /** + * Creates a plain object from an AnswerFeedback message. Also converts values to other types if specified. + * @param message AnswerFeedback + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AnswerFeedback, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnswerFeedback to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnswerFeedback + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AnswerFeedback { + + /** CorrectnessLevel enum. */ + enum CorrectnessLevel { + CORRECTNESS_LEVEL_UNSPECIFIED = 0, + NOT_CORRECT = 1, + PARTIALLY_CORRECT = 2, + FULLY_CORRECT = 3 + } + } + + /** Properties of an AgentAssistantFeedback. */ + interface IAgentAssistantFeedback { + + /** AgentAssistantFeedback answerRelevance */ + answerRelevance?: (google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance|keyof typeof google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance|null); + + /** AgentAssistantFeedback documentCorrectness */ + documentCorrectness?: (google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness|keyof typeof google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness|null); + + /** AgentAssistantFeedback documentEfficiency */ + documentEfficiency?: (google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency|keyof typeof google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency|null); + } + + /** Represents an AgentAssistantFeedback. */ + class AgentAssistantFeedback implements IAgentAssistantFeedback { + + /** + * Constructs a new AgentAssistantFeedback. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAgentAssistantFeedback); + + /** AgentAssistantFeedback answerRelevance. */ + public answerRelevance: (google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance|keyof typeof google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance); + + /** AgentAssistantFeedback documentCorrectness. */ + public documentCorrectness: (google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness|keyof typeof google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness); + + /** AgentAssistantFeedback documentEfficiency. */ + public documentEfficiency: (google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency|keyof typeof google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency); + + /** + * Creates a new AgentAssistantFeedback instance using the specified properties. + * @param [properties] Properties to set + * @returns AgentAssistantFeedback instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAgentAssistantFeedback): google.cloud.dialogflow.v2.AgentAssistantFeedback; + + /** + * Encodes the specified AgentAssistantFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2.AgentAssistantFeedback.verify|verify} messages. + * @param message AgentAssistantFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAgentAssistantFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AgentAssistantFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AgentAssistantFeedback.verify|verify} messages. + * @param message AgentAssistantFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAgentAssistantFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AgentAssistantFeedback message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AgentAssistantFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AgentAssistantFeedback; + + /** + * Decodes an AgentAssistantFeedback message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AgentAssistantFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AgentAssistantFeedback; + + /** + * Verifies an AgentAssistantFeedback message. + * @param message Plain 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 AgentAssistantFeedback message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AgentAssistantFeedback + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AgentAssistantFeedback; + + /** + * Creates a plain object from an AgentAssistantFeedback message. Also converts values to other types if specified. + * @param message AgentAssistantFeedback + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AgentAssistantFeedback, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AgentAssistantFeedback to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AgentAssistantFeedback + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AgentAssistantFeedback { + + /** AnswerRelevance enum. */ + enum AnswerRelevance { + ANSWER_RELEVANCE_UNSPECIFIED = 0, + IRRELEVANT = 1, + RELEVANT = 2 + } + + /** DocumentCorrectness enum. */ + enum DocumentCorrectness { + DOCUMENT_CORRECTNESS_UNSPECIFIED = 0, + INCORRECT = 1, + CORRECT = 2 + } + + /** DocumentEfficiency enum. */ + enum DocumentEfficiency { + DOCUMENT_EFFICIENCY_UNSPECIFIED = 0, + INEFFICIENT = 1, + EFFICIENT = 2 + } + } + + /** Properties of an AgentAssistantRecord. */ + interface IAgentAssistantRecord { + + /** AgentAssistantRecord articleSuggestionAnswer */ + articleSuggestionAnswer?: (google.cloud.dialogflow.v2.IArticleAnswer|null); + + /** AgentAssistantRecord faqAnswer */ + faqAnswer?: (google.cloud.dialogflow.v2.IFaqAnswer|null); + } + + /** Represents an AgentAssistantRecord. */ + class AgentAssistantRecord implements IAgentAssistantRecord { + + /** + * Constructs a new AgentAssistantRecord. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAgentAssistantRecord); + + /** AgentAssistantRecord articleSuggestionAnswer. */ + public articleSuggestionAnswer?: (google.cloud.dialogflow.v2.IArticleAnswer|null); + + /** AgentAssistantRecord faqAnswer. */ + public faqAnswer?: (google.cloud.dialogflow.v2.IFaqAnswer|null); + + /** AgentAssistantRecord answer. */ + public answer?: ("articleSuggestionAnswer"|"faqAnswer"); + + /** + * Creates a new AgentAssistantRecord instance using the specified properties. + * @param [properties] Properties to set + * @returns AgentAssistantRecord instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAgentAssistantRecord): google.cloud.dialogflow.v2.AgentAssistantRecord; + + /** + * Encodes the specified AgentAssistantRecord message. Does not implicitly {@link google.cloud.dialogflow.v2.AgentAssistantRecord.verify|verify} messages. + * @param message AgentAssistantRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAgentAssistantRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AgentAssistantRecord message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AgentAssistantRecord.verify|verify} messages. + * @param message AgentAssistantRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAgentAssistantRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AgentAssistantRecord message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AgentAssistantRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AgentAssistantRecord; + + /** + * Decodes an AgentAssistantRecord message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AgentAssistantRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AgentAssistantRecord; + + /** + * Verifies an AgentAssistantRecord message. + * @param message Plain 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 AgentAssistantRecord message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AgentAssistantRecord + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AgentAssistantRecord; + + /** + * Creates a plain object from an AgentAssistantRecord message. Also converts values to other types if specified. + * @param message AgentAssistantRecord + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AgentAssistantRecord, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AgentAssistantRecord to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AgentAssistantRecord + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Participants */ + class Participants extends $protobuf.rpc.Service { + + /** + * Constructs a new Participants 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 Participants 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): Participants; + + /** + * Calls CreateParticipant. + * @param request CreateParticipantRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Participant + */ + public createParticipant(request: google.cloud.dialogflow.v2.ICreateParticipantRequest, callback: google.cloud.dialogflow.v2.Participants.CreateParticipantCallback): void; + + /** + * Calls CreateParticipant. + * @param request CreateParticipantRequest message or plain object + * @returns Promise + */ + public createParticipant(request: google.cloud.dialogflow.v2.ICreateParticipantRequest): Promise; + + /** + * Calls GetParticipant. + * @param request GetParticipantRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Participant + */ + public getParticipant(request: google.cloud.dialogflow.v2.IGetParticipantRequest, callback: google.cloud.dialogflow.v2.Participants.GetParticipantCallback): void; + + /** + * Calls GetParticipant. + * @param request GetParticipantRequest message or plain object + * @returns Promise + */ + public getParticipant(request: google.cloud.dialogflow.v2.IGetParticipantRequest): Promise; + + /** + * Calls ListParticipants. + * @param request ListParticipantsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListParticipantsResponse + */ + public listParticipants(request: google.cloud.dialogflow.v2.IListParticipantsRequest, callback: google.cloud.dialogflow.v2.Participants.ListParticipantsCallback): void; + + /** + * Calls ListParticipants. + * @param request ListParticipantsRequest message or plain object + * @returns Promise + */ + public listParticipants(request: google.cloud.dialogflow.v2.IListParticipantsRequest): Promise; + + /** + * Calls UpdateParticipant. + * @param request UpdateParticipantRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Participant + */ + public updateParticipant(request: google.cloud.dialogflow.v2.IUpdateParticipantRequest, callback: google.cloud.dialogflow.v2.Participants.UpdateParticipantCallback): void; + + /** + * Calls UpdateParticipant. + * @param request UpdateParticipantRequest message or plain object + * @returns Promise + */ + public updateParticipant(request: google.cloud.dialogflow.v2.IUpdateParticipantRequest): Promise; + + /** + * Calls AnalyzeContent. + * @param request AnalyzeContentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AnalyzeContentResponse + */ + public analyzeContent(request: google.cloud.dialogflow.v2.IAnalyzeContentRequest, callback: google.cloud.dialogflow.v2.Participants.AnalyzeContentCallback): void; + + /** + * Calls AnalyzeContent. + * @param request AnalyzeContentRequest message or plain object + * @returns Promise + */ + public analyzeContent(request: google.cloud.dialogflow.v2.IAnalyzeContentRequest): Promise; + + /** + * Calls StreamingAnalyzeContent. + * @param request StreamingAnalyzeContentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and StreamingAnalyzeContentResponse + */ + public streamingAnalyzeContent(request: google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest, callback: google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContentCallback): void; + + /** + * Calls StreamingAnalyzeContent. + * @param request StreamingAnalyzeContentRequest message or plain object + * @returns Promise + */ + public streamingAnalyzeContent(request: google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest): Promise; + + /** + * Calls SuggestArticles. + * @param request SuggestArticlesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SuggestArticlesResponse + */ + public suggestArticles(request: google.cloud.dialogflow.v2.ISuggestArticlesRequest, callback: google.cloud.dialogflow.v2.Participants.SuggestArticlesCallback): void; + + /** + * Calls SuggestArticles. + * @param request SuggestArticlesRequest message or plain object + * @returns Promise + */ + public suggestArticles(request: google.cloud.dialogflow.v2.ISuggestArticlesRequest): Promise; + + /** + * Calls SuggestFaqAnswers. + * @param request SuggestFaqAnswersRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SuggestFaqAnswersResponse + */ + public suggestFaqAnswers(request: google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, callback: google.cloud.dialogflow.v2.Participants.SuggestFaqAnswersCallback): void; + + /** + * Calls SuggestFaqAnswers. + * @param request SuggestFaqAnswersRequest message or plain object + * @returns Promise + */ + public suggestFaqAnswers(request: google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest): Promise; + + /** + * Calls SuggestSmartReplies. + * @param request SuggestSmartRepliesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SuggestSmartRepliesResponse + */ + public suggestSmartReplies(request: google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, callback: google.cloud.dialogflow.v2.Participants.SuggestSmartRepliesCallback): void; + + /** + * Calls SuggestSmartReplies. + * @param request SuggestSmartRepliesRequest message or plain object + * @returns Promise + */ + public suggestSmartReplies(request: google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest): Promise; + } + + namespace Participants { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|createParticipant}. + * @param error Error, if any + * @param [response] Participant + */ + type CreateParticipantCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Participant) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|getParticipant}. + * @param error Error, if any + * @param [response] Participant + */ + type GetParticipantCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Participant) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|listParticipants}. + * @param error Error, if any + * @param [response] ListParticipantsResponse + */ + type ListParticipantsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListParticipantsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|updateParticipant}. + * @param error Error, if any + * @param [response] Participant + */ + type UpdateParticipantCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Participant) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|analyzeContent}. + * @param error Error, if any + * @param [response] AnalyzeContentResponse + */ + type AnalyzeContentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.AnalyzeContentResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|streamingAnalyzeContent}. + * @param error Error, if any + * @param [response] StreamingAnalyzeContentResponse + */ + type StreamingAnalyzeContentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|suggestArticles}. + * @param error Error, if any + * @param [response] SuggestArticlesResponse + */ + type SuggestArticlesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.SuggestArticlesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|suggestFaqAnswers}. + * @param error Error, if any + * @param [response] SuggestFaqAnswersResponse + */ + type SuggestFaqAnswersCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.SuggestFaqAnswersResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|suggestSmartReplies}. + * @param error Error, if any + * @param [response] SuggestSmartRepliesResponse + */ + type SuggestSmartRepliesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.SuggestSmartRepliesResponse) => void; + } + + /** Properties of a Participant. */ + interface IParticipant { + + /** Participant name */ + name?: (string|null); + + /** Participant role */ + role?: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role|null); + + /** Participant sipRecordingMediaLabel */ + sipRecordingMediaLabel?: (string|null); + + /** Participant obfuscatedExternalUserId */ + obfuscatedExternalUserId?: (string|null); + + /** Participant documentsMetadataFilters */ + documentsMetadataFilters?: ({ [k: string]: string }|null); + } + + /** Represents a Participant. */ + class Participant implements IParticipant { + + /** + * Constructs a new Participant. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IParticipant); + + /** Participant name. */ + public name: string; + + /** Participant role. */ + public role: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role); + + /** Participant sipRecordingMediaLabel. */ + public sipRecordingMediaLabel: string; + + /** Participant obfuscatedExternalUserId. */ + public obfuscatedExternalUserId: string; + + /** Participant documentsMetadataFilters. */ + public documentsMetadataFilters: { [k: string]: string }; + + /** + * Creates a new Participant instance using the specified properties. + * @param [properties] Properties to set + * @returns Participant instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IParticipant): google.cloud.dialogflow.v2.Participant; + + /** + * Encodes the specified Participant message. Does not implicitly {@link google.cloud.dialogflow.v2.Participant.verify|verify} messages. + * @param message Participant message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IParticipant, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Participant message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Participant.verify|verify} messages. + * @param message Participant message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IParticipant, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Participant message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Participant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Participant; + + /** + * Decodes a Participant message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Participant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Participant; + + /** + * Verifies a Participant message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Participant message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Participant + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Participant; + + /** + * Creates a plain object from a Participant message. Also converts values to other types if specified. + * @param message Participant + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Participant, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Participant to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Participant + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Participant { + + /** Role enum. */ + enum Role { + ROLE_UNSPECIFIED = 0, + HUMAN_AGENT = 1, + AUTOMATED_AGENT = 2, + END_USER = 3 + } + } + + /** Properties of a Message. */ + interface IMessage { + + /** Message name */ + name?: (string|null); + + /** Message content */ + content?: (string|null); + + /** Message languageCode */ + languageCode?: (string|null); + + /** Message participant */ + participant?: (string|null); + + /** Message participantRole */ + participantRole?: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role|null); + + /** Message createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Message sendTime */ + sendTime?: (google.protobuf.ITimestamp|null); + + /** Message messageAnnotation */ + messageAnnotation?: (google.cloud.dialogflow.v2.IMessageAnnotation|null); + + /** Message sentimentAnalysis */ + sentimentAnalysis?: (google.cloud.dialogflow.v2.ISentimentAnalysisResult|null); + } + + /** Represents a Message. */ + class Message implements IMessage { + + /** + * Constructs a new Message. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IMessage); + + /** Message name. */ + public name: string; + + /** Message content. */ + public content: string; + + /** Message languageCode. */ + public languageCode: string; + + /** Message participant. */ + public participant: string; + + /** Message participantRole. */ + public participantRole: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role); + + /** Message createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Message sendTime. */ + public sendTime?: (google.protobuf.ITimestamp|null); + + /** Message messageAnnotation. */ + public messageAnnotation?: (google.cloud.dialogflow.v2.IMessageAnnotation|null); + + /** Message sentimentAnalysis. */ + public sentimentAnalysis?: (google.cloud.dialogflow.v2.ISentimentAnalysisResult|null); + + /** + * Creates a new Message instance using the specified properties. + * @param [properties] Properties to set + * @returns Message instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IMessage): google.cloud.dialogflow.v2.Message; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.dialogflow.v2.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Message message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Message; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Message; + + /** + * Verifies a Message message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Message + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Message; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @param message Message + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Message, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Message to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Message + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateParticipantRequest. */ + interface ICreateParticipantRequest { + + /** CreateParticipantRequest parent */ + parent?: (string|null); + + /** CreateParticipantRequest participant */ + participant?: (google.cloud.dialogflow.v2.IParticipant|null); + } + + /** Represents a CreateParticipantRequest. */ + class CreateParticipantRequest implements ICreateParticipantRequest { + + /** + * Constructs a new CreateParticipantRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateParticipantRequest); + + /** CreateParticipantRequest parent. */ + public parent: string; + + /** CreateParticipantRequest participant. */ + public participant?: (google.cloud.dialogflow.v2.IParticipant|null); + + /** + * Creates a new CreateParticipantRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateParticipantRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateParticipantRequest): google.cloud.dialogflow.v2.CreateParticipantRequest; + + /** + * Encodes the specified CreateParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateParticipantRequest.verify|verify} messages. + * @param message CreateParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateParticipantRequest.verify|verify} messages. + * @param message CreateParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateParticipantRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateParticipantRequest; + + /** + * Decodes a CreateParticipantRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateParticipantRequest; + + /** + * Verifies a CreateParticipantRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateParticipantRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateParticipantRequest; + + /** + * Creates a plain object from a CreateParticipantRequest message. Also converts values to other types if specified. + * @param message CreateParticipantRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateParticipantRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateParticipantRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateParticipantRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetParticipantRequest. */ + interface IGetParticipantRequest { + + /** GetParticipantRequest name */ + name?: (string|null); + } + + /** Represents a GetParticipantRequest. */ + class GetParticipantRequest implements IGetParticipantRequest { + + /** + * Constructs a new GetParticipantRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetParticipantRequest); + + /** GetParticipantRequest name. */ + public name: string; + + /** + * Creates a new GetParticipantRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetParticipantRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetParticipantRequest): google.cloud.dialogflow.v2.GetParticipantRequest; + + /** + * Encodes the specified GetParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetParticipantRequest.verify|verify} messages. + * @param message GetParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetParticipantRequest.verify|verify} messages. + * @param message GetParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetParticipantRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetParticipantRequest; + + /** + * Decodes a GetParticipantRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetParticipantRequest; + + /** + * Verifies a GetParticipantRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetParticipantRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetParticipantRequest; + + /** + * Creates a plain object from a GetParticipantRequest message. Also converts values to other types if specified. + * @param message GetParticipantRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetParticipantRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetParticipantRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetParticipantRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListParticipantsRequest. */ + interface IListParticipantsRequest { + + /** ListParticipantsRequest parent */ + parent?: (string|null); + + /** ListParticipantsRequest pageSize */ + pageSize?: (number|null); + + /** ListParticipantsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListParticipantsRequest. */ + class ListParticipantsRequest implements IListParticipantsRequest { + + /** + * Constructs a new ListParticipantsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListParticipantsRequest); + + /** ListParticipantsRequest parent. */ + public parent: string; + + /** ListParticipantsRequest pageSize. */ + public pageSize: number; + + /** ListParticipantsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListParticipantsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListParticipantsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListParticipantsRequest): google.cloud.dialogflow.v2.ListParticipantsRequest; + + /** + * Encodes the specified ListParticipantsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListParticipantsRequest.verify|verify} messages. + * @param message ListParticipantsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListParticipantsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListParticipantsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListParticipantsRequest.verify|verify} messages. + * @param message ListParticipantsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListParticipantsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListParticipantsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListParticipantsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListParticipantsRequest; + + /** + * Decodes a ListParticipantsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListParticipantsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListParticipantsRequest; + + /** + * Verifies a ListParticipantsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListParticipantsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListParticipantsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListParticipantsRequest; + + /** + * Creates a plain object from a ListParticipantsRequest message. Also converts values to other types if specified. + * @param message ListParticipantsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListParticipantsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListParticipantsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListParticipantsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListParticipantsResponse. */ + interface IListParticipantsResponse { + + /** ListParticipantsResponse participants */ + participants?: (google.cloud.dialogflow.v2.IParticipant[]|null); + + /** ListParticipantsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListParticipantsResponse. */ + class ListParticipantsResponse implements IListParticipantsResponse { + + /** + * Constructs a new ListParticipantsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListParticipantsResponse); + + /** ListParticipantsResponse participants. */ + public participants: google.cloud.dialogflow.v2.IParticipant[]; + + /** ListParticipantsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListParticipantsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListParticipantsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListParticipantsResponse): google.cloud.dialogflow.v2.ListParticipantsResponse; + + /** + * Encodes the specified ListParticipantsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListParticipantsResponse.verify|verify} messages. + * @param message ListParticipantsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListParticipantsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListParticipantsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListParticipantsResponse.verify|verify} messages. + * @param message ListParticipantsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListParticipantsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListParticipantsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListParticipantsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListParticipantsResponse; + + /** + * Decodes a ListParticipantsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListParticipantsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListParticipantsResponse; + + /** + * Verifies a ListParticipantsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListParticipantsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListParticipantsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListParticipantsResponse; + + /** + * Creates a plain object from a ListParticipantsResponse message. Also converts values to other types if specified. + * @param message ListParticipantsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListParticipantsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListParticipantsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListParticipantsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateParticipantRequest. */ + interface IUpdateParticipantRequest { + + /** UpdateParticipantRequest participant */ + participant?: (google.cloud.dialogflow.v2.IParticipant|null); + + /** UpdateParticipantRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateParticipantRequest. */ + class UpdateParticipantRequest implements IUpdateParticipantRequest { + + /** + * Constructs a new UpdateParticipantRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateParticipantRequest); + + /** UpdateParticipantRequest participant. */ + public participant?: (google.cloud.dialogflow.v2.IParticipant|null); + + /** UpdateParticipantRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateParticipantRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateParticipantRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateParticipantRequest): google.cloud.dialogflow.v2.UpdateParticipantRequest; + + /** + * Encodes the specified UpdateParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateParticipantRequest.verify|verify} messages. + * @param message UpdateParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateParticipantRequest.verify|verify} messages. + * @param message UpdateParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateParticipantRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateParticipantRequest; + + /** + * Decodes an UpdateParticipantRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateParticipantRequest; + + /** + * Verifies an UpdateParticipantRequest message. + * @param message Plain 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 UpdateParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateParticipantRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateParticipantRequest; + + /** + * Creates a plain object from an UpdateParticipantRequest message. Also converts values to other types if specified. + * @param message UpdateParticipantRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateParticipantRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateParticipantRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateParticipantRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnalyzeContentRequest. */ + interface IAnalyzeContentRequest { + + /** AnalyzeContentRequest participant */ + participant?: (string|null); + + /** AnalyzeContentRequest textInput */ + textInput?: (google.cloud.dialogflow.v2.ITextInput|null); + + /** AnalyzeContentRequest eventInput */ + eventInput?: (google.cloud.dialogflow.v2.IEventInput|null); + + /** AnalyzeContentRequest replyAudioConfig */ + replyAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** AnalyzeContentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.v2.IQueryParameters|null); + + /** AnalyzeContentRequest assistQueryParams */ + assistQueryParams?: (google.cloud.dialogflow.v2.IAssistQueryParameters|null); + + /** AnalyzeContentRequest cxParameters */ + cxParameters?: (google.protobuf.IStruct|null); + + /** AnalyzeContentRequest requestId */ + requestId?: (string|null); + } + + /** Represents an AnalyzeContentRequest. */ + class AnalyzeContentRequest implements IAnalyzeContentRequest { + + /** + * Constructs a new AnalyzeContentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAnalyzeContentRequest); + + /** AnalyzeContentRequest participant. */ + public participant: string; + + /** AnalyzeContentRequest textInput. */ + public textInput?: (google.cloud.dialogflow.v2.ITextInput|null); + + /** AnalyzeContentRequest eventInput. */ + public eventInput?: (google.cloud.dialogflow.v2.IEventInput|null); + + /** AnalyzeContentRequest replyAudioConfig. */ + public replyAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** AnalyzeContentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.v2.IQueryParameters|null); + + /** AnalyzeContentRequest assistQueryParams. */ + public assistQueryParams?: (google.cloud.dialogflow.v2.IAssistQueryParameters|null); + + /** AnalyzeContentRequest cxParameters. */ + public cxParameters?: (google.protobuf.IStruct|null); + + /** AnalyzeContentRequest requestId. */ + public requestId: string; + + /** AnalyzeContentRequest input. */ + public input?: ("textInput"|"eventInput"); + + /** + * Creates a new AnalyzeContentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AnalyzeContentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAnalyzeContentRequest): google.cloud.dialogflow.v2.AnalyzeContentRequest; + + /** + * Encodes the specified AnalyzeContentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.AnalyzeContentRequest.verify|verify} messages. + * @param message AnalyzeContentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAnalyzeContentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnalyzeContentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnalyzeContentRequest.verify|verify} messages. + * @param message AnalyzeContentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAnalyzeContentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnalyzeContentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AnalyzeContentRequest; + + /** + * Decodes an AnalyzeContentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AnalyzeContentRequest; + + /** + * Verifies an AnalyzeContentRequest message. + * @param message Plain 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 AnalyzeContentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnalyzeContentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AnalyzeContentRequest; + + /** + * Creates a plain object from an AnalyzeContentRequest message. Also converts values to other types if specified. + * @param message AnalyzeContentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AnalyzeContentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnalyzeContentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnalyzeContentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DtmfParameters. */ + interface IDtmfParameters { + + /** DtmfParameters acceptsDtmfInput */ + acceptsDtmfInput?: (boolean|null); + } + + /** Represents a DtmfParameters. */ + class DtmfParameters implements IDtmfParameters { + + /** + * Constructs a new DtmfParameters. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDtmfParameters); + + /** DtmfParameters acceptsDtmfInput. */ + public acceptsDtmfInput: boolean; + + /** + * Creates a new DtmfParameters instance using the specified properties. + * @param [properties] Properties to set + * @returns DtmfParameters instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDtmfParameters): google.cloud.dialogflow.v2.DtmfParameters; + + /** + * Encodes the specified DtmfParameters message. Does not implicitly {@link google.cloud.dialogflow.v2.DtmfParameters.verify|verify} messages. + * @param message DtmfParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDtmfParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DtmfParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DtmfParameters.verify|verify} messages. + * @param message DtmfParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDtmfParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DtmfParameters message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DtmfParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DtmfParameters; + + /** + * Decodes a DtmfParameters message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DtmfParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DtmfParameters; + + /** + * Verifies a DtmfParameters message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DtmfParameters message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DtmfParameters + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DtmfParameters; + + /** + * Creates a plain object from a DtmfParameters message. Also converts values to other types if specified. + * @param message DtmfParameters + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DtmfParameters, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DtmfParameters to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DtmfParameters + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnalyzeContentResponse. */ + interface IAnalyzeContentResponse { + + /** AnalyzeContentResponse replyText */ + replyText?: (string|null); + + /** AnalyzeContentResponse replyAudio */ + replyAudio?: (google.cloud.dialogflow.v2.IOutputAudio|null); + + /** AnalyzeContentResponse automatedAgentReply */ + automatedAgentReply?: (google.cloud.dialogflow.v2.IAutomatedAgentReply|null); + + /** AnalyzeContentResponse message */ + message?: (google.cloud.dialogflow.v2.IMessage|null); + + /** AnalyzeContentResponse humanAgentSuggestionResults */ + humanAgentSuggestionResults?: (google.cloud.dialogflow.v2.ISuggestionResult[]|null); + + /** AnalyzeContentResponse endUserSuggestionResults */ + endUserSuggestionResults?: (google.cloud.dialogflow.v2.ISuggestionResult[]|null); + + /** AnalyzeContentResponse dtmfParameters */ + dtmfParameters?: (google.cloud.dialogflow.v2.IDtmfParameters|null); + } + + /** Represents an AnalyzeContentResponse. */ + class AnalyzeContentResponse implements IAnalyzeContentResponse { + + /** + * Constructs a new AnalyzeContentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAnalyzeContentResponse); + + /** AnalyzeContentResponse replyText. */ + public replyText: string; + + /** AnalyzeContentResponse replyAudio. */ + public replyAudio?: (google.cloud.dialogflow.v2.IOutputAudio|null); + + /** AnalyzeContentResponse automatedAgentReply. */ + public automatedAgentReply?: (google.cloud.dialogflow.v2.IAutomatedAgentReply|null); + + /** AnalyzeContentResponse message. */ + public message?: (google.cloud.dialogflow.v2.IMessage|null); + + /** AnalyzeContentResponse humanAgentSuggestionResults. */ + public humanAgentSuggestionResults: google.cloud.dialogflow.v2.ISuggestionResult[]; + + /** AnalyzeContentResponse endUserSuggestionResults. */ + public endUserSuggestionResults: google.cloud.dialogflow.v2.ISuggestionResult[]; + + /** AnalyzeContentResponse dtmfParameters. */ + public dtmfParameters?: (google.cloud.dialogflow.v2.IDtmfParameters|null); + + /** + * Creates a new AnalyzeContentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AnalyzeContentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAnalyzeContentResponse): google.cloud.dialogflow.v2.AnalyzeContentResponse; + + /** + * Encodes the specified AnalyzeContentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.AnalyzeContentResponse.verify|verify} messages. + * @param message AnalyzeContentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAnalyzeContentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnalyzeContentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnalyzeContentResponse.verify|verify} messages. + * @param message AnalyzeContentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAnalyzeContentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnalyzeContentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AnalyzeContentResponse; + + /** + * Decodes an AnalyzeContentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AnalyzeContentResponse; + + /** + * Verifies an AnalyzeContentResponse message. + * @param message Plain 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 AnalyzeContentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnalyzeContentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AnalyzeContentResponse; + + /** + * Creates a plain object from an AnalyzeContentResponse message. Also converts values to other types if specified. + * @param message AnalyzeContentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AnalyzeContentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnalyzeContentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnalyzeContentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingAnalyzeContentRequest. */ + interface IStreamingAnalyzeContentRequest { + + /** StreamingAnalyzeContentRequest participant */ + participant?: (string|null); + + /** StreamingAnalyzeContentRequest audioConfig */ + audioConfig?: (google.cloud.dialogflow.v2.IInputAudioConfig|null); + + /** StreamingAnalyzeContentRequest textConfig */ + textConfig?: (google.cloud.dialogflow.v2.IInputTextConfig|null); + + /** StreamingAnalyzeContentRequest replyAudioConfig */ + replyAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** StreamingAnalyzeContentRequest inputAudio */ + inputAudio?: (Uint8Array|string|null); + + /** StreamingAnalyzeContentRequest inputText */ + inputText?: (string|null); + + /** StreamingAnalyzeContentRequest inputDtmf */ + inputDtmf?: (google.cloud.dialogflow.v2.ITelephonyDtmfEvents|null); + + /** StreamingAnalyzeContentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.v2.IQueryParameters|null); + + /** StreamingAnalyzeContentRequest assistQueryParams */ + assistQueryParams?: (google.cloud.dialogflow.v2.IAssistQueryParameters|null); + + /** StreamingAnalyzeContentRequest cxParameters */ + cxParameters?: (google.protobuf.IStruct|null); + + /** StreamingAnalyzeContentRequest enablePartialAutomatedAgentReply */ + enablePartialAutomatedAgentReply?: (boolean|null); + } + + /** Represents a StreamingAnalyzeContentRequest. */ + class StreamingAnalyzeContentRequest implements IStreamingAnalyzeContentRequest { + + /** + * Constructs a new StreamingAnalyzeContentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest); + + /** StreamingAnalyzeContentRequest participant. */ + public participant: string; + + /** StreamingAnalyzeContentRequest audioConfig. */ + public audioConfig?: (google.cloud.dialogflow.v2.IInputAudioConfig|null); + + /** StreamingAnalyzeContentRequest textConfig. */ + public textConfig?: (google.cloud.dialogflow.v2.IInputTextConfig|null); + + /** StreamingAnalyzeContentRequest replyAudioConfig. */ + public replyAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** StreamingAnalyzeContentRequest inputAudio. */ + public inputAudio?: (Uint8Array|string|null); + + /** StreamingAnalyzeContentRequest inputText. */ + public inputText?: (string|null); + + /** StreamingAnalyzeContentRequest inputDtmf. */ + public inputDtmf?: (google.cloud.dialogflow.v2.ITelephonyDtmfEvents|null); + + /** StreamingAnalyzeContentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.v2.IQueryParameters|null); + + /** StreamingAnalyzeContentRequest assistQueryParams. */ + public assistQueryParams?: (google.cloud.dialogflow.v2.IAssistQueryParameters|null); + + /** StreamingAnalyzeContentRequest cxParameters. */ + public cxParameters?: (google.protobuf.IStruct|null); + + /** StreamingAnalyzeContentRequest enablePartialAutomatedAgentReply. */ + public enablePartialAutomatedAgentReply: boolean; + + /** StreamingAnalyzeContentRequest config. */ + public config?: ("audioConfig"|"textConfig"); + + /** StreamingAnalyzeContentRequest input. */ + public input?: ("inputAudio"|"inputText"|"inputDtmf"); + + /** + * Creates a new StreamingAnalyzeContentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingAnalyzeContentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest): google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest; + + /** + * Encodes the specified StreamingAnalyzeContentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.verify|verify} messages. + * @param message StreamingAnalyzeContentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingAnalyzeContentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.verify|verify} messages. + * @param message StreamingAnalyzeContentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingAnalyzeContentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingAnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest; + + /** + * Decodes a StreamingAnalyzeContentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingAnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest; + + /** + * Verifies a StreamingAnalyzeContentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingAnalyzeContentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingAnalyzeContentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest; + + /** + * Creates a plain object from a StreamingAnalyzeContentRequest message. Also converts values to other types if specified. + * @param message StreamingAnalyzeContentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingAnalyzeContentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingAnalyzeContentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingAnalyzeContentResponse. */ + interface IStreamingAnalyzeContentResponse { + + /** StreamingAnalyzeContentResponse recognitionResult */ + recognitionResult?: (google.cloud.dialogflow.v2.IStreamingRecognitionResult|null); + + /** StreamingAnalyzeContentResponse replyText */ + replyText?: (string|null); + + /** StreamingAnalyzeContentResponse replyAudio */ + replyAudio?: (google.cloud.dialogflow.v2.IOutputAudio|null); + + /** StreamingAnalyzeContentResponse automatedAgentReply */ + automatedAgentReply?: (google.cloud.dialogflow.v2.IAutomatedAgentReply|null); + + /** StreamingAnalyzeContentResponse message */ + message?: (google.cloud.dialogflow.v2.IMessage|null); + + /** StreamingAnalyzeContentResponse humanAgentSuggestionResults */ + humanAgentSuggestionResults?: (google.cloud.dialogflow.v2.ISuggestionResult[]|null); + + /** StreamingAnalyzeContentResponse endUserSuggestionResults */ + endUserSuggestionResults?: (google.cloud.dialogflow.v2.ISuggestionResult[]|null); + + /** StreamingAnalyzeContentResponse dtmfParameters */ + dtmfParameters?: (google.cloud.dialogflow.v2.IDtmfParameters|null); + } + + /** Represents a StreamingAnalyzeContentResponse. */ + class StreamingAnalyzeContentResponse implements IStreamingAnalyzeContentResponse { + + /** + * Constructs a new StreamingAnalyzeContentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IStreamingAnalyzeContentResponse); + + /** StreamingAnalyzeContentResponse recognitionResult. */ + public recognitionResult?: (google.cloud.dialogflow.v2.IStreamingRecognitionResult|null); + + /** StreamingAnalyzeContentResponse replyText. */ + public replyText: string; + + /** StreamingAnalyzeContentResponse replyAudio. */ + public replyAudio?: (google.cloud.dialogflow.v2.IOutputAudio|null); + + /** StreamingAnalyzeContentResponse automatedAgentReply. */ + public automatedAgentReply?: (google.cloud.dialogflow.v2.IAutomatedAgentReply|null); + + /** StreamingAnalyzeContentResponse message. */ + public message?: (google.cloud.dialogflow.v2.IMessage|null); + + /** StreamingAnalyzeContentResponse humanAgentSuggestionResults. */ + public humanAgentSuggestionResults: google.cloud.dialogflow.v2.ISuggestionResult[]; + + /** StreamingAnalyzeContentResponse endUserSuggestionResults. */ + public endUserSuggestionResults: google.cloud.dialogflow.v2.ISuggestionResult[]; + + /** StreamingAnalyzeContentResponse dtmfParameters. */ + public dtmfParameters?: (google.cloud.dialogflow.v2.IDtmfParameters|null); + + /** + * Creates a new StreamingAnalyzeContentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingAnalyzeContentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IStreamingAnalyzeContentResponse): google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse; + + /** + * Encodes the specified StreamingAnalyzeContentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.verify|verify} messages. + * @param message StreamingAnalyzeContentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IStreamingAnalyzeContentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingAnalyzeContentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.verify|verify} messages. + * @param message StreamingAnalyzeContentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IStreamingAnalyzeContentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingAnalyzeContentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingAnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse; + + /** + * Decodes a StreamingAnalyzeContentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingAnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse; + + /** + * Verifies a StreamingAnalyzeContentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingAnalyzeContentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingAnalyzeContentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse; + + /** + * Creates a plain object from a StreamingAnalyzeContentResponse message. Also converts values to other types if specified. + * @param message StreamingAnalyzeContentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingAnalyzeContentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingAnalyzeContentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestArticlesRequest. */ + interface ISuggestArticlesRequest { + + /** SuggestArticlesRequest parent */ + parent?: (string|null); + + /** SuggestArticlesRequest latestMessage */ + latestMessage?: (string|null); + + /** SuggestArticlesRequest contextSize */ + contextSize?: (number|null); + + /** SuggestArticlesRequest assistQueryParams */ + assistQueryParams?: (google.cloud.dialogflow.v2.IAssistQueryParameters|null); + } + + /** Represents a SuggestArticlesRequest. */ + class SuggestArticlesRequest implements ISuggestArticlesRequest { + + /** + * Constructs a new SuggestArticlesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISuggestArticlesRequest); + + /** SuggestArticlesRequest parent. */ + public parent: string; + + /** SuggestArticlesRequest latestMessage. */ + public latestMessage: string; + + /** SuggestArticlesRequest contextSize. */ + public contextSize: number; + + /** SuggestArticlesRequest assistQueryParams. */ + public assistQueryParams?: (google.cloud.dialogflow.v2.IAssistQueryParameters|null); + + /** + * Creates a new SuggestArticlesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestArticlesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISuggestArticlesRequest): google.cloud.dialogflow.v2.SuggestArticlesRequest; + + /** + * Encodes the specified SuggestArticlesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestArticlesRequest.verify|verify} messages. + * @param message SuggestArticlesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISuggestArticlesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestArticlesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestArticlesRequest.verify|verify} messages. + * @param message SuggestArticlesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISuggestArticlesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestArticlesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestArticlesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SuggestArticlesRequest; + + /** + * Decodes a SuggestArticlesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestArticlesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SuggestArticlesRequest; + + /** + * Verifies a SuggestArticlesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestArticlesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestArticlesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SuggestArticlesRequest; + + /** + * Creates a plain object from a SuggestArticlesRequest message. Also converts values to other types if specified. + * @param message SuggestArticlesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SuggestArticlesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestArticlesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestArticlesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestArticlesResponse. */ + interface ISuggestArticlesResponse { + + /** SuggestArticlesResponse articleAnswers */ + articleAnswers?: (google.cloud.dialogflow.v2.IArticleAnswer[]|null); + + /** SuggestArticlesResponse latestMessage */ + latestMessage?: (string|null); + + /** SuggestArticlesResponse contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestArticlesResponse. */ + class SuggestArticlesResponse implements ISuggestArticlesResponse { + + /** + * Constructs a new SuggestArticlesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISuggestArticlesResponse); + + /** SuggestArticlesResponse articleAnswers. */ + public articleAnswers: google.cloud.dialogflow.v2.IArticleAnswer[]; + + /** SuggestArticlesResponse latestMessage. */ + public latestMessage: string; + + /** SuggestArticlesResponse contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestArticlesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestArticlesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISuggestArticlesResponse): google.cloud.dialogflow.v2.SuggestArticlesResponse; + + /** + * Encodes the specified SuggestArticlesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestArticlesResponse.verify|verify} messages. + * @param message SuggestArticlesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISuggestArticlesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestArticlesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestArticlesResponse.verify|verify} messages. + * @param message SuggestArticlesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISuggestArticlesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestArticlesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestArticlesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SuggestArticlesResponse; + + /** + * Decodes a SuggestArticlesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestArticlesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SuggestArticlesResponse; + + /** + * Verifies a SuggestArticlesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestArticlesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestArticlesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SuggestArticlesResponse; + + /** + * Creates a plain object from a SuggestArticlesResponse message. Also converts values to other types if specified. + * @param message SuggestArticlesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SuggestArticlesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestArticlesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestArticlesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestFaqAnswersRequest. */ + interface ISuggestFaqAnswersRequest { + + /** SuggestFaqAnswersRequest parent */ + parent?: (string|null); + + /** SuggestFaqAnswersRequest latestMessage */ + latestMessage?: (string|null); + + /** SuggestFaqAnswersRequest contextSize */ + contextSize?: (number|null); + + /** SuggestFaqAnswersRequest assistQueryParams */ + assistQueryParams?: (google.cloud.dialogflow.v2.IAssistQueryParameters|null); + } + + /** Represents a SuggestFaqAnswersRequest. */ + class SuggestFaqAnswersRequest implements ISuggestFaqAnswersRequest { + + /** + * Constructs a new SuggestFaqAnswersRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest); + + /** SuggestFaqAnswersRequest parent. */ + public parent: string; + + /** SuggestFaqAnswersRequest latestMessage. */ + public latestMessage: string; + + /** SuggestFaqAnswersRequest contextSize. */ + public contextSize: number; + + /** SuggestFaqAnswersRequest assistQueryParams. */ + public assistQueryParams?: (google.cloud.dialogflow.v2.IAssistQueryParameters|null); + + /** + * Creates a new SuggestFaqAnswersRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestFaqAnswersRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest): google.cloud.dialogflow.v2.SuggestFaqAnswersRequest; + + /** + * Encodes the specified SuggestFaqAnswersRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.verify|verify} messages. + * @param message SuggestFaqAnswersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestFaqAnswersRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.verify|verify} messages. + * @param message SuggestFaqAnswersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestFaqAnswersRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestFaqAnswersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SuggestFaqAnswersRequest; + + /** + * Decodes a SuggestFaqAnswersRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestFaqAnswersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SuggestFaqAnswersRequest; + + /** + * Verifies a SuggestFaqAnswersRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestFaqAnswersRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestFaqAnswersRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SuggestFaqAnswersRequest; + + /** + * Creates a plain object from a SuggestFaqAnswersRequest message. Also converts values to other types if specified. + * @param message SuggestFaqAnswersRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SuggestFaqAnswersRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestFaqAnswersRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestFaqAnswersRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestFaqAnswersResponse. */ + interface ISuggestFaqAnswersResponse { + + /** SuggestFaqAnswersResponse faqAnswers */ + faqAnswers?: (google.cloud.dialogflow.v2.IFaqAnswer[]|null); + + /** SuggestFaqAnswersResponse latestMessage */ + latestMessage?: (string|null); + + /** SuggestFaqAnswersResponse contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestFaqAnswersResponse. */ + class SuggestFaqAnswersResponse implements ISuggestFaqAnswersResponse { + + /** + * Constructs a new SuggestFaqAnswersResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse); + + /** SuggestFaqAnswersResponse faqAnswers. */ + public faqAnswers: google.cloud.dialogflow.v2.IFaqAnswer[]; + + /** SuggestFaqAnswersResponse latestMessage. */ + public latestMessage: string; + + /** SuggestFaqAnswersResponse contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestFaqAnswersResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestFaqAnswersResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse): google.cloud.dialogflow.v2.SuggestFaqAnswersResponse; + + /** + * Encodes the specified SuggestFaqAnswersResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.verify|verify} messages. + * @param message SuggestFaqAnswersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestFaqAnswersResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.verify|verify} messages. + * @param message SuggestFaqAnswersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestFaqAnswersResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestFaqAnswersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SuggestFaqAnswersResponse; + + /** + * Decodes a SuggestFaqAnswersResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestFaqAnswersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SuggestFaqAnswersResponse; + + /** + * Verifies a SuggestFaqAnswersResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestFaqAnswersResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestFaqAnswersResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SuggestFaqAnswersResponse; + + /** + * Creates a plain object from a SuggestFaqAnswersResponse message. Also converts values to other types if specified. + * @param message SuggestFaqAnswersResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SuggestFaqAnswersResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestFaqAnswersResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestFaqAnswersResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestSmartRepliesRequest. */ + interface ISuggestSmartRepliesRequest { + + /** SuggestSmartRepliesRequest parent */ + parent?: (string|null); + + /** SuggestSmartRepliesRequest currentTextInput */ + currentTextInput?: (google.cloud.dialogflow.v2.ITextInput|null); + + /** SuggestSmartRepliesRequest latestMessage */ + latestMessage?: (string|null); + + /** SuggestSmartRepliesRequest contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestSmartRepliesRequest. */ + class SuggestSmartRepliesRequest implements ISuggestSmartRepliesRequest { + + /** + * Constructs a new SuggestSmartRepliesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest); + + /** SuggestSmartRepliesRequest parent. */ + public parent: string; + + /** SuggestSmartRepliesRequest currentTextInput. */ + public currentTextInput?: (google.cloud.dialogflow.v2.ITextInput|null); + + /** SuggestSmartRepliesRequest latestMessage. */ + public latestMessage: string; + + /** SuggestSmartRepliesRequest contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestSmartRepliesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestSmartRepliesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest): google.cloud.dialogflow.v2.SuggestSmartRepliesRequest; + + /** + * Encodes the specified SuggestSmartRepliesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.verify|verify} messages. + * @param message SuggestSmartRepliesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestSmartRepliesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.verify|verify} messages. + * @param message SuggestSmartRepliesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestSmartRepliesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestSmartRepliesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SuggestSmartRepliesRequest; + + /** + * Decodes a SuggestSmartRepliesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestSmartRepliesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SuggestSmartRepliesRequest; + + /** + * Verifies a SuggestSmartRepliesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestSmartRepliesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestSmartRepliesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SuggestSmartRepliesRequest; + + /** + * Creates a plain object from a SuggestSmartRepliesRequest message. Also converts values to other types if specified. + * @param message SuggestSmartRepliesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SuggestSmartRepliesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestSmartRepliesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestSmartRepliesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestSmartRepliesResponse. */ + interface ISuggestSmartRepliesResponse { + + /** SuggestSmartRepliesResponse smartReplyAnswers */ + smartReplyAnswers?: (google.cloud.dialogflow.v2.ISmartReplyAnswer[]|null); + + /** SuggestSmartRepliesResponse latestMessage */ + latestMessage?: (string|null); + + /** SuggestSmartRepliesResponse contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestSmartRepliesResponse. */ + class SuggestSmartRepliesResponse implements ISuggestSmartRepliesResponse { + + /** + * Constructs a new SuggestSmartRepliesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse); + + /** SuggestSmartRepliesResponse smartReplyAnswers. */ + public smartReplyAnswers: google.cloud.dialogflow.v2.ISmartReplyAnswer[]; + + /** SuggestSmartRepliesResponse latestMessage. */ + public latestMessage: string; + + /** SuggestSmartRepliesResponse contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestSmartRepliesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestSmartRepliesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse): google.cloud.dialogflow.v2.SuggestSmartRepliesResponse; + + /** + * Encodes the specified SuggestSmartRepliesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.verify|verify} messages. + * @param message SuggestSmartRepliesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestSmartRepliesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.verify|verify} messages. + * @param message SuggestSmartRepliesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestSmartRepliesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestSmartRepliesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SuggestSmartRepliesResponse; + + /** + * Decodes a SuggestSmartRepliesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestSmartRepliesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SuggestSmartRepliesResponse; + + /** + * Verifies a SuggestSmartRepliesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestSmartRepliesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestSmartRepliesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SuggestSmartRepliesResponse; + + /** + * Creates a plain object from a SuggestSmartRepliesResponse message. Also converts values to other types if specified. + * @param message SuggestSmartRepliesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SuggestSmartRepliesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestSmartRepliesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestSmartRepliesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OutputAudio. */ + interface IOutputAudio { + + /** OutputAudio config */ + config?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** OutputAudio audio */ + audio?: (Uint8Array|string|null); + } + + /** Represents an OutputAudio. */ + class OutputAudio implements IOutputAudio { + + /** + * Constructs a new OutputAudio. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IOutputAudio); + + /** OutputAudio config. */ + public config?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** OutputAudio audio. */ + public audio: (Uint8Array|string); + + /** + * Creates a new OutputAudio instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputAudio instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IOutputAudio): google.cloud.dialogflow.v2.OutputAudio; + + /** + * Encodes the specified OutputAudio message. Does not implicitly {@link google.cloud.dialogflow.v2.OutputAudio.verify|verify} messages. + * @param message OutputAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IOutputAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.OutputAudio.verify|verify} messages. + * @param message OutputAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IOutputAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputAudio message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.OutputAudio; + + /** + * Decodes an OutputAudio message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.OutputAudio; + + /** + * Verifies an OutputAudio message. + * @param message Plain 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 OutputAudio message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputAudio + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.OutputAudio; + + /** + * Creates a plain object from an OutputAudio message. Also converts values to other types if specified. + * @param message OutputAudio + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.OutputAudio, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputAudio to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputAudio + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AutomatedAgentReply. */ + interface IAutomatedAgentReply { + + /** AutomatedAgentReply detectIntentResponse */ + detectIntentResponse?: (google.cloud.dialogflow.v2.IDetectIntentResponse|null); + + /** AutomatedAgentReply automatedAgentReplyType */ + automatedAgentReplyType?: (google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType|keyof typeof google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType|null); + + /** AutomatedAgentReply allowCancellation */ + allowCancellation?: (boolean|null); + } + + /** Represents an AutomatedAgentReply. */ + class AutomatedAgentReply implements IAutomatedAgentReply { + + /** + * Constructs a new AutomatedAgentReply. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAutomatedAgentReply); + + /** AutomatedAgentReply detectIntentResponse. */ + public detectIntentResponse?: (google.cloud.dialogflow.v2.IDetectIntentResponse|null); + + /** AutomatedAgentReply automatedAgentReplyType. */ + public automatedAgentReplyType: (google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType|keyof typeof google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType); + + /** AutomatedAgentReply allowCancellation. */ + public allowCancellation: boolean; + + /** + * Creates a new AutomatedAgentReply instance using the specified properties. + * @param [properties] Properties to set + * @returns AutomatedAgentReply instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAutomatedAgentReply): google.cloud.dialogflow.v2.AutomatedAgentReply; + + /** + * Encodes the specified AutomatedAgentReply message. Does not implicitly {@link google.cloud.dialogflow.v2.AutomatedAgentReply.verify|verify} messages. + * @param message AutomatedAgentReply message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAutomatedAgentReply, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AutomatedAgentReply message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AutomatedAgentReply.verify|verify} messages. + * @param message AutomatedAgentReply message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAutomatedAgentReply, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AutomatedAgentReply message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AutomatedAgentReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AutomatedAgentReply; + + /** + * Decodes an AutomatedAgentReply message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AutomatedAgentReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AutomatedAgentReply; + + /** + * Verifies an AutomatedAgentReply message. + * @param message Plain 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 AutomatedAgentReply message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AutomatedAgentReply + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AutomatedAgentReply; + + /** + * Creates a plain object from an AutomatedAgentReply message. Also converts values to other types if specified. + * @param message AutomatedAgentReply + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AutomatedAgentReply, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AutomatedAgentReply to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AutomatedAgentReply + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AutomatedAgentReply { + + /** AutomatedAgentReplyType enum. */ + enum AutomatedAgentReplyType { + AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED = 0, + PARTIAL = 1, + FINAL = 2 + } + } + + /** Properties of an ArticleAnswer. */ + interface IArticleAnswer { + + /** ArticleAnswer title */ + title?: (string|null); + + /** ArticleAnswer uri */ + uri?: (string|null); + + /** ArticleAnswer snippets */ + snippets?: (string[]|null); + + /** ArticleAnswer confidence */ + confidence?: (number|null); + + /** ArticleAnswer metadata */ + metadata?: ({ [k: string]: string }|null); + + /** ArticleAnswer answerRecord */ + answerRecord?: (string|null); + } + + /** Represents an ArticleAnswer. */ + class ArticleAnswer implements IArticleAnswer { + + /** + * Constructs a new ArticleAnswer. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IArticleAnswer); + + /** ArticleAnswer title. */ + public title: string; + + /** ArticleAnswer uri. */ + public uri: string; + + /** ArticleAnswer snippets. */ + public snippets: string[]; + + /** ArticleAnswer confidence. */ + public confidence: number; + + /** ArticleAnswer metadata. */ + public metadata: { [k: string]: string }; + + /** ArticleAnswer answerRecord. */ + public answerRecord: string; + + /** + * Creates a new ArticleAnswer instance using the specified properties. + * @param [properties] Properties to set + * @returns ArticleAnswer instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IArticleAnswer): google.cloud.dialogflow.v2.ArticleAnswer; + + /** + * Encodes the specified ArticleAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2.ArticleAnswer.verify|verify} messages. + * @param message ArticleAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IArticleAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ArticleAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ArticleAnswer.verify|verify} messages. + * @param message ArticleAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IArticleAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ArticleAnswer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ArticleAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ArticleAnswer; + + /** + * Decodes an ArticleAnswer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ArticleAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ArticleAnswer; + + /** + * Verifies an ArticleAnswer message. + * @param message Plain 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 ArticleAnswer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ArticleAnswer + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ArticleAnswer; + + /** + * Creates a plain object from an ArticleAnswer message. Also converts values to other types if specified. + * @param message ArticleAnswer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ArticleAnswer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ArticleAnswer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ArticleAnswer + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FaqAnswer. */ + interface IFaqAnswer { + + /** FaqAnswer answer */ + answer?: (string|null); + + /** FaqAnswer confidence */ + confidence?: (number|null); + + /** FaqAnswer question */ + question?: (string|null); + + /** FaqAnswer source */ + source?: (string|null); + + /** FaqAnswer metadata */ + metadata?: ({ [k: string]: string }|null); + + /** FaqAnswer answerRecord */ + answerRecord?: (string|null); + } + + /** Represents a FaqAnswer. */ + class FaqAnswer implements IFaqAnswer { + + /** + * Constructs a new FaqAnswer. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IFaqAnswer); + + /** FaqAnswer answer. */ + public answer: string; + + /** FaqAnswer confidence. */ + public confidence: number; + + /** FaqAnswer question. */ + public question: string; + + /** FaqAnswer source. */ + public source: string; + + /** FaqAnswer metadata. */ + public metadata: { [k: string]: string }; + + /** FaqAnswer answerRecord. */ + public answerRecord: string; + + /** + * Creates a new FaqAnswer instance using the specified properties. + * @param [properties] Properties to set + * @returns FaqAnswer instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IFaqAnswer): google.cloud.dialogflow.v2.FaqAnswer; + + /** + * Encodes the specified FaqAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2.FaqAnswer.verify|verify} messages. + * @param message FaqAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IFaqAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FaqAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.FaqAnswer.verify|verify} messages. + * @param message FaqAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IFaqAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.FaqAnswer; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.FaqAnswer; + + /** + * Verifies a FaqAnswer message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FaqAnswer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FaqAnswer + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.FaqAnswer; + + /** + * Creates a plain object from a FaqAnswer message. Also converts values to other types if specified. + * @param message FaqAnswer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.FaqAnswer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FaqAnswer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FaqAnswer + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SmartReplyAnswer. */ + interface ISmartReplyAnswer { + + /** SmartReplyAnswer reply */ + reply?: (string|null); + + /** SmartReplyAnswer confidence */ + confidence?: (number|null); + + /** SmartReplyAnswer answerRecord */ + answerRecord?: (string|null); + } + + /** Represents a SmartReplyAnswer. */ + class SmartReplyAnswer implements ISmartReplyAnswer { + + /** + * Constructs a new SmartReplyAnswer. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISmartReplyAnswer); + + /** SmartReplyAnswer reply. */ + public reply: string; + + /** SmartReplyAnswer confidence. */ + public confidence: number; + + /** SmartReplyAnswer answerRecord. */ + public answerRecord: string; + + /** + * Creates a new SmartReplyAnswer instance using the specified properties. + * @param [properties] Properties to set + * @returns SmartReplyAnswer instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISmartReplyAnswer): google.cloud.dialogflow.v2.SmartReplyAnswer; + + /** + * Encodes the specified SmartReplyAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyAnswer.verify|verify} messages. + * @param message SmartReplyAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISmartReplyAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SmartReplyAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyAnswer.verify|verify} messages. + * @param message SmartReplyAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISmartReplyAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SmartReplyAnswer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SmartReplyAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SmartReplyAnswer; + + /** + * Decodes a SmartReplyAnswer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SmartReplyAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SmartReplyAnswer; + + /** + * Verifies a SmartReplyAnswer message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SmartReplyAnswer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SmartReplyAnswer + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SmartReplyAnswer; + + /** + * Creates a plain object from a SmartReplyAnswer message. Also converts values to other types if specified. + * @param message SmartReplyAnswer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SmartReplyAnswer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SmartReplyAnswer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SmartReplyAnswer + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestionResult. */ + interface ISuggestionResult { + + /** SuggestionResult error */ + error?: (google.rpc.IStatus|null); + + /** SuggestionResult suggestArticlesResponse */ + suggestArticlesResponse?: (google.cloud.dialogflow.v2.ISuggestArticlesResponse|null); + + /** SuggestionResult suggestFaqAnswersResponse */ + suggestFaqAnswersResponse?: (google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse|null); + + /** SuggestionResult suggestSmartRepliesResponse */ + suggestSmartRepliesResponse?: (google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse|null); + } + + /** Represents a SuggestionResult. */ + class SuggestionResult implements ISuggestionResult { + + /** + * Constructs a new SuggestionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISuggestionResult); + + /** SuggestionResult error. */ + public error?: (google.rpc.IStatus|null); + + /** SuggestionResult suggestArticlesResponse. */ + public suggestArticlesResponse?: (google.cloud.dialogflow.v2.ISuggestArticlesResponse|null); + + /** SuggestionResult suggestFaqAnswersResponse. */ + public suggestFaqAnswersResponse?: (google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse|null); + + /** SuggestionResult suggestSmartRepliesResponse. */ + public suggestSmartRepliesResponse?: (google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse|null); + + /** SuggestionResult suggestionResponse. */ + public suggestionResponse?: ("error"|"suggestArticlesResponse"|"suggestFaqAnswersResponse"|"suggestSmartRepliesResponse"); + + /** + * Creates a new SuggestionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISuggestionResult): google.cloud.dialogflow.v2.SuggestionResult; + + /** + * Encodes the specified SuggestionResult message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestionResult.verify|verify} messages. + * @param message SuggestionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISuggestionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestionResult.verify|verify} messages. + * @param message SuggestionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISuggestionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SuggestionResult; + + /** + * Decodes a SuggestionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SuggestionResult; + + /** + * Verifies a SuggestionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SuggestionResult; + + /** + * Creates a plain object from a SuggestionResult message. Also converts values to other types if specified. + * @param message SuggestionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SuggestionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InputTextConfig. */ + interface IInputTextConfig { + + /** InputTextConfig languageCode */ + languageCode?: (string|null); + } + + /** Represents an InputTextConfig. */ + class InputTextConfig implements IInputTextConfig { + + /** + * Constructs a new InputTextConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IInputTextConfig); + + /** InputTextConfig languageCode. */ + public languageCode: string; + + /** + * Creates a new InputTextConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InputTextConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IInputTextConfig): google.cloud.dialogflow.v2.InputTextConfig; + + /** + * Encodes the specified InputTextConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.InputTextConfig.verify|verify} messages. + * @param message InputTextConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IInputTextConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputTextConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.InputTextConfig.verify|verify} messages. + * @param message InputTextConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IInputTextConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InputTextConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InputTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.InputTextConfig; + + /** + * Decodes an InputTextConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InputTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.InputTextConfig; + + /** + * Verifies an InputTextConfig message. + * @param message Plain 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 InputTextConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InputTextConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.InputTextConfig; + + /** + * Creates a plain object from an InputTextConfig message. Also converts values to other types if specified. + * @param message InputTextConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.InputTextConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputTextConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InputTextConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnnotatedMessagePart. */ + interface IAnnotatedMessagePart { + + /** AnnotatedMessagePart text */ + text?: (string|null); + + /** AnnotatedMessagePart entityType */ + entityType?: (string|null); + + /** AnnotatedMessagePart formattedValue */ + formattedValue?: (google.protobuf.IValue|null); + } + + /** Represents an AnnotatedMessagePart. */ + class AnnotatedMessagePart implements IAnnotatedMessagePart { + + /** + * Constructs a new AnnotatedMessagePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAnnotatedMessagePart); + + /** AnnotatedMessagePart text. */ + public text: string; + + /** AnnotatedMessagePart entityType. */ + public entityType: string; + + /** AnnotatedMessagePart formattedValue. */ + public formattedValue?: (google.protobuf.IValue|null); + + /** + * Creates a new AnnotatedMessagePart instance using the specified properties. + * @param [properties] Properties to set + * @returns AnnotatedMessagePart instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAnnotatedMessagePart): google.cloud.dialogflow.v2.AnnotatedMessagePart; + + /** + * Encodes the specified AnnotatedMessagePart message. Does not implicitly {@link google.cloud.dialogflow.v2.AnnotatedMessagePart.verify|verify} messages. + * @param message AnnotatedMessagePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAnnotatedMessagePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnnotatedMessagePart message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnnotatedMessagePart.verify|verify} messages. + * @param message AnnotatedMessagePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAnnotatedMessagePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnnotatedMessagePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnnotatedMessagePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AnnotatedMessagePart; + + /** + * Decodes an AnnotatedMessagePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnnotatedMessagePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AnnotatedMessagePart; + + /** + * Verifies an AnnotatedMessagePart message. + * @param message Plain 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 AnnotatedMessagePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnnotatedMessagePart + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AnnotatedMessagePart; + + /** + * Creates a plain object from an AnnotatedMessagePart message. Also converts values to other types if specified. + * @param message AnnotatedMessagePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AnnotatedMessagePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnnotatedMessagePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnnotatedMessagePart + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MessageAnnotation. */ + interface IMessageAnnotation { + + /** MessageAnnotation parts */ + parts?: (google.cloud.dialogflow.v2.IAnnotatedMessagePart[]|null); + + /** MessageAnnotation containEntities */ + containEntities?: (boolean|null); + } + + /** Represents a MessageAnnotation. */ + class MessageAnnotation implements IMessageAnnotation { + + /** + * Constructs a new MessageAnnotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IMessageAnnotation); + + /** MessageAnnotation parts. */ + public parts: google.cloud.dialogflow.v2.IAnnotatedMessagePart[]; + + /** MessageAnnotation containEntities. */ + public containEntities: boolean; + + /** + * Creates a new MessageAnnotation instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageAnnotation instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IMessageAnnotation): google.cloud.dialogflow.v2.MessageAnnotation; + + /** + * Encodes the specified MessageAnnotation message. Does not implicitly {@link google.cloud.dialogflow.v2.MessageAnnotation.verify|verify} messages. + * @param message MessageAnnotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IMessageAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageAnnotation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.MessageAnnotation.verify|verify} messages. + * @param message MessageAnnotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IMessageAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageAnnotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.MessageAnnotation; + + /** + * Decodes a MessageAnnotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.MessageAnnotation; + + /** + * Verifies a MessageAnnotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageAnnotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageAnnotation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.MessageAnnotation; + + /** + * Creates a plain object from a MessageAnnotation message. Also converts values to other types if specified. + * @param message MessageAnnotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.MessageAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageAnnotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageAnnotation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AssistQueryParameters. */ + interface IAssistQueryParameters { + + /** AssistQueryParameters documentsMetadataFilters */ + documentsMetadataFilters?: ({ [k: string]: string }|null); + } + + /** Represents an AssistQueryParameters. */ + class AssistQueryParameters implements IAssistQueryParameters { + + /** + * Constructs a new AssistQueryParameters. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAssistQueryParameters); + + /** AssistQueryParameters documentsMetadataFilters. */ + public documentsMetadataFilters: { [k: string]: string }; + + /** + * Creates a new AssistQueryParameters instance using the specified properties. + * @param [properties] Properties to set + * @returns AssistQueryParameters instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAssistQueryParameters): google.cloud.dialogflow.v2.AssistQueryParameters; + + /** + * Encodes the specified AssistQueryParameters message. Does not implicitly {@link google.cloud.dialogflow.v2.AssistQueryParameters.verify|verify} messages. + * @param message AssistQueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAssistQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AssistQueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AssistQueryParameters.verify|verify} messages. + * @param message AssistQueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAssistQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AssistQueryParameters message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AssistQueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AssistQueryParameters; + + /** + * Decodes an AssistQueryParameters message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AssistQueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AssistQueryParameters; + + /** + * Verifies an AssistQueryParameters message. + * @param message Plain 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 AssistQueryParameters message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AssistQueryParameters + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AssistQueryParameters; + + /** + * Creates a plain object from an AssistQueryParameters message. Also converts values to other types if specified. + * @param message AssistQueryParameters + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AssistQueryParameters, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AssistQueryParameters to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AssistQueryParameters + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** AudioEncoding enum. */ + enum AudioEncoding { + AUDIO_ENCODING_UNSPECIFIED = 0, + AUDIO_ENCODING_LINEAR_16 = 1, + AUDIO_ENCODING_FLAC = 2, + AUDIO_ENCODING_MULAW = 3, + AUDIO_ENCODING_AMR = 4, + AUDIO_ENCODING_AMR_WB = 5, + AUDIO_ENCODING_OGG_OPUS = 6, + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 + } + + /** Properties of a SpeechContext. */ + interface ISpeechContext { + + /** SpeechContext phrases */ + phrases?: (string[]|null); + + /** SpeechContext boost */ + boost?: (number|null); + } + + /** Represents a SpeechContext. */ + class SpeechContext implements ISpeechContext { + + /** + * Constructs a new SpeechContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISpeechContext); + + /** SpeechContext phrases. */ + public phrases: string[]; + + /** SpeechContext boost. */ + public boost: number; + + /** + * Creates a new SpeechContext instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechContext instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISpeechContext): google.cloud.dialogflow.v2.SpeechContext; + + /** + * Encodes the specified SpeechContext message. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechContext.verify|verify} messages. + * @param message SpeechContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISpeechContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechContext message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechContext.verify|verify} messages. + * @param message SpeechContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISpeechContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SpeechContext; + + /** + * Decodes a SpeechContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SpeechContext; + + /** + * Verifies a SpeechContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpeechContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SpeechContext; + + /** + * Creates a plain object from a SpeechContext message. Also converts values to other types if specified. + * @param message SpeechContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SpeechContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpeechContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpeechContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SpeechModelVariant enum. */ + enum SpeechModelVariant { + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0, + USE_BEST_AVAILABLE = 1, + USE_STANDARD = 2, + USE_ENHANCED = 3 + } + + /** Properties of a SpeechWordInfo. */ + interface ISpeechWordInfo { + + /** SpeechWordInfo word */ + word?: (string|null); + + /** SpeechWordInfo startOffset */ + startOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo endOffset */ + endOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo confidence */ + confidence?: (number|null); + } + + /** Represents a SpeechWordInfo. */ + class SpeechWordInfo implements ISpeechWordInfo { + + /** + * Constructs a new SpeechWordInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISpeechWordInfo); + + /** SpeechWordInfo word. */ + public word: string; + + /** SpeechWordInfo startOffset. */ + public startOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo endOffset. */ + public endOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo confidence. */ + public confidence: number; + + /** + * Creates a new SpeechWordInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechWordInfo instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISpeechWordInfo): google.cloud.dialogflow.v2.SpeechWordInfo; + + /** + * Encodes the specified SpeechWordInfo message. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechWordInfo.verify|verify} messages. + * @param message SpeechWordInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISpeechWordInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechWordInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechWordInfo.verify|verify} messages. + * @param message SpeechWordInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISpeechWordInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SpeechWordInfo; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SpeechWordInfo; + + /** + * Verifies a SpeechWordInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpeechWordInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechWordInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SpeechWordInfo; + + /** + * Creates a plain object from a SpeechWordInfo message. Also converts values to other types if specified. + * @param message SpeechWordInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SpeechWordInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpeechWordInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpeechWordInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InputAudioConfig. */ + interface IInputAudioConfig { + + /** InputAudioConfig audioEncoding */ + audioEncoding?: (google.cloud.dialogflow.v2.AudioEncoding|keyof typeof google.cloud.dialogflow.v2.AudioEncoding|null); + + /** InputAudioConfig sampleRateHertz */ + sampleRateHertz?: (number|null); + + /** InputAudioConfig languageCode */ + languageCode?: (string|null); + + /** InputAudioConfig enableWordInfo */ + enableWordInfo?: (boolean|null); + + /** InputAudioConfig phraseHints */ + phraseHints?: (string[]|null); + + /** InputAudioConfig speechContexts */ + speechContexts?: (google.cloud.dialogflow.v2.ISpeechContext[]|null); + + /** InputAudioConfig model */ + model?: (string|null); + + /** InputAudioConfig modelVariant */ + modelVariant?: (google.cloud.dialogflow.v2.SpeechModelVariant|keyof typeof google.cloud.dialogflow.v2.SpeechModelVariant|null); + + /** InputAudioConfig singleUtterance */ + singleUtterance?: (boolean|null); + + /** InputAudioConfig disableNoSpeechRecognizedEvent */ + disableNoSpeechRecognizedEvent?: (boolean|null); + } + + /** Represents an InputAudioConfig. */ + class InputAudioConfig implements IInputAudioConfig { + + /** + * Constructs a new InputAudioConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IInputAudioConfig); + + /** InputAudioConfig audioEncoding. */ + public audioEncoding: (google.cloud.dialogflow.v2.AudioEncoding|keyof typeof google.cloud.dialogflow.v2.AudioEncoding); + + /** InputAudioConfig sampleRateHertz. */ + public sampleRateHertz: number; + + /** InputAudioConfig languageCode. */ + public languageCode: string; + + /** InputAudioConfig enableWordInfo. */ + public enableWordInfo: boolean; + + /** InputAudioConfig phraseHints. */ + public phraseHints: string[]; + + /** InputAudioConfig speechContexts. */ + public speechContexts: google.cloud.dialogflow.v2.ISpeechContext[]; + + /** InputAudioConfig model. */ + public model: string; + + /** InputAudioConfig modelVariant. */ + public modelVariant: (google.cloud.dialogflow.v2.SpeechModelVariant|keyof typeof google.cloud.dialogflow.v2.SpeechModelVariant); + + /** InputAudioConfig singleUtterance. */ + public singleUtterance: boolean; + + /** InputAudioConfig disableNoSpeechRecognizedEvent. */ + public disableNoSpeechRecognizedEvent: boolean; + + /** + * Creates a new InputAudioConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InputAudioConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IInputAudioConfig): google.cloud.dialogflow.v2.InputAudioConfig; + + /** + * Encodes the specified InputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.InputAudioConfig.verify|verify} messages. + * @param message InputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IInputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.InputAudioConfig.verify|verify} messages. + * @param message InputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IInputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.InputAudioConfig; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.InputAudioConfig; + + /** + * Verifies an InputAudioConfig message. + * @param message Plain 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 InputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InputAudioConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.InputAudioConfig; + + /** + * Creates a plain object from an InputAudioConfig message. Also converts values to other types if specified. + * @param message InputAudioConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.InputAudioConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputAudioConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InputAudioConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SsmlVoiceGender enum. */ + enum SsmlVoiceGender { + SSML_VOICE_GENDER_UNSPECIFIED = 0, + SSML_VOICE_GENDER_MALE = 1, + SSML_VOICE_GENDER_FEMALE = 2, + SSML_VOICE_GENDER_NEUTRAL = 3 + } + + /** Properties of a VoiceSelectionParams. */ + interface IVoiceSelectionParams { + + /** VoiceSelectionParams name */ + name?: (string|null); + + /** VoiceSelectionParams ssmlGender */ + ssmlGender?: (google.cloud.dialogflow.v2.SsmlVoiceGender|keyof typeof google.cloud.dialogflow.v2.SsmlVoiceGender|null); + } + + /** Represents a VoiceSelectionParams. */ + class VoiceSelectionParams implements IVoiceSelectionParams { + + /** + * Constructs a new VoiceSelectionParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IVoiceSelectionParams); + + /** VoiceSelectionParams name. */ + public name: string; + + /** VoiceSelectionParams ssmlGender. */ + public ssmlGender: (google.cloud.dialogflow.v2.SsmlVoiceGender|keyof typeof google.cloud.dialogflow.v2.SsmlVoiceGender); + + /** + * Creates a new VoiceSelectionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns VoiceSelectionParams instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IVoiceSelectionParams): google.cloud.dialogflow.v2.VoiceSelectionParams; + + /** + * Encodes the specified VoiceSelectionParams message. Does not implicitly {@link google.cloud.dialogflow.v2.VoiceSelectionParams.verify|verify} messages. + * @param message VoiceSelectionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IVoiceSelectionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VoiceSelectionParams message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.VoiceSelectionParams.verify|verify} messages. + * @param message VoiceSelectionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IVoiceSelectionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.VoiceSelectionParams; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.VoiceSelectionParams; + + /** + * Verifies a VoiceSelectionParams message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VoiceSelectionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VoiceSelectionParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.VoiceSelectionParams; + + /** + * Creates a plain object from a VoiceSelectionParams message. Also converts values to other types if specified. + * @param message VoiceSelectionParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.VoiceSelectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VoiceSelectionParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VoiceSelectionParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SynthesizeSpeechConfig. */ + interface ISynthesizeSpeechConfig { + + /** SynthesizeSpeechConfig speakingRate */ + speakingRate?: (number|null); + + /** SynthesizeSpeechConfig pitch */ + pitch?: (number|null); + + /** SynthesizeSpeechConfig volumeGainDb */ + volumeGainDb?: (number|null); + + /** SynthesizeSpeechConfig effectsProfileId */ + effectsProfileId?: (string[]|null); + + /** SynthesizeSpeechConfig voice */ + voice?: (google.cloud.dialogflow.v2.IVoiceSelectionParams|null); + } + + /** Represents a SynthesizeSpeechConfig. */ + class SynthesizeSpeechConfig implements ISynthesizeSpeechConfig { + + /** + * Constructs a new SynthesizeSpeechConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISynthesizeSpeechConfig); + + /** SynthesizeSpeechConfig speakingRate. */ + public speakingRate: number; + + /** SynthesizeSpeechConfig pitch. */ + public pitch: number; + + /** SynthesizeSpeechConfig volumeGainDb. */ + public volumeGainDb: number; + + /** SynthesizeSpeechConfig effectsProfileId. */ + public effectsProfileId: string[]; + + /** SynthesizeSpeechConfig voice. */ + public voice?: (google.cloud.dialogflow.v2.IVoiceSelectionParams|null); + + /** + * Creates a new SynthesizeSpeechConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SynthesizeSpeechConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISynthesizeSpeechConfig): google.cloud.dialogflow.v2.SynthesizeSpeechConfig; + + /** + * Encodes the specified SynthesizeSpeechConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.SynthesizeSpeechConfig.verify|verify} messages. + * @param message SynthesizeSpeechConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISynthesizeSpeechConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SynthesizeSpeechConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SynthesizeSpeechConfig.verify|verify} messages. + * @param message SynthesizeSpeechConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISynthesizeSpeechConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SynthesizeSpeechConfig; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SynthesizeSpeechConfig; + + /** + * Verifies a SynthesizeSpeechConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SynthesizeSpeechConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SynthesizeSpeechConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SynthesizeSpeechConfig; + + /** + * Creates a plain object from a SynthesizeSpeechConfig message. Also converts values to other types if specified. + * @param message SynthesizeSpeechConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SynthesizeSpeechConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SynthesizeSpeechConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SynthesizeSpeechConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** OutputAudioEncoding enum. */ + enum OutputAudioEncoding { + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0, + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1, + OUTPUT_AUDIO_ENCODING_MP3 = 2, + OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4, + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3, + OUTPUT_AUDIO_ENCODING_MULAW = 5 + } + + /** Properties of an OutputAudioConfig. */ + interface IOutputAudioConfig { + + /** OutputAudioConfig audioEncoding */ + audioEncoding?: (google.cloud.dialogflow.v2.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.v2.OutputAudioEncoding|null); + + /** OutputAudioConfig sampleRateHertz */ + sampleRateHertz?: (number|null); + + /** OutputAudioConfig synthesizeSpeechConfig */ + synthesizeSpeechConfig?: (google.cloud.dialogflow.v2.ISynthesizeSpeechConfig|null); + } + + /** Represents an OutputAudioConfig. */ + class OutputAudioConfig implements IOutputAudioConfig { + + /** + * Constructs a new OutputAudioConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IOutputAudioConfig); + + /** OutputAudioConfig audioEncoding. */ + public audioEncoding: (google.cloud.dialogflow.v2.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.v2.OutputAudioEncoding); + + /** OutputAudioConfig sampleRateHertz. */ + public sampleRateHertz: number; + + /** OutputAudioConfig synthesizeSpeechConfig. */ + public synthesizeSpeechConfig?: (google.cloud.dialogflow.v2.ISynthesizeSpeechConfig|null); + + /** + * Creates a new OutputAudioConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputAudioConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IOutputAudioConfig): google.cloud.dialogflow.v2.OutputAudioConfig; + + /** + * Encodes the specified OutputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.OutputAudioConfig.verify|verify} messages. + * @param message OutputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IOutputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.OutputAudioConfig.verify|verify} messages. + * @param message OutputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IOutputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.OutputAudioConfig; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.OutputAudioConfig; + + /** + * Verifies an OutputAudioConfig message. + * @param message Plain 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 OutputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputAudioConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.OutputAudioConfig; + + /** + * Creates a plain object from an OutputAudioConfig message. Also converts values to other types if specified. + * @param message OutputAudioConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.OutputAudioConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputAudioConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputAudioConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** TelephonyDtmf enum. */ + enum TelephonyDtmf { + TELEPHONY_DTMF_UNSPECIFIED = 0, + DTMF_ONE = 1, + DTMF_TWO = 2, + DTMF_THREE = 3, + DTMF_FOUR = 4, + DTMF_FIVE = 5, + DTMF_SIX = 6, + DTMF_SEVEN = 7, + DTMF_EIGHT = 8, + DTMF_NINE = 9, + DTMF_ZERO = 10, + DTMF_A = 11, + DTMF_B = 12, + DTMF_C = 13, + DTMF_D = 14, + DTMF_STAR = 15, + DTMF_POUND = 16 + } + + /** Properties of a TelephonyDtmfEvents. */ + interface ITelephonyDtmfEvents { + + /** TelephonyDtmfEvents dtmfEvents */ + dtmfEvents?: (google.cloud.dialogflow.v2.TelephonyDtmf[]|null); + } + + /** Represents a TelephonyDtmfEvents. */ + class TelephonyDtmfEvents implements ITelephonyDtmfEvents { + + /** + * Constructs a new TelephonyDtmfEvents. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ITelephonyDtmfEvents); + + /** TelephonyDtmfEvents dtmfEvents. */ + public dtmfEvents: google.cloud.dialogflow.v2.TelephonyDtmf[]; + + /** + * Creates a new TelephonyDtmfEvents instance using the specified properties. + * @param [properties] Properties to set + * @returns TelephonyDtmfEvents instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ITelephonyDtmfEvents): google.cloud.dialogflow.v2.TelephonyDtmfEvents; + + /** + * Encodes the specified TelephonyDtmfEvents message. Does not implicitly {@link google.cloud.dialogflow.v2.TelephonyDtmfEvents.verify|verify} messages. + * @param message TelephonyDtmfEvents message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ITelephonyDtmfEvents, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TelephonyDtmfEvents message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.TelephonyDtmfEvents.verify|verify} messages. + * @param message TelephonyDtmfEvents message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ITelephonyDtmfEvents, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TelephonyDtmfEvents message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TelephonyDtmfEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.TelephonyDtmfEvents; + + /** + * Decodes a TelephonyDtmfEvents message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TelephonyDtmfEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.TelephonyDtmfEvents; + + /** + * Verifies a TelephonyDtmfEvents message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TelephonyDtmfEvents message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TelephonyDtmfEvents + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.TelephonyDtmfEvents; + + /** + * Creates a plain object from a TelephonyDtmfEvents message. Also converts values to other types if specified. + * @param message TelephonyDtmfEvents + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.TelephonyDtmfEvents, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TelephonyDtmfEvents to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TelephonyDtmfEvents + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SpeechToTextConfig. */ + interface ISpeechToTextConfig { + + /** SpeechToTextConfig speechModelVariant */ + speechModelVariant?: (google.cloud.dialogflow.v2.SpeechModelVariant|keyof typeof google.cloud.dialogflow.v2.SpeechModelVariant|null); + + /** SpeechToTextConfig model */ + model?: (string|null); + } + + /** Represents a SpeechToTextConfig. */ + class SpeechToTextConfig implements ISpeechToTextConfig { + + /** + * Constructs a new SpeechToTextConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISpeechToTextConfig); + + /** SpeechToTextConfig speechModelVariant. */ + public speechModelVariant: (google.cloud.dialogflow.v2.SpeechModelVariant|keyof typeof google.cloud.dialogflow.v2.SpeechModelVariant); + + /** SpeechToTextConfig model. */ + public model: string; + + /** + * Creates a new SpeechToTextConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechToTextConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISpeechToTextConfig): google.cloud.dialogflow.v2.SpeechToTextConfig; + + /** + * Encodes the specified SpeechToTextConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechToTextConfig.verify|verify} messages. + * @param message SpeechToTextConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISpeechToTextConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechToTextConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechToTextConfig.verify|verify} messages. + * @param message SpeechToTextConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISpeechToTextConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechToTextConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechToTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SpeechToTextConfig; + + /** + * Decodes a SpeechToTextConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechToTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SpeechToTextConfig; + + /** + * Verifies a SpeechToTextConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpeechToTextConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechToTextConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SpeechToTextConfig; + + /** + * Creates a plain object from a SpeechToTextConfig message. Also converts values to other types if specified. + * @param message SpeechToTextConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SpeechToTextConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpeechToTextConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpeechToTextConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Sessions */ + class Sessions extends $protobuf.rpc.Service { + + /** + * Constructs a new Sessions 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 Sessions 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): Sessions; + + /** + * Calls DetectIntent. + * @param request DetectIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DetectIntentResponse + */ + public detectIntent(request: google.cloud.dialogflow.v2.IDetectIntentRequest, callback: google.cloud.dialogflow.v2.Sessions.DetectIntentCallback): void; + + /** + * Calls DetectIntent. + * @param request DetectIntentRequest message or plain object + * @returns Promise + */ + public detectIntent(request: google.cloud.dialogflow.v2.IDetectIntentRequest): Promise; + + /** + * Calls StreamingDetectIntent. + * @param request StreamingDetectIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and StreamingDetectIntentResponse + */ + public streamingDetectIntent(request: google.cloud.dialogflow.v2.IStreamingDetectIntentRequest, callback: google.cloud.dialogflow.v2.Sessions.StreamingDetectIntentCallback): void; + + /** + * Calls StreamingDetectIntent. + * @param request StreamingDetectIntentRequest message or plain object + * @returns Promise + */ + public streamingDetectIntent(request: google.cloud.dialogflow.v2.IStreamingDetectIntentRequest): Promise; + } + + namespace Sessions { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Sessions|detectIntent}. + * @param error Error, if any + * @param [response] DetectIntentResponse + */ + type DetectIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.DetectIntentResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Sessions|streamingDetectIntent}. + * @param error Error, if any + * @param [response] StreamingDetectIntentResponse + */ + type StreamingDetectIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.StreamingDetectIntentResponse) => void; + } + + /** Properties of a DetectIntentRequest. */ + interface IDetectIntentRequest { + + /** DetectIntentRequest session */ + session?: (string|null); + + /** DetectIntentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.v2.IQueryParameters|null); + + /** DetectIntentRequest queryInput */ + queryInput?: (google.cloud.dialogflow.v2.IQueryInput|null); + + /** DetectIntentRequest outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** DetectIntentRequest outputAudioConfigMask */ + outputAudioConfigMask?: (google.protobuf.IFieldMask|null); + + /** DetectIntentRequest inputAudio */ + inputAudio?: (Uint8Array|string|null); + } + + /** Represents a DetectIntentRequest. */ + class DetectIntentRequest implements IDetectIntentRequest { + + /** + * Constructs a new DetectIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDetectIntentRequest); + + /** DetectIntentRequest session. */ + public session: string; + + /** DetectIntentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.v2.IQueryParameters|null); + + /** DetectIntentRequest queryInput. */ + public queryInput?: (google.cloud.dialogflow.v2.IQueryInput|null); + + /** DetectIntentRequest outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** DetectIntentRequest outputAudioConfigMask. */ + public outputAudioConfigMask?: (google.protobuf.IFieldMask|null); + + /** DetectIntentRequest inputAudio. */ + public inputAudio: (Uint8Array|string); + + /** + * Creates a new DetectIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDetectIntentRequest): google.cloud.dialogflow.v2.DetectIntentRequest; + + /** + * Encodes the specified DetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DetectIntentRequest.verify|verify} messages. + * @param message DetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DetectIntentRequest.verify|verify} messages. + * @param message DetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DetectIntentRequest; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DetectIntentRequest; + + /** + * Verifies a DetectIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DetectIntentRequest; + + /** + * Creates a plain object from a DetectIntentRequest message. Also converts values to other types if specified. + * @param message DetectIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DetectIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DetectIntentResponse. */ + interface IDetectIntentResponse { + + /** DetectIntentResponse responseId */ + responseId?: (string|null); + + /** DetectIntentResponse queryResult */ + queryResult?: (google.cloud.dialogflow.v2.IQueryResult|null); + + /** DetectIntentResponse webhookStatus */ + webhookStatus?: (google.rpc.IStatus|null); + + /** DetectIntentResponse outputAudio */ + outputAudio?: (Uint8Array|string|null); + + /** DetectIntentResponse outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + } + + /** Represents a DetectIntentResponse. */ + class DetectIntentResponse implements IDetectIntentResponse { + + /** + * Constructs a new DetectIntentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDetectIntentResponse); + + /** DetectIntentResponse responseId. */ + public responseId: string; + + /** DetectIntentResponse queryResult. */ + public queryResult?: (google.cloud.dialogflow.v2.IQueryResult|null); + + /** DetectIntentResponse webhookStatus. */ + public webhookStatus?: (google.rpc.IStatus|null); + + /** DetectIntentResponse outputAudio. */ + public outputAudio: (Uint8Array|string); + + /** DetectIntentResponse outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** + * Creates a new DetectIntentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectIntentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDetectIntentResponse): google.cloud.dialogflow.v2.DetectIntentResponse; + + /** + * Encodes the specified DetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.DetectIntentResponse.verify|verify} messages. + * @param message DetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DetectIntentResponse.verify|verify} messages. + * @param message DetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DetectIntentResponse; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DetectIntentResponse; + + /** + * Verifies a DetectIntentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectIntentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DetectIntentResponse; + + /** + * Creates a plain object from a DetectIntentResponse message. Also converts values to other types if specified. + * @param message DetectIntentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DetectIntentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectIntentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectIntentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryParameters. */ + interface IQueryParameters { + + /** QueryParameters timeZone */ + timeZone?: (string|null); + + /** QueryParameters geoLocation */ + geoLocation?: (google.type.ILatLng|null); + + /** QueryParameters contexts */ + contexts?: (google.cloud.dialogflow.v2.IContext[]|null); + + /** QueryParameters resetContexts */ + resetContexts?: (boolean|null); + + /** QueryParameters sessionEntityTypes */ + sessionEntityTypes?: (google.cloud.dialogflow.v2.ISessionEntityType[]|null); + + /** QueryParameters payload */ + payload?: (google.protobuf.IStruct|null); + + /** QueryParameters sentimentAnalysisRequestConfig */ + sentimentAnalysisRequestConfig?: (google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig|null); + + /** QueryParameters webhookHeaders */ + webhookHeaders?: ({ [k: string]: string }|null); + } + + /** Represents a QueryParameters. */ + class QueryParameters implements IQueryParameters { + + /** + * Constructs a new QueryParameters. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IQueryParameters); + + /** QueryParameters timeZone. */ + public timeZone: string; + + /** QueryParameters geoLocation. */ + public geoLocation?: (google.type.ILatLng|null); + + /** QueryParameters contexts. */ + public contexts: google.cloud.dialogflow.v2.IContext[]; + + /** QueryParameters resetContexts. */ + public resetContexts: boolean; + + /** QueryParameters sessionEntityTypes. */ + public sessionEntityTypes: google.cloud.dialogflow.v2.ISessionEntityType[]; + + /** QueryParameters payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** QueryParameters sentimentAnalysisRequestConfig. */ + public sentimentAnalysisRequestConfig?: (google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig|null); + + /** QueryParameters webhookHeaders. */ + public webhookHeaders: { [k: string]: string }; + + /** + * Creates a new QueryParameters instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryParameters instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IQueryParameters): google.cloud.dialogflow.v2.QueryParameters; + + /** + * Encodes the specified QueryParameters message. Does not implicitly {@link google.cloud.dialogflow.v2.QueryParameters.verify|verify} messages. + * @param message QueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.QueryParameters.verify|verify} messages. + * @param message QueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryParameters message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.QueryParameters; + + /** + * Decodes a QueryParameters message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.QueryParameters; + + /** + * Verifies a QueryParameters message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryParameters message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryParameters + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.QueryParameters; + + /** + * Creates a plain object from a QueryParameters message. Also converts values to other types if specified. + * @param message QueryParameters + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.QueryParameters, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryParameters to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryParameters + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryInput. */ + interface IQueryInput { + + /** QueryInput audioConfig */ + audioConfig?: (google.cloud.dialogflow.v2.IInputAudioConfig|null); + + /** QueryInput text */ + text?: (google.cloud.dialogflow.v2.ITextInput|null); + + /** QueryInput event */ + event?: (google.cloud.dialogflow.v2.IEventInput|null); + } + + /** Represents a QueryInput. */ + class QueryInput implements IQueryInput { + + /** + * Constructs a new QueryInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IQueryInput); + + /** QueryInput audioConfig. */ + public audioConfig?: (google.cloud.dialogflow.v2.IInputAudioConfig|null); + + /** QueryInput text. */ + public text?: (google.cloud.dialogflow.v2.ITextInput|null); + + /** QueryInput event. */ + public event?: (google.cloud.dialogflow.v2.IEventInput|null); + + /** QueryInput input. */ + public input?: ("audioConfig"|"text"|"event"); + + /** + * Creates a new QueryInput instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryInput instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IQueryInput): google.cloud.dialogflow.v2.QueryInput; + + /** + * Encodes the specified QueryInput message. Does not implicitly {@link google.cloud.dialogflow.v2.QueryInput.verify|verify} messages. + * @param message QueryInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IQueryInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.QueryInput.verify|verify} messages. + * @param message QueryInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IQueryInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.QueryInput; + + /** + * Decodes a QueryInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.QueryInput; + + /** + * Verifies a QueryInput message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.QueryInput; + + /** + * Creates a plain object from a QueryInput message. Also converts values to other types if specified. + * @param message QueryInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.QueryInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryInput + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryResult. */ + interface IQueryResult { + + /** QueryResult queryText */ + queryText?: (string|null); + + /** QueryResult languageCode */ + languageCode?: (string|null); + + /** QueryResult speechRecognitionConfidence */ + speechRecognitionConfidence?: (number|null); + + /** QueryResult action */ + action?: (string|null); + + /** QueryResult parameters */ + parameters?: (google.protobuf.IStruct|null); + + /** QueryResult allRequiredParamsPresent */ + allRequiredParamsPresent?: (boolean|null); + + /** QueryResult cancelsSlotFilling */ + cancelsSlotFilling?: (boolean|null); + + /** QueryResult fulfillmentText */ + fulfillmentText?: (string|null); + + /** QueryResult fulfillmentMessages */ + fulfillmentMessages?: (google.cloud.dialogflow.v2.Intent.IMessage[]|null); + + /** QueryResult webhookSource */ + webhookSource?: (string|null); + + /** QueryResult webhookPayload */ + webhookPayload?: (google.protobuf.IStruct|null); + + /** QueryResult outputContexts */ + outputContexts?: (google.cloud.dialogflow.v2.IContext[]|null); + + /** QueryResult intent */ + intent?: (google.cloud.dialogflow.v2.IIntent|null); + + /** QueryResult intentDetectionConfidence */ + intentDetectionConfidence?: (number|null); + + /** QueryResult diagnosticInfo */ + diagnosticInfo?: (google.protobuf.IStruct|null); + + /** QueryResult sentimentAnalysisResult */ + sentimentAnalysisResult?: (google.cloud.dialogflow.v2.ISentimentAnalysisResult|null); + } + + /** Represents a QueryResult. */ + class QueryResult implements IQueryResult { + + /** + * Constructs a new QueryResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IQueryResult); + + /** QueryResult queryText. */ + public queryText: string; + + /** QueryResult languageCode. */ + public languageCode: string; + + /** QueryResult speechRecognitionConfidence. */ + public speechRecognitionConfidence: number; + + /** QueryResult action. */ + public action: string; + + /** QueryResult parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** QueryResult allRequiredParamsPresent. */ + public allRequiredParamsPresent: boolean; + + /** QueryResult cancelsSlotFilling. */ + public cancelsSlotFilling: boolean; + + /** QueryResult fulfillmentText. */ + public fulfillmentText: string; + + /** QueryResult fulfillmentMessages. */ + public fulfillmentMessages: google.cloud.dialogflow.v2.Intent.IMessage[]; + + /** QueryResult webhookSource. */ + public webhookSource: string; + + /** QueryResult webhookPayload. */ + public webhookPayload?: (google.protobuf.IStruct|null); + + /** QueryResult outputContexts. */ + public outputContexts: google.cloud.dialogflow.v2.IContext[]; + + /** QueryResult intent. */ + public intent?: (google.cloud.dialogflow.v2.IIntent|null); + + /** QueryResult intentDetectionConfidence. */ + public intentDetectionConfidence: number; + + /** QueryResult diagnosticInfo. */ + public diagnosticInfo?: (google.protobuf.IStruct|null); + + /** QueryResult sentimentAnalysisResult. */ + public sentimentAnalysisResult?: (google.cloud.dialogflow.v2.ISentimentAnalysisResult|null); + + /** + * Creates a new QueryResult instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IQueryResult): google.cloud.dialogflow.v2.QueryResult; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.dialogflow.v2.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.QueryResult; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.QueryResult; + + /** + * Verifies a QueryResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.QueryResult; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @param message QueryResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.QueryResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingDetectIntentRequest. */ + interface IStreamingDetectIntentRequest { + + /** StreamingDetectIntentRequest session */ + session?: (string|null); + + /** StreamingDetectIntentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.v2.IQueryParameters|null); + + /** StreamingDetectIntentRequest queryInput */ + queryInput?: (google.cloud.dialogflow.v2.IQueryInput|null); + + /** StreamingDetectIntentRequest singleUtterance */ + singleUtterance?: (boolean|null); + + /** StreamingDetectIntentRequest outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** StreamingDetectIntentRequest outputAudioConfigMask */ + outputAudioConfigMask?: (google.protobuf.IFieldMask|null); + + /** StreamingDetectIntentRequest inputAudio */ + inputAudio?: (Uint8Array|string|null); + } + + /** Represents a StreamingDetectIntentRequest. */ + class StreamingDetectIntentRequest implements IStreamingDetectIntentRequest { + + /** + * Constructs a new StreamingDetectIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IStreamingDetectIntentRequest); + + /** StreamingDetectIntentRequest session. */ + public session: string; + + /** StreamingDetectIntentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.v2.IQueryParameters|null); + + /** StreamingDetectIntentRequest queryInput. */ + public queryInput?: (google.cloud.dialogflow.v2.IQueryInput|null); + + /** StreamingDetectIntentRequest singleUtterance. */ + public singleUtterance: boolean; + + /** StreamingDetectIntentRequest outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** StreamingDetectIntentRequest outputAudioConfigMask. */ + public outputAudioConfigMask?: (google.protobuf.IFieldMask|null); + + /** StreamingDetectIntentRequest inputAudio. */ + public inputAudio: (Uint8Array|string); + + /** + * Creates a new StreamingDetectIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingDetectIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IStreamingDetectIntentRequest): google.cloud.dialogflow.v2.StreamingDetectIntentRequest; + + /** + * Encodes the specified StreamingDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingDetectIntentRequest.verify|verify} messages. + * @param message StreamingDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IStreamingDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingDetectIntentRequest.verify|verify} messages. + * @param message StreamingDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IStreamingDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.StreamingDetectIntentRequest; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.StreamingDetectIntentRequest; + + /** + * Verifies a StreamingDetectIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingDetectIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.StreamingDetectIntentRequest; + + /** + * Creates a plain object from a StreamingDetectIntentRequest message. Also converts values to other types if specified. + * @param message StreamingDetectIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.StreamingDetectIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingDetectIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingDetectIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingDetectIntentResponse. */ + interface IStreamingDetectIntentResponse { + + /** StreamingDetectIntentResponse responseId */ + responseId?: (string|null); + + /** StreamingDetectIntentResponse recognitionResult */ + recognitionResult?: (google.cloud.dialogflow.v2.IStreamingRecognitionResult|null); + + /** StreamingDetectIntentResponse queryResult */ + queryResult?: (google.cloud.dialogflow.v2.IQueryResult|null); + + /** StreamingDetectIntentResponse webhookStatus */ + webhookStatus?: (google.rpc.IStatus|null); + + /** StreamingDetectIntentResponse outputAudio */ + outputAudio?: (Uint8Array|string|null); + + /** StreamingDetectIntentResponse outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + } + + /** Represents a StreamingDetectIntentResponse. */ + class StreamingDetectIntentResponse implements IStreamingDetectIntentResponse { + + /** + * Constructs a new StreamingDetectIntentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IStreamingDetectIntentResponse); + + /** StreamingDetectIntentResponse responseId. */ + public responseId: string; + + /** StreamingDetectIntentResponse recognitionResult. */ + public recognitionResult?: (google.cloud.dialogflow.v2.IStreamingRecognitionResult|null); + + /** StreamingDetectIntentResponse queryResult. */ + public queryResult?: (google.cloud.dialogflow.v2.IQueryResult|null); + + /** StreamingDetectIntentResponse webhookStatus. */ + public webhookStatus?: (google.rpc.IStatus|null); + + /** StreamingDetectIntentResponse outputAudio. */ + public outputAudio: (Uint8Array|string); + + /** StreamingDetectIntentResponse outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.v2.IOutputAudioConfig|null); + + /** + * Creates a new StreamingDetectIntentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingDetectIntentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IStreamingDetectIntentResponse): google.cloud.dialogflow.v2.StreamingDetectIntentResponse; + + /** + * Encodes the specified StreamingDetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingDetectIntentResponse.verify|verify} messages. + * @param message StreamingDetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IStreamingDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingDetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingDetectIntentResponse.verify|verify} messages. + * @param message StreamingDetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IStreamingDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.StreamingDetectIntentResponse; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.StreamingDetectIntentResponse; + + /** + * Verifies a StreamingDetectIntentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingDetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingDetectIntentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.StreamingDetectIntentResponse; + + /** + * Creates a plain object from a StreamingDetectIntentResponse message. Also converts values to other types if specified. + * @param message StreamingDetectIntentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.StreamingDetectIntentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingDetectIntentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingDetectIntentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingRecognitionResult. */ + interface IStreamingRecognitionResult { + + /** StreamingRecognitionResult messageType */ + messageType?: (google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType|keyof typeof google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType|null); + + /** StreamingRecognitionResult transcript */ + transcript?: (string|null); + + /** StreamingRecognitionResult isFinal */ + isFinal?: (boolean|null); + + /** StreamingRecognitionResult confidence */ + confidence?: (number|null); + + /** StreamingRecognitionResult speechWordInfo */ + speechWordInfo?: (google.cloud.dialogflow.v2.ISpeechWordInfo[]|null); + + /** StreamingRecognitionResult speechEndOffset */ + speechEndOffset?: (google.protobuf.IDuration|null); + + /** StreamingRecognitionResult languageCode */ + languageCode?: (string|null); + } + + /** Represents a StreamingRecognitionResult. */ + class StreamingRecognitionResult implements IStreamingRecognitionResult { + + /** + * Constructs a new StreamingRecognitionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IStreamingRecognitionResult); + + /** StreamingRecognitionResult messageType. */ + public messageType: (google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType|keyof typeof google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType); + + /** StreamingRecognitionResult transcript. */ + public transcript: string; + + /** StreamingRecognitionResult isFinal. */ + public isFinal: boolean; + + /** StreamingRecognitionResult confidence. */ + public confidence: number; + + /** StreamingRecognitionResult speechWordInfo. */ + public speechWordInfo: google.cloud.dialogflow.v2.ISpeechWordInfo[]; + + /** StreamingRecognitionResult speechEndOffset. */ + public speechEndOffset?: (google.protobuf.IDuration|null); + + /** StreamingRecognitionResult languageCode. */ + public languageCode: string; + + /** + * Creates a new StreamingRecognitionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingRecognitionResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IStreamingRecognitionResult): google.cloud.dialogflow.v2.StreamingRecognitionResult; + + /** + * Encodes the specified StreamingRecognitionResult message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingRecognitionResult.verify|verify} messages. + * @param message StreamingRecognitionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IStreamingRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingRecognitionResult.verify|verify} messages. + * @param message StreamingRecognitionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IStreamingRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.StreamingRecognitionResult; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.StreamingRecognitionResult; + + /** + * Verifies a StreamingRecognitionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingRecognitionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingRecognitionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.StreamingRecognitionResult; + + /** + * Creates a plain object from a StreamingRecognitionResult message. Also converts values to other types if specified. + * @param message StreamingRecognitionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.StreamingRecognitionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingRecognitionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingRecognitionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace StreamingRecognitionResult { + + /** MessageType enum. */ + enum MessageType { + MESSAGE_TYPE_UNSPECIFIED = 0, + TRANSCRIPT = 1, + END_OF_SINGLE_UTTERANCE = 2 + } + } + + /** Properties of a TextInput. */ + interface ITextInput { + + /** TextInput text */ + text?: (string|null); + + /** TextInput languageCode */ + languageCode?: (string|null); + } + + /** Represents a TextInput. */ + class TextInput implements ITextInput { + + /** + * Constructs a new TextInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ITextInput); + + /** TextInput text. */ + public text: string; + + /** TextInput languageCode. */ + public languageCode: string; + + /** + * Creates a new TextInput instance using the specified properties. + * @param [properties] Properties to set + * @returns TextInput instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ITextInput): google.cloud.dialogflow.v2.TextInput; + + /** + * Encodes the specified TextInput message. Does not implicitly {@link google.cloud.dialogflow.v2.TextInput.verify|verify} messages. + * @param message TextInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ITextInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.TextInput.verify|verify} messages. + * @param message TextInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ITextInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.TextInput; + + /** + * Decodes a TextInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.TextInput; + + /** + * Verifies a TextInput message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.TextInput; + + /** + * Creates a plain object from a TextInput message. Also converts values to other types if specified. + * @param message TextInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.TextInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextInput + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EventInput. */ + interface IEventInput { + + /** EventInput name */ + name?: (string|null); + + /** EventInput parameters */ + parameters?: (google.protobuf.IStruct|null); + + /** EventInput languageCode */ + languageCode?: (string|null); + } + + /** Represents an EventInput. */ + class EventInput implements IEventInput { + + /** + * Constructs a new EventInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IEventInput); + + /** EventInput name. */ + public name: string; + + /** EventInput parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** EventInput languageCode. */ + public languageCode: string; + + /** + * Creates a new EventInput instance using the specified properties. + * @param [properties] Properties to set + * @returns EventInput instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IEventInput): google.cloud.dialogflow.v2.EventInput; + + /** + * Encodes the specified EventInput message. Does not implicitly {@link google.cloud.dialogflow.v2.EventInput.verify|verify} messages. + * @param message EventInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IEventInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EventInput.verify|verify} messages. + * @param message EventInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IEventInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.EventInput; + + /** + * Decodes an EventInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.EventInput; + + /** + * Verifies an EventInput message. + * @param message Plain 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 EventInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.EventInput; + + /** + * Creates a plain object from an EventInput message. Also converts values to other types if specified. + * @param message EventInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.EventInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EventInput + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SentimentAnalysisRequestConfig. */ + interface ISentimentAnalysisRequestConfig { + + /** SentimentAnalysisRequestConfig analyzeQueryTextSentiment */ + analyzeQueryTextSentiment?: (boolean|null); + } + + /** Represents a SentimentAnalysisRequestConfig. */ + class SentimentAnalysisRequestConfig implements ISentimentAnalysisRequestConfig { + + /** + * Constructs a new SentimentAnalysisRequestConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig); + + /** SentimentAnalysisRequestConfig analyzeQueryTextSentiment. */ + public analyzeQueryTextSentiment: boolean; + + /** + * Creates a new SentimentAnalysisRequestConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SentimentAnalysisRequestConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig): google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig; + + /** + * Encodes the specified SentimentAnalysisRequestConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.verify|verify} messages. + * @param message SentimentAnalysisRequestConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SentimentAnalysisRequestConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.verify|verify} messages. + * @param message SentimentAnalysisRequestConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SentimentAnalysisRequestConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SentimentAnalysisRequestConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig; + + /** + * Decodes a SentimentAnalysisRequestConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SentimentAnalysisRequestConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig; + + /** + * Verifies a SentimentAnalysisRequestConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SentimentAnalysisRequestConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SentimentAnalysisRequestConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig; + + /** + * Creates a plain object from a SentimentAnalysisRequestConfig message. Also converts values to other types if specified. + * @param message SentimentAnalysisRequestConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SentimentAnalysisRequestConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SentimentAnalysisRequestConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SentimentAnalysisResult. */ + interface ISentimentAnalysisResult { + + /** SentimentAnalysisResult queryTextSentiment */ + queryTextSentiment?: (google.cloud.dialogflow.v2.ISentiment|null); + } + + /** Represents a SentimentAnalysisResult. */ + class SentimentAnalysisResult implements ISentimentAnalysisResult { + + /** + * Constructs a new SentimentAnalysisResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISentimentAnalysisResult); + + /** SentimentAnalysisResult queryTextSentiment. */ + public queryTextSentiment?: (google.cloud.dialogflow.v2.ISentiment|null); + + /** + * Creates a new SentimentAnalysisResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SentimentAnalysisResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISentimentAnalysisResult): google.cloud.dialogflow.v2.SentimentAnalysisResult; + + /** + * Encodes the specified SentimentAnalysisResult message. Does not implicitly {@link google.cloud.dialogflow.v2.SentimentAnalysisResult.verify|verify} messages. + * @param message SentimentAnalysisResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISentimentAnalysisResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SentimentAnalysisResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SentimentAnalysisResult.verify|verify} messages. + * @param message SentimentAnalysisResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISentimentAnalysisResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SentimentAnalysisResult; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SentimentAnalysisResult; + + /** + * Verifies a SentimentAnalysisResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SentimentAnalysisResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SentimentAnalysisResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SentimentAnalysisResult; + + /** + * Creates a plain object from a SentimentAnalysisResult message. Also converts values to other types if specified. + * @param message SentimentAnalysisResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SentimentAnalysisResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SentimentAnalysisResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SentimentAnalysisResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Sentiment. */ + interface ISentiment { + + /** Sentiment score */ + score?: (number|null); + + /** Sentiment magnitude */ + magnitude?: (number|null); + } + + /** Represents a Sentiment. */ + class Sentiment implements ISentiment { + + /** + * Constructs a new Sentiment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISentiment); + + /** Sentiment score. */ + public score: number; + + /** Sentiment magnitude. */ + public magnitude: number; + + /** + * Creates a new Sentiment instance using the specified properties. + * @param [properties] Properties to set + * @returns Sentiment instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISentiment): google.cloud.dialogflow.v2.Sentiment; + + /** + * Encodes the specified Sentiment message. Does not implicitly {@link google.cloud.dialogflow.v2.Sentiment.verify|verify} messages. + * @param message Sentiment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISentiment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Sentiment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Sentiment.verify|verify} messages. + * @param message Sentiment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISentiment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Sentiment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Sentiment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Sentiment; + + /** + * Decodes a Sentiment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Sentiment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Sentiment; + + /** + * Verifies a Sentiment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Sentiment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Sentiment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Sentiment; + + /** + * Creates a plain object from a Sentiment message. Also converts values to other types if specified. + * @param message Sentiment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Sentiment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Sentiment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Sentiment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Contexts */ + class Contexts extends $protobuf.rpc.Service { + + /** + * Constructs a new Contexts 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 Contexts 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): Contexts; + + /** + * Calls ListContexts. + * @param request ListContextsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListContextsResponse + */ + public listContexts(request: google.cloud.dialogflow.v2.IListContextsRequest, callback: google.cloud.dialogflow.v2.Contexts.ListContextsCallback): void; + + /** + * Calls ListContexts. + * @param request ListContextsRequest message or plain object + * @returns Promise + */ + public listContexts(request: google.cloud.dialogflow.v2.IListContextsRequest): Promise; + + /** + * Calls GetContext. + * @param request GetContextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Context + */ + public getContext(request: google.cloud.dialogflow.v2.IGetContextRequest, callback: google.cloud.dialogflow.v2.Contexts.GetContextCallback): void; + + /** + * Calls GetContext. + * @param request GetContextRequest message or plain object + * @returns Promise + */ + public getContext(request: google.cloud.dialogflow.v2.IGetContextRequest): Promise; + + /** + * Calls CreateContext. + * @param request CreateContextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Context + */ + public createContext(request: google.cloud.dialogflow.v2.ICreateContextRequest, callback: google.cloud.dialogflow.v2.Contexts.CreateContextCallback): void; + + /** + * Calls CreateContext. + * @param request CreateContextRequest message or plain object + * @returns Promise + */ + public createContext(request: google.cloud.dialogflow.v2.ICreateContextRequest): Promise; + + /** + * Calls UpdateContext. + * @param request UpdateContextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Context + */ + public updateContext(request: google.cloud.dialogflow.v2.IUpdateContextRequest, callback: google.cloud.dialogflow.v2.Contexts.UpdateContextCallback): void; + + /** + * Calls UpdateContext. + * @param request UpdateContextRequest message or plain object + * @returns Promise + */ + public updateContext(request: google.cloud.dialogflow.v2.IUpdateContextRequest): Promise; + + /** + * Calls DeleteContext. + * @param request DeleteContextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteContext(request: google.cloud.dialogflow.v2.IDeleteContextRequest, callback: google.cloud.dialogflow.v2.Contexts.DeleteContextCallback): void; + + /** + * Calls DeleteContext. + * @param request DeleteContextRequest message or plain object + * @returns Promise + */ + public deleteContext(request: google.cloud.dialogflow.v2.IDeleteContextRequest): Promise; + + /** + * Calls DeleteAllContexts. + * @param request DeleteAllContextsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteAllContexts(request: google.cloud.dialogflow.v2.IDeleteAllContextsRequest, callback: google.cloud.dialogflow.v2.Contexts.DeleteAllContextsCallback): void; + + /** + * Calls DeleteAllContexts. + * @param request DeleteAllContextsRequest message or plain object + * @returns Promise + */ + public deleteAllContexts(request: google.cloud.dialogflow.v2.IDeleteAllContextsRequest): Promise; + } + + namespace Contexts { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|listContexts}. + * @param error Error, if any + * @param [response] ListContextsResponse + */ + type ListContextsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListContextsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|getContext}. + * @param error Error, if any + * @param [response] Context + */ + type GetContextCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Context) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|createContext}. + * @param error Error, if any + * @param [response] Context + */ + type CreateContextCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Context) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|updateContext}. + * @param error Error, if any + * @param [response] Context + */ + type UpdateContextCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Context) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|deleteContext}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteContextCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|deleteAllContexts}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteAllContextsCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a Context. */ + interface IContext { + + /** Context name */ + name?: (string|null); + + /** Context lifespanCount */ + lifespanCount?: (number|null); + + /** Context parameters */ + parameters?: (google.protobuf.IStruct|null); + } + + /** Represents a Context. */ + class Context implements IContext { + + /** + * Constructs a new Context. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IContext); + + /** Context name. */ + public name: string; + + /** Context lifespanCount. */ + public lifespanCount: number; + + /** Context parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** + * Creates a new Context instance using the specified properties. + * @param [properties] Properties to set + * @returns Context instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IContext): google.cloud.dialogflow.v2.Context; + + /** + * Encodes the specified Context message. Does not implicitly {@link google.cloud.dialogflow.v2.Context.verify|verify} messages. + * @param message Context message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Context message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Context.verify|verify} messages. + * @param message Context message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Context message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Context + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Context; + + /** + * Decodes a Context message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Context + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Context; + + /** + * Verifies a Context message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Context message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Context + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Context; + + /** + * Creates a plain object from a Context message. Also converts values to other types if specified. + * @param message Context + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Context, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Context to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Context + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListContextsRequest. */ + interface IListContextsRequest { + + /** ListContextsRequest parent */ + parent?: (string|null); + + /** ListContextsRequest pageSize */ + pageSize?: (number|null); + + /** ListContextsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListContextsRequest. */ + class ListContextsRequest implements IListContextsRequest { + + /** + * Constructs a new ListContextsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListContextsRequest); + + /** ListContextsRequest parent. */ + public parent: string; + + /** ListContextsRequest pageSize. */ + public pageSize: number; + + /** ListContextsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListContextsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListContextsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListContextsRequest): google.cloud.dialogflow.v2.ListContextsRequest; + + /** + * Encodes the specified ListContextsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListContextsRequest.verify|verify} messages. + * @param message ListContextsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListContextsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListContextsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListContextsRequest.verify|verify} messages. + * @param message ListContextsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListContextsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListContextsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListContextsRequest; + + /** + * Decodes a ListContextsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListContextsRequest; + + /** + * Verifies a ListContextsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListContextsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListContextsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListContextsRequest; + + /** + * Creates a plain object from a ListContextsRequest message. Also converts values to other types if specified. + * @param message ListContextsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListContextsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListContextsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListContextsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListContextsResponse. */ + interface IListContextsResponse { + + /** ListContextsResponse contexts */ + contexts?: (google.cloud.dialogflow.v2.IContext[]|null); + + /** ListContextsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListContextsResponse. */ + class ListContextsResponse implements IListContextsResponse { + + /** + * Constructs a new ListContextsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListContextsResponse); + + /** ListContextsResponse contexts. */ + public contexts: google.cloud.dialogflow.v2.IContext[]; + + /** ListContextsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListContextsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListContextsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListContextsResponse): google.cloud.dialogflow.v2.ListContextsResponse; + + /** + * Encodes the specified ListContextsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListContextsResponse.verify|verify} messages. + * @param message ListContextsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListContextsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListContextsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListContextsResponse.verify|verify} messages. + * @param message ListContextsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListContextsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListContextsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListContextsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListContextsResponse; + + /** + * Decodes a ListContextsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListContextsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListContextsResponse; + + /** + * Verifies a ListContextsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListContextsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListContextsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListContextsResponse; + + /** + * Creates a plain object from a ListContextsResponse message. Also converts values to other types if specified. + * @param message ListContextsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListContextsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListContextsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListContextsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetContextRequest. */ + interface IGetContextRequest { + + /** GetContextRequest name */ + name?: (string|null); + } + + /** Represents a GetContextRequest. */ + class GetContextRequest implements IGetContextRequest { + + /** + * Constructs a new GetContextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetContextRequest); + + /** GetContextRequest name. */ + public name: string; + + /** + * Creates a new GetContextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetContextRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetContextRequest): google.cloud.dialogflow.v2.GetContextRequest; + + /** + * Encodes the specified GetContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetContextRequest.verify|verify} messages. + * @param message GetContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetContextRequest.verify|verify} messages. + * @param message GetContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetContextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetContextRequest; + + /** + * Decodes a GetContextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetContextRequest; + + /** + * Verifies a GetContextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetContextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetContextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetContextRequest; + + /** + * Creates a plain object from a GetContextRequest message. Also converts values to other types if specified. + * @param message GetContextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetContextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetContextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetContextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateContextRequest. */ + interface ICreateContextRequest { + + /** CreateContextRequest parent */ + parent?: (string|null); + + /** CreateContextRequest context */ + context?: (google.cloud.dialogflow.v2.IContext|null); + } + + /** Represents a CreateContextRequest. */ + class CreateContextRequest implements ICreateContextRequest { + + /** + * Constructs a new CreateContextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateContextRequest); + + /** CreateContextRequest parent. */ + public parent: string; + + /** CreateContextRequest context. */ + public context?: (google.cloud.dialogflow.v2.IContext|null); + + /** + * Creates a new CreateContextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateContextRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateContextRequest): google.cloud.dialogflow.v2.CreateContextRequest; + + /** + * Encodes the specified CreateContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateContextRequest.verify|verify} messages. + * @param message CreateContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateContextRequest.verify|verify} messages. + * @param message CreateContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateContextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateContextRequest; + + /** + * Decodes a CreateContextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateContextRequest; + + /** + * Verifies a CreateContextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateContextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateContextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateContextRequest; + + /** + * Creates a plain object from a CreateContextRequest message. Also converts values to other types if specified. + * @param message CreateContextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateContextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateContextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateContextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateContextRequest. */ + interface IUpdateContextRequest { + + /** UpdateContextRequest context */ + context?: (google.cloud.dialogflow.v2.IContext|null); + + /** UpdateContextRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateContextRequest. */ + class UpdateContextRequest implements IUpdateContextRequest { + + /** + * Constructs a new UpdateContextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateContextRequest); + + /** UpdateContextRequest context. */ + public context?: (google.cloud.dialogflow.v2.IContext|null); + + /** UpdateContextRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateContextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateContextRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateContextRequest): google.cloud.dialogflow.v2.UpdateContextRequest; + + /** + * Encodes the specified UpdateContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateContextRequest.verify|verify} messages. + * @param message UpdateContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateContextRequest.verify|verify} messages. + * @param message UpdateContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateContextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateContextRequest; + + /** + * Decodes an UpdateContextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateContextRequest; + + /** + * Verifies an UpdateContextRequest message. + * @param message Plain 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 UpdateContextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateContextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateContextRequest; + + /** + * Creates a plain object from an UpdateContextRequest message. Also converts values to other types if specified. + * @param message UpdateContextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateContextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateContextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateContextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteContextRequest. */ + interface IDeleteContextRequest { + + /** DeleteContextRequest name */ + name?: (string|null); + } + + /** Represents a DeleteContextRequest. */ + class DeleteContextRequest implements IDeleteContextRequest { + + /** + * Constructs a new DeleteContextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteContextRequest); + + /** DeleteContextRequest name. */ + public name: string; + + /** + * Creates a new DeleteContextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteContextRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteContextRequest): google.cloud.dialogflow.v2.DeleteContextRequest; + + /** + * Encodes the specified DeleteContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteContextRequest.verify|verify} messages. + * @param message DeleteContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteContextRequest.verify|verify} messages. + * @param message DeleteContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteContextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteContextRequest; + + /** + * Decodes a DeleteContextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteContextRequest; + + /** + * Verifies a DeleteContextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteContextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteContextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteContextRequest; + + /** + * Creates a plain object from a DeleteContextRequest message. Also converts values to other types if specified. + * @param message DeleteContextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteContextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteContextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteContextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteAllContextsRequest. */ + interface IDeleteAllContextsRequest { + + /** DeleteAllContextsRequest parent */ + parent?: (string|null); + } + + /** Represents a DeleteAllContextsRequest. */ + class DeleteAllContextsRequest implements IDeleteAllContextsRequest { + + /** + * Constructs a new DeleteAllContextsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteAllContextsRequest); + + /** DeleteAllContextsRequest parent. */ + public parent: string; + + /** + * Creates a new DeleteAllContextsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteAllContextsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteAllContextsRequest): google.cloud.dialogflow.v2.DeleteAllContextsRequest; + + /** + * Encodes the specified DeleteAllContextsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteAllContextsRequest.verify|verify} messages. + * @param message DeleteAllContextsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteAllContextsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteAllContextsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteAllContextsRequest.verify|verify} messages. + * @param message DeleteAllContextsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteAllContextsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteAllContextsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteAllContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteAllContextsRequest; + + /** + * Decodes a DeleteAllContextsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteAllContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteAllContextsRequest; + + /** + * Verifies a DeleteAllContextsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteAllContextsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteAllContextsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteAllContextsRequest; + + /** + * Creates a plain object from a DeleteAllContextsRequest message. Also converts values to other types if specified. + * @param message DeleteAllContextsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteAllContextsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteAllContextsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteAllContextsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents an Intents */ + class Intents extends $protobuf.rpc.Service { + + /** + * Constructs a new Intents 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 Intents 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): Intents; + + /** + * Calls ListIntents. + * @param request ListIntentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListIntentsResponse + */ + public listIntents(request: google.cloud.dialogflow.v2.IListIntentsRequest, callback: google.cloud.dialogflow.v2.Intents.ListIntentsCallback): void; + + /** + * Calls ListIntents. + * @param request ListIntentsRequest message or plain object + * @returns Promise + */ + public listIntents(request: google.cloud.dialogflow.v2.IListIntentsRequest): Promise; + + /** + * Calls GetIntent. + * @param request GetIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Intent + */ + public getIntent(request: google.cloud.dialogflow.v2.IGetIntentRequest, callback: google.cloud.dialogflow.v2.Intents.GetIntentCallback): void; + + /** + * Calls GetIntent. + * @param request GetIntentRequest message or plain object + * @returns Promise + */ + public getIntent(request: google.cloud.dialogflow.v2.IGetIntentRequest): Promise; + + /** + * Calls CreateIntent. + * @param request CreateIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Intent + */ + public createIntent(request: google.cloud.dialogflow.v2.ICreateIntentRequest, callback: google.cloud.dialogflow.v2.Intents.CreateIntentCallback): void; + + /** + * Calls CreateIntent. + * @param request CreateIntentRequest message or plain object + * @returns Promise + */ + public createIntent(request: google.cloud.dialogflow.v2.ICreateIntentRequest): Promise; + + /** + * Calls UpdateIntent. + * @param request UpdateIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Intent + */ + public updateIntent(request: google.cloud.dialogflow.v2.IUpdateIntentRequest, callback: google.cloud.dialogflow.v2.Intents.UpdateIntentCallback): void; + + /** + * Calls UpdateIntent. + * @param request UpdateIntentRequest message or plain object + * @returns Promise + */ + public updateIntent(request: google.cloud.dialogflow.v2.IUpdateIntentRequest): Promise; + + /** + * Calls DeleteIntent. + * @param request DeleteIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteIntent(request: google.cloud.dialogflow.v2.IDeleteIntentRequest, callback: google.cloud.dialogflow.v2.Intents.DeleteIntentCallback): void; + + /** + * Calls DeleteIntent. + * @param request DeleteIntentRequest message or plain object + * @returns Promise + */ + public deleteIntent(request: google.cloud.dialogflow.v2.IDeleteIntentRequest): Promise; + + /** + * Calls BatchUpdateIntents. + * @param request BatchUpdateIntentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchUpdateIntents(request: google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, callback: google.cloud.dialogflow.v2.Intents.BatchUpdateIntentsCallback): void; + + /** + * Calls BatchUpdateIntents. + * @param request BatchUpdateIntentsRequest message or plain object + * @returns Promise + */ + public batchUpdateIntents(request: google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest): Promise; + + /** + * Calls BatchDeleteIntents. + * @param request BatchDeleteIntentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchDeleteIntents(request: google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, callback: google.cloud.dialogflow.v2.Intents.BatchDeleteIntentsCallback): void; + + /** + * Calls BatchDeleteIntents. + * @param request BatchDeleteIntentsRequest message or plain object + * @returns Promise + */ + public batchDeleteIntents(request: google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest): Promise; + } + + namespace Intents { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|listIntents}. + * @param error Error, if any + * @param [response] ListIntentsResponse + */ + type ListIntentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListIntentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|getIntent}. + * @param error Error, if any + * @param [response] Intent + */ + type GetIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Intent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|createIntent}. + * @param error Error, if any + * @param [response] Intent + */ + type CreateIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Intent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|updateIntent}. + * @param error Error, if any + * @param [response] Intent + */ + type UpdateIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Intent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|deleteIntent}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteIntentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|batchUpdateIntents}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchUpdateIntentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|batchDeleteIntents}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchDeleteIntentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an Intent. */ + interface IIntent { + + /** Intent name */ + name?: (string|null); + + /** Intent displayName */ + displayName?: (string|null); + + /** Intent webhookState */ + webhookState?: (google.cloud.dialogflow.v2.Intent.WebhookState|keyof typeof google.cloud.dialogflow.v2.Intent.WebhookState|null); + + /** Intent priority */ + priority?: (number|null); + + /** Intent isFallback */ + isFallback?: (boolean|null); + + /** Intent mlDisabled */ + mlDisabled?: (boolean|null); + + /** Intent liveAgentHandoff */ + liveAgentHandoff?: (boolean|null); + + /** Intent endInteraction */ + endInteraction?: (boolean|null); + + /** Intent inputContextNames */ + inputContextNames?: (string[]|null); + + /** Intent events */ + events?: (string[]|null); + + /** Intent trainingPhrases */ + trainingPhrases?: (google.cloud.dialogflow.v2.Intent.ITrainingPhrase[]|null); + + /** Intent action */ + action?: (string|null); + + /** Intent outputContexts */ + outputContexts?: (google.cloud.dialogflow.v2.IContext[]|null); + + /** Intent resetContexts */ + resetContexts?: (boolean|null); + + /** Intent parameters */ + parameters?: (google.cloud.dialogflow.v2.Intent.IParameter[]|null); + + /** Intent messages */ + messages?: (google.cloud.dialogflow.v2.Intent.IMessage[]|null); + + /** Intent defaultResponsePlatforms */ + defaultResponsePlatforms?: (google.cloud.dialogflow.v2.Intent.Message.Platform[]|null); + + /** Intent rootFollowupIntentName */ + rootFollowupIntentName?: (string|null); + + /** Intent parentFollowupIntentName */ + parentFollowupIntentName?: (string|null); + + /** Intent followupIntentInfo */ + followupIntentInfo?: (google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo[]|null); + } + + /** Represents an Intent. */ + class Intent implements IIntent { + + /** + * Constructs a new Intent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IIntent); + + /** Intent name. */ + public name: string; + + /** Intent displayName. */ + public displayName: string; + + /** Intent webhookState. */ + public webhookState: (google.cloud.dialogflow.v2.Intent.WebhookState|keyof typeof google.cloud.dialogflow.v2.Intent.WebhookState); + + /** Intent priority. */ + public priority: number; + + /** Intent isFallback. */ + public isFallback: boolean; + + /** Intent mlDisabled. */ + public mlDisabled: boolean; + + /** Intent liveAgentHandoff. */ + public liveAgentHandoff: boolean; + + /** Intent endInteraction. */ + public endInteraction: boolean; + + /** Intent inputContextNames. */ + public inputContextNames: string[]; + + /** Intent events. */ + public events: string[]; + + /** Intent trainingPhrases. */ + public trainingPhrases: google.cloud.dialogflow.v2.Intent.ITrainingPhrase[]; + + /** Intent action. */ + public action: string; + + /** Intent outputContexts. */ + public outputContexts: google.cloud.dialogflow.v2.IContext[]; + + /** Intent resetContexts. */ + public resetContexts: boolean; + + /** Intent parameters. */ + public parameters: google.cloud.dialogflow.v2.Intent.IParameter[]; + + /** Intent messages. */ + public messages: google.cloud.dialogflow.v2.Intent.IMessage[]; + + /** Intent defaultResponsePlatforms. */ + public defaultResponsePlatforms: google.cloud.dialogflow.v2.Intent.Message.Platform[]; + + /** Intent rootFollowupIntentName. */ + public rootFollowupIntentName: string; + + /** Intent parentFollowupIntentName. */ + public parentFollowupIntentName: string; + + /** Intent followupIntentInfo. */ + public followupIntentInfo: google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo[]; + + /** + * Creates a new Intent instance using the specified properties. + * @param [properties] Properties to set + * @returns Intent instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IIntent): google.cloud.dialogflow.v2.Intent; + + /** + * Encodes the specified Intent message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.verify|verify} messages. + * @param message Intent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IIntent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Intent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.verify|verify} messages. + * @param message Intent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IIntent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Intent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent; + + /** + * Decodes an Intent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent; + + /** + * Verifies an Intent message. + * @param message Plain 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 Intent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Intent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent; + + /** + * Creates a plain object from an Intent message. Also converts values to other types if specified. + * @param message Intent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Intent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Intent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Intent { + + /** WebhookState enum. */ + enum WebhookState { + WEBHOOK_STATE_UNSPECIFIED = 0, + WEBHOOK_STATE_ENABLED = 1, + WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2 + } + + /** Properties of a TrainingPhrase. */ + interface ITrainingPhrase { + + /** TrainingPhrase name */ + name?: (string|null); + + /** TrainingPhrase type */ + type?: (google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type|keyof typeof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type|null); + + /** TrainingPhrase parts */ + parts?: (google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart[]|null); + + /** TrainingPhrase timesAddedCount */ + timesAddedCount?: (number|null); + } + + /** Represents a TrainingPhrase. */ + class TrainingPhrase implements ITrainingPhrase { + + /** + * Constructs a new TrainingPhrase. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.ITrainingPhrase); + + /** TrainingPhrase name. */ + public name: string; + + /** TrainingPhrase type. */ + public type: (google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type|keyof typeof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type); + + /** TrainingPhrase parts. */ + public parts: google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart[]; + + /** TrainingPhrase timesAddedCount. */ + public timesAddedCount: number; + + /** + * Creates a new TrainingPhrase instance using the specified properties. + * @param [properties] Properties to set + * @returns TrainingPhrase instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.ITrainingPhrase): google.cloud.dialogflow.v2.Intent.TrainingPhrase; + + /** + * Encodes the specified TrainingPhrase message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.TrainingPhrase.verify|verify} messages. + * @param message TrainingPhrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.ITrainingPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TrainingPhrase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.TrainingPhrase.verify|verify} messages. + * @param message TrainingPhrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.ITrainingPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.TrainingPhrase; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.TrainingPhrase; + + /** + * Verifies a TrainingPhrase message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TrainingPhrase message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TrainingPhrase + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.TrainingPhrase; + + /** + * Creates a plain object from a TrainingPhrase message. Also converts values to other types if specified. + * @param message TrainingPhrase + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.TrainingPhrase, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TrainingPhrase to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TrainingPhrase + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TrainingPhrase { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + EXAMPLE = 1, + TEMPLATE = 2 + } + + /** Properties of a Part. */ + interface IPart { + + /** Part text */ + text?: (string|null); + + /** Part entityType */ + entityType?: (string|null); + + /** Part alias */ + alias?: (string|null); + + /** Part userDefined */ + userDefined?: (boolean|null); + } + + /** Represents a Part. */ + class Part implements IPart { + + /** + * Constructs a new Part. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart); + + /** Part text. */ + public text: string; + + /** Part entityType. */ + public entityType: string; + + /** Part alias. */ + public alias: string; + + /** Part userDefined. */ + public userDefined: boolean; + + /** + * Creates a new Part instance using the specified properties. + * @param [properties] Properties to set + * @returns Part instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart): google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part; + + /** + * Encodes the specified Part message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.verify|verify} messages. + * @param message Part message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Part message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.verify|verify} messages. + * @param message Part message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Part message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part; + + /** + * Decodes a Part message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part; + + /** + * Verifies a Part message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Part message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Part + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part; + + /** + * Creates a plain object from a Part message. Also converts values to other types if specified. + * @param message Part + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Part to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Part + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a Parameter. */ + interface IParameter { + + /** Parameter name */ + name?: (string|null); + + /** Parameter displayName */ + displayName?: (string|null); + + /** Parameter value */ + value?: (string|null); + + /** Parameter defaultValue */ + defaultValue?: (string|null); + + /** Parameter entityTypeDisplayName */ + entityTypeDisplayName?: (string|null); + + /** Parameter mandatory */ + mandatory?: (boolean|null); + + /** Parameter prompts */ + prompts?: (string[]|null); + + /** Parameter isList */ + isList?: (boolean|null); + } + + /** Represents a Parameter. */ + class Parameter implements IParameter { + + /** + * Constructs a new Parameter. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.IParameter); + + /** Parameter name. */ + public name: string; + + /** Parameter displayName. */ + public displayName: string; + + /** Parameter value. */ + public value: string; + + /** Parameter defaultValue. */ + public defaultValue: string; + + /** Parameter entityTypeDisplayName. */ + public entityTypeDisplayName: string; + + /** Parameter mandatory. */ + public mandatory: boolean; + + /** Parameter prompts. */ + public prompts: string[]; + + /** Parameter isList. */ + public isList: boolean; + + /** + * Creates a new Parameter instance using the specified properties. + * @param [properties] Properties to set + * @returns Parameter instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.IParameter): google.cloud.dialogflow.v2.Intent.Parameter; + + /** + * Encodes the specified Parameter message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Parameter.verify|verify} messages. + * @param message Parameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.IParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Parameter message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Parameter.verify|verify} messages. + * @param message Parameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.IParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Parameter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Parameter; + + /** + * Decodes a Parameter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Parameter; + + /** + * Verifies a Parameter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Parameter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Parameter + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Parameter; + + /** + * Creates a plain object from a Parameter message. Also converts values to other types if specified. + * @param message Parameter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Parameter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Parameter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Parameter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Message. */ + interface IMessage { + + /** Message text */ + text?: (google.cloud.dialogflow.v2.Intent.Message.IText|null); + + /** Message image */ + image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** Message quickReplies */ + quickReplies?: (google.cloud.dialogflow.v2.Intent.Message.IQuickReplies|null); + + /** Message card */ + card?: (google.cloud.dialogflow.v2.Intent.Message.ICard|null); + + /** Message payload */ + payload?: (google.protobuf.IStruct|null); + + /** Message simpleResponses */ + simpleResponses?: (google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses|null); + + /** Message basicCard */ + basicCard?: (google.cloud.dialogflow.v2.Intent.Message.IBasicCard|null); + + /** Message suggestions */ + suggestions?: (google.cloud.dialogflow.v2.Intent.Message.ISuggestions|null); + + /** Message linkOutSuggestion */ + linkOutSuggestion?: (google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion|null); + + /** Message listSelect */ + listSelect?: (google.cloud.dialogflow.v2.Intent.Message.IListSelect|null); + + /** Message carouselSelect */ + carouselSelect?: (google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect|null); + + /** Message browseCarouselCard */ + browseCarouselCard?: (google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard|null); + + /** Message tableCard */ + tableCard?: (google.cloud.dialogflow.v2.Intent.Message.ITableCard|null); + + /** Message mediaContent */ + mediaContent?: (google.cloud.dialogflow.v2.Intent.Message.IMediaContent|null); + + /** Message platform */ + platform?: (google.cloud.dialogflow.v2.Intent.Message.Platform|keyof typeof google.cloud.dialogflow.v2.Intent.Message.Platform|null); + } + + /** Represents a Message. */ + class Message implements IMessage { + + /** + * Constructs a new Message. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.IMessage); + + /** Message text. */ + public text?: (google.cloud.dialogflow.v2.Intent.Message.IText|null); + + /** Message image. */ + public image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** Message quickReplies. */ + public quickReplies?: (google.cloud.dialogflow.v2.Intent.Message.IQuickReplies|null); + + /** Message card. */ + public card?: (google.cloud.dialogflow.v2.Intent.Message.ICard|null); + + /** Message payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** Message simpleResponses. */ + public simpleResponses?: (google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses|null); + + /** Message basicCard. */ + public basicCard?: (google.cloud.dialogflow.v2.Intent.Message.IBasicCard|null); + + /** Message suggestions. */ + public suggestions?: (google.cloud.dialogflow.v2.Intent.Message.ISuggestions|null); + + /** Message linkOutSuggestion. */ + public linkOutSuggestion?: (google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion|null); + + /** Message listSelect. */ + public listSelect?: (google.cloud.dialogflow.v2.Intent.Message.IListSelect|null); + + /** Message carouselSelect. */ + public carouselSelect?: (google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect|null); + + /** Message browseCarouselCard. */ + public browseCarouselCard?: (google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard|null); + + /** Message tableCard. */ + public tableCard?: (google.cloud.dialogflow.v2.Intent.Message.ITableCard|null); + + /** Message mediaContent. */ + public mediaContent?: (google.cloud.dialogflow.v2.Intent.Message.IMediaContent|null); + + /** Message platform. */ + public platform: (google.cloud.dialogflow.v2.Intent.Message.Platform|keyof typeof google.cloud.dialogflow.v2.Intent.Message.Platform); + + /** Message message. */ + public message?: ("text"|"image"|"quickReplies"|"card"|"payload"|"simpleResponses"|"basicCard"|"suggestions"|"linkOutSuggestion"|"listSelect"|"carouselSelect"|"browseCarouselCard"|"tableCard"|"mediaContent"); + + /** + * Creates a new Message instance using the specified properties. + * @param [properties] Properties to set + * @returns Message instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.IMessage): google.cloud.dialogflow.v2.Intent.Message; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Message message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message; + + /** + * Verifies a Message message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Message + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @param message Message + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Message to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Message + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Message { + + /** Platform enum. */ + enum Platform { + PLATFORM_UNSPECIFIED = 0, + FACEBOOK = 1, + SLACK = 2, + TELEGRAM = 3, + KIK = 4, + SKYPE = 5, + LINE = 6, + VIBER = 7, + ACTIONS_ON_GOOGLE = 8, + GOOGLE_HANGOUTS = 11 + } + + /** Properties of a Text. */ + interface IText { + + /** Text text */ + text?: (string[]|null); + } + + /** Represents a Text. */ + class Text implements IText { + + /** + * Constructs a new Text. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.IText); + + /** Text text. */ + public text: string[]; + + /** + * Creates a new Text instance using the specified properties. + * @param [properties] Properties to set + * @returns Text instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.IText): google.cloud.dialogflow.v2.Intent.Message.Text; + + /** + * Encodes the specified Text message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.IText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.IText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Text message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.Text; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.Text; + + /** + * Verifies a Text message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Text message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Text + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.Text; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @param message Text + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.Text, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Text to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Text + * @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 imageUri */ + imageUri?: (string|null); + + /** Image accessibilityText */ + accessibilityText?: (string|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.IImage); + + /** Image imageUri. */ + public imageUri: string; + + /** Image accessibilityText. */ + public accessibilityText: string; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.IImage): google.cloud.dialogflow.v2.Intent.Message.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.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 QuickReplies. */ + interface IQuickReplies { + + /** QuickReplies title */ + title?: (string|null); + + /** QuickReplies quickReplies */ + quickReplies?: (string[]|null); + } + + /** Represents a QuickReplies. */ + class QuickReplies implements IQuickReplies { + + /** + * Constructs a new QuickReplies. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.IQuickReplies); + + /** QuickReplies title. */ + public title: string; + + /** QuickReplies quickReplies. */ + public quickReplies: string[]; + + /** + * Creates a new QuickReplies instance using the specified properties. + * @param [properties] Properties to set + * @returns QuickReplies instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.IQuickReplies): google.cloud.dialogflow.v2.Intent.Message.QuickReplies; + + /** + * Encodes the specified QuickReplies message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.QuickReplies.verify|verify} messages. + * @param message QuickReplies message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.IQuickReplies, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuickReplies message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.QuickReplies.verify|verify} messages. + * @param message QuickReplies message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.IQuickReplies, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuickReplies message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuickReplies + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.QuickReplies; + + /** + * Decodes a QuickReplies message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuickReplies + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.QuickReplies; + + /** + * Verifies a QuickReplies message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QuickReplies message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuickReplies + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.QuickReplies; + + /** + * Creates a plain object from a QuickReplies message. Also converts values to other types if specified. + * @param message QuickReplies + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.QuickReplies, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuickReplies to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QuickReplies + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Card. */ + interface ICard { + + /** Card title */ + title?: (string|null); + + /** Card subtitle */ + subtitle?: (string|null); + + /** Card imageUri */ + imageUri?: (string|null); + + /** Card buttons */ + buttons?: (google.cloud.dialogflow.v2.Intent.Message.Card.IButton[]|null); + } + + /** Represents a Card. */ + class Card implements ICard { + + /** + * Constructs a new Card. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ICard); + + /** Card title. */ + public title: string; + + /** Card subtitle. */ + public subtitle: string; + + /** Card imageUri. */ + public imageUri: string; + + /** Card buttons. */ + public buttons: google.cloud.dialogflow.v2.Intent.Message.Card.IButton[]; + + /** + * Creates a new Card instance using the specified properties. + * @param [properties] Properties to set + * @returns Card instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ICard): google.cloud.dialogflow.v2.Intent.Message.Card; + + /** + * Encodes the specified Card message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Card.verify|verify} messages. + * @param message Card message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ICard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Card message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Card.verify|verify} messages. + * @param message Card message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ICard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Card message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Card + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.Card; + + /** + * Decodes a Card message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Card + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.Card; + + /** + * Verifies a Card message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Card message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Card + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.Card; + + /** + * Creates a plain object from a Card message. Also converts values to other types if specified. + * @param message Card + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.Card, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Card to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Card + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Card { + + /** Properties of a Button. */ + interface IButton { + + /** Button text */ + text?: (string|null); + + /** Button postback */ + postback?: (string|null); + } + + /** Represents a Button. */ + class Button implements IButton { + + /** + * Constructs a new Button. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.Card.IButton); + + /** Button text. */ + public text: string; + + /** Button postback. */ + public postback: string; + + /** + * Creates a new Button instance using the specified properties. + * @param [properties] Properties to set + * @returns Button instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.Card.IButton): google.cloud.dialogflow.v2.Intent.Message.Card.Button; + + /** + * Encodes the specified Button message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Card.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.Card.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Card.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.Card.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Button message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.Card.Button; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.Card.Button; + + /** + * Verifies a Button message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Button + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.Card.Button; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @param message Button + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.Card.Button, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Button to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Button + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SimpleResponse. */ + interface ISimpleResponse { + + /** SimpleResponse textToSpeech */ + textToSpeech?: (string|null); + + /** SimpleResponse ssml */ + ssml?: (string|null); + + /** SimpleResponse displayText */ + displayText?: (string|null); + } + + /** Represents a SimpleResponse. */ + class SimpleResponse implements ISimpleResponse { + + /** + * Constructs a new SimpleResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse); + + /** SimpleResponse textToSpeech. */ + public textToSpeech: string; + + /** SimpleResponse ssml. */ + public ssml: string; + + /** SimpleResponse displayText. */ + public displayText: string; + + /** + * Creates a new SimpleResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SimpleResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse): google.cloud.dialogflow.v2.Intent.Message.SimpleResponse; + + /** + * Encodes the specified SimpleResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.verify|verify} messages. + * @param message SimpleResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SimpleResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.verify|verify} messages. + * @param message SimpleResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SimpleResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SimpleResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.SimpleResponse; + + /** + * Decodes a SimpleResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SimpleResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.SimpleResponse; + + /** + * Verifies a SimpleResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SimpleResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SimpleResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.SimpleResponse; + + /** + * Creates a plain object from a SimpleResponse message. Also converts values to other types if specified. + * @param message SimpleResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.SimpleResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SimpleResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SimpleResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SimpleResponses. */ + interface ISimpleResponses { + + /** SimpleResponses simpleResponses */ + simpleResponses?: (google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse[]|null); + } + + /** Represents a SimpleResponses. */ + class SimpleResponses implements ISimpleResponses { + + /** + * Constructs a new SimpleResponses. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses); + + /** SimpleResponses simpleResponses. */ + public simpleResponses: google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse[]; + + /** + * Creates a new SimpleResponses instance using the specified properties. + * @param [properties] Properties to set + * @returns SimpleResponses instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses): google.cloud.dialogflow.v2.Intent.Message.SimpleResponses; + + /** + * Encodes the specified SimpleResponses message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.verify|verify} messages. + * @param message SimpleResponses message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SimpleResponses message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.verify|verify} messages. + * @param message SimpleResponses message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SimpleResponses message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SimpleResponses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.SimpleResponses; + + /** + * Decodes a SimpleResponses message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SimpleResponses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.SimpleResponses; + + /** + * Verifies a SimpleResponses message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SimpleResponses message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SimpleResponses + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.SimpleResponses; + + /** + * Creates a plain object from a SimpleResponses message. Also converts values to other types if specified. + * @param message SimpleResponses + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.SimpleResponses, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SimpleResponses to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SimpleResponses + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BasicCard. */ + interface IBasicCard { + + /** BasicCard title */ + title?: (string|null); + + /** BasicCard subtitle */ + subtitle?: (string|null); + + /** BasicCard formattedText */ + formattedText?: (string|null); + + /** BasicCard image */ + image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** BasicCard buttons */ + buttons?: (google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton[]|null); + } + + /** Represents a BasicCard. */ + class BasicCard implements IBasicCard { + + /** + * Constructs a new BasicCard. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.IBasicCard); + + /** BasicCard title. */ + public title: string; + + /** BasicCard subtitle. */ + public subtitle: string; + + /** BasicCard formattedText. */ + public formattedText: string; + + /** BasicCard image. */ + public image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** BasicCard buttons. */ + public buttons: google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton[]; + + /** + * Creates a new BasicCard instance using the specified properties. + * @param [properties] Properties to set + * @returns BasicCard instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.IBasicCard): google.cloud.dialogflow.v2.Intent.Message.BasicCard; + + /** + * Encodes the specified BasicCard message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.verify|verify} messages. + * @param message BasicCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.IBasicCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BasicCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.verify|verify} messages. + * @param message BasicCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.IBasicCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BasicCard message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BasicCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.BasicCard; + + /** + * Decodes a BasicCard message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BasicCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.BasicCard; + + /** + * Verifies a BasicCard message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BasicCard message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BasicCard + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.BasicCard; + + /** + * Creates a plain object from a BasicCard message. Also converts values to other types if specified. + * @param message BasicCard + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.BasicCard, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BasicCard to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BasicCard + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BasicCard { + + /** Properties of a Button. */ + interface IButton { + + /** Button title */ + title?: (string|null); + + /** Button openUriAction */ + openUriAction?: (google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction|null); + } + + /** Represents a Button. */ + class Button implements IButton { + + /** + * Constructs a new Button. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton); + + /** Button title. */ + public title: string; + + /** Button openUriAction. */ + public openUriAction?: (google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction|null); + + /** + * Creates a new Button instance using the specified properties. + * @param [properties] Properties to set + * @returns Button instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton): google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button; + + /** + * Encodes the specified Button message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Button message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button; + + /** + * Verifies a Button message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Button + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @param message Button + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Button to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Button + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Button { + + /** Properties of an OpenUriAction. */ + interface IOpenUriAction { + + /** OpenUriAction uri */ + uri?: (string|null); + } + + /** Represents an OpenUriAction. */ + class OpenUriAction implements IOpenUriAction { + + /** + * Constructs a new OpenUriAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction); + + /** OpenUriAction uri. */ + public uri: string; + + /** + * Creates a new OpenUriAction instance using the specified properties. + * @param [properties] Properties to set + * @returns OpenUriAction instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction): google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction; + + /** + * Encodes the specified OpenUriAction message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.verify|verify} messages. + * @param message OpenUriAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OpenUriAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.verify|verify} messages. + * @param message OpenUriAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OpenUriAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OpenUriAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction; + + /** + * Decodes an OpenUriAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OpenUriAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction; + + /** + * Verifies an OpenUriAction message. + * @param message Plain 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 OpenUriAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OpenUriAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction; + + /** + * Creates a plain object from an OpenUriAction message. Also converts values to other types if specified. + * @param message OpenUriAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OpenUriAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OpenUriAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + + /** Properties of a Suggestion. */ + interface ISuggestion { + + /** Suggestion title */ + title?: (string|null); + } + + /** Represents a Suggestion. */ + class Suggestion implements ISuggestion { + + /** + * Constructs a new Suggestion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ISuggestion); + + /** Suggestion title. */ + public title: string; + + /** + * Creates a new Suggestion instance using the specified properties. + * @param [properties] Properties to set + * @returns Suggestion instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ISuggestion): google.cloud.dialogflow.v2.Intent.Message.Suggestion; + + /** + * Encodes the specified Suggestion message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Suggestion.verify|verify} messages. + * @param message Suggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ISuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Suggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Suggestion.verify|verify} messages. + * @param message Suggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ISuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Suggestion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.Suggestion; + + /** + * Decodes a Suggestion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.Suggestion; + + /** + * Verifies a Suggestion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Suggestion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Suggestion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.Suggestion; + + /** + * Creates a plain object from a Suggestion message. Also converts values to other types if specified. + * @param message Suggestion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.Suggestion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Suggestion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Suggestion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Suggestions. */ + interface ISuggestions { + + /** Suggestions suggestions */ + suggestions?: (google.cloud.dialogflow.v2.Intent.Message.ISuggestion[]|null); + } + + /** Represents a Suggestions. */ + class Suggestions implements ISuggestions { + + /** + * Constructs a new Suggestions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ISuggestions); + + /** Suggestions suggestions. */ + public suggestions: google.cloud.dialogflow.v2.Intent.Message.ISuggestion[]; + + /** + * Creates a new Suggestions instance using the specified properties. + * @param [properties] Properties to set + * @returns Suggestions instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ISuggestions): google.cloud.dialogflow.v2.Intent.Message.Suggestions; + + /** + * Encodes the specified Suggestions message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Suggestions.verify|verify} messages. + * @param message Suggestions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ISuggestions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Suggestions message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Suggestions.verify|verify} messages. + * @param message Suggestions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ISuggestions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Suggestions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Suggestions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.Suggestions; + + /** + * Decodes a Suggestions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Suggestions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.Suggestions; + + /** + * Verifies a Suggestions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Suggestions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Suggestions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.Suggestions; + + /** + * Creates a plain object from a Suggestions message. Also converts values to other types if specified. + * @param message Suggestions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.Suggestions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Suggestions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Suggestions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LinkOutSuggestion. */ + interface ILinkOutSuggestion { + + /** LinkOutSuggestion destinationName */ + destinationName?: (string|null); + + /** LinkOutSuggestion uri */ + uri?: (string|null); + } + + /** Represents a LinkOutSuggestion. */ + class LinkOutSuggestion implements ILinkOutSuggestion { + + /** + * Constructs a new LinkOutSuggestion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion); + + /** LinkOutSuggestion destinationName. */ + public destinationName: string; + + /** LinkOutSuggestion uri. */ + public uri: string; + + /** + * Creates a new LinkOutSuggestion instance using the specified properties. + * @param [properties] Properties to set + * @returns LinkOutSuggestion instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion): google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion; + + /** + * Encodes the specified LinkOutSuggestion message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.verify|verify} messages. + * @param message LinkOutSuggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LinkOutSuggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.verify|verify} messages. + * @param message LinkOutSuggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LinkOutSuggestion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LinkOutSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion; + + /** + * Decodes a LinkOutSuggestion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LinkOutSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion; + + /** + * Verifies a LinkOutSuggestion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LinkOutSuggestion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LinkOutSuggestion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion; + + /** + * Creates a plain object from a LinkOutSuggestion message. Also converts values to other types if specified. + * @param message LinkOutSuggestion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LinkOutSuggestion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LinkOutSuggestion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSelect. */ + interface IListSelect { + + /** ListSelect title */ + title?: (string|null); + + /** ListSelect items */ + items?: (google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem[]|null); + + /** ListSelect subtitle */ + subtitle?: (string|null); + } + + /** Represents a ListSelect. */ + class ListSelect implements IListSelect { + + /** + * Constructs a new ListSelect. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.IListSelect); + + /** ListSelect title. */ + public title: string; + + /** ListSelect items. */ + public items: google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem[]; + + /** ListSelect subtitle. */ + public subtitle: string; + + /** + * Creates a new ListSelect instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSelect instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.IListSelect): google.cloud.dialogflow.v2.Intent.Message.ListSelect; + + /** + * Encodes the specified ListSelect message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ListSelect.verify|verify} messages. + * @param message ListSelect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.IListSelect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSelect message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ListSelect.verify|verify} messages. + * @param message ListSelect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.IListSelect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSelect message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.ListSelect; + + /** + * Decodes a ListSelect message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.ListSelect; + + /** + * Verifies a ListSelect message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSelect message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSelect + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.ListSelect; + + /** + * Creates a plain object from a ListSelect message. Also converts values to other types if specified. + * @param message ListSelect + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.ListSelect, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSelect to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSelect + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ListSelect { + + /** Properties of an Item. */ + interface IItem { + + /** Item info */ + info?: (google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo|null); + + /** Item title */ + title?: (string|null); + + /** Item description */ + description?: (string|null); + + /** Item image */ + image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + } + + /** Represents an Item. */ + class Item implements IItem { + + /** + * Constructs a new Item. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem); + + /** Item info. */ + public info?: (google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo|null); + + /** Item title. */ + public title: string; + + /** Item description. */ + public description: string; + + /** Item image. */ + public image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** + * Creates a new Item instance using the specified properties. + * @param [properties] Properties to set + * @returns Item instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem): google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item; + + /** + * Encodes the specified Item message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.verify|verify} messages. + * @param message Item message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Item message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.verify|verify} messages. + * @param message Item message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Item message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item; + + /** + * Decodes an Item message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item; + + /** + * Verifies an Item message. + * @param message Plain 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 Item message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Item + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item; + + /** + * Creates a plain object from an Item message. Also converts values to other types if specified. + * @param message Item + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Item to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Item + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a CarouselSelect. */ + interface ICarouselSelect { + + /** CarouselSelect items */ + items?: (google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem[]|null); + } + + /** Represents a CarouselSelect. */ + class CarouselSelect implements ICarouselSelect { + + /** + * Constructs a new CarouselSelect. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect); + + /** CarouselSelect items. */ + public items: google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem[]; + + /** + * Creates a new CarouselSelect instance using the specified properties. + * @param [properties] Properties to set + * @returns CarouselSelect instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect): google.cloud.dialogflow.v2.Intent.Message.CarouselSelect; + + /** + * Encodes the specified CarouselSelect message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.verify|verify} messages. + * @param message CarouselSelect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CarouselSelect message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.verify|verify} messages. + * @param message CarouselSelect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CarouselSelect message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CarouselSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.CarouselSelect; + + /** + * Decodes a CarouselSelect message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CarouselSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.CarouselSelect; + + /** + * Verifies a CarouselSelect message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CarouselSelect message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CarouselSelect + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.CarouselSelect; + + /** + * Creates a plain object from a CarouselSelect message. Also converts values to other types if specified. + * @param message CarouselSelect + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.CarouselSelect, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CarouselSelect to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CarouselSelect + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CarouselSelect { + + /** Properties of an Item. */ + interface IItem { + + /** Item info */ + info?: (google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo|null); + + /** Item title */ + title?: (string|null); + + /** Item description */ + description?: (string|null); + + /** Item image */ + image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + } + + /** Represents an Item. */ + class Item implements IItem { + + /** + * Constructs a new Item. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem); + + /** Item info. */ + public info?: (google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo|null); + + /** Item title. */ + public title: string; + + /** Item description. */ + public description: string; + + /** Item image. */ + public image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** + * Creates a new Item instance using the specified properties. + * @param [properties] Properties to set + * @returns Item instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem): google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item; + + /** + * Encodes the specified Item message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.verify|verify} messages. + * @param message Item message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Item message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.verify|verify} messages. + * @param message Item message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Item message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item; + + /** + * Decodes an Item message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item; + + /** + * Verifies an Item message. + * @param message Plain 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 Item message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Item + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item; + + /** + * Creates a plain object from an Item message. Also converts values to other types if specified. + * @param message Item + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Item to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Item + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SelectItemInfo. */ + interface ISelectItemInfo { + + /** SelectItemInfo key */ + key?: (string|null); + + /** SelectItemInfo synonyms */ + synonyms?: (string[]|null); + } + + /** Represents a SelectItemInfo. */ + class SelectItemInfo implements ISelectItemInfo { + + /** + * Constructs a new SelectItemInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo); + + /** SelectItemInfo key. */ + public key: string; + + /** SelectItemInfo synonyms. */ + public synonyms: string[]; + + /** + * Creates a new SelectItemInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectItemInfo instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo): google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo; + + /** + * Encodes the specified SelectItemInfo message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.verify|verify} messages. + * @param message SelectItemInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectItemInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.verify|verify} messages. + * @param message SelectItemInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectItemInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectItemInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo; + + /** + * Decodes a SelectItemInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectItemInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo; + + /** + * Verifies a SelectItemInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SelectItemInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectItemInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo; + + /** + * Creates a plain object from a SelectItemInfo message. Also converts values to other types if specified. + * @param message SelectItemInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectItemInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectItemInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MediaContent. */ + interface IMediaContent { + + /** MediaContent mediaType */ + mediaType?: (google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType|keyof typeof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType|null); + + /** MediaContent mediaObjects */ + mediaObjects?: (google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject[]|null); + } + + /** Represents a MediaContent. */ + class MediaContent implements IMediaContent { + + /** + * Constructs a new MediaContent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.IMediaContent); + + /** MediaContent mediaType. */ + public mediaType: (google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType|keyof typeof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType); + + /** MediaContent mediaObjects. */ + public mediaObjects: google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject[]; + + /** + * Creates a new MediaContent instance using the specified properties. + * @param [properties] Properties to set + * @returns MediaContent instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.IMediaContent): google.cloud.dialogflow.v2.Intent.Message.MediaContent; + + /** + * Encodes the specified MediaContent message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.MediaContent.verify|verify} messages. + * @param message MediaContent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.IMediaContent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MediaContent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.MediaContent.verify|verify} messages. + * @param message MediaContent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.IMediaContent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MediaContent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MediaContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.MediaContent; + + /** + * Decodes a MediaContent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MediaContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.MediaContent; + + /** + * Verifies a MediaContent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MediaContent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MediaContent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.MediaContent; + + /** + * Creates a plain object from a MediaContent message. Also converts values to other types if specified. + * @param message MediaContent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.MediaContent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MediaContent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MediaContent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MediaContent { + + /** ResponseMediaType enum. */ + enum ResponseMediaType { + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0, + AUDIO = 1 + } + + /** Properties of a ResponseMediaObject. */ + interface IResponseMediaObject { + + /** ResponseMediaObject name */ + name?: (string|null); + + /** ResponseMediaObject description */ + description?: (string|null); + + /** ResponseMediaObject largeImage */ + largeImage?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** ResponseMediaObject icon */ + icon?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** ResponseMediaObject contentUrl */ + contentUrl?: (string|null); + } + + /** Represents a ResponseMediaObject. */ + class ResponseMediaObject implements IResponseMediaObject { + + /** + * Constructs a new ResponseMediaObject. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject); + + /** ResponseMediaObject name. */ + public name: string; + + /** ResponseMediaObject description. */ + public description: string; + + /** ResponseMediaObject largeImage. */ + public largeImage?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** ResponseMediaObject icon. */ + public icon?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** ResponseMediaObject contentUrl. */ + public contentUrl: string; + + /** ResponseMediaObject image. */ + public image?: ("largeImage"|"icon"); + + /** + * Creates a new ResponseMediaObject instance using the specified properties. + * @param [properties] Properties to set + * @returns ResponseMediaObject instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject): google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject; + + /** + * Encodes the specified ResponseMediaObject message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.verify|verify} messages. + * @param message ResponseMediaObject message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResponseMediaObject message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.verify|verify} messages. + * @param message ResponseMediaObject message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResponseMediaObject message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResponseMediaObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject; + + /** + * Decodes a ResponseMediaObject message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResponseMediaObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject; + + /** + * Verifies a ResponseMediaObject message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResponseMediaObject message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResponseMediaObject + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject; + + /** + * Creates a plain object from a ResponseMediaObject message. Also converts values to other types if specified. + * @param message ResponseMediaObject + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResponseMediaObject to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResponseMediaObject + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a BrowseCarouselCard. */ + interface IBrowseCarouselCard { + + /** BrowseCarouselCard items */ + items?: (google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem[]|null); + + /** BrowseCarouselCard imageDisplayOptions */ + imageDisplayOptions?: (google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions|keyof typeof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions|null); + } + + /** Represents a BrowseCarouselCard. */ + class BrowseCarouselCard implements IBrowseCarouselCard { + + /** + * Constructs a new BrowseCarouselCard. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard); + + /** BrowseCarouselCard items. */ + public items: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem[]; + + /** BrowseCarouselCard imageDisplayOptions. */ + public imageDisplayOptions: (google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions|keyof typeof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions); + + /** + * Creates a new BrowseCarouselCard instance using the specified properties. + * @param [properties] Properties to set + * @returns BrowseCarouselCard instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard; + + /** + * Encodes the specified BrowseCarouselCard message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.verify|verify} messages. + * @param message BrowseCarouselCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BrowseCarouselCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.verify|verify} messages. + * @param message BrowseCarouselCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BrowseCarouselCard message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BrowseCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard; + + /** + * Decodes a BrowseCarouselCard message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BrowseCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard; + + /** + * Verifies a BrowseCarouselCard message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BrowseCarouselCard message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BrowseCarouselCard + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard; + + /** + * Creates a plain object from a BrowseCarouselCard message. Also converts values to other types if specified. + * @param message BrowseCarouselCard + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BrowseCarouselCard to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BrowseCarouselCard + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BrowseCarouselCard { + + /** Properties of a BrowseCarouselCardItem. */ + interface IBrowseCarouselCardItem { + + /** BrowseCarouselCardItem openUriAction */ + openUriAction?: (google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction|null); + + /** BrowseCarouselCardItem title */ + title?: (string|null); + + /** BrowseCarouselCardItem description */ + description?: (string|null); + + /** BrowseCarouselCardItem image */ + image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** BrowseCarouselCardItem footer */ + footer?: (string|null); + } + + /** Represents a BrowseCarouselCardItem. */ + class BrowseCarouselCardItem implements IBrowseCarouselCardItem { + + /** + * Constructs a new BrowseCarouselCardItem. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem); + + /** BrowseCarouselCardItem openUriAction. */ + public openUriAction?: (google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction|null); + + /** BrowseCarouselCardItem title. */ + public title: string; + + /** BrowseCarouselCardItem description. */ + public description: string; + + /** BrowseCarouselCardItem image. */ + public image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** BrowseCarouselCardItem footer. */ + public footer: string; + + /** + * Creates a new BrowseCarouselCardItem instance using the specified properties. + * @param [properties] Properties to set + * @returns BrowseCarouselCardItem instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem; + + /** + * Encodes the specified BrowseCarouselCardItem message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify|verify} messages. + * @param message BrowseCarouselCardItem message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BrowseCarouselCardItem message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify|verify} messages. + * @param message BrowseCarouselCardItem message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BrowseCarouselCardItem message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BrowseCarouselCardItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem; + + /** + * Decodes a BrowseCarouselCardItem message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BrowseCarouselCardItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem; + + /** + * Verifies a BrowseCarouselCardItem message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BrowseCarouselCardItem message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BrowseCarouselCardItem + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem; + + /** + * Creates a plain object from a BrowseCarouselCardItem message. Also converts values to other types if specified. + * @param message BrowseCarouselCardItem + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BrowseCarouselCardItem to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BrowseCarouselCardItem + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BrowseCarouselCardItem { + + /** Properties of an OpenUrlAction. */ + interface IOpenUrlAction { + + /** OpenUrlAction url */ + url?: (string|null); + + /** OpenUrlAction urlTypeHint */ + urlTypeHint?: (google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint|keyof typeof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint|null); + } + + /** Represents an OpenUrlAction. */ + class OpenUrlAction implements IOpenUrlAction { + + /** + * Constructs a new OpenUrlAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction); + + /** OpenUrlAction url. */ + public url: string; + + /** OpenUrlAction urlTypeHint. */ + public urlTypeHint: (google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint|keyof typeof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint); + + /** + * Creates a new OpenUrlAction instance using the specified properties. + * @param [properties] Properties to set + * @returns OpenUrlAction instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction; + + /** + * Encodes the specified OpenUrlAction message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify|verify} messages. + * @param message OpenUrlAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OpenUrlAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify|verify} messages. + * @param message OpenUrlAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OpenUrlAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OpenUrlAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction; + + /** + * Decodes an OpenUrlAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OpenUrlAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction; + + /** + * Verifies an OpenUrlAction message. + * @param message Plain 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 OpenUrlAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OpenUrlAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction; + + /** + * Creates a plain object from an OpenUrlAction message. Also converts values to other types if specified. + * @param message OpenUrlAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OpenUrlAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OpenUrlAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace OpenUrlAction { + + /** UrlTypeHint enum. */ + enum UrlTypeHint { + URL_TYPE_HINT_UNSPECIFIED = 0, + AMP_ACTION = 1, + AMP_CONTENT = 2 + } + } + } + + /** ImageDisplayOptions enum. */ + enum ImageDisplayOptions { + IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0, + GRAY = 1, + WHITE = 2, + CROPPED = 3, + BLURRED_BACKGROUND = 4 + } + } + + /** Properties of a TableCard. */ + interface ITableCard { + + /** TableCard title */ + title?: (string|null); + + /** TableCard subtitle */ + subtitle?: (string|null); + + /** TableCard image */ + image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** TableCard columnProperties */ + columnProperties?: (google.cloud.dialogflow.v2.Intent.Message.IColumnProperties[]|null); + + /** TableCard rows */ + rows?: (google.cloud.dialogflow.v2.Intent.Message.ITableCardRow[]|null); + + /** TableCard buttons */ + buttons?: (google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton[]|null); + } + + /** Represents a TableCard. */ + class TableCard implements ITableCard { + + /** + * Constructs a new TableCard. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ITableCard); + + /** TableCard title. */ + public title: string; + + /** TableCard subtitle. */ + public subtitle: string; + + /** TableCard image. */ + public image?: (google.cloud.dialogflow.v2.Intent.Message.IImage|null); + + /** TableCard columnProperties. */ + public columnProperties: google.cloud.dialogflow.v2.Intent.Message.IColumnProperties[]; + + /** TableCard rows. */ + public rows: google.cloud.dialogflow.v2.Intent.Message.ITableCardRow[]; + + /** TableCard buttons. */ + public buttons: google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton[]; + + /** + * Creates a new TableCard instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCard instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ITableCard): google.cloud.dialogflow.v2.Intent.Message.TableCard; + + /** + * Encodes the specified TableCard message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCard.verify|verify} messages. + * @param message TableCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ITableCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCard.verify|verify} messages. + * @param message TableCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ITableCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCard message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.TableCard; + + /** + * Decodes a TableCard message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.TableCard; + + /** + * Verifies a TableCard message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCard message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCard + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.TableCard; + + /** + * Creates a plain object from a TableCard message. Also converts values to other types if specified. + * @param message TableCard + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.TableCard, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCard to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCard + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ColumnProperties. */ + interface IColumnProperties { + + /** ColumnProperties header */ + header?: (string|null); + + /** ColumnProperties horizontalAlignment */ + horizontalAlignment?: (google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment|keyof typeof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment|null); + } + + /** Represents a ColumnProperties. */ + class ColumnProperties implements IColumnProperties { + + /** + * Constructs a new ColumnProperties. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.IColumnProperties); + + /** ColumnProperties header. */ + public header: string; + + /** ColumnProperties horizontalAlignment. */ + public horizontalAlignment: (google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment|keyof typeof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment); + + /** + * Creates a new ColumnProperties instance using the specified properties. + * @param [properties] Properties to set + * @returns ColumnProperties instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.IColumnProperties): google.cloud.dialogflow.v2.Intent.Message.ColumnProperties; + + /** + * Encodes the specified ColumnProperties message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.verify|verify} messages. + * @param message ColumnProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.IColumnProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ColumnProperties message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.verify|verify} messages. + * @param message ColumnProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.IColumnProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ColumnProperties message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ColumnProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.ColumnProperties; + + /** + * Decodes a ColumnProperties message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ColumnProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.ColumnProperties; + + /** + * Verifies a ColumnProperties message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ColumnProperties message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ColumnProperties + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.ColumnProperties; + + /** + * Creates a plain object from a ColumnProperties message. Also converts values to other types if specified. + * @param message ColumnProperties + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.ColumnProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ColumnProperties to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ColumnProperties + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ColumnProperties { + + /** HorizontalAlignment enum. */ + enum HorizontalAlignment { + HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0, + LEADING = 1, + CENTER = 2, + TRAILING = 3 + } + } + + /** Properties of a TableCardRow. */ + interface ITableCardRow { + + /** TableCardRow cells */ + cells?: (google.cloud.dialogflow.v2.Intent.Message.ITableCardCell[]|null); + + /** TableCardRow dividerAfter */ + dividerAfter?: (boolean|null); + } + + /** Represents a TableCardRow. */ + class TableCardRow implements ITableCardRow { + + /** + * Constructs a new TableCardRow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ITableCardRow); + + /** TableCardRow cells. */ + public cells: google.cloud.dialogflow.v2.Intent.Message.ITableCardCell[]; + + /** TableCardRow dividerAfter. */ + public dividerAfter: boolean; + + /** + * Creates a new TableCardRow instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCardRow instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ITableCardRow): google.cloud.dialogflow.v2.Intent.Message.TableCardRow; + + /** + * Encodes the specified TableCardRow message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCardRow.verify|verify} messages. + * @param message TableCardRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ITableCardRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCardRow message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCardRow.verify|verify} messages. + * @param message TableCardRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ITableCardRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCardRow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCardRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.TableCardRow; + + /** + * Decodes a TableCardRow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCardRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.TableCardRow; + + /** + * Verifies a TableCardRow message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCardRow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCardRow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.TableCardRow; + + /** + * Creates a plain object from a TableCardRow message. Also converts values to other types if specified. + * @param message TableCardRow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.TableCardRow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCardRow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCardRow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TableCardCell. */ + interface ITableCardCell { + + /** TableCardCell text */ + text?: (string|null); + } + + /** Represents a TableCardCell. */ + class TableCardCell implements ITableCardCell { + + /** + * Constructs a new TableCardCell. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.Message.ITableCardCell); + + /** TableCardCell text. */ + public text: string; + + /** + * Creates a new TableCardCell instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCardCell instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.Message.ITableCardCell): google.cloud.dialogflow.v2.Intent.Message.TableCardCell; + + /** + * Encodes the specified TableCardCell message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCardCell.verify|verify} messages. + * @param message TableCardCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.Message.ITableCardCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCardCell message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCardCell.verify|verify} messages. + * @param message TableCardCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.Message.ITableCardCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCardCell message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCardCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.Message.TableCardCell; + + /** + * Decodes a TableCardCell message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCardCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.Message.TableCardCell; + + /** + * Verifies a TableCardCell message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCardCell message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCardCell + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.Message.TableCardCell; + + /** + * Creates a plain object from a TableCardCell message. Also converts values to other types if specified. + * @param message TableCardCell + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.Message.TableCardCell, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCardCell to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCardCell + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a FollowupIntentInfo. */ + interface IFollowupIntentInfo { + + /** FollowupIntentInfo followupIntentName */ + followupIntentName?: (string|null); + + /** FollowupIntentInfo parentFollowupIntentName */ + parentFollowupIntentName?: (string|null); + } + + /** Represents a FollowupIntentInfo. */ + class FollowupIntentInfo implements IFollowupIntentInfo { + + /** + * Constructs a new FollowupIntentInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo); + + /** FollowupIntentInfo followupIntentName. */ + public followupIntentName: string; + + /** FollowupIntentInfo parentFollowupIntentName. */ + public parentFollowupIntentName: string; + + /** + * Creates a new FollowupIntentInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns FollowupIntentInfo instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo): google.cloud.dialogflow.v2.Intent.FollowupIntentInfo; + + /** + * Encodes the specified FollowupIntentInfo message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.verify|verify} messages. + * @param message FollowupIntentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FollowupIntentInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.verify|verify} messages. + * @param message FollowupIntentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FollowupIntentInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FollowupIntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Intent.FollowupIntentInfo; + + /** + * Decodes a FollowupIntentInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FollowupIntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Intent.FollowupIntentInfo; + + /** + * Verifies a FollowupIntentInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FollowupIntentInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FollowupIntentInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Intent.FollowupIntentInfo; + + /** + * Creates a plain object from a FollowupIntentInfo message. Also converts values to other types if specified. + * @param message FollowupIntentInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Intent.FollowupIntentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FollowupIntentInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FollowupIntentInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ListIntentsRequest. */ + interface IListIntentsRequest { + + /** ListIntentsRequest parent */ + parent?: (string|null); + + /** ListIntentsRequest languageCode */ + languageCode?: (string|null); + + /** ListIntentsRequest intentView */ + intentView?: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView|null); + + /** ListIntentsRequest pageSize */ + pageSize?: (number|null); + + /** ListIntentsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListIntentsRequest. */ + class ListIntentsRequest implements IListIntentsRequest { + + /** + * Constructs a new ListIntentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListIntentsRequest); + + /** ListIntentsRequest parent. */ + public parent: string; + + /** ListIntentsRequest languageCode. */ + public languageCode: string; + + /** ListIntentsRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView); + + /** ListIntentsRequest pageSize. */ + public pageSize: number; + + /** ListIntentsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListIntentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListIntentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListIntentsRequest): google.cloud.dialogflow.v2.ListIntentsRequest; + + /** + * Encodes the specified ListIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListIntentsRequest.verify|verify} messages. + * @param message ListIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListIntentsRequest.verify|verify} messages. + * @param message ListIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListIntentsRequest; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListIntentsRequest; + + /** + * Verifies a ListIntentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListIntentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListIntentsRequest; + + /** + * Creates a plain object from a ListIntentsRequest message. Also converts values to other types if specified. + * @param message ListIntentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListIntentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListIntentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListIntentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListIntentsResponse. */ + interface IListIntentsResponse { + + /** ListIntentsResponse intents */ + intents?: (google.cloud.dialogflow.v2.IIntent[]|null); + + /** ListIntentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListIntentsResponse. */ + class ListIntentsResponse implements IListIntentsResponse { + + /** + * Constructs a new ListIntentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListIntentsResponse); + + /** ListIntentsResponse intents. */ + public intents: google.cloud.dialogflow.v2.IIntent[]; + + /** ListIntentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListIntentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListIntentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListIntentsResponse): google.cloud.dialogflow.v2.ListIntentsResponse; + + /** + * Encodes the specified ListIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListIntentsResponse.verify|verify} messages. + * @param message ListIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListIntentsResponse.verify|verify} messages. + * @param message ListIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListIntentsResponse; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListIntentsResponse; + + /** + * Verifies a ListIntentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListIntentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListIntentsResponse; + + /** + * Creates a plain object from a ListIntentsResponse message. Also converts values to other types if specified. + * @param message ListIntentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListIntentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListIntentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListIntentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetIntentRequest. */ + interface IGetIntentRequest { + + /** GetIntentRequest name */ + name?: (string|null); + + /** GetIntentRequest languageCode */ + languageCode?: (string|null); + + /** GetIntentRequest intentView */ + intentView?: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView|null); + } + + /** Represents a GetIntentRequest. */ + class GetIntentRequest implements IGetIntentRequest { + + /** + * Constructs a new GetIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetIntentRequest); + + /** GetIntentRequest name. */ + public name: string; + + /** GetIntentRequest languageCode. */ + public languageCode: string; + + /** GetIntentRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView); + + /** + * Creates a new GetIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetIntentRequest): google.cloud.dialogflow.v2.GetIntentRequest; + + /** + * Encodes the specified GetIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetIntentRequest.verify|verify} messages. + * @param message GetIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetIntentRequest.verify|verify} messages. + * @param message GetIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetIntentRequest; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetIntentRequest; + + /** + * Verifies a GetIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetIntentRequest; + + /** + * Creates a plain object from a GetIntentRequest message. Also converts values to other types if specified. + * @param message GetIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateIntentRequest. */ + interface ICreateIntentRequest { + + /** CreateIntentRequest parent */ + parent?: (string|null); + + /** CreateIntentRequest intent */ + intent?: (google.cloud.dialogflow.v2.IIntent|null); + + /** CreateIntentRequest languageCode */ + languageCode?: (string|null); + + /** CreateIntentRequest intentView */ + intentView?: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView|null); + } + + /** Represents a CreateIntentRequest. */ + class CreateIntentRequest implements ICreateIntentRequest { + + /** + * Constructs a new CreateIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateIntentRequest); + + /** CreateIntentRequest parent. */ + public parent: string; + + /** CreateIntentRequest intent. */ + public intent?: (google.cloud.dialogflow.v2.IIntent|null); + + /** CreateIntentRequest languageCode. */ + public languageCode: string; + + /** CreateIntentRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView); + + /** + * Creates a new CreateIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateIntentRequest): google.cloud.dialogflow.v2.CreateIntentRequest; + + /** + * Encodes the specified CreateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateIntentRequest.verify|verify} messages. + * @param message CreateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateIntentRequest.verify|verify} messages. + * @param message CreateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateIntentRequest; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateIntentRequest; + + /** + * Verifies a CreateIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateIntentRequest; + + /** + * Creates a plain object from a CreateIntentRequest message. Also converts values to other types if specified. + * @param message CreateIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateIntentRequest. */ + interface IUpdateIntentRequest { + + /** UpdateIntentRequest intent */ + intent?: (google.cloud.dialogflow.v2.IIntent|null); + + /** UpdateIntentRequest languageCode */ + languageCode?: (string|null); + + /** UpdateIntentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateIntentRequest intentView */ + intentView?: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView|null); + } + + /** Represents an UpdateIntentRequest. */ + class UpdateIntentRequest implements IUpdateIntentRequest { + + /** + * Constructs a new UpdateIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateIntentRequest); + + /** UpdateIntentRequest intent. */ + public intent?: (google.cloud.dialogflow.v2.IIntent|null); + + /** UpdateIntentRequest languageCode. */ + public languageCode: string; + + /** UpdateIntentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateIntentRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView); + + /** + * Creates a new UpdateIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateIntentRequest): google.cloud.dialogflow.v2.UpdateIntentRequest; + + /** + * Encodes the specified UpdateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateIntentRequest.verify|verify} messages. + * @param message UpdateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateIntentRequest.verify|verify} messages. + * @param message UpdateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateIntentRequest; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateIntentRequest; + + /** + * Verifies an UpdateIntentRequest message. + * @param message Plain 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 UpdateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateIntentRequest; + + /** + * Creates a plain object from an UpdateIntentRequest message. Also converts values to other types if specified. + * @param message UpdateIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteIntentRequest. */ + interface IDeleteIntentRequest { + + /** DeleteIntentRequest name */ + name?: (string|null); + } + + /** Represents a DeleteIntentRequest. */ + class DeleteIntentRequest implements IDeleteIntentRequest { + + /** + * Constructs a new DeleteIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteIntentRequest); + + /** DeleteIntentRequest name. */ + public name: string; + + /** + * Creates a new DeleteIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteIntentRequest): google.cloud.dialogflow.v2.DeleteIntentRequest; + + /** + * Encodes the specified DeleteIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteIntentRequest.verify|verify} messages. + * @param message DeleteIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteIntentRequest.verify|verify} messages. + * @param message DeleteIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteIntentRequest; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteIntentRequest; + + /** + * Verifies a DeleteIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteIntentRequest; + + /** + * Creates a plain object from a DeleteIntentRequest message. Also converts values to other types if specified. + * @param message DeleteIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateIntentsRequest. */ + interface IBatchUpdateIntentsRequest { + + /** BatchUpdateIntentsRequest parent */ + parent?: (string|null); + + /** BatchUpdateIntentsRequest intentBatchUri */ + intentBatchUri?: (string|null); + + /** BatchUpdateIntentsRequest intentBatchInline */ + intentBatchInline?: (google.cloud.dialogflow.v2.IIntentBatch|null); + + /** BatchUpdateIntentsRequest languageCode */ + languageCode?: (string|null); + + /** BatchUpdateIntentsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** BatchUpdateIntentsRequest intentView */ + intentView?: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView|null); + } + + /** Represents a BatchUpdateIntentsRequest. */ + class BatchUpdateIntentsRequest implements IBatchUpdateIntentsRequest { + + /** + * Constructs a new BatchUpdateIntentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest); + + /** BatchUpdateIntentsRequest parent. */ + public parent: string; + + /** BatchUpdateIntentsRequest intentBatchUri. */ + public intentBatchUri?: (string|null); + + /** BatchUpdateIntentsRequest intentBatchInline. */ + public intentBatchInline?: (google.cloud.dialogflow.v2.IIntentBatch|null); + + /** BatchUpdateIntentsRequest languageCode. */ + public languageCode: string; + + /** BatchUpdateIntentsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** BatchUpdateIntentsRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2.IntentView|keyof typeof google.cloud.dialogflow.v2.IntentView); + + /** BatchUpdateIntentsRequest intentBatch. */ + public intentBatch?: ("intentBatchUri"|"intentBatchInline"); + + /** + * Creates a new BatchUpdateIntentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateIntentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest): google.cloud.dialogflow.v2.BatchUpdateIntentsRequest; + + /** + * Encodes the specified BatchUpdateIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.verify|verify} messages. + * @param message BatchUpdateIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.verify|verify} messages. + * @param message BatchUpdateIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateIntentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.BatchUpdateIntentsRequest; + + /** + * Decodes a BatchUpdateIntentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.BatchUpdateIntentsRequest; + + /** + * Verifies a BatchUpdateIntentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateIntentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.BatchUpdateIntentsRequest; + + /** + * Creates a plain object from a BatchUpdateIntentsRequest message. Also converts values to other types if specified. + * @param message BatchUpdateIntentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.BatchUpdateIntentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateIntentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateIntentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateIntentsResponse. */ + interface IBatchUpdateIntentsResponse { + + /** BatchUpdateIntentsResponse intents */ + intents?: (google.cloud.dialogflow.v2.IIntent[]|null); + } + + /** Represents a BatchUpdateIntentsResponse. */ + class BatchUpdateIntentsResponse implements IBatchUpdateIntentsResponse { + + /** + * Constructs a new BatchUpdateIntentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse); + + /** BatchUpdateIntentsResponse intents. */ + public intents: google.cloud.dialogflow.v2.IIntent[]; + + /** + * Creates a new BatchUpdateIntentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateIntentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse): google.cloud.dialogflow.v2.BatchUpdateIntentsResponse; + + /** + * Encodes the specified BatchUpdateIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateIntentsResponse.verify|verify} messages. + * @param message BatchUpdateIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateIntentsResponse.verify|verify} messages. + * @param message BatchUpdateIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateIntentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.BatchUpdateIntentsResponse; + + /** + * Decodes a BatchUpdateIntentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.BatchUpdateIntentsResponse; + + /** + * Verifies a BatchUpdateIntentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateIntentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.BatchUpdateIntentsResponse; + + /** + * Creates a plain object from a BatchUpdateIntentsResponse message. Also converts values to other types if specified. + * @param message BatchUpdateIntentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.BatchUpdateIntentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateIntentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateIntentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDeleteIntentsRequest. */ + interface IBatchDeleteIntentsRequest { + + /** BatchDeleteIntentsRequest parent */ + parent?: (string|null); + + /** BatchDeleteIntentsRequest intents */ + intents?: (google.cloud.dialogflow.v2.IIntent[]|null); + } + + /** Represents a BatchDeleteIntentsRequest. */ + class BatchDeleteIntentsRequest implements IBatchDeleteIntentsRequest { + + /** + * Constructs a new BatchDeleteIntentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest); + + /** BatchDeleteIntentsRequest parent. */ + public parent: string; + + /** BatchDeleteIntentsRequest intents. */ + public intents: google.cloud.dialogflow.v2.IIntent[]; + + /** + * Creates a new BatchDeleteIntentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDeleteIntentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest): google.cloud.dialogflow.v2.BatchDeleteIntentsRequest; + + /** + * Encodes the specified BatchDeleteIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteIntentsRequest.verify|verify} messages. + * @param message BatchDeleteIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDeleteIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteIntentsRequest.verify|verify} messages. + * @param message BatchDeleteIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDeleteIntentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDeleteIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.BatchDeleteIntentsRequest; + + /** + * Decodes a BatchDeleteIntentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDeleteIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.BatchDeleteIntentsRequest; + + /** + * Verifies a BatchDeleteIntentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDeleteIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDeleteIntentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.BatchDeleteIntentsRequest; + + /** + * Creates a plain object from a BatchDeleteIntentsRequest message. Also converts values to other types if specified. + * @param message BatchDeleteIntentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.BatchDeleteIntentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDeleteIntentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDeleteIntentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** IntentView enum. */ + enum IntentView { + INTENT_VIEW_UNSPECIFIED = 0, + INTENT_VIEW_FULL = 1 + } + + /** Properties of an IntentBatch. */ + interface IIntentBatch { + + /** IntentBatch intents */ + intents?: (google.cloud.dialogflow.v2.IIntent[]|null); + } + + /** Represents an IntentBatch. */ + class IntentBatch implements IIntentBatch { + + /** + * Constructs a new IntentBatch. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IIntentBatch); + + /** IntentBatch intents. */ + public intents: google.cloud.dialogflow.v2.IIntent[]; + + /** + * Creates a new IntentBatch instance using the specified properties. + * @param [properties] Properties to set + * @returns IntentBatch instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IIntentBatch): google.cloud.dialogflow.v2.IntentBatch; + + /** + * Encodes the specified IntentBatch message. Does not implicitly {@link google.cloud.dialogflow.v2.IntentBatch.verify|verify} messages. + * @param message IntentBatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IIntentBatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IntentBatch message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.IntentBatch.verify|verify} messages. + * @param message IntentBatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IIntentBatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IntentBatch message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IntentBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.IntentBatch; + + /** + * Decodes an IntentBatch message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IntentBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.IntentBatch; + + /** + * Verifies an IntentBatch message. + * @param message Plain 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 IntentBatch message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IntentBatch + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.IntentBatch; + + /** + * Creates a plain object from an IntentBatch message. Also converts values to other types if specified. + * @param message IntentBatch + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.IntentBatch, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IntentBatch to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IntentBatch + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SessionEntityTypes */ + class SessionEntityTypes extends $protobuf.rpc.Service { + + /** + * Constructs a new SessionEntityTypes 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 SessionEntityTypes 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): SessionEntityTypes; + + /** + * Calls ListSessionEntityTypes. + * @param request ListSessionEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSessionEntityTypesResponse + */ + public listSessionEntityTypes(request: google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, callback: google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypesCallback): void; + + /** + * Calls ListSessionEntityTypes. + * @param request ListSessionEntityTypesRequest message or plain object + * @returns Promise + */ + public listSessionEntityTypes(request: google.cloud.dialogflow.v2.IListSessionEntityTypesRequest): Promise; + + /** + * Calls GetSessionEntityType. + * @param request GetSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SessionEntityType + */ + public getSessionEntityType(request: google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, callback: google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityTypeCallback): void; + + /** + * Calls GetSessionEntityType. + * @param request GetSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public getSessionEntityType(request: google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest): Promise; + + /** + * Calls CreateSessionEntityType. + * @param request CreateSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SessionEntityType + */ + public createSessionEntityType(request: google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, callback: google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityTypeCallback): void; + + /** + * Calls CreateSessionEntityType. + * @param request CreateSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public createSessionEntityType(request: google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest): Promise; + + /** + * Calls UpdateSessionEntityType. + * @param request UpdateSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SessionEntityType + */ + public updateSessionEntityType(request: google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, callback: google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityTypeCallback): void; + + /** + * Calls UpdateSessionEntityType. + * @param request UpdateSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public updateSessionEntityType(request: google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest): Promise; + + /** + * Calls DeleteSessionEntityType. + * @param request DeleteSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteSessionEntityType(request: google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, callback: google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityTypeCallback): void; + + /** + * Calls DeleteSessionEntityType. + * @param request DeleteSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public deleteSessionEntityType(request: google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest): Promise; + } + + namespace SessionEntityTypes { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|listSessionEntityTypes}. + * @param error Error, if any + * @param [response] ListSessionEntityTypesResponse + */ + type ListSessionEntityTypesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListSessionEntityTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|getSessionEntityType}. + * @param error Error, if any + * @param [response] SessionEntityType + */ + type GetSessionEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.SessionEntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|createSessionEntityType}. + * @param error Error, if any + * @param [response] SessionEntityType + */ + type CreateSessionEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.SessionEntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|updateSessionEntityType}. + * @param error Error, if any + * @param [response] SessionEntityType + */ + type UpdateSessionEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.SessionEntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|deleteSessionEntityType}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteSessionEntityTypeCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a SessionEntityType. */ + interface ISessionEntityType { + + /** SessionEntityType name */ + name?: (string|null); + + /** SessionEntityType entityOverrideMode */ + entityOverrideMode?: (google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode|keyof typeof google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode|null); + + /** SessionEntityType entities */ + entities?: (google.cloud.dialogflow.v2.EntityType.IEntity[]|null); + } + + /** Represents a SessionEntityType. */ + class SessionEntityType implements ISessionEntityType { + + /** + * Constructs a new SessionEntityType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISessionEntityType); + + /** SessionEntityType name. */ + public name: string; + + /** SessionEntityType entityOverrideMode. */ + public entityOverrideMode: (google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode|keyof typeof google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode); + + /** SessionEntityType entities. */ + public entities: google.cloud.dialogflow.v2.EntityType.IEntity[]; + + /** + * Creates a new SessionEntityType instance using the specified properties. + * @param [properties] Properties to set + * @returns SessionEntityType instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISessionEntityType): google.cloud.dialogflow.v2.SessionEntityType; + + /** + * Encodes the specified SessionEntityType message. Does not implicitly {@link google.cloud.dialogflow.v2.SessionEntityType.verify|verify} messages. + * @param message SessionEntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISessionEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SessionEntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SessionEntityType.verify|verify} messages. + * @param message SessionEntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISessionEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SessionEntityType; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SessionEntityType; + + /** + * Verifies a SessionEntityType message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SessionEntityType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SessionEntityType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SessionEntityType; + + /** + * Creates a plain object from a SessionEntityType message. Also converts values to other types if specified. + * @param message SessionEntityType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SessionEntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SessionEntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SessionEntityType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SessionEntityType { + + /** EntityOverrideMode enum. */ + enum EntityOverrideMode { + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0, + ENTITY_OVERRIDE_MODE_OVERRIDE = 1, + ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2 + } + } + + /** Properties of a ListSessionEntityTypesRequest. */ + interface IListSessionEntityTypesRequest { + + /** ListSessionEntityTypesRequest parent */ + parent?: (string|null); + + /** ListSessionEntityTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListSessionEntityTypesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListSessionEntityTypesRequest. */ + class ListSessionEntityTypesRequest implements IListSessionEntityTypesRequest { + + /** + * Constructs a new ListSessionEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListSessionEntityTypesRequest); + + /** ListSessionEntityTypesRequest parent. */ + public parent: string; + + /** ListSessionEntityTypesRequest pageSize. */ + public pageSize: number; + + /** ListSessionEntityTypesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListSessionEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSessionEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListSessionEntityTypesRequest): google.cloud.dialogflow.v2.ListSessionEntityTypesRequest; + + /** + * Encodes the specified ListSessionEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListSessionEntityTypesRequest.verify|verify} messages. + * @param message ListSessionEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSessionEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListSessionEntityTypesRequest.verify|verify} messages. + * @param message ListSessionEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListSessionEntityTypesRequest; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListSessionEntityTypesRequest; + + /** + * Verifies a ListSessionEntityTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSessionEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSessionEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListSessionEntityTypesRequest; + + /** + * Creates a plain object from a ListSessionEntityTypesRequest message. Also converts values to other types if specified. + * @param message ListSessionEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListSessionEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSessionEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSessionEntityTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSessionEntityTypesResponse. */ + interface IListSessionEntityTypesResponse { + + /** ListSessionEntityTypesResponse sessionEntityTypes */ + sessionEntityTypes?: (google.cloud.dialogflow.v2.ISessionEntityType[]|null); + + /** ListSessionEntityTypesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListSessionEntityTypesResponse. */ + class ListSessionEntityTypesResponse implements IListSessionEntityTypesResponse { + + /** + * Constructs a new ListSessionEntityTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListSessionEntityTypesResponse); + + /** ListSessionEntityTypesResponse sessionEntityTypes. */ + public sessionEntityTypes: google.cloud.dialogflow.v2.ISessionEntityType[]; + + /** ListSessionEntityTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListSessionEntityTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSessionEntityTypesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListSessionEntityTypesResponse): google.cloud.dialogflow.v2.ListSessionEntityTypesResponse; + + /** + * Encodes the specified ListSessionEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListSessionEntityTypesResponse.verify|verify} messages. + * @param message ListSessionEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListSessionEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSessionEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListSessionEntityTypesResponse.verify|verify} messages. + * @param message ListSessionEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListSessionEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListSessionEntityTypesResponse; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListSessionEntityTypesResponse; + + /** + * Verifies a ListSessionEntityTypesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSessionEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSessionEntityTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListSessionEntityTypesResponse; + + /** + * Creates a plain object from a ListSessionEntityTypesResponse message. Also converts values to other types if specified. + * @param message ListSessionEntityTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListSessionEntityTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSessionEntityTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSessionEntityTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetSessionEntityTypeRequest. */ + interface IGetSessionEntityTypeRequest { + + /** GetSessionEntityTypeRequest name */ + name?: (string|null); + } + + /** Represents a GetSessionEntityTypeRequest. */ + class GetSessionEntityTypeRequest implements IGetSessionEntityTypeRequest { + + /** + * Constructs a new GetSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest); + + /** GetSessionEntityTypeRequest name. */ + public name: string; + + /** + * Creates a new GetSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest): google.cloud.dialogflow.v2.GetSessionEntityTypeRequest; + + /** + * Encodes the specified GetSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetSessionEntityTypeRequest.verify|verify} messages. + * @param message GetSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetSessionEntityTypeRequest.verify|verify} messages. + * @param message GetSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetSessionEntityTypeRequest; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetSessionEntityTypeRequest; + + /** + * Verifies a GetSessionEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetSessionEntityTypeRequest; + + /** + * Creates a plain object from a GetSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message GetSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetSessionEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateSessionEntityTypeRequest. */ + interface ICreateSessionEntityTypeRequest { + + /** CreateSessionEntityTypeRequest parent */ + parent?: (string|null); + + /** CreateSessionEntityTypeRequest sessionEntityType */ + sessionEntityType?: (google.cloud.dialogflow.v2.ISessionEntityType|null); + } + + /** Represents a CreateSessionEntityTypeRequest. */ + class CreateSessionEntityTypeRequest implements ICreateSessionEntityTypeRequest { + + /** + * Constructs a new CreateSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest); + + /** CreateSessionEntityTypeRequest parent. */ + public parent: string; + + /** CreateSessionEntityTypeRequest sessionEntityType. */ + public sessionEntityType?: (google.cloud.dialogflow.v2.ISessionEntityType|null); + + /** + * Creates a new CreateSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest): google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest.verify|verify} messages. + * @param message CreateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest.verify|verify} messages. + * @param message CreateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest; + + /** + * Verifies a CreateSessionEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest; + + /** + * Creates a plain object from a CreateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message CreateSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateSessionEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateSessionEntityTypeRequest. */ + interface IUpdateSessionEntityTypeRequest { + + /** UpdateSessionEntityTypeRequest sessionEntityType */ + sessionEntityType?: (google.cloud.dialogflow.v2.ISessionEntityType|null); + + /** UpdateSessionEntityTypeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateSessionEntityTypeRequest. */ + class UpdateSessionEntityTypeRequest implements IUpdateSessionEntityTypeRequest { + + /** + * Constructs a new UpdateSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest); + + /** UpdateSessionEntityTypeRequest sessionEntityType. */ + public sessionEntityType?: (google.cloud.dialogflow.v2.ISessionEntityType|null); + + /** UpdateSessionEntityTypeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest): google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @param message UpdateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @param message UpdateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest; + + /** + * Verifies an UpdateSessionEntityTypeRequest message. + * @param message Plain 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 UpdateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest; + + /** + * Creates a plain object from an UpdateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message UpdateSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateSessionEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteSessionEntityTypeRequest. */ + interface IDeleteSessionEntityTypeRequest { + + /** DeleteSessionEntityTypeRequest name */ + name?: (string|null); + } + + /** Represents a DeleteSessionEntityTypeRequest. */ + class DeleteSessionEntityTypeRequest implements IDeleteSessionEntityTypeRequest { + + /** + * Constructs a new DeleteSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest); + + /** DeleteSessionEntityTypeRequest name. */ + public name: string; + + /** + * Creates a new DeleteSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest): google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @param message DeleteSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @param message DeleteSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest; + + /** + * Verifies a DeleteSessionEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest; + + /** + * Creates a plain object from a DeleteSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message DeleteSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteSessionEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents an EntityTypes */ + class EntityTypes extends $protobuf.rpc.Service { + + /** + * Constructs a new EntityTypes 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 EntityTypes 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): EntityTypes; + + /** + * Calls ListEntityTypes. + * @param request ListEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListEntityTypesResponse + */ + public listEntityTypes(request: google.cloud.dialogflow.v2.IListEntityTypesRequest, callback: google.cloud.dialogflow.v2.EntityTypes.ListEntityTypesCallback): void; + + /** + * Calls ListEntityTypes. + * @param request ListEntityTypesRequest message or plain object + * @returns Promise + */ + public listEntityTypes(request: google.cloud.dialogflow.v2.IListEntityTypesRequest): Promise; + + /** + * Calls GetEntityType. + * @param request GetEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EntityType + */ + public getEntityType(request: google.cloud.dialogflow.v2.IGetEntityTypeRequest, callback: google.cloud.dialogflow.v2.EntityTypes.GetEntityTypeCallback): void; + + /** + * Calls GetEntityType. + * @param request GetEntityTypeRequest message or plain object + * @returns Promise + */ + public getEntityType(request: google.cloud.dialogflow.v2.IGetEntityTypeRequest): Promise; + + /** + * Calls CreateEntityType. + * @param request CreateEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EntityType + */ + public createEntityType(request: google.cloud.dialogflow.v2.ICreateEntityTypeRequest, callback: google.cloud.dialogflow.v2.EntityTypes.CreateEntityTypeCallback): void; + + /** + * Calls CreateEntityType. + * @param request CreateEntityTypeRequest message or plain object + * @returns Promise + */ + public createEntityType(request: google.cloud.dialogflow.v2.ICreateEntityTypeRequest): Promise; + + /** + * Calls UpdateEntityType. + * @param request UpdateEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EntityType + */ + public updateEntityType(request: google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, callback: google.cloud.dialogflow.v2.EntityTypes.UpdateEntityTypeCallback): void; + + /** + * Calls UpdateEntityType. + * @param request UpdateEntityTypeRequest message or plain object + * @returns Promise + */ + public updateEntityType(request: google.cloud.dialogflow.v2.IUpdateEntityTypeRequest): Promise; + + /** + * Calls DeleteEntityType. + * @param request DeleteEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteEntityType(request: google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, callback: google.cloud.dialogflow.v2.EntityTypes.DeleteEntityTypeCallback): void; + + /** + * Calls DeleteEntityType. + * @param request DeleteEntityTypeRequest message or plain object + * @returns Promise + */ + public deleteEntityType(request: google.cloud.dialogflow.v2.IDeleteEntityTypeRequest): Promise; + + /** + * Calls BatchUpdateEntityTypes. + * @param request BatchUpdateEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchUpdateEntityTypes(request: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, callback: google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypesCallback): void; + + /** + * Calls BatchUpdateEntityTypes. + * @param request BatchUpdateEntityTypesRequest message or plain object + * @returns Promise + */ + public batchUpdateEntityTypes(request: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest): Promise; + + /** + * Calls BatchDeleteEntityTypes. + * @param request BatchDeleteEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchDeleteEntityTypes(request: google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, callback: google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypesCallback): void; + + /** + * Calls BatchDeleteEntityTypes. + * @param request BatchDeleteEntityTypesRequest message or plain object + * @returns Promise + */ + public batchDeleteEntityTypes(request: google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest): Promise; + + /** + * Calls BatchCreateEntities. + * @param request BatchCreateEntitiesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchCreateEntities(request: google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, callback: google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntitiesCallback): void; + + /** + * Calls BatchCreateEntities. + * @param request BatchCreateEntitiesRequest message or plain object + * @returns Promise + */ + public batchCreateEntities(request: google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest): Promise; + + /** + * Calls BatchUpdateEntities. + * @param request BatchUpdateEntitiesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchUpdateEntities(request: google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, callback: google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntitiesCallback): void; + + /** + * Calls BatchUpdateEntities. + * @param request BatchUpdateEntitiesRequest message or plain object + * @returns Promise + */ + public batchUpdateEntities(request: google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest): Promise; + + /** + * Calls BatchDeleteEntities. + * @param request BatchDeleteEntitiesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchDeleteEntities(request: google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, callback: google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntitiesCallback): void; + + /** + * Calls BatchDeleteEntities. + * @param request BatchDeleteEntitiesRequest message or plain object + * @returns Promise + */ + public batchDeleteEntities(request: google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest): Promise; + } + + namespace EntityTypes { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|listEntityTypes}. + * @param error Error, if any + * @param [response] ListEntityTypesResponse + */ + type ListEntityTypesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListEntityTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|getEntityType}. + * @param error Error, if any + * @param [response] EntityType + */ + type GetEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.EntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|createEntityType}. + * @param error Error, if any + * @param [response] EntityType + */ + type CreateEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.EntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|updateEntityType}. + * @param error Error, if any + * @param [response] EntityType + */ + type UpdateEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.EntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|deleteEntityType}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteEntityTypeCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchUpdateEntityTypes}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchUpdateEntityTypesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchDeleteEntityTypes}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchDeleteEntityTypesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchCreateEntities}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchCreateEntitiesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchUpdateEntities}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchUpdateEntitiesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchDeleteEntities}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchDeleteEntitiesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an EntityType. */ + interface IEntityType { + + /** EntityType name */ + name?: (string|null); + + /** EntityType displayName */ + displayName?: (string|null); + + /** EntityType kind */ + kind?: (google.cloud.dialogflow.v2.EntityType.Kind|keyof typeof google.cloud.dialogflow.v2.EntityType.Kind|null); + + /** EntityType autoExpansionMode */ + autoExpansionMode?: (google.cloud.dialogflow.v2.EntityType.AutoExpansionMode|keyof typeof google.cloud.dialogflow.v2.EntityType.AutoExpansionMode|null); + + /** EntityType entities */ + entities?: (google.cloud.dialogflow.v2.EntityType.IEntity[]|null); + + /** EntityType enableFuzzyExtraction */ + enableFuzzyExtraction?: (boolean|null); + } + + /** Represents an EntityType. */ + class EntityType implements IEntityType { + + /** + * Constructs a new EntityType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IEntityType); + + /** EntityType name. */ + public name: string; + + /** EntityType displayName. */ + public displayName: string; + + /** EntityType kind. */ + public kind: (google.cloud.dialogflow.v2.EntityType.Kind|keyof typeof google.cloud.dialogflow.v2.EntityType.Kind); + + /** EntityType autoExpansionMode. */ + public autoExpansionMode: (google.cloud.dialogflow.v2.EntityType.AutoExpansionMode|keyof typeof google.cloud.dialogflow.v2.EntityType.AutoExpansionMode); + + /** EntityType entities. */ + public entities: google.cloud.dialogflow.v2.EntityType.IEntity[]; + + /** EntityType enableFuzzyExtraction. */ + public enableFuzzyExtraction: boolean; + + /** + * Creates a new EntityType instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityType instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IEntityType): google.cloud.dialogflow.v2.EntityType; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.dialogflow.v2.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.EntityType; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.EntityType; + + /** + * Verifies an EntityType message. + * @param message Plain 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 EntityType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.EntityType; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @param message EntityType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.EntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EntityType { + + /** Kind enum. */ + enum Kind { + KIND_UNSPECIFIED = 0, + KIND_MAP = 1, + KIND_LIST = 2, + KIND_REGEXP = 3 + } + + /** AutoExpansionMode enum. */ + enum AutoExpansionMode { + AUTO_EXPANSION_MODE_UNSPECIFIED = 0, + AUTO_EXPANSION_MODE_DEFAULT = 1 + } + + /** Properties of an Entity. */ + interface IEntity { + + /** Entity value */ + value?: (string|null); + + /** Entity synonyms */ + synonyms?: (string[]|null); + } + + /** Represents an Entity. */ + class Entity implements IEntity { + + /** + * Constructs a new Entity. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.EntityType.IEntity); + + /** Entity value. */ + public value: string; + + /** Entity synonyms. */ + public synonyms: string[]; + + /** + * Creates a new Entity instance using the specified properties. + * @param [properties] Properties to set + * @returns Entity instance + */ + public static create(properties?: google.cloud.dialogflow.v2.EntityType.IEntity): google.cloud.dialogflow.v2.EntityType.Entity; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.dialogflow.v2.EntityType.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.EntityType.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EntityType.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.EntityType.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.EntityType.Entity; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.EntityType.Entity; + + /** + * Verifies an Entity message. + * @param message Plain 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 Entity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entity + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.EntityType.Entity; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @param message Entity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.EntityType.Entity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entity + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ListEntityTypesRequest. */ + interface IListEntityTypesRequest { + + /** ListEntityTypesRequest parent */ + parent?: (string|null); + + /** ListEntityTypesRequest languageCode */ + languageCode?: (string|null); + + /** ListEntityTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListEntityTypesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListEntityTypesRequest. */ + class ListEntityTypesRequest implements IListEntityTypesRequest { + + /** + * Constructs a new ListEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListEntityTypesRequest); + + /** ListEntityTypesRequest parent. */ + public parent: string; + + /** ListEntityTypesRequest languageCode. */ + public languageCode: string; + + /** ListEntityTypesRequest pageSize. */ + public pageSize: number; + + /** ListEntityTypesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListEntityTypesRequest): google.cloud.dialogflow.v2.ListEntityTypesRequest; + + /** + * Encodes the specified ListEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListEntityTypesRequest.verify|verify} messages. + * @param message ListEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListEntityTypesRequest.verify|verify} messages. + * @param message ListEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListEntityTypesRequest; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListEntityTypesRequest; + + /** + * Verifies a ListEntityTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListEntityTypesRequest; + + /** + * Creates a plain object from a ListEntityTypesRequest message. Also converts values to other types if specified. + * @param message ListEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEntityTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEntityTypesResponse. */ + interface IListEntityTypesResponse { + + /** ListEntityTypesResponse entityTypes */ + entityTypes?: (google.cloud.dialogflow.v2.IEntityType[]|null); + + /** ListEntityTypesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListEntityTypesResponse. */ + class ListEntityTypesResponse implements IListEntityTypesResponse { + + /** + * Constructs a new ListEntityTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListEntityTypesResponse); + + /** ListEntityTypesResponse entityTypes. */ + public entityTypes: google.cloud.dialogflow.v2.IEntityType[]; + + /** ListEntityTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListEntityTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEntityTypesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListEntityTypesResponse): google.cloud.dialogflow.v2.ListEntityTypesResponse; + + /** + * Encodes the specified ListEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListEntityTypesResponse.verify|verify} messages. + * @param message ListEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListEntityTypesResponse.verify|verify} messages. + * @param message ListEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListEntityTypesResponse; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListEntityTypesResponse; + + /** + * Verifies a ListEntityTypesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEntityTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListEntityTypesResponse; + + /** + * Creates a plain object from a ListEntityTypesResponse message. Also converts values to other types if specified. + * @param message ListEntityTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListEntityTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEntityTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEntityTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetEntityTypeRequest. */ + interface IGetEntityTypeRequest { + + /** GetEntityTypeRequest name */ + name?: (string|null); + + /** GetEntityTypeRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a GetEntityTypeRequest. */ + class GetEntityTypeRequest implements IGetEntityTypeRequest { + + /** + * Constructs a new GetEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetEntityTypeRequest); + + /** GetEntityTypeRequest name. */ + public name: string; + + /** GetEntityTypeRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new GetEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetEntityTypeRequest): google.cloud.dialogflow.v2.GetEntityTypeRequest; + + /** + * Encodes the specified GetEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetEntityTypeRequest.verify|verify} messages. + * @param message GetEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetEntityTypeRequest.verify|verify} messages. + * @param message GetEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetEntityTypeRequest; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetEntityTypeRequest; + + /** + * Verifies a GetEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetEntityTypeRequest; + + /** + * Creates a plain object from a GetEntityTypeRequest message. Also converts values to other types if specified. + * @param message GetEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateEntityTypeRequest. */ + interface ICreateEntityTypeRequest { + + /** CreateEntityTypeRequest parent */ + parent?: (string|null); + + /** CreateEntityTypeRequest entityType */ + entityType?: (google.cloud.dialogflow.v2.IEntityType|null); + + /** CreateEntityTypeRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a CreateEntityTypeRequest. */ + class CreateEntityTypeRequest implements ICreateEntityTypeRequest { + + /** + * Constructs a new CreateEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateEntityTypeRequest); + + /** CreateEntityTypeRequest parent. */ + public parent: string; + + /** CreateEntityTypeRequest entityType. */ + public entityType?: (google.cloud.dialogflow.v2.IEntityType|null); + + /** CreateEntityTypeRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new CreateEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateEntityTypeRequest): google.cloud.dialogflow.v2.CreateEntityTypeRequest; + + /** + * Encodes the specified CreateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateEntityTypeRequest.verify|verify} messages. + * @param message CreateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateEntityTypeRequest.verify|verify} messages. + * @param message CreateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateEntityTypeRequest; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateEntityTypeRequest; + + /** + * Verifies a CreateEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateEntityTypeRequest; + + /** + * Creates a plain object from a CreateEntityTypeRequest message. Also converts values to other types if specified. + * @param message CreateEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateEntityTypeRequest. */ + interface IUpdateEntityTypeRequest { + + /** UpdateEntityTypeRequest entityType */ + entityType?: (google.cloud.dialogflow.v2.IEntityType|null); + + /** UpdateEntityTypeRequest languageCode */ + languageCode?: (string|null); + + /** UpdateEntityTypeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateEntityTypeRequest. */ + class UpdateEntityTypeRequest implements IUpdateEntityTypeRequest { + + /** + * Constructs a new UpdateEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateEntityTypeRequest); + + /** UpdateEntityTypeRequest entityType. */ + public entityType?: (google.cloud.dialogflow.v2.IEntityType|null); + + /** UpdateEntityTypeRequest languageCode. */ + public languageCode: string; + + /** UpdateEntityTypeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateEntityTypeRequest): google.cloud.dialogflow.v2.UpdateEntityTypeRequest; + + /** + * Encodes the specified UpdateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateEntityTypeRequest.verify|verify} messages. + * @param message UpdateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateEntityTypeRequest.verify|verify} messages. + * @param message UpdateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateEntityTypeRequest; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateEntityTypeRequest; + + /** + * Verifies an UpdateEntityTypeRequest message. + * @param message Plain 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 UpdateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateEntityTypeRequest; + + /** + * Creates a plain object from an UpdateEntityTypeRequest message. Also converts values to other types if specified. + * @param message UpdateEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteEntityTypeRequest. */ + interface IDeleteEntityTypeRequest { + + /** DeleteEntityTypeRequest name */ + name?: (string|null); + } + + /** Represents a DeleteEntityTypeRequest. */ + class DeleteEntityTypeRequest implements IDeleteEntityTypeRequest { + + /** + * Constructs a new DeleteEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteEntityTypeRequest); + + /** DeleteEntityTypeRequest name. */ + public name: string; + + /** + * Creates a new DeleteEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteEntityTypeRequest): google.cloud.dialogflow.v2.DeleteEntityTypeRequest; + + /** + * Encodes the specified DeleteEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteEntityTypeRequest.verify|verify} messages. + * @param message DeleteEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteEntityTypeRequest.verify|verify} messages. + * @param message DeleteEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteEntityTypeRequest; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteEntityTypeRequest; + + /** + * Verifies a DeleteEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteEntityTypeRequest; + + /** + * Creates a plain object from a DeleteEntityTypeRequest message. Also converts values to other types if specified. + * @param message DeleteEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateEntityTypesRequest. */ + interface IBatchUpdateEntityTypesRequest { + + /** BatchUpdateEntityTypesRequest parent */ + parent?: (string|null); + + /** BatchUpdateEntityTypesRequest entityTypeBatchUri */ + entityTypeBatchUri?: (string|null); + + /** BatchUpdateEntityTypesRequest entityTypeBatchInline */ + entityTypeBatchInline?: (google.cloud.dialogflow.v2.IEntityTypeBatch|null); + + /** BatchUpdateEntityTypesRequest languageCode */ + languageCode?: (string|null); + + /** BatchUpdateEntityTypesRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a BatchUpdateEntityTypesRequest. */ + class BatchUpdateEntityTypesRequest implements IBatchUpdateEntityTypesRequest { + + /** + * Constructs a new BatchUpdateEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest); + + /** BatchUpdateEntityTypesRequest parent. */ + public parent: string; + + /** BatchUpdateEntityTypesRequest entityTypeBatchUri. */ + public entityTypeBatchUri?: (string|null); + + /** BatchUpdateEntityTypesRequest entityTypeBatchInline. */ + public entityTypeBatchInline?: (google.cloud.dialogflow.v2.IEntityTypeBatch|null); + + /** BatchUpdateEntityTypesRequest languageCode. */ + public languageCode: string; + + /** BatchUpdateEntityTypesRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** BatchUpdateEntityTypesRequest entityTypeBatch. */ + public entityTypeBatch?: ("entityTypeBatchUri"|"entityTypeBatchInline"); + + /** + * Creates a new BatchUpdateEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest): google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest; + + /** + * Encodes the specified BatchUpdateEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.verify|verify} messages. + * @param message BatchUpdateEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.verify|verify} messages. + * @param message BatchUpdateEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest; + + /** + * Decodes a BatchUpdateEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest; + + /** + * Verifies a BatchUpdateEntityTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest; + + /** + * Creates a plain object from a BatchUpdateEntityTypesRequest message. Also converts values to other types if specified. + * @param message BatchUpdateEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateEntityTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateEntityTypesResponse. */ + interface IBatchUpdateEntityTypesResponse { + + /** BatchUpdateEntityTypesResponse entityTypes */ + entityTypes?: (google.cloud.dialogflow.v2.IEntityType[]|null); + } + + /** Represents a BatchUpdateEntityTypesResponse. */ + class BatchUpdateEntityTypesResponse implements IBatchUpdateEntityTypesResponse { + + /** + * Constructs a new BatchUpdateEntityTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse); + + /** BatchUpdateEntityTypesResponse entityTypes. */ + public entityTypes: google.cloud.dialogflow.v2.IEntityType[]; + + /** + * Creates a new BatchUpdateEntityTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateEntityTypesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse): google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse; + + /** + * Encodes the specified BatchUpdateEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse.verify|verify} messages. + * @param message BatchUpdateEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse.verify|verify} messages. + * @param message BatchUpdateEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateEntityTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse; + + /** + * Decodes a BatchUpdateEntityTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse; + + /** + * Verifies a BatchUpdateEntityTypesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateEntityTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse; + + /** + * Creates a plain object from a BatchUpdateEntityTypesResponse message. Also converts values to other types if specified. + * @param message BatchUpdateEntityTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateEntityTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateEntityTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDeleteEntityTypesRequest. */ + interface IBatchDeleteEntityTypesRequest { + + /** BatchDeleteEntityTypesRequest parent */ + parent?: (string|null); + + /** BatchDeleteEntityTypesRequest entityTypeNames */ + entityTypeNames?: (string[]|null); + } + + /** Represents a BatchDeleteEntityTypesRequest. */ + class BatchDeleteEntityTypesRequest implements IBatchDeleteEntityTypesRequest { + + /** + * Constructs a new BatchDeleteEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest); + + /** BatchDeleteEntityTypesRequest parent. */ + public parent: string; + + /** BatchDeleteEntityTypesRequest entityTypeNames. */ + public entityTypeNames: string[]; + + /** + * Creates a new BatchDeleteEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDeleteEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest): google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest; + + /** + * Encodes the specified BatchDeleteEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest.verify|verify} messages. + * @param message BatchDeleteEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDeleteEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest.verify|verify} messages. + * @param message BatchDeleteEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDeleteEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDeleteEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest; + + /** + * Decodes a BatchDeleteEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDeleteEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest; + + /** + * Verifies a BatchDeleteEntityTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDeleteEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDeleteEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest; + + /** + * Creates a plain object from a BatchDeleteEntityTypesRequest message. Also converts values to other types if specified. + * @param message BatchDeleteEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDeleteEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDeleteEntityTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchCreateEntitiesRequest. */ + interface IBatchCreateEntitiesRequest { + + /** BatchCreateEntitiesRequest parent */ + parent?: (string|null); + + /** BatchCreateEntitiesRequest entities */ + entities?: (google.cloud.dialogflow.v2.EntityType.IEntity[]|null); + + /** BatchCreateEntitiesRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a BatchCreateEntitiesRequest. */ + class BatchCreateEntitiesRequest implements IBatchCreateEntitiesRequest { + + /** + * Constructs a new BatchCreateEntitiesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest); + + /** BatchCreateEntitiesRequest parent. */ + public parent: string; + + /** BatchCreateEntitiesRequest entities. */ + public entities: google.cloud.dialogflow.v2.EntityType.IEntity[]; + + /** BatchCreateEntitiesRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new BatchCreateEntitiesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchCreateEntitiesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest): google.cloud.dialogflow.v2.BatchCreateEntitiesRequest; + + /** + * Encodes the specified BatchCreateEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchCreateEntitiesRequest.verify|verify} messages. + * @param message BatchCreateEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchCreateEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchCreateEntitiesRequest.verify|verify} messages. + * @param message BatchCreateEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchCreateEntitiesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchCreateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.BatchCreateEntitiesRequest; + + /** + * Decodes a BatchCreateEntitiesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchCreateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.BatchCreateEntitiesRequest; + + /** + * Verifies a BatchCreateEntitiesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchCreateEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchCreateEntitiesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.BatchCreateEntitiesRequest; + + /** + * Creates a plain object from a BatchCreateEntitiesRequest message. Also converts values to other types if specified. + * @param message BatchCreateEntitiesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.BatchCreateEntitiesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchCreateEntitiesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchCreateEntitiesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateEntitiesRequest. */ + interface IBatchUpdateEntitiesRequest { + + /** BatchUpdateEntitiesRequest parent */ + parent?: (string|null); + + /** BatchUpdateEntitiesRequest entities */ + entities?: (google.cloud.dialogflow.v2.EntityType.IEntity[]|null); + + /** BatchUpdateEntitiesRequest languageCode */ + languageCode?: (string|null); + + /** BatchUpdateEntitiesRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a BatchUpdateEntitiesRequest. */ + class BatchUpdateEntitiesRequest implements IBatchUpdateEntitiesRequest { + + /** + * Constructs a new BatchUpdateEntitiesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest); + + /** BatchUpdateEntitiesRequest parent. */ + public parent: string; + + /** BatchUpdateEntitiesRequest entities. */ + public entities: google.cloud.dialogflow.v2.EntityType.IEntity[]; + + /** BatchUpdateEntitiesRequest languageCode. */ + public languageCode: string; + + /** BatchUpdateEntitiesRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new BatchUpdateEntitiesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateEntitiesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest): google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest; + + /** + * Encodes the specified BatchUpdateEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.verify|verify} messages. + * @param message BatchUpdateEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.verify|verify} messages. + * @param message BatchUpdateEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateEntitiesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest; + + /** + * Decodes a BatchUpdateEntitiesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest; + + /** + * Verifies a BatchUpdateEntitiesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateEntitiesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest; + + /** + * Creates a plain object from a BatchUpdateEntitiesRequest message. Also converts values to other types if specified. + * @param message BatchUpdateEntitiesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateEntitiesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateEntitiesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDeleteEntitiesRequest. */ + interface IBatchDeleteEntitiesRequest { + + /** BatchDeleteEntitiesRequest parent */ + parent?: (string|null); + + /** BatchDeleteEntitiesRequest entityValues */ + entityValues?: (string[]|null); + + /** BatchDeleteEntitiesRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a BatchDeleteEntitiesRequest. */ + class BatchDeleteEntitiesRequest implements IBatchDeleteEntitiesRequest { + + /** + * Constructs a new BatchDeleteEntitiesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest); + + /** BatchDeleteEntitiesRequest parent. */ + public parent: string; + + /** BatchDeleteEntitiesRequest entityValues. */ + public entityValues: string[]; + + /** BatchDeleteEntitiesRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new BatchDeleteEntitiesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDeleteEntitiesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest): google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest; + + /** + * Encodes the specified BatchDeleteEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest.verify|verify} messages. + * @param message BatchDeleteEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDeleteEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest.verify|verify} messages. + * @param message BatchDeleteEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDeleteEntitiesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDeleteEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest; + + /** + * Decodes a BatchDeleteEntitiesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDeleteEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest; + + /** + * Verifies a BatchDeleteEntitiesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDeleteEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDeleteEntitiesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest; + + /** + * Creates a plain object from a BatchDeleteEntitiesRequest message. Also converts values to other types if specified. + * @param message BatchDeleteEntitiesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDeleteEntitiesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDeleteEntitiesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EntityTypeBatch. */ + interface IEntityTypeBatch { + + /** EntityTypeBatch entityTypes */ + entityTypes?: (google.cloud.dialogflow.v2.IEntityType[]|null); + } + + /** Represents an EntityTypeBatch. */ + class EntityTypeBatch implements IEntityTypeBatch { + + /** + * Constructs a new EntityTypeBatch. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IEntityTypeBatch); + + /** EntityTypeBatch entityTypes. */ + public entityTypes: google.cloud.dialogflow.v2.IEntityType[]; + + /** + * Creates a new EntityTypeBatch instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityTypeBatch instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IEntityTypeBatch): google.cloud.dialogflow.v2.EntityTypeBatch; + + /** + * Encodes the specified EntityTypeBatch message. Does not implicitly {@link google.cloud.dialogflow.v2.EntityTypeBatch.verify|verify} messages. + * @param message EntityTypeBatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IEntityTypeBatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityTypeBatch message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EntityTypeBatch.verify|verify} messages. + * @param message EntityTypeBatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IEntityTypeBatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityTypeBatch message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityTypeBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.EntityTypeBatch; + + /** + * Decodes an EntityTypeBatch message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityTypeBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.EntityTypeBatch; + + /** + * Verifies an EntityTypeBatch message. + * @param message Plain 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 EntityTypeBatch message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityTypeBatch + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.EntityTypeBatch; + + /** + * Creates a plain object from an EntityTypeBatch message. Also converts values to other types if specified. + * @param message EntityTypeBatch + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.EntityTypeBatch, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityTypeBatch to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityTypeBatch + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Conversations */ + class Conversations extends $protobuf.rpc.Service { + + /** + * Constructs a new Conversations 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 Conversations 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): Conversations; + + /** + * Calls CreateConversation. + * @param request CreateConversationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Conversation + */ + public createConversation(request: google.cloud.dialogflow.v2.ICreateConversationRequest, callback: google.cloud.dialogflow.v2.Conversations.CreateConversationCallback): void; + + /** + * Calls CreateConversation. + * @param request CreateConversationRequest message or plain object + * @returns Promise + */ + public createConversation(request: google.cloud.dialogflow.v2.ICreateConversationRequest): Promise; + + /** + * Calls ListConversations. + * @param request ListConversationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListConversationsResponse + */ + public listConversations(request: google.cloud.dialogflow.v2.IListConversationsRequest, callback: google.cloud.dialogflow.v2.Conversations.ListConversationsCallback): void; + + /** + * Calls ListConversations. + * @param request ListConversationsRequest message or plain object + * @returns Promise + */ + public listConversations(request: google.cloud.dialogflow.v2.IListConversationsRequest): Promise; + + /** + * Calls GetConversation. + * @param request GetConversationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Conversation + */ + public getConversation(request: google.cloud.dialogflow.v2.IGetConversationRequest, callback: google.cloud.dialogflow.v2.Conversations.GetConversationCallback): void; + + /** + * Calls GetConversation. + * @param request GetConversationRequest message or plain object + * @returns Promise + */ + public getConversation(request: google.cloud.dialogflow.v2.IGetConversationRequest): Promise; + + /** + * Calls CompleteConversation. + * @param request CompleteConversationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Conversation + */ + public completeConversation(request: google.cloud.dialogflow.v2.ICompleteConversationRequest, callback: google.cloud.dialogflow.v2.Conversations.CompleteConversationCallback): void; + + /** + * Calls CompleteConversation. + * @param request CompleteConversationRequest message or plain object + * @returns Promise + */ + public completeConversation(request: google.cloud.dialogflow.v2.ICompleteConversationRequest): Promise; + + /** + * Calls ListMessages. + * @param request ListMessagesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListMessagesResponse + */ + public listMessages(request: google.cloud.dialogflow.v2.IListMessagesRequest, callback: google.cloud.dialogflow.v2.Conversations.ListMessagesCallback): void; + + /** + * Calls ListMessages. + * @param request ListMessagesRequest message or plain object + * @returns Promise + */ + public listMessages(request: google.cloud.dialogflow.v2.IListMessagesRequest): Promise; + } + + namespace Conversations { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|createConversation}. + * @param error Error, if any + * @param [response] Conversation + */ + type CreateConversationCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Conversation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|listConversations}. + * @param error Error, if any + * @param [response] ListConversationsResponse + */ + type ListConversationsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListConversationsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|getConversation}. + * @param error Error, if any + * @param [response] Conversation + */ + type GetConversationCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Conversation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|completeConversation}. + * @param error Error, if any + * @param [response] Conversation + */ + type CompleteConversationCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Conversation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|listMessages}. + * @param error Error, if any + * @param [response] ListMessagesResponse + */ + type ListMessagesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListMessagesResponse) => void; + } + + /** Properties of a Conversation. */ + interface IConversation { + + /** Conversation name */ + name?: (string|null); + + /** Conversation lifecycleState */ + lifecycleState?: (google.cloud.dialogflow.v2.Conversation.LifecycleState|keyof typeof google.cloud.dialogflow.v2.Conversation.LifecycleState|null); + + /** Conversation conversationProfile */ + conversationProfile?: (string|null); + + /** Conversation phoneNumber */ + phoneNumber?: (google.cloud.dialogflow.v2.IConversationPhoneNumber|null); + + /** Conversation startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** Conversation endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** Conversation conversationStage */ + conversationStage?: (google.cloud.dialogflow.v2.Conversation.ConversationStage|keyof typeof google.cloud.dialogflow.v2.Conversation.ConversationStage|null); + } + + /** Represents a Conversation. */ + class Conversation implements IConversation { + + /** + * Constructs a new Conversation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IConversation); + + /** Conversation name. */ + public name: string; + + /** Conversation lifecycleState. */ + public lifecycleState: (google.cloud.dialogflow.v2.Conversation.LifecycleState|keyof typeof google.cloud.dialogflow.v2.Conversation.LifecycleState); + + /** Conversation conversationProfile. */ + public conversationProfile: string; + + /** Conversation phoneNumber. */ + public phoneNumber?: (google.cloud.dialogflow.v2.IConversationPhoneNumber|null); + + /** Conversation startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** Conversation endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** Conversation conversationStage. */ + public conversationStage: (google.cloud.dialogflow.v2.Conversation.ConversationStage|keyof typeof google.cloud.dialogflow.v2.Conversation.ConversationStage); + + /** + * Creates a new Conversation instance using the specified properties. + * @param [properties] Properties to set + * @returns Conversation instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IConversation): google.cloud.dialogflow.v2.Conversation; + + /** + * Encodes the specified Conversation message. Does not implicitly {@link google.cloud.dialogflow.v2.Conversation.verify|verify} messages. + * @param message Conversation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IConversation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Conversation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Conversation.verify|verify} messages. + * @param message Conversation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IConversation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Conversation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Conversation; + + /** + * Decodes a Conversation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Conversation; + + /** + * Verifies a Conversation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Conversation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Conversation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Conversation; + + /** + * Creates a plain object from a Conversation message. Also converts values to other types if specified. + * @param message Conversation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Conversation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Conversation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Conversation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Conversation { + + /** LifecycleState enum. */ + enum LifecycleState { + LIFECYCLE_STATE_UNSPECIFIED = 0, + IN_PROGRESS = 1, + COMPLETED = 2 + } + + /** ConversationStage enum. */ + enum ConversationStage { + CONVERSATION_STAGE_UNSPECIFIED = 0, + VIRTUAL_AGENT_STAGE = 1, + HUMAN_ASSIST_STAGE = 2 + } + } + + /** Properties of a CreateConversationRequest. */ + interface ICreateConversationRequest { + + /** CreateConversationRequest parent */ + parent?: (string|null); + + /** CreateConversationRequest conversation */ + conversation?: (google.cloud.dialogflow.v2.IConversation|null); + + /** CreateConversationRequest conversationId */ + conversationId?: (string|null); + } + + /** Represents a CreateConversationRequest. */ + class CreateConversationRequest implements ICreateConversationRequest { + + /** + * Constructs a new CreateConversationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateConversationRequest); + + /** CreateConversationRequest parent. */ + public parent: string; + + /** CreateConversationRequest conversation. */ + public conversation?: (google.cloud.dialogflow.v2.IConversation|null); + + /** CreateConversationRequest conversationId. */ + public conversationId: string; + + /** + * Creates a new CreateConversationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateConversationRequest): google.cloud.dialogflow.v2.CreateConversationRequest; + + /** + * Encodes the specified CreateConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationRequest.verify|verify} messages. + * @param message CreateConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationRequest.verify|verify} messages. + * @param message CreateConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateConversationRequest; + + /** + * Decodes a CreateConversationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateConversationRequest; + + /** + * Verifies a CreateConversationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateConversationRequest; + + /** + * Creates a plain object from a CreateConversationRequest message. Also converts values to other types if specified. + * @param message CreateConversationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateConversationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationsRequest. */ + interface IListConversationsRequest { + + /** ListConversationsRequest parent */ + parent?: (string|null); + + /** ListConversationsRequest pageSize */ + pageSize?: (number|null); + + /** ListConversationsRequest pageToken */ + pageToken?: (string|null); + + /** ListConversationsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListConversationsRequest. */ + class ListConversationsRequest implements IListConversationsRequest { + + /** + * Constructs a new ListConversationsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationsRequest); + + /** ListConversationsRequest parent. */ + public parent: string; + + /** ListConversationsRequest pageSize. */ + public pageSize: number; + + /** ListConversationsRequest pageToken. */ + public pageToken: string; + + /** ListConversationsRequest filter. */ + public filter: string; + + /** + * Creates a new ListConversationsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationsRequest): google.cloud.dialogflow.v2.ListConversationsRequest; + + /** + * Encodes the specified ListConversationsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationsRequest.verify|verify} messages. + * @param message ListConversationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationsRequest.verify|verify} messages. + * @param message ListConversationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationsRequest; + + /** + * Decodes a ListConversationsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationsRequest; + + /** + * Verifies a ListConversationsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationsRequest; + + /** + * Creates a plain object from a ListConversationsRequest message. Also converts values to other types if specified. + * @param message ListConversationsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationsResponse. */ + interface IListConversationsResponse { + + /** ListConversationsResponse conversations */ + conversations?: (google.cloud.dialogflow.v2.IConversation[]|null); + + /** ListConversationsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListConversationsResponse. */ + class ListConversationsResponse implements IListConversationsResponse { + + /** + * Constructs a new ListConversationsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationsResponse); + + /** ListConversationsResponse conversations. */ + public conversations: google.cloud.dialogflow.v2.IConversation[]; + + /** ListConversationsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListConversationsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationsResponse): google.cloud.dialogflow.v2.ListConversationsResponse; + + /** + * Encodes the specified ListConversationsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationsResponse.verify|verify} messages. + * @param message ListConversationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationsResponse.verify|verify} messages. + * @param message ListConversationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationsResponse; + + /** + * Decodes a ListConversationsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationsResponse; + + /** + * Verifies a ListConversationsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationsResponse; + + /** + * Creates a plain object from a ListConversationsResponse message. Also converts values to other types if specified. + * @param message ListConversationsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetConversationRequest. */ + interface IGetConversationRequest { + + /** GetConversationRequest name */ + name?: (string|null); + } + + /** Represents a GetConversationRequest. */ + class GetConversationRequest implements IGetConversationRequest { + + /** + * Constructs a new GetConversationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetConversationRequest); + + /** GetConversationRequest name. */ + public name: string; + + /** + * Creates a new GetConversationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetConversationRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetConversationRequest): google.cloud.dialogflow.v2.GetConversationRequest; + + /** + * Encodes the specified GetConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationRequest.verify|verify} messages. + * @param message GetConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationRequest.verify|verify} messages. + * @param message GetConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetConversationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetConversationRequest; + + /** + * Decodes a GetConversationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetConversationRequest; + + /** + * Verifies a GetConversationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetConversationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetConversationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetConversationRequest; + + /** + * Creates a plain object from a GetConversationRequest message. Also converts values to other types if specified. + * @param message GetConversationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetConversationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetConversationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetConversationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CompleteConversationRequest. */ + interface ICompleteConversationRequest { + + /** CompleteConversationRequest name */ + name?: (string|null); + } + + /** Represents a CompleteConversationRequest. */ + class CompleteConversationRequest implements ICompleteConversationRequest { + + /** + * Constructs a new CompleteConversationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICompleteConversationRequest); + + /** CompleteConversationRequest name. */ + public name: string; + + /** + * Creates a new CompleteConversationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CompleteConversationRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICompleteConversationRequest): google.cloud.dialogflow.v2.CompleteConversationRequest; + + /** + * Encodes the specified CompleteConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CompleteConversationRequest.verify|verify} messages. + * @param message CompleteConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICompleteConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompleteConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CompleteConversationRequest.verify|verify} messages. + * @param message CompleteConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICompleteConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompleteConversationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompleteConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CompleteConversationRequest; + + /** + * Decodes a CompleteConversationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompleteConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CompleteConversationRequest; + + /** + * Verifies a CompleteConversationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompleteConversationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompleteConversationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CompleteConversationRequest; + + /** + * Creates a plain object from a CompleteConversationRequest message. Also converts values to other types if specified. + * @param message CompleteConversationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CompleteConversationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompleteConversationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompleteConversationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMessagesRequest. */ + interface IListMessagesRequest { + + /** ListMessagesRequest parent */ + parent?: (string|null); + + /** ListMessagesRequest filter */ + filter?: (string|null); + + /** ListMessagesRequest pageSize */ + pageSize?: (number|null); + + /** ListMessagesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListMessagesRequest. */ + class ListMessagesRequest implements IListMessagesRequest { + + /** + * Constructs a new ListMessagesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListMessagesRequest); + + /** ListMessagesRequest parent. */ + public parent: string; + + /** ListMessagesRequest filter. */ + public filter: string; + + /** ListMessagesRequest pageSize. */ + public pageSize: number; + + /** ListMessagesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListMessagesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMessagesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListMessagesRequest): google.cloud.dialogflow.v2.ListMessagesRequest; + + /** + * Encodes the specified ListMessagesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListMessagesRequest.verify|verify} messages. + * @param message ListMessagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListMessagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMessagesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListMessagesRequest.verify|verify} messages. + * @param message ListMessagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListMessagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMessagesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListMessagesRequest; + + /** + * Decodes a ListMessagesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListMessagesRequest; + + /** + * Verifies a ListMessagesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMessagesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMessagesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListMessagesRequest; + + /** + * Creates a plain object from a ListMessagesRequest message. Also converts values to other types if specified. + * @param message ListMessagesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListMessagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMessagesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMessagesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMessagesResponse. */ + interface IListMessagesResponse { + + /** ListMessagesResponse messages */ + messages?: (google.cloud.dialogflow.v2.IMessage[]|null); + + /** ListMessagesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListMessagesResponse. */ + class ListMessagesResponse implements IListMessagesResponse { + + /** + * Constructs a new ListMessagesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListMessagesResponse); + + /** ListMessagesResponse messages. */ + public messages: google.cloud.dialogflow.v2.IMessage[]; + + /** ListMessagesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListMessagesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMessagesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListMessagesResponse): google.cloud.dialogflow.v2.ListMessagesResponse; + + /** + * Encodes the specified ListMessagesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListMessagesResponse.verify|verify} messages. + * @param message ListMessagesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListMessagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMessagesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListMessagesResponse.verify|verify} messages. + * @param message ListMessagesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListMessagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMessagesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListMessagesResponse; + + /** + * Decodes a ListMessagesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListMessagesResponse; + + /** + * Verifies a ListMessagesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMessagesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMessagesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListMessagesResponse; + + /** + * Creates a plain object from a ListMessagesResponse message. Also converts values to other types if specified. + * @param message ListMessagesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListMessagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMessagesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMessagesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ConversationPhoneNumber. */ + interface IConversationPhoneNumber { + + /** ConversationPhoneNumber phoneNumber */ + phoneNumber?: (string|null); + } + + /** Represents a ConversationPhoneNumber. */ + class ConversationPhoneNumber implements IConversationPhoneNumber { + + /** + * Constructs a new ConversationPhoneNumber. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IConversationPhoneNumber); + + /** ConversationPhoneNumber phoneNumber. */ + public phoneNumber: string; + + /** + * Creates a new ConversationPhoneNumber instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationPhoneNumber instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IConversationPhoneNumber): google.cloud.dialogflow.v2.ConversationPhoneNumber; + + /** + * Encodes the specified ConversationPhoneNumber message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationPhoneNumber.verify|verify} messages. + * @param message ConversationPhoneNumber message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IConversationPhoneNumber, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationPhoneNumber message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationPhoneNumber.verify|verify} messages. + * @param message ConversationPhoneNumber message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IConversationPhoneNumber, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationPhoneNumber message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationPhoneNumber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ConversationPhoneNumber; + + /** + * Decodes a ConversationPhoneNumber message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationPhoneNumber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ConversationPhoneNumber; + + /** + * Verifies a ConversationPhoneNumber message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationPhoneNumber message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationPhoneNumber + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ConversationPhoneNumber; + + /** + * Creates a plain object from a ConversationPhoneNumber message. Also converts values to other types if specified. + * @param message ConversationPhoneNumber + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ConversationPhoneNumber, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationPhoneNumber to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationPhoneNumber + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a ConversationDatasets */ + class ConversationDatasets extends $protobuf.rpc.Service { + + /** + * Constructs a new ConversationDatasets 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 ConversationDatasets 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): ConversationDatasets; + + /** + * Calls CreateConversationDataset. + * @param request CreateConversationDatasetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createConversationDataset(request: google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, callback: google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDatasetCallback): void; + + /** + * Calls CreateConversationDataset. + * @param request CreateConversationDatasetRequest message or plain object + * @returns Promise + */ + public createConversationDataset(request: google.cloud.dialogflow.v2.ICreateConversationDatasetRequest): Promise; + + /** + * Calls GetConversationDataset. + * @param request GetConversationDatasetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConversationDataset + */ + public getConversationDataset(request: google.cloud.dialogflow.v2.IGetConversationDatasetRequest, callback: google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDatasetCallback): void; + + /** + * Calls GetConversationDataset. + * @param request GetConversationDatasetRequest message or plain object + * @returns Promise + */ + public getConversationDataset(request: google.cloud.dialogflow.v2.IGetConversationDatasetRequest): Promise; + + /** + * Calls ListConversationDatasets. + * @param request ListConversationDatasetsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListConversationDatasetsResponse + */ + public listConversationDatasets(request: google.cloud.dialogflow.v2.IListConversationDatasetsRequest, callback: google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasetsCallback): void; + + /** + * Calls ListConversationDatasets. + * @param request ListConversationDatasetsRequest message or plain object + * @returns Promise + */ + public listConversationDatasets(request: google.cloud.dialogflow.v2.IListConversationDatasetsRequest): Promise; + + /** + * Calls DeleteConversationDataset. + * @param request DeleteConversationDatasetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteConversationDataset(request: google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, callback: google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDatasetCallback): void; + + /** + * Calls DeleteConversationDataset. + * @param request DeleteConversationDatasetRequest message or plain object + * @returns Promise + */ + public deleteConversationDataset(request: google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest): Promise; + + /** + * Calls ImportConversationData. + * @param request ImportConversationDataRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importConversationData(request: google.cloud.dialogflow.v2.IImportConversationDataRequest, callback: google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationDataCallback): void; + + /** + * Calls ImportConversationData. + * @param request ImportConversationDataRequest message or plain object + * @returns Promise + */ + public importConversationData(request: google.cloud.dialogflow.v2.IImportConversationDataRequest): Promise; + } + + namespace ConversationDatasets { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|createConversationDataset}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateConversationDatasetCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|getConversationDataset}. + * @param error Error, if any + * @param [response] ConversationDataset + */ + type GetConversationDatasetCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ConversationDataset) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|listConversationDatasets}. + * @param error Error, if any + * @param [response] ListConversationDatasetsResponse + */ + type ListConversationDatasetsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListConversationDatasetsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|deleteConversationDataset}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteConversationDatasetCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|importConversationData}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportConversationDataCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ConversationInfo. */ + interface IConversationInfo { + + /** ConversationInfo languageCode */ + languageCode?: (string|null); + } + + /** Represents a ConversationInfo. */ + class ConversationInfo implements IConversationInfo { + + /** + * Constructs a new ConversationInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IConversationInfo); + + /** ConversationInfo languageCode. */ + public languageCode: string; + + /** + * Creates a new ConversationInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationInfo instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IConversationInfo): google.cloud.dialogflow.v2.ConversationInfo; + + /** + * Encodes the specified ConversationInfo message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationInfo.verify|verify} messages. + * @param message ConversationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IConversationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationInfo.verify|verify} messages. + * @param message ConversationInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IConversationInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ConversationInfo; + + /** + * Decodes a ConversationInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ConversationInfo; + + /** + * Verifies a ConversationInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ConversationInfo; + + /** + * Creates a plain object from a ConversationInfo message. Also converts values to other types if specified. + * @param message ConversationInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ConversationInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationInfo + * @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.dialogflow.v2.IGcsSources|null); + } + + /** Represents an InputConfig. */ + class InputConfig implements IInputConfig { + + /** + * Constructs a new InputConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IInputConfig); + + /** InputConfig gcsSource. */ + public gcsSource?: (google.cloud.dialogflow.v2.IGcsSources|null); + + /** InputConfig source. */ + public source?: "gcsSource"; + + /** + * Creates a new InputConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InputConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IInputConfig): google.cloud.dialogflow.v2.InputConfig; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.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.dialogflow.v2.IInputConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.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 a ConversationDataset. */ + interface IConversationDataset { + + /** ConversationDataset name */ + name?: (string|null); + + /** ConversationDataset displayName */ + displayName?: (string|null); + + /** ConversationDataset description */ + description?: (string|null); + + /** ConversationDataset createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationDataset inputConfig */ + inputConfig?: (google.cloud.dialogflow.v2.IInputConfig|null); + + /** ConversationDataset conversationInfo */ + conversationInfo?: (google.cloud.dialogflow.v2.IConversationInfo|null); + + /** ConversationDataset conversationCount */ + conversationCount?: (number|Long|string|null); + } + + /** Represents a ConversationDataset. */ + class ConversationDataset implements IConversationDataset { + + /** + * Constructs a new ConversationDataset. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IConversationDataset); + + /** ConversationDataset name. */ + public name: string; + + /** ConversationDataset displayName. */ + public displayName: string; + + /** ConversationDataset description. */ + public description: string; + + /** ConversationDataset createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationDataset inputConfig. */ + public inputConfig?: (google.cloud.dialogflow.v2.IInputConfig|null); + + /** ConversationDataset conversationInfo. */ + public conversationInfo?: (google.cloud.dialogflow.v2.IConversationInfo|null); + + /** ConversationDataset conversationCount. */ + public conversationCount: (number|Long|string); + + /** + * Creates a new ConversationDataset instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationDataset instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IConversationDataset): google.cloud.dialogflow.v2.ConversationDataset; + + /** + * Encodes the specified ConversationDataset message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationDataset.verify|verify} messages. + * @param message ConversationDataset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IConversationDataset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationDataset message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationDataset.verify|verify} messages. + * @param message ConversationDataset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IConversationDataset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationDataset message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ConversationDataset; + + /** + * Decodes a ConversationDataset message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ConversationDataset; + + /** + * Verifies a ConversationDataset message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationDataset message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationDataset + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ConversationDataset; + + /** + * Creates a plain object from a ConversationDataset message. Also converts values to other types if specified. + * @param message ConversationDataset + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ConversationDataset, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationDataset to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationDataset + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateConversationDatasetRequest. */ + interface ICreateConversationDatasetRequest { + + /** CreateConversationDatasetRequest parent */ + parent?: (string|null); + + /** CreateConversationDatasetRequest conversationDataset */ + conversationDataset?: (google.cloud.dialogflow.v2.IConversationDataset|null); + } + + /** Represents a CreateConversationDatasetRequest. */ + class CreateConversationDatasetRequest implements ICreateConversationDatasetRequest { + + /** + * Constructs a new CreateConversationDatasetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateConversationDatasetRequest); + + /** CreateConversationDatasetRequest parent. */ + public parent: string; + + /** CreateConversationDatasetRequest conversationDataset. */ + public conversationDataset?: (google.cloud.dialogflow.v2.IConversationDataset|null); + + /** + * Creates a new CreateConversationDatasetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationDatasetRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateConversationDatasetRequest): google.cloud.dialogflow.v2.CreateConversationDatasetRequest; + + /** + * Encodes the specified CreateConversationDatasetRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationDatasetRequest.verify|verify} messages. + * @param message CreateConversationDatasetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationDatasetRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationDatasetRequest.verify|verify} messages. + * @param message CreateConversationDatasetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationDatasetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateConversationDatasetRequest; + + /** + * Decodes a CreateConversationDatasetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateConversationDatasetRequest; + + /** + * Verifies a CreateConversationDatasetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationDatasetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationDatasetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateConversationDatasetRequest; + + /** + * Creates a plain object from a CreateConversationDatasetRequest message. Also converts values to other types if specified. + * @param message CreateConversationDatasetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateConversationDatasetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationDatasetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationDatasetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetConversationDatasetRequest. */ + interface IGetConversationDatasetRequest { + + /** GetConversationDatasetRequest name */ + name?: (string|null); + } + + /** Represents a GetConversationDatasetRequest. */ + class GetConversationDatasetRequest implements IGetConversationDatasetRequest { + + /** + * Constructs a new GetConversationDatasetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetConversationDatasetRequest); + + /** GetConversationDatasetRequest name. */ + public name: string; + + /** + * Creates a new GetConversationDatasetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetConversationDatasetRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetConversationDatasetRequest): google.cloud.dialogflow.v2.GetConversationDatasetRequest; + + /** + * Encodes the specified GetConversationDatasetRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationDatasetRequest.verify|verify} messages. + * @param message GetConversationDatasetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetConversationDatasetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetConversationDatasetRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationDatasetRequest.verify|verify} messages. + * @param message GetConversationDatasetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetConversationDatasetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetConversationDatasetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetConversationDatasetRequest; + + /** + * Decodes a GetConversationDatasetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetConversationDatasetRequest; + + /** + * Verifies a GetConversationDatasetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetConversationDatasetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetConversationDatasetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetConversationDatasetRequest; + + /** + * Creates a plain object from a GetConversationDatasetRequest message. Also converts values to other types if specified. + * @param message GetConversationDatasetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetConversationDatasetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetConversationDatasetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetConversationDatasetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationDatasetsRequest. */ + interface IListConversationDatasetsRequest { + + /** ListConversationDatasetsRequest parent */ + parent?: (string|null); + + /** ListConversationDatasetsRequest pageSize */ + pageSize?: (number|null); + + /** ListConversationDatasetsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListConversationDatasetsRequest. */ + class ListConversationDatasetsRequest implements IListConversationDatasetsRequest { + + /** + * Constructs a new ListConversationDatasetsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationDatasetsRequest); + + /** ListConversationDatasetsRequest parent. */ + public parent: string; + + /** ListConversationDatasetsRequest pageSize. */ + public pageSize: number; + + /** ListConversationDatasetsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListConversationDatasetsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationDatasetsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationDatasetsRequest): google.cloud.dialogflow.v2.ListConversationDatasetsRequest; + + /** + * Encodes the specified ListConversationDatasetsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationDatasetsRequest.verify|verify} messages. + * @param message ListConversationDatasetsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationDatasetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationDatasetsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationDatasetsRequest.verify|verify} messages. + * @param message ListConversationDatasetsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationDatasetsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationDatasetsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationDatasetsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationDatasetsRequest; + + /** + * Decodes a ListConversationDatasetsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationDatasetsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationDatasetsRequest; + + /** + * Verifies a ListConversationDatasetsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationDatasetsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationDatasetsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationDatasetsRequest; + + /** + * Creates a plain object from a ListConversationDatasetsRequest message. Also converts values to other types if specified. + * @param message ListConversationDatasetsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationDatasetsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationDatasetsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationDatasetsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationDatasetsResponse. */ + interface IListConversationDatasetsResponse { + + /** ListConversationDatasetsResponse conversationDatasets */ + conversationDatasets?: (google.cloud.dialogflow.v2.IConversationDataset[]|null); + + /** ListConversationDatasetsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListConversationDatasetsResponse. */ + class ListConversationDatasetsResponse implements IListConversationDatasetsResponse { + + /** + * Constructs a new ListConversationDatasetsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationDatasetsResponse); + + /** ListConversationDatasetsResponse conversationDatasets. */ + public conversationDatasets: google.cloud.dialogflow.v2.IConversationDataset[]; + + /** ListConversationDatasetsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListConversationDatasetsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationDatasetsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationDatasetsResponse): google.cloud.dialogflow.v2.ListConversationDatasetsResponse; + + /** + * Encodes the specified ListConversationDatasetsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationDatasetsResponse.verify|verify} messages. + * @param message ListConversationDatasetsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationDatasetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationDatasetsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationDatasetsResponse.verify|verify} messages. + * @param message ListConversationDatasetsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationDatasetsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationDatasetsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationDatasetsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationDatasetsResponse; + + /** + * Decodes a ListConversationDatasetsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationDatasetsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationDatasetsResponse; + + /** + * Verifies a ListConversationDatasetsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationDatasetsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationDatasetsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationDatasetsResponse; + + /** + * Creates a plain object from a ListConversationDatasetsResponse message. Also converts values to other types if specified. + * @param message ListConversationDatasetsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationDatasetsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationDatasetsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationDatasetsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteConversationDatasetRequest. */ + interface IDeleteConversationDatasetRequest { + + /** DeleteConversationDatasetRequest name */ + name?: (string|null); + } + + /** Represents a DeleteConversationDatasetRequest. */ + class DeleteConversationDatasetRequest implements IDeleteConversationDatasetRequest { + + /** + * Constructs a new DeleteConversationDatasetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest); + + /** DeleteConversationDatasetRequest name. */ + public name: string; + + /** + * Creates a new DeleteConversationDatasetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteConversationDatasetRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest): google.cloud.dialogflow.v2.DeleteConversationDatasetRequest; + + /** + * Encodes the specified DeleteConversationDatasetRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationDatasetRequest.verify|verify} messages. + * @param message DeleteConversationDatasetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteConversationDatasetRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationDatasetRequest.verify|verify} messages. + * @param message DeleteConversationDatasetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteConversationDatasetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteConversationDatasetRequest; + + /** + * Decodes a DeleteConversationDatasetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteConversationDatasetRequest; + + /** + * Verifies a DeleteConversationDatasetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteConversationDatasetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteConversationDatasetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteConversationDatasetRequest; + + /** + * Creates a plain object from a DeleteConversationDatasetRequest message. Also converts values to other types if specified. + * @param message DeleteConversationDatasetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteConversationDatasetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteConversationDatasetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteConversationDatasetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportConversationDataRequest. */ + interface IImportConversationDataRequest { + + /** ImportConversationDataRequest name */ + name?: (string|null); + + /** ImportConversationDataRequest inputConfig */ + inputConfig?: (google.cloud.dialogflow.v2.IInputConfig|null); + } + + /** Represents an ImportConversationDataRequest. */ + class ImportConversationDataRequest implements IImportConversationDataRequest { + + /** + * Constructs a new ImportConversationDataRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IImportConversationDataRequest); + + /** ImportConversationDataRequest name. */ + public name: string; + + /** ImportConversationDataRequest inputConfig. */ + public inputConfig?: (google.cloud.dialogflow.v2.IInputConfig|null); + + /** + * Creates a new ImportConversationDataRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportConversationDataRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IImportConversationDataRequest): google.cloud.dialogflow.v2.ImportConversationDataRequest; + + /** + * Encodes the specified ImportConversationDataRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataRequest.verify|verify} messages. + * @param message ImportConversationDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IImportConversationDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportConversationDataRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataRequest.verify|verify} messages. + * @param message ImportConversationDataRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IImportConversationDataRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportConversationDataRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportConversationDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ImportConversationDataRequest; + + /** + * Decodes an ImportConversationDataRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportConversationDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ImportConversationDataRequest; + + /** + * Verifies an ImportConversationDataRequest message. + * @param message Plain 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 ImportConversationDataRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportConversationDataRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ImportConversationDataRequest; + + /** + * Creates a plain object from an ImportConversationDataRequest message. Also converts values to other types if specified. + * @param message ImportConversationDataRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ImportConversationDataRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportConversationDataRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportConversationDataRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportConversationDataOperationMetadata. */ + interface IImportConversationDataOperationMetadata { + + /** ImportConversationDataOperationMetadata conversationDataset */ + conversationDataset?: (string|null); + + /** ImportConversationDataOperationMetadata partialFailures */ + partialFailures?: (google.rpc.IStatus[]|null); + + /** ImportConversationDataOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an ImportConversationDataOperationMetadata. */ + class ImportConversationDataOperationMetadata implements IImportConversationDataOperationMetadata { + + /** + * Constructs a new ImportConversationDataOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata); + + /** ImportConversationDataOperationMetadata conversationDataset. */ + public conversationDataset: string; + + /** ImportConversationDataOperationMetadata partialFailures. */ + public partialFailures: google.rpc.IStatus[]; + + /** ImportConversationDataOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ImportConversationDataOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportConversationDataOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata): google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata; + + /** + * Encodes the specified ImportConversationDataOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata.verify|verify} messages. + * @param message ImportConversationDataOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportConversationDataOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata.verify|verify} messages. + * @param message ImportConversationDataOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportConversationDataOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportConversationDataOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata; + + /** + * Decodes an ImportConversationDataOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportConversationDataOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata; + + /** + * Verifies an ImportConversationDataOperationMetadata message. + * @param message Plain 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 ImportConversationDataOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportConversationDataOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata; + + /** + * Creates a plain object from an ImportConversationDataOperationMetadata message. Also converts values to other types if specified. + * @param message ImportConversationDataOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportConversationDataOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportConversationDataOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportConversationDataOperationResponse. */ + interface IImportConversationDataOperationResponse { + + /** ImportConversationDataOperationResponse conversationDataset */ + conversationDataset?: (string|null); + + /** ImportConversationDataOperationResponse importCount */ + importCount?: (number|null); + } + + /** Represents an ImportConversationDataOperationResponse. */ + class ImportConversationDataOperationResponse implements IImportConversationDataOperationResponse { + + /** + * Constructs a new ImportConversationDataOperationResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IImportConversationDataOperationResponse); + + /** ImportConversationDataOperationResponse conversationDataset. */ + public conversationDataset: string; + + /** ImportConversationDataOperationResponse importCount. */ + public importCount: number; + + /** + * Creates a new ImportConversationDataOperationResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportConversationDataOperationResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IImportConversationDataOperationResponse): google.cloud.dialogflow.v2.ImportConversationDataOperationResponse; + + /** + * Encodes the specified ImportConversationDataOperationResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataOperationResponse.verify|verify} messages. + * @param message ImportConversationDataOperationResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportConversationDataOperationResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataOperationResponse.verify|verify} messages. + * @param message ImportConversationDataOperationResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportConversationDataOperationResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportConversationDataOperationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ImportConversationDataOperationResponse; + + /** + * Decodes an ImportConversationDataOperationResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportConversationDataOperationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ImportConversationDataOperationResponse; + + /** + * Verifies an ImportConversationDataOperationResponse message. + * @param message Plain 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 ImportConversationDataOperationResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportConversationDataOperationResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ImportConversationDataOperationResponse; + + /** + * Creates a plain object from an ImportConversationDataOperationResponse message. Also converts values to other types if specified. + * @param message ImportConversationDataOperationResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ImportConversationDataOperationResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportConversationDataOperationResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportConversationDataOperationResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateConversationDatasetOperationMetadata. */ + interface ICreateConversationDatasetOperationMetadata { + + /** CreateConversationDatasetOperationMetadata conversationDataset */ + conversationDataset?: (string|null); + } + + /** Represents a CreateConversationDatasetOperationMetadata. */ + class CreateConversationDatasetOperationMetadata implements ICreateConversationDatasetOperationMetadata { + + /** + * Constructs a new CreateConversationDatasetOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata); + + /** CreateConversationDatasetOperationMetadata conversationDataset. */ + public conversationDataset: string; + + /** + * Creates a new CreateConversationDatasetOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationDatasetOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata): google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata; + + /** + * Encodes the specified CreateConversationDatasetOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata.verify|verify} messages. + * @param message CreateConversationDatasetOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationDatasetOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata.verify|verify} messages. + * @param message CreateConversationDatasetOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationDatasetOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata; + + /** + * Decodes a CreateConversationDatasetOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata; + + /** + * Verifies a CreateConversationDatasetOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationDatasetOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationDatasetOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata; + + /** + * Creates a plain object from a CreateConversationDatasetOperationMetadata message. Also converts values to other types if specified. + * @param message CreateConversationDatasetOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationDatasetOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationDatasetOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteConversationDatasetOperationMetadata. */ + interface IDeleteConversationDatasetOperationMetadata { + } + + /** Represents a DeleteConversationDatasetOperationMetadata. */ + class DeleteConversationDatasetOperationMetadata implements IDeleteConversationDatasetOperationMetadata { + + /** + * Constructs a new DeleteConversationDatasetOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata); + + /** + * Creates a new DeleteConversationDatasetOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteConversationDatasetOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata): google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata; + + /** + * Encodes the specified DeleteConversationDatasetOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata.verify|verify} messages. + * @param message DeleteConversationDatasetOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteConversationDatasetOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata.verify|verify} messages. + * @param message DeleteConversationDatasetOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteConversationDatasetOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteConversationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata; + + /** + * Decodes a DeleteConversationDatasetOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteConversationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata; + + /** + * Verifies a DeleteConversationDatasetOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteConversationDatasetOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteConversationDatasetOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata; + + /** + * Creates a plain object from a DeleteConversationDatasetOperationMetadata message. Also converts values to other types if specified. + * @param message DeleteConversationDatasetOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteConversationDatasetOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteConversationDatasetOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GcsSources. */ + interface IGcsSources { + + /** GcsSources uris */ + uris?: (string[]|null); + } + + /** Represents a GcsSources. */ + class GcsSources implements IGcsSources { + + /** + * Constructs a new GcsSources. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGcsSources); + + /** GcsSources uris. */ + public uris: string[]; + + /** + * Creates a new GcsSources instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSources instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGcsSources): google.cloud.dialogflow.v2.GcsSources; + + /** + * Encodes the specified GcsSources message. Does not implicitly {@link google.cloud.dialogflow.v2.GcsSources.verify|verify} messages. + * @param message GcsSources message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGcsSources, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSources message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GcsSources.verify|verify} messages. + * @param message GcsSources message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGcsSources, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsSources message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSources + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GcsSources; + + /** + * Decodes a GcsSources message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSources + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GcsSources; + + /** + * Verifies a GcsSources message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsSources message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSources + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GcsSources; + + /** + * Creates a plain object from a GcsSources message. Also converts values to other types if specified. + * @param message GcsSources + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GcsSources, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSources to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsSources + * @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.dialogflow.v2.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.dialogflow.v2.IGcsDestination): google.cloud.dialogflow.v2.GcsDestination; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.dialogflow.v2.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.dialogflow.v2.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.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 a ConversationEvent. */ + interface IConversationEvent { + + /** ConversationEvent conversation */ + conversation?: (string|null); + + /** ConversationEvent type */ + type?: (google.cloud.dialogflow.v2.ConversationEvent.Type|keyof typeof google.cloud.dialogflow.v2.ConversationEvent.Type|null); + + /** ConversationEvent errorStatus */ + errorStatus?: (google.rpc.IStatus|null); + + /** ConversationEvent newMessagePayload */ + newMessagePayload?: (google.cloud.dialogflow.v2.IMessage|null); + } + + /** Represents a ConversationEvent. */ + class ConversationEvent implements IConversationEvent { + + /** + * Constructs a new ConversationEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IConversationEvent); + + /** ConversationEvent conversation. */ + public conversation: string; + + /** ConversationEvent type. */ + public type: (google.cloud.dialogflow.v2.ConversationEvent.Type|keyof typeof google.cloud.dialogflow.v2.ConversationEvent.Type); + + /** ConversationEvent errorStatus. */ + public errorStatus?: (google.rpc.IStatus|null); + + /** ConversationEvent newMessagePayload. */ + public newMessagePayload?: (google.cloud.dialogflow.v2.IMessage|null); + + /** ConversationEvent payload. */ + public payload?: "newMessagePayload"; + + /** + * Creates a new ConversationEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationEvent instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IConversationEvent): google.cloud.dialogflow.v2.ConversationEvent; + + /** + * Encodes the specified ConversationEvent message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationEvent.verify|verify} messages. + * @param message ConversationEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IConversationEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationEvent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationEvent.verify|verify} messages. + * @param message ConversationEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IConversationEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ConversationEvent; + + /** + * Decodes a ConversationEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ConversationEvent; + + /** + * Verifies a ConversationEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ConversationEvent; + + /** + * Creates a plain object from a ConversationEvent message. Also converts values to other types if specified. + * @param message ConversationEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ConversationEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationEvent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ConversationEvent { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + CONVERSATION_STARTED = 1, + CONVERSATION_FINISHED = 2, + HUMAN_INTERVENTION_NEEDED = 3, + NEW_MESSAGE = 5, + UNRECOVERABLE_ERROR = 4 + } + } + + /** Represents a ConversationModels */ + class ConversationModels extends $protobuf.rpc.Service { + + /** + * Constructs a new ConversationModels 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 ConversationModels 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): ConversationModels; + + /** + * Calls CreateConversationModel. + * @param request CreateConversationModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createConversationModel(request: google.cloud.dialogflow.v2.ICreateConversationModelRequest, callback: google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelCallback): void; + + /** + * Calls CreateConversationModel. + * @param request CreateConversationModelRequest message or plain object + * @returns Promise + */ + public createConversationModel(request: google.cloud.dialogflow.v2.ICreateConversationModelRequest): Promise; + + /** + * Calls GetConversationModel. + * @param request GetConversationModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConversationModel + */ + public getConversationModel(request: google.cloud.dialogflow.v2.IGetConversationModelRequest, callback: google.cloud.dialogflow.v2.ConversationModels.GetConversationModelCallback): void; + + /** + * Calls GetConversationModel. + * @param request GetConversationModelRequest message or plain object + * @returns Promise + */ + public getConversationModel(request: google.cloud.dialogflow.v2.IGetConversationModelRequest): Promise; + + /** + * Calls ListConversationModels. + * @param request ListConversationModelsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListConversationModelsResponse + */ + public listConversationModels(request: google.cloud.dialogflow.v2.IListConversationModelsRequest, callback: google.cloud.dialogflow.v2.ConversationModels.ListConversationModelsCallback): void; + + /** + * Calls ListConversationModels. + * @param request ListConversationModelsRequest message or plain object + * @returns Promise + */ + public listConversationModels(request: google.cloud.dialogflow.v2.IListConversationModelsRequest): Promise; + + /** + * Calls DeleteConversationModel. + * @param request DeleteConversationModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteConversationModel(request: google.cloud.dialogflow.v2.IDeleteConversationModelRequest, callback: google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModelCallback): void; + + /** + * Calls DeleteConversationModel. + * @param request DeleteConversationModelRequest message or plain object + * @returns Promise + */ + public deleteConversationModel(request: google.cloud.dialogflow.v2.IDeleteConversationModelRequest): Promise; + + /** + * Calls DeployConversationModel. + * @param request DeployConversationModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deployConversationModel(request: google.cloud.dialogflow.v2.IDeployConversationModelRequest, callback: google.cloud.dialogflow.v2.ConversationModels.DeployConversationModelCallback): void; + + /** + * Calls DeployConversationModel. + * @param request DeployConversationModelRequest message or plain object + * @returns Promise + */ + public deployConversationModel(request: google.cloud.dialogflow.v2.IDeployConversationModelRequest): Promise; + + /** + * Calls UndeployConversationModel. + * @param request UndeployConversationModelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public undeployConversationModel(request: google.cloud.dialogflow.v2.IUndeployConversationModelRequest, callback: google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModelCallback): void; + + /** + * Calls UndeployConversationModel. + * @param request UndeployConversationModelRequest message or plain object + * @returns Promise + */ + public undeployConversationModel(request: google.cloud.dialogflow.v2.IUndeployConversationModelRequest): Promise; + + /** + * Calls GetConversationModelEvaluation. + * @param request GetConversationModelEvaluationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConversationModelEvaluation + */ + public getConversationModelEvaluation(request: google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, callback: google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluationCallback): void; + + /** + * Calls GetConversationModelEvaluation. + * @param request GetConversationModelEvaluationRequest message or plain object + * @returns Promise + */ + public getConversationModelEvaluation(request: google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest): Promise; + + /** + * Calls ListConversationModelEvaluations. + * @param request ListConversationModelEvaluationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListConversationModelEvaluationsResponse + */ + public listConversationModelEvaluations(request: google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, callback: google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluationsCallback): void; + + /** + * Calls ListConversationModelEvaluations. + * @param request ListConversationModelEvaluationsRequest message or plain object + * @returns Promise + */ + public listConversationModelEvaluations(request: google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest): Promise; + + /** + * Calls CreateConversationModelEvaluation. + * @param request CreateConversationModelEvaluationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createConversationModelEvaluation(request: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, callback: google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluationCallback): void; + + /** + * Calls CreateConversationModelEvaluation. + * @param request CreateConversationModelEvaluationRequest message or plain object + * @returns Promise + */ + public createConversationModelEvaluation(request: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest): Promise; + } + + namespace ConversationModels { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|createConversationModel}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateConversationModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|getConversationModel}. + * @param error Error, if any + * @param [response] ConversationModel + */ + type GetConversationModelCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ConversationModel) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|listConversationModels}. + * @param error Error, if any + * @param [response] ListConversationModelsResponse + */ + type ListConversationModelsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListConversationModelsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|deleteConversationModel}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteConversationModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|deployConversationModel}. + * @param error Error, if any + * @param [response] Operation + */ + type DeployConversationModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|undeployConversationModel}. + * @param error Error, if any + * @param [response] Operation + */ + type UndeployConversationModelCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|getConversationModelEvaluation}. + * @param error Error, if any + * @param [response] ConversationModelEvaluation + */ + type GetConversationModelEvaluationCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ConversationModelEvaluation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|listConversationModelEvaluations}. + * @param error Error, if any + * @param [response] ListConversationModelEvaluationsResponse + */ + type ListConversationModelEvaluationsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|createConversationModelEvaluation}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateConversationModelEvaluationCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ConversationModel. */ + interface IConversationModel { + + /** ConversationModel name */ + name?: (string|null); + + /** ConversationModel displayName */ + displayName?: (string|null); + + /** ConversationModel createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationModel datasets */ + datasets?: (google.cloud.dialogflow.v2.IInputDataset[]|null); + + /** ConversationModel state */ + state?: (google.cloud.dialogflow.v2.ConversationModel.State|keyof typeof google.cloud.dialogflow.v2.ConversationModel.State|null); + + /** ConversationModel languageCode */ + languageCode?: (string|null); + + /** ConversationModel articleSuggestionModelMetadata */ + articleSuggestionModelMetadata?: (google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata|null); + + /** ConversationModel smartReplyModelMetadata */ + smartReplyModelMetadata?: (google.cloud.dialogflow.v2.ISmartReplyModelMetadata|null); + } + + /** Represents a ConversationModel. */ + class ConversationModel implements IConversationModel { + + /** + * Constructs a new ConversationModel. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IConversationModel); + + /** ConversationModel name. */ + public name: string; + + /** ConversationModel displayName. */ + public displayName: string; + + /** ConversationModel createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationModel datasets. */ + public datasets: google.cloud.dialogflow.v2.IInputDataset[]; + + /** ConversationModel state. */ + public state: (google.cloud.dialogflow.v2.ConversationModel.State|keyof typeof google.cloud.dialogflow.v2.ConversationModel.State); + + /** ConversationModel languageCode. */ + public languageCode: string; + + /** ConversationModel articleSuggestionModelMetadata. */ + public articleSuggestionModelMetadata?: (google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata|null); + + /** ConversationModel smartReplyModelMetadata. */ + public smartReplyModelMetadata?: (google.cloud.dialogflow.v2.ISmartReplyModelMetadata|null); + + /** ConversationModel modelMetadata. */ + public modelMetadata?: ("articleSuggestionModelMetadata"|"smartReplyModelMetadata"); + + /** + * Creates a new ConversationModel instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationModel instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IConversationModel): google.cloud.dialogflow.v2.ConversationModel; + + /** + * Encodes the specified ConversationModel message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationModel.verify|verify} messages. + * @param message ConversationModel message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IConversationModel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationModel message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationModel.verify|verify} messages. + * @param message ConversationModel message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IConversationModel, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationModel message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationModel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ConversationModel; + + /** + * Decodes a ConversationModel message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationModel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ConversationModel; + + /** + * Verifies a ConversationModel message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationModel message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationModel + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ConversationModel; + + /** + * Creates a plain object from a ConversationModel message. Also converts values to other types if specified. + * @param message ConversationModel + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ConversationModel, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationModel to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationModel + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ConversationModel { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + UNDEPLOYED = 2, + DEPLOYING = 3, + DEPLOYED = 4, + UNDEPLOYING = 5, + DELETING = 6, + FAILED = 7, + PENDING = 8 + } + + /** ModelType enum. */ + enum ModelType { + MODEL_TYPE_UNSPECIFIED = 0, + SMART_REPLY_DUAL_ENCODER_MODEL = 2, + SMART_REPLY_BERT_MODEL = 6 + } + } + + /** Properties of a ConversationModelEvaluation. */ + interface IConversationModelEvaluation { + + /** ConversationModelEvaluation name */ + name?: (string|null); + + /** ConversationModelEvaluation displayName */ + displayName?: (string|null); + + /** ConversationModelEvaluation evaluationConfig */ + evaluationConfig?: (google.cloud.dialogflow.v2.IEvaluationConfig|null); + + /** ConversationModelEvaluation createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationModelEvaluation smartReplyMetrics */ + smartReplyMetrics?: (google.cloud.dialogflow.v2.ISmartReplyMetrics|null); + } + + /** Represents a ConversationModelEvaluation. */ + class ConversationModelEvaluation implements IConversationModelEvaluation { + + /** + * Constructs a new ConversationModelEvaluation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IConversationModelEvaluation); + + /** ConversationModelEvaluation name. */ + public name: string; + + /** ConversationModelEvaluation displayName. */ + public displayName: string; + + /** ConversationModelEvaluation evaluationConfig. */ + public evaluationConfig?: (google.cloud.dialogflow.v2.IEvaluationConfig|null); + + /** ConversationModelEvaluation createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationModelEvaluation smartReplyMetrics. */ + public smartReplyMetrics?: (google.cloud.dialogflow.v2.ISmartReplyMetrics|null); + + /** ConversationModelEvaluation metrics. */ + public metrics?: "smartReplyMetrics"; + + /** + * Creates a new ConversationModelEvaluation instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationModelEvaluation instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IConversationModelEvaluation): google.cloud.dialogflow.v2.ConversationModelEvaluation; + + /** + * Encodes the specified ConversationModelEvaluation message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationModelEvaluation.verify|verify} messages. + * @param message ConversationModelEvaluation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IConversationModelEvaluation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationModelEvaluation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationModelEvaluation.verify|verify} messages. + * @param message ConversationModelEvaluation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IConversationModelEvaluation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationModelEvaluation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationModelEvaluation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ConversationModelEvaluation; + + /** + * Decodes a ConversationModelEvaluation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationModelEvaluation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ConversationModelEvaluation; + + /** + * Verifies a ConversationModelEvaluation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationModelEvaluation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationModelEvaluation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ConversationModelEvaluation; + + /** + * Creates a plain object from a ConversationModelEvaluation message. Also converts values to other types if specified. + * @param message ConversationModelEvaluation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ConversationModelEvaluation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationModelEvaluation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationModelEvaluation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EvaluationConfig. */ + interface IEvaluationConfig { + + /** EvaluationConfig datasets */ + datasets?: (google.cloud.dialogflow.v2.IInputDataset[]|null); + + /** EvaluationConfig smartReplyConfig */ + smartReplyConfig?: (google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig|null); + + /** EvaluationConfig smartComposeConfig */ + smartComposeConfig?: (google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig|null); + } + + /** Represents an EvaluationConfig. */ + class EvaluationConfig implements IEvaluationConfig { + + /** + * Constructs a new EvaluationConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IEvaluationConfig); + + /** EvaluationConfig datasets. */ + public datasets: google.cloud.dialogflow.v2.IInputDataset[]; + + /** EvaluationConfig smartReplyConfig. */ + public smartReplyConfig?: (google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig|null); + + /** EvaluationConfig smartComposeConfig. */ + public smartComposeConfig?: (google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig|null); + + /** EvaluationConfig modelSpecificConfig. */ + public modelSpecificConfig?: ("smartReplyConfig"|"smartComposeConfig"); + + /** + * Creates a new EvaluationConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns EvaluationConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IEvaluationConfig): google.cloud.dialogflow.v2.EvaluationConfig; + + /** + * Encodes the specified EvaluationConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.verify|verify} messages. + * @param message EvaluationConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IEvaluationConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EvaluationConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.verify|verify} messages. + * @param message EvaluationConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IEvaluationConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EvaluationConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EvaluationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.EvaluationConfig; + + /** + * Decodes an EvaluationConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EvaluationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.EvaluationConfig; + + /** + * Verifies an EvaluationConfig message. + * @param message Plain 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 EvaluationConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EvaluationConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.EvaluationConfig; + + /** + * Creates a plain object from an EvaluationConfig message. Also converts values to other types if specified. + * @param message EvaluationConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.EvaluationConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EvaluationConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EvaluationConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EvaluationConfig { + + /** Properties of a SmartReplyConfig. */ + interface ISmartReplyConfig { + + /** SmartReplyConfig allowlistDocument */ + allowlistDocument?: (string|null); + + /** SmartReplyConfig maxResultCount */ + maxResultCount?: (number|null); + } + + /** Represents a SmartReplyConfig. */ + class SmartReplyConfig implements ISmartReplyConfig { + + /** + * Constructs a new SmartReplyConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig); + + /** SmartReplyConfig allowlistDocument. */ + public allowlistDocument: string; + + /** SmartReplyConfig maxResultCount. */ + public maxResultCount: number; + + /** + * Creates a new SmartReplyConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SmartReplyConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig): google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig; + + /** + * Encodes the specified SmartReplyConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig.verify|verify} messages. + * @param message SmartReplyConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SmartReplyConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig.verify|verify} messages. + * @param message SmartReplyConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SmartReplyConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SmartReplyConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig; + + /** + * Decodes a SmartReplyConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SmartReplyConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig; + + /** + * Verifies a SmartReplyConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SmartReplyConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SmartReplyConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig; + + /** + * Creates a plain object from a SmartReplyConfig message. Also converts values to other types if specified. + * @param message SmartReplyConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SmartReplyConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SmartReplyConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SmartComposeConfig. */ + interface ISmartComposeConfig { + + /** SmartComposeConfig allowlistDocument */ + allowlistDocument?: (string|null); + + /** SmartComposeConfig maxResultCount */ + maxResultCount?: (number|null); + } + + /** Represents a SmartComposeConfig. */ + class SmartComposeConfig implements ISmartComposeConfig { + + /** + * Constructs a new SmartComposeConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig); + + /** SmartComposeConfig allowlistDocument. */ + public allowlistDocument: string; + + /** SmartComposeConfig maxResultCount. */ + public maxResultCount: number; + + /** + * Creates a new SmartComposeConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SmartComposeConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig): google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig; + + /** + * Encodes the specified SmartComposeConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig.verify|verify} messages. + * @param message SmartComposeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SmartComposeConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig.verify|verify} messages. + * @param message SmartComposeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SmartComposeConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SmartComposeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig; + + /** + * Decodes a SmartComposeConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SmartComposeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig; + + /** + * Verifies a SmartComposeConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SmartComposeConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SmartComposeConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig; + + /** + * Creates a plain object from a SmartComposeConfig message. Also converts values to other types if specified. + * @param message SmartComposeConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SmartComposeConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SmartComposeConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an InputDataset. */ + interface IInputDataset { + + /** InputDataset dataset */ + dataset?: (string|null); + } + + /** Represents an InputDataset. */ + class InputDataset implements IInputDataset { + + /** + * Constructs a new InputDataset. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IInputDataset); + + /** InputDataset dataset. */ + public dataset: string; + + /** + * Creates a new InputDataset instance using the specified properties. + * @param [properties] Properties to set + * @returns InputDataset instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IInputDataset): google.cloud.dialogflow.v2.InputDataset; + + /** + * Encodes the specified InputDataset message. Does not implicitly {@link google.cloud.dialogflow.v2.InputDataset.verify|verify} messages. + * @param message InputDataset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IInputDataset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputDataset message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.InputDataset.verify|verify} messages. + * @param message InputDataset message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IInputDataset, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InputDataset message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InputDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.InputDataset; + + /** + * Decodes an InputDataset message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InputDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.InputDataset; + + /** + * Verifies an InputDataset message. + * @param message Plain 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 InputDataset message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InputDataset + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.InputDataset; + + /** + * Creates a plain object from an InputDataset message. Also converts values to other types if specified. + * @param message InputDataset + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.InputDataset, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputDataset to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InputDataset + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ArticleSuggestionModelMetadata. */ + interface IArticleSuggestionModelMetadata { + + /** ArticleSuggestionModelMetadata trainingModelType */ + trainingModelType?: (google.cloud.dialogflow.v2.ConversationModel.ModelType|keyof typeof google.cloud.dialogflow.v2.ConversationModel.ModelType|null); + } + + /** Represents an ArticleSuggestionModelMetadata. */ + class ArticleSuggestionModelMetadata implements IArticleSuggestionModelMetadata { + + /** + * Constructs a new ArticleSuggestionModelMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata); + + /** ArticleSuggestionModelMetadata trainingModelType. */ + public trainingModelType: (google.cloud.dialogflow.v2.ConversationModel.ModelType|keyof typeof google.cloud.dialogflow.v2.ConversationModel.ModelType); + + /** + * Creates a new ArticleSuggestionModelMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ArticleSuggestionModelMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata): google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata; + + /** + * Encodes the specified ArticleSuggestionModelMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata.verify|verify} messages. + * @param message ArticleSuggestionModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ArticleSuggestionModelMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata.verify|verify} messages. + * @param message ArticleSuggestionModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ArticleSuggestionModelMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ArticleSuggestionModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata; + + /** + * Decodes an ArticleSuggestionModelMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ArticleSuggestionModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata; + + /** + * Verifies an ArticleSuggestionModelMetadata message. + * @param message Plain 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 ArticleSuggestionModelMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ArticleSuggestionModelMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata; + + /** + * Creates a plain object from an ArticleSuggestionModelMetadata message. Also converts values to other types if specified. + * @param message ArticleSuggestionModelMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ArticleSuggestionModelMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ArticleSuggestionModelMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SmartReplyModelMetadata. */ + interface ISmartReplyModelMetadata { + + /** SmartReplyModelMetadata trainingModelType */ + trainingModelType?: (google.cloud.dialogflow.v2.ConversationModel.ModelType|keyof typeof google.cloud.dialogflow.v2.ConversationModel.ModelType|null); + } + + /** Represents a SmartReplyModelMetadata. */ + class SmartReplyModelMetadata implements ISmartReplyModelMetadata { + + /** + * Constructs a new SmartReplyModelMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISmartReplyModelMetadata); + + /** SmartReplyModelMetadata trainingModelType. */ + public trainingModelType: (google.cloud.dialogflow.v2.ConversationModel.ModelType|keyof typeof google.cloud.dialogflow.v2.ConversationModel.ModelType); + + /** + * Creates a new SmartReplyModelMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns SmartReplyModelMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISmartReplyModelMetadata): google.cloud.dialogflow.v2.SmartReplyModelMetadata; + + /** + * Encodes the specified SmartReplyModelMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyModelMetadata.verify|verify} messages. + * @param message SmartReplyModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISmartReplyModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SmartReplyModelMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyModelMetadata.verify|verify} messages. + * @param message SmartReplyModelMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISmartReplyModelMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SmartReplyModelMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SmartReplyModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SmartReplyModelMetadata; + + /** + * Decodes a SmartReplyModelMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SmartReplyModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SmartReplyModelMetadata; + + /** + * Verifies a SmartReplyModelMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SmartReplyModelMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SmartReplyModelMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SmartReplyModelMetadata; + + /** + * Creates a plain object from a SmartReplyModelMetadata message. Also converts values to other types if specified. + * @param message SmartReplyModelMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SmartReplyModelMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SmartReplyModelMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SmartReplyModelMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SmartReplyMetrics. */ + interface ISmartReplyMetrics { + + /** SmartReplyMetrics allowlistCoverage */ + allowlistCoverage?: (number|null); + + /** SmartReplyMetrics topNMetrics */ + topNMetrics?: (google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics[]|null); + + /** SmartReplyMetrics conversationCount */ + conversationCount?: (number|Long|string|null); + } + + /** Represents a SmartReplyMetrics. */ + class SmartReplyMetrics implements ISmartReplyMetrics { + + /** + * Constructs a new SmartReplyMetrics. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISmartReplyMetrics); + + /** SmartReplyMetrics allowlistCoverage. */ + public allowlistCoverage: number; + + /** SmartReplyMetrics topNMetrics. */ + public topNMetrics: google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics[]; + + /** SmartReplyMetrics conversationCount. */ + public conversationCount: (number|Long|string); + + /** + * Creates a new SmartReplyMetrics instance using the specified properties. + * @param [properties] Properties to set + * @returns SmartReplyMetrics instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISmartReplyMetrics): google.cloud.dialogflow.v2.SmartReplyMetrics; + + /** + * Encodes the specified SmartReplyMetrics message. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyMetrics.verify|verify} messages. + * @param message SmartReplyMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISmartReplyMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SmartReplyMetrics message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyMetrics.verify|verify} messages. + * @param message SmartReplyMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISmartReplyMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SmartReplyMetrics message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SmartReplyMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SmartReplyMetrics; + + /** + * Decodes a SmartReplyMetrics message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SmartReplyMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SmartReplyMetrics; + + /** + * Verifies a SmartReplyMetrics message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SmartReplyMetrics message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SmartReplyMetrics + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SmartReplyMetrics; + + /** + * Creates a plain object from a SmartReplyMetrics message. Also converts values to other types if specified. + * @param message SmartReplyMetrics + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SmartReplyMetrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SmartReplyMetrics to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SmartReplyMetrics + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SmartReplyMetrics { + + /** Properties of a TopNMetrics. */ + interface ITopNMetrics { + + /** TopNMetrics n */ + n?: (number|null); + + /** TopNMetrics recall */ + recall?: (number|null); + } + + /** Represents a TopNMetrics. */ + class TopNMetrics implements ITopNMetrics { + + /** + * Constructs a new TopNMetrics. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics); + + /** TopNMetrics n. */ + public n: number; + + /** TopNMetrics recall. */ + public recall: number; + + /** + * Creates a new TopNMetrics instance using the specified properties. + * @param [properties] Properties to set + * @returns TopNMetrics instance + */ + public static create(properties?: google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics): google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics; + + /** + * Encodes the specified TopNMetrics message. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics.verify|verify} messages. + * @param message TopNMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TopNMetrics message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics.verify|verify} messages. + * @param message TopNMetrics message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TopNMetrics message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TopNMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics; + + /** + * Decodes a TopNMetrics message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TopNMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics; + + /** + * Verifies a TopNMetrics message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TopNMetrics message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TopNMetrics + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics; + + /** + * Creates a plain object from a TopNMetrics message. Also converts values to other types if specified. + * @param message TopNMetrics + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TopNMetrics to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TopNMetrics + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a CreateConversationModelRequest. */ + interface ICreateConversationModelRequest { + + /** CreateConversationModelRequest parent */ + parent?: (string|null); + + /** CreateConversationModelRequest conversationModel */ + conversationModel?: (google.cloud.dialogflow.v2.IConversationModel|null); + } + + /** Represents a CreateConversationModelRequest. */ + class CreateConversationModelRequest implements ICreateConversationModelRequest { + + /** + * Constructs a new CreateConversationModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateConversationModelRequest); + + /** CreateConversationModelRequest parent. */ + public parent: string; + + /** CreateConversationModelRequest conversationModel. */ + public conversationModel?: (google.cloud.dialogflow.v2.IConversationModel|null); + + /** + * Creates a new CreateConversationModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationModelRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateConversationModelRequest): google.cloud.dialogflow.v2.CreateConversationModelRequest; + + /** + * Encodes the specified CreateConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelRequest.verify|verify} messages. + * @param message CreateConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelRequest.verify|verify} messages. + * @param message CreateConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateConversationModelRequest; + + /** + * Decodes a CreateConversationModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateConversationModelRequest; + + /** + * Verifies a CreateConversationModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateConversationModelRequest; + + /** + * Creates a plain object from a CreateConversationModelRequest message. Also converts values to other types if specified. + * @param message CreateConversationModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateConversationModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetConversationModelRequest. */ + interface IGetConversationModelRequest { + + /** GetConversationModelRequest name */ + name?: (string|null); + } + + /** Represents a GetConversationModelRequest. */ + class GetConversationModelRequest implements IGetConversationModelRequest { + + /** + * Constructs a new GetConversationModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetConversationModelRequest); + + /** GetConversationModelRequest name. */ + public name: string; + + /** + * Creates a new GetConversationModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetConversationModelRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetConversationModelRequest): google.cloud.dialogflow.v2.GetConversationModelRequest; + + /** + * Encodes the specified GetConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationModelRequest.verify|verify} messages. + * @param message GetConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationModelRequest.verify|verify} messages. + * @param message GetConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetConversationModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetConversationModelRequest; + + /** + * Decodes a GetConversationModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetConversationModelRequest; + + /** + * Verifies a GetConversationModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetConversationModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetConversationModelRequest; + + /** + * Creates a plain object from a GetConversationModelRequest message. Also converts values to other types if specified. + * @param message GetConversationModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetConversationModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetConversationModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetConversationModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationModelsRequest. */ + interface IListConversationModelsRequest { + + /** ListConversationModelsRequest parent */ + parent?: (string|null); + + /** ListConversationModelsRequest pageSize */ + pageSize?: (number|null); + + /** ListConversationModelsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListConversationModelsRequest. */ + class ListConversationModelsRequest implements IListConversationModelsRequest { + + /** + * Constructs a new ListConversationModelsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationModelsRequest); + + /** ListConversationModelsRequest parent. */ + public parent: string; + + /** ListConversationModelsRequest pageSize. */ + public pageSize: number; + + /** ListConversationModelsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListConversationModelsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationModelsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationModelsRequest): google.cloud.dialogflow.v2.ListConversationModelsRequest; + + /** + * Encodes the specified ListConversationModelsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelsRequest.verify|verify} messages. + * @param message ListConversationModelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationModelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationModelsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelsRequest.verify|verify} messages. + * @param message ListConversationModelsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationModelsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationModelsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationModelsRequest; + + /** + * Decodes a ListConversationModelsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationModelsRequest; + + /** + * Verifies a ListConversationModelsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationModelsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationModelsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationModelsRequest; + + /** + * Creates a plain object from a ListConversationModelsRequest message. Also converts values to other types if specified. + * @param message ListConversationModelsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationModelsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationModelsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationModelsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationModelsResponse. */ + interface IListConversationModelsResponse { + + /** ListConversationModelsResponse conversationModels */ + conversationModels?: (google.cloud.dialogflow.v2.IConversationModel[]|null); + + /** ListConversationModelsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListConversationModelsResponse. */ + class ListConversationModelsResponse implements IListConversationModelsResponse { + + /** + * Constructs a new ListConversationModelsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationModelsResponse); + + /** ListConversationModelsResponse conversationModels. */ + public conversationModels: google.cloud.dialogflow.v2.IConversationModel[]; + + /** ListConversationModelsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListConversationModelsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationModelsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationModelsResponse): google.cloud.dialogflow.v2.ListConversationModelsResponse; + + /** + * Encodes the specified ListConversationModelsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelsResponse.verify|verify} messages. + * @param message ListConversationModelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationModelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationModelsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelsResponse.verify|verify} messages. + * @param message ListConversationModelsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationModelsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationModelsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationModelsResponse; + + /** + * Decodes a ListConversationModelsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationModelsResponse; + + /** + * Verifies a ListConversationModelsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationModelsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationModelsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationModelsResponse; + + /** + * Creates a plain object from a ListConversationModelsResponse message. Also converts values to other types if specified. + * @param message ListConversationModelsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationModelsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationModelsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationModelsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteConversationModelRequest. */ + interface IDeleteConversationModelRequest { + + /** DeleteConversationModelRequest name */ + name?: (string|null); + } + + /** Represents a DeleteConversationModelRequest. */ + class DeleteConversationModelRequest implements IDeleteConversationModelRequest { + + /** + * Constructs a new DeleteConversationModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteConversationModelRequest); + + /** DeleteConversationModelRequest name. */ + public name: string; + + /** + * Creates a new DeleteConversationModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteConversationModelRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteConversationModelRequest): google.cloud.dialogflow.v2.DeleteConversationModelRequest; + + /** + * Encodes the specified DeleteConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationModelRequest.verify|verify} messages. + * @param message DeleteConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationModelRequest.verify|verify} messages. + * @param message DeleteConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteConversationModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteConversationModelRequest; + + /** + * Decodes a DeleteConversationModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteConversationModelRequest; + + /** + * Verifies a DeleteConversationModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteConversationModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteConversationModelRequest; + + /** + * Creates a plain object from a DeleteConversationModelRequest message. Also converts values to other types if specified. + * @param message DeleteConversationModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteConversationModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteConversationModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteConversationModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeployConversationModelRequest. */ + interface IDeployConversationModelRequest { + + /** DeployConversationModelRequest name */ + name?: (string|null); + } + + /** Represents a DeployConversationModelRequest. */ + class DeployConversationModelRequest implements IDeployConversationModelRequest { + + /** + * Constructs a new DeployConversationModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeployConversationModelRequest); + + /** DeployConversationModelRequest name. */ + public name: string; + + /** + * Creates a new DeployConversationModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeployConversationModelRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeployConversationModelRequest): google.cloud.dialogflow.v2.DeployConversationModelRequest; + + /** + * Encodes the specified DeployConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeployConversationModelRequest.verify|verify} messages. + * @param message DeployConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeployConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeployConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeployConversationModelRequest.verify|verify} messages. + * @param message DeployConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeployConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeployConversationModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeployConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeployConversationModelRequest; + + /** + * Decodes a DeployConversationModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeployConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeployConversationModelRequest; + + /** + * Verifies a DeployConversationModelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeployConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeployConversationModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeployConversationModelRequest; + + /** + * Creates a plain object from a DeployConversationModelRequest message. Also converts values to other types if specified. + * @param message DeployConversationModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeployConversationModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployConversationModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeployConversationModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UndeployConversationModelRequest. */ + interface IUndeployConversationModelRequest { + + /** UndeployConversationModelRequest name */ + name?: (string|null); + } + + /** Represents an UndeployConversationModelRequest. */ + class UndeployConversationModelRequest implements IUndeployConversationModelRequest { + + /** + * Constructs a new UndeployConversationModelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUndeployConversationModelRequest); + + /** UndeployConversationModelRequest name. */ + public name: string; + + /** + * Creates a new UndeployConversationModelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployConversationModelRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUndeployConversationModelRequest): google.cloud.dialogflow.v2.UndeployConversationModelRequest; + + /** + * Encodes the specified UndeployConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UndeployConversationModelRequest.verify|verify} messages. + * @param message UndeployConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUndeployConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UndeployConversationModelRequest.verify|verify} messages. + * @param message UndeployConversationModelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUndeployConversationModelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployConversationModelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UndeployConversationModelRequest; + + /** + * Decodes an UndeployConversationModelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UndeployConversationModelRequest; + + /** + * Verifies an UndeployConversationModelRequest message. + * @param message Plain 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 UndeployConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployConversationModelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UndeployConversationModelRequest; + + /** + * Creates a plain object from an UndeployConversationModelRequest message. Also converts values to other types if specified. + * @param message UndeployConversationModelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UndeployConversationModelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployConversationModelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UndeployConversationModelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetConversationModelEvaluationRequest. */ + interface IGetConversationModelEvaluationRequest { + + /** GetConversationModelEvaluationRequest name */ + name?: (string|null); + } + + /** Represents a GetConversationModelEvaluationRequest. */ + class GetConversationModelEvaluationRequest implements IGetConversationModelEvaluationRequest { + + /** + * Constructs a new GetConversationModelEvaluationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest); + + /** GetConversationModelEvaluationRequest name. */ + public name: string; + + /** + * Creates a new GetConversationModelEvaluationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetConversationModelEvaluationRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest): google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest; + + /** + * Encodes the specified GetConversationModelEvaluationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest.verify|verify} messages. + * @param message GetConversationModelEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetConversationModelEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest.verify|verify} messages. + * @param message GetConversationModelEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetConversationModelEvaluationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetConversationModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest; + + /** + * Decodes a GetConversationModelEvaluationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetConversationModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest; + + /** + * Verifies a GetConversationModelEvaluationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetConversationModelEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetConversationModelEvaluationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest; + + /** + * Creates a plain object from a GetConversationModelEvaluationRequest message. Also converts values to other types if specified. + * @param message GetConversationModelEvaluationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetConversationModelEvaluationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetConversationModelEvaluationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationModelEvaluationsRequest. */ + interface IListConversationModelEvaluationsRequest { + + /** ListConversationModelEvaluationsRequest parent */ + parent?: (string|null); + + /** ListConversationModelEvaluationsRequest pageSize */ + pageSize?: (number|null); + + /** ListConversationModelEvaluationsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListConversationModelEvaluationsRequest. */ + class ListConversationModelEvaluationsRequest implements IListConversationModelEvaluationsRequest { + + /** + * Constructs a new ListConversationModelEvaluationsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest); + + /** ListConversationModelEvaluationsRequest parent. */ + public parent: string; + + /** ListConversationModelEvaluationsRequest pageSize. */ + public pageSize: number; + + /** ListConversationModelEvaluationsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListConversationModelEvaluationsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationModelEvaluationsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest): google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest; + + /** + * Encodes the specified ListConversationModelEvaluationsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest.verify|verify} messages. + * @param message ListConversationModelEvaluationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationModelEvaluationsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest.verify|verify} messages. + * @param message ListConversationModelEvaluationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationModelEvaluationsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationModelEvaluationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest; + + /** + * Decodes a ListConversationModelEvaluationsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationModelEvaluationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest; + + /** + * Verifies a ListConversationModelEvaluationsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationModelEvaluationsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationModelEvaluationsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest; + + /** + * Creates a plain object from a ListConversationModelEvaluationsRequest message. Also converts values to other types if specified. + * @param message ListConversationModelEvaluationsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationModelEvaluationsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationModelEvaluationsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationModelEvaluationsResponse. */ + interface IListConversationModelEvaluationsResponse { + + /** ListConversationModelEvaluationsResponse conversationModelEvaluations */ + conversationModelEvaluations?: (google.cloud.dialogflow.v2.IConversationModelEvaluation[]|null); + + /** ListConversationModelEvaluationsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListConversationModelEvaluationsResponse. */ + class ListConversationModelEvaluationsResponse implements IListConversationModelEvaluationsResponse { + + /** + * Constructs a new ListConversationModelEvaluationsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse); + + /** ListConversationModelEvaluationsResponse conversationModelEvaluations. */ + public conversationModelEvaluations: google.cloud.dialogflow.v2.IConversationModelEvaluation[]; + + /** ListConversationModelEvaluationsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListConversationModelEvaluationsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationModelEvaluationsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse): google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse; + + /** + * Encodes the specified ListConversationModelEvaluationsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse.verify|verify} messages. + * @param message ListConversationModelEvaluationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationModelEvaluationsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse.verify|verify} messages. + * @param message ListConversationModelEvaluationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationModelEvaluationsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationModelEvaluationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse; + + /** + * Decodes a ListConversationModelEvaluationsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationModelEvaluationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse; + + /** + * Verifies a ListConversationModelEvaluationsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationModelEvaluationsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationModelEvaluationsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse; + + /** + * Creates a plain object from a ListConversationModelEvaluationsResponse message. Also converts values to other types if specified. + * @param message ListConversationModelEvaluationsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationModelEvaluationsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationModelEvaluationsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateConversationModelEvaluationRequest. */ + interface ICreateConversationModelEvaluationRequest { + + /** CreateConversationModelEvaluationRequest parent */ + parent?: (string|null); + + /** CreateConversationModelEvaluationRequest conversationModelEvaluation */ + conversationModelEvaluation?: (google.cloud.dialogflow.v2.IConversationModelEvaluation|null); + } + + /** Represents a CreateConversationModelEvaluationRequest. */ + class CreateConversationModelEvaluationRequest implements ICreateConversationModelEvaluationRequest { + + /** + * Constructs a new CreateConversationModelEvaluationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest); + + /** CreateConversationModelEvaluationRequest parent. */ + public parent: string; + + /** CreateConversationModelEvaluationRequest conversationModelEvaluation. */ + public conversationModelEvaluation?: (google.cloud.dialogflow.v2.IConversationModelEvaluation|null); + + /** + * Creates a new CreateConversationModelEvaluationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationModelEvaluationRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest): google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest; + + /** + * Encodes the specified CreateConversationModelEvaluationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest.verify|verify} messages. + * @param message CreateConversationModelEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationModelEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest.verify|verify} messages. + * @param message CreateConversationModelEvaluationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationModelEvaluationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest; + + /** + * Decodes a CreateConversationModelEvaluationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest; + + /** + * Verifies a CreateConversationModelEvaluationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationModelEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationModelEvaluationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest; + + /** + * Creates a plain object from a CreateConversationModelEvaluationRequest message. Also converts values to other types if specified. + * @param message CreateConversationModelEvaluationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationModelEvaluationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationModelEvaluationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateConversationModelOperationMetadata. */ + interface ICreateConversationModelOperationMetadata { + + /** CreateConversationModelOperationMetadata conversationModel */ + conversationModel?: (string|null); + + /** CreateConversationModelOperationMetadata state */ + state?: (google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.State|null); + + /** CreateConversationModelOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CreateConversationModelOperationMetadata. */ + class CreateConversationModelOperationMetadata implements ICreateConversationModelOperationMetadata { + + /** + * Constructs a new CreateConversationModelOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata); + + /** CreateConversationModelOperationMetadata conversationModel. */ + public conversationModel: string; + + /** CreateConversationModelOperationMetadata state. */ + public state: (google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.State); + + /** CreateConversationModelOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new CreateConversationModelOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationModelOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata): google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata; + + /** + * Encodes the specified CreateConversationModelOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.verify|verify} messages. + * @param message CreateConversationModelOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationModelOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.verify|verify} messages. + * @param message CreateConversationModelOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationModelOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata; + + /** + * Decodes a CreateConversationModelOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata; + + /** + * Verifies a CreateConversationModelOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationModelOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationModelOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata; + + /** + * Creates a plain object from a CreateConversationModelOperationMetadata message. Also converts values to other types if specified. + * @param message CreateConversationModelOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationModelOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationModelOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CreateConversationModelOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + PENDING = 1, + SUCCEEDED = 2, + FAILED = 3, + CANCELLED = 4, + CANCELLING = 5, + TRAINING = 6 + } + } + + /** Properties of a DeployConversationModelOperationMetadata. */ + interface IDeployConversationModelOperationMetadata { + + /** DeployConversationModelOperationMetadata conversationModel */ + conversationModel?: (string|null); + + /** DeployConversationModelOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DeployConversationModelOperationMetadata. */ + class DeployConversationModelOperationMetadata implements IDeployConversationModelOperationMetadata { + + /** + * Constructs a new DeployConversationModelOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata); + + /** DeployConversationModelOperationMetadata conversationModel. */ + public conversationModel: string; + + /** DeployConversationModelOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DeployConversationModelOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeployConversationModelOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata): google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata; + + /** + * Encodes the specified DeployConversationModelOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata.verify|verify} messages. + * @param message DeployConversationModelOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeployConversationModelOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata.verify|verify} messages. + * @param message DeployConversationModelOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeployConversationModelOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeployConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata; + + /** + * Decodes a DeployConversationModelOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeployConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata; + + /** + * Verifies a DeployConversationModelOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeployConversationModelOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeployConversationModelOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata; + + /** + * Creates a plain object from a DeployConversationModelOperationMetadata message. Also converts values to other types if specified. + * @param message DeployConversationModelOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeployConversationModelOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeployConversationModelOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UndeployConversationModelOperationMetadata. */ + interface IUndeployConversationModelOperationMetadata { + + /** UndeployConversationModelOperationMetadata conversationModel */ + conversationModel?: (string|null); + + /** UndeployConversationModelOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an UndeployConversationModelOperationMetadata. */ + class UndeployConversationModelOperationMetadata implements IUndeployConversationModelOperationMetadata { + + /** + * Constructs a new UndeployConversationModelOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata); + + /** UndeployConversationModelOperationMetadata conversationModel. */ + public conversationModel: string; + + /** UndeployConversationModelOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new UndeployConversationModelOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns UndeployConversationModelOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata): google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata; + + /** + * Encodes the specified UndeployConversationModelOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata.verify|verify} messages. + * @param message UndeployConversationModelOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UndeployConversationModelOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata.verify|verify} messages. + * @param message UndeployConversationModelOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UndeployConversationModelOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UndeployConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata; + + /** + * Decodes an UndeployConversationModelOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UndeployConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata; + + /** + * Verifies an UndeployConversationModelOperationMetadata message. + * @param message Plain 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 UndeployConversationModelOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UndeployConversationModelOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata; + + /** + * Creates a plain object from an UndeployConversationModelOperationMetadata message. Also converts values to other types if specified. + * @param message UndeployConversationModelOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UndeployConversationModelOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UndeployConversationModelOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteConversationModelOperationMetadata. */ + interface IDeleteConversationModelOperationMetadata { + + /** DeleteConversationModelOperationMetadata conversationModel */ + conversationModel?: (string|null); + + /** DeleteConversationModelOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a DeleteConversationModelOperationMetadata. */ + class DeleteConversationModelOperationMetadata implements IDeleteConversationModelOperationMetadata { + + /** + * Constructs a new DeleteConversationModelOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata); + + /** DeleteConversationModelOperationMetadata conversationModel. */ + public conversationModel: string; + + /** DeleteConversationModelOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new DeleteConversationModelOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteConversationModelOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata): google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata; + + /** + * Encodes the specified DeleteConversationModelOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata.verify|verify} messages. + * @param message DeleteConversationModelOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteConversationModelOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata.verify|verify} messages. + * @param message DeleteConversationModelOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteConversationModelOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata; + + /** + * Decodes a DeleteConversationModelOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata; + + /** + * Verifies a DeleteConversationModelOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteConversationModelOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteConversationModelOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata; + + /** + * Creates a plain object from a DeleteConversationModelOperationMetadata message. Also converts values to other types if specified. + * @param message DeleteConversationModelOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteConversationModelOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteConversationModelOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateConversationModelEvaluationOperationMetadata. */ + interface ICreateConversationModelEvaluationOperationMetadata { + + /** CreateConversationModelEvaluationOperationMetadata conversationModelEvaluation */ + conversationModelEvaluation?: (string|null); + + /** CreateConversationModelEvaluationOperationMetadata conversationModel */ + conversationModel?: (string|null); + + /** CreateConversationModelEvaluationOperationMetadata state */ + state?: (google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State|null); + + /** CreateConversationModelEvaluationOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a CreateConversationModelEvaluationOperationMetadata. */ + class CreateConversationModelEvaluationOperationMetadata implements ICreateConversationModelEvaluationOperationMetadata { + + /** + * Constructs a new CreateConversationModelEvaluationOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata); + + /** CreateConversationModelEvaluationOperationMetadata conversationModelEvaluation. */ + public conversationModelEvaluation: string; + + /** CreateConversationModelEvaluationOperationMetadata conversationModel. */ + public conversationModel: string; + + /** CreateConversationModelEvaluationOperationMetadata state. */ + public state: (google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State); + + /** CreateConversationModelEvaluationOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new CreateConversationModelEvaluationOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationModelEvaluationOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata): google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata; + + /** + * Encodes the specified CreateConversationModelEvaluationOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.verify|verify} messages. + * @param message CreateConversationModelEvaluationOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationModelEvaluationOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.verify|verify} messages. + * @param message CreateConversationModelEvaluationOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationModelEvaluationOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationModelEvaluationOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata; + + /** + * Decodes a CreateConversationModelEvaluationOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationModelEvaluationOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata; + + /** + * Verifies a CreateConversationModelEvaluationOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationModelEvaluationOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationModelEvaluationOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata; + + /** + * Creates a plain object from a CreateConversationModelEvaluationOperationMetadata message. Also converts values to other types if specified. + * @param message CreateConversationModelEvaluationOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationModelEvaluationOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationModelEvaluationOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CreateConversationModelEvaluationOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + INITIALIZING = 1, + RUNNING = 2, + CANCELLED = 3, + SUCCEEDED = 4, + FAILED = 5 + } + } + + /** Represents a ConversationProfiles */ + class ConversationProfiles extends $protobuf.rpc.Service { + + /** + * Constructs a new ConversationProfiles 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 ConversationProfiles 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): ConversationProfiles; + + /** + * Calls ListConversationProfiles. + * @param request ListConversationProfilesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListConversationProfilesResponse + */ + public listConversationProfiles(request: google.cloud.dialogflow.v2.IListConversationProfilesRequest, callback: google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfilesCallback): void; + + /** + * Calls ListConversationProfiles. + * @param request ListConversationProfilesRequest message or plain object + * @returns Promise + */ + public listConversationProfiles(request: google.cloud.dialogflow.v2.IListConversationProfilesRequest): Promise; + + /** + * Calls GetConversationProfile. + * @param request GetConversationProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConversationProfile + */ + public getConversationProfile(request: google.cloud.dialogflow.v2.IGetConversationProfileRequest, callback: google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfileCallback): void; + + /** + * Calls GetConversationProfile. + * @param request GetConversationProfileRequest message or plain object + * @returns Promise + */ + public getConversationProfile(request: google.cloud.dialogflow.v2.IGetConversationProfileRequest): Promise; + + /** + * Calls CreateConversationProfile. + * @param request CreateConversationProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConversationProfile + */ + public createConversationProfile(request: google.cloud.dialogflow.v2.ICreateConversationProfileRequest, callback: google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfileCallback): void; + + /** + * Calls CreateConversationProfile. + * @param request CreateConversationProfileRequest message or plain object + * @returns Promise + */ + public createConversationProfile(request: google.cloud.dialogflow.v2.ICreateConversationProfileRequest): Promise; + + /** + * Calls UpdateConversationProfile. + * @param request UpdateConversationProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConversationProfile + */ + public updateConversationProfile(request: google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, callback: google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfileCallback): void; + + /** + * Calls UpdateConversationProfile. + * @param request UpdateConversationProfileRequest message or plain object + * @returns Promise + */ + public updateConversationProfile(request: google.cloud.dialogflow.v2.IUpdateConversationProfileRequest): Promise; + + /** + * Calls DeleteConversationProfile. + * @param request DeleteConversationProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteConversationProfile(request: google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, callback: google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfileCallback): void; + + /** + * Calls DeleteConversationProfile. + * @param request DeleteConversationProfileRequest message or plain object + * @returns Promise + */ + public deleteConversationProfile(request: google.cloud.dialogflow.v2.IDeleteConversationProfileRequest): Promise; + + /** + * Calls SetSuggestionFeatureConfig. + * @param request SetSuggestionFeatureConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public setSuggestionFeatureConfig(request: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, callback: google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfigCallback): void; + + /** + * Calls SetSuggestionFeatureConfig. + * @param request SetSuggestionFeatureConfigRequest message or plain object + * @returns Promise + */ + public setSuggestionFeatureConfig(request: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest): Promise; + + /** + * Calls ClearSuggestionFeatureConfig. + * @param request ClearSuggestionFeatureConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public clearSuggestionFeatureConfig(request: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, callback: google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfigCallback): void; + + /** + * Calls ClearSuggestionFeatureConfig. + * @param request ClearSuggestionFeatureConfigRequest message or plain object + * @returns Promise + */ + public clearSuggestionFeatureConfig(request: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest): Promise; + } + + namespace ConversationProfiles { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|listConversationProfiles}. + * @param error Error, if any + * @param [response] ListConversationProfilesResponse + */ + type ListConversationProfilesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListConversationProfilesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|getConversationProfile}. + * @param error Error, if any + * @param [response] ConversationProfile + */ + type GetConversationProfileCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ConversationProfile) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|createConversationProfile}. + * @param error Error, if any + * @param [response] ConversationProfile + */ + type CreateConversationProfileCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ConversationProfile) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|updateConversationProfile}. + * @param error Error, if any + * @param [response] ConversationProfile + */ + type UpdateConversationProfileCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ConversationProfile) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|deleteConversationProfile}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteConversationProfileCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|setSuggestionFeatureConfig}. + * @param error Error, if any + * @param [response] Operation + */ + type SetSuggestionFeatureConfigCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|clearSuggestionFeatureConfig}. + * @param error Error, if any + * @param [response] Operation + */ + type ClearSuggestionFeatureConfigCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ConversationProfile. */ + interface IConversationProfile { + + /** ConversationProfile name */ + name?: (string|null); + + /** ConversationProfile displayName */ + displayName?: (string|null); + + /** ConversationProfile createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationProfile updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ConversationProfile automatedAgentConfig */ + automatedAgentConfig?: (google.cloud.dialogflow.v2.IAutomatedAgentConfig|null); + + /** ConversationProfile humanAgentAssistantConfig */ + humanAgentAssistantConfig?: (google.cloud.dialogflow.v2.IHumanAgentAssistantConfig|null); + + /** ConversationProfile humanAgentHandoffConfig */ + humanAgentHandoffConfig?: (google.cloud.dialogflow.v2.IHumanAgentHandoffConfig|null); + + /** ConversationProfile notificationConfig */ + notificationConfig?: (google.cloud.dialogflow.v2.INotificationConfig|null); + + /** ConversationProfile loggingConfig */ + loggingConfig?: (google.cloud.dialogflow.v2.ILoggingConfig|null); + + /** ConversationProfile newMessageEventNotificationConfig */ + newMessageEventNotificationConfig?: (google.cloud.dialogflow.v2.INotificationConfig|null); + + /** ConversationProfile sttConfig */ + sttConfig?: (google.cloud.dialogflow.v2.ISpeechToTextConfig|null); + + /** ConversationProfile languageCode */ + languageCode?: (string|null); + + /** ConversationProfile timeZone */ + timeZone?: (string|null); + + /** ConversationProfile securitySettings */ + securitySettings?: (string|null); + } + + /** Represents a ConversationProfile. */ + class ConversationProfile implements IConversationProfile { + + /** + * Constructs a new ConversationProfile. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IConversationProfile); + + /** ConversationProfile name. */ + public name: string; + + /** ConversationProfile displayName. */ + public displayName: string; + + /** ConversationProfile createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationProfile updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ConversationProfile automatedAgentConfig. */ + public automatedAgentConfig?: (google.cloud.dialogflow.v2.IAutomatedAgentConfig|null); + + /** ConversationProfile humanAgentAssistantConfig. */ + public humanAgentAssistantConfig?: (google.cloud.dialogflow.v2.IHumanAgentAssistantConfig|null); + + /** ConversationProfile humanAgentHandoffConfig. */ + public humanAgentHandoffConfig?: (google.cloud.dialogflow.v2.IHumanAgentHandoffConfig|null); + + /** ConversationProfile notificationConfig. */ + public notificationConfig?: (google.cloud.dialogflow.v2.INotificationConfig|null); + + /** ConversationProfile loggingConfig. */ + public loggingConfig?: (google.cloud.dialogflow.v2.ILoggingConfig|null); + + /** ConversationProfile newMessageEventNotificationConfig. */ + public newMessageEventNotificationConfig?: (google.cloud.dialogflow.v2.INotificationConfig|null); + + /** ConversationProfile sttConfig. */ + public sttConfig?: (google.cloud.dialogflow.v2.ISpeechToTextConfig|null); + + /** ConversationProfile languageCode. */ + public languageCode: string; + + /** ConversationProfile timeZone. */ + public timeZone: string; + + /** ConversationProfile securitySettings. */ + public securitySettings: string; + + /** + * Creates a new ConversationProfile instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationProfile instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IConversationProfile): google.cloud.dialogflow.v2.ConversationProfile; + + /** + * Encodes the specified ConversationProfile message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationProfile.verify|verify} messages. + * @param message ConversationProfile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IConversationProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationProfile message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationProfile.verify|verify} messages. + * @param message ConversationProfile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IConversationProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationProfile message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ConversationProfile; + + /** + * Decodes a ConversationProfile message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ConversationProfile; + + /** + * Verifies a ConversationProfile message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationProfile message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationProfile + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ConversationProfile; + + /** + * Creates a plain object from a ConversationProfile message. Also converts values to other types if specified. + * @param message ConversationProfile + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ConversationProfile, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationProfile to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationProfile + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationProfilesRequest. */ + interface IListConversationProfilesRequest { + + /** ListConversationProfilesRequest parent */ + parent?: (string|null); + + /** ListConversationProfilesRequest pageSize */ + pageSize?: (number|null); + + /** ListConversationProfilesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListConversationProfilesRequest. */ + class ListConversationProfilesRequest implements IListConversationProfilesRequest { + + /** + * Constructs a new ListConversationProfilesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationProfilesRequest); + + /** ListConversationProfilesRequest parent. */ + public parent: string; + + /** ListConversationProfilesRequest pageSize. */ + public pageSize: number; + + /** ListConversationProfilesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListConversationProfilesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationProfilesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationProfilesRequest): google.cloud.dialogflow.v2.ListConversationProfilesRequest; + + /** + * Encodes the specified ListConversationProfilesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationProfilesRequest.verify|verify} messages. + * @param message ListConversationProfilesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationProfilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationProfilesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationProfilesRequest.verify|verify} messages. + * @param message ListConversationProfilesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationProfilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationProfilesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationProfilesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationProfilesRequest; + + /** + * Decodes a ListConversationProfilesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationProfilesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationProfilesRequest; + + /** + * Verifies a ListConversationProfilesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationProfilesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationProfilesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationProfilesRequest; + + /** + * Creates a plain object from a ListConversationProfilesRequest message. Also converts values to other types if specified. + * @param message ListConversationProfilesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationProfilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationProfilesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationProfilesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationProfilesResponse. */ + interface IListConversationProfilesResponse { + + /** ListConversationProfilesResponse conversationProfiles */ + conversationProfiles?: (google.cloud.dialogflow.v2.IConversationProfile[]|null); + + /** ListConversationProfilesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListConversationProfilesResponse. */ + class ListConversationProfilesResponse implements IListConversationProfilesResponse { + + /** + * Constructs a new ListConversationProfilesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListConversationProfilesResponse); + + /** ListConversationProfilesResponse conversationProfiles. */ + public conversationProfiles: google.cloud.dialogflow.v2.IConversationProfile[]; + + /** ListConversationProfilesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListConversationProfilesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationProfilesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListConversationProfilesResponse): google.cloud.dialogflow.v2.ListConversationProfilesResponse; + + /** + * Encodes the specified ListConversationProfilesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationProfilesResponse.verify|verify} messages. + * @param message ListConversationProfilesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListConversationProfilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationProfilesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationProfilesResponse.verify|verify} messages. + * @param message ListConversationProfilesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListConversationProfilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationProfilesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationProfilesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListConversationProfilesResponse; + + /** + * Decodes a ListConversationProfilesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationProfilesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListConversationProfilesResponse; + + /** + * Verifies a ListConversationProfilesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationProfilesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationProfilesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListConversationProfilesResponse; + + /** + * Creates a plain object from a ListConversationProfilesResponse message. Also converts values to other types if specified. + * @param message ListConversationProfilesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListConversationProfilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationProfilesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationProfilesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetConversationProfileRequest. */ + interface IGetConversationProfileRequest { + + /** GetConversationProfileRequest name */ + name?: (string|null); + } + + /** Represents a GetConversationProfileRequest. */ + class GetConversationProfileRequest implements IGetConversationProfileRequest { + + /** + * Constructs a new GetConversationProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetConversationProfileRequest); + + /** GetConversationProfileRequest name. */ + public name: string; + + /** + * Creates a new GetConversationProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetConversationProfileRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetConversationProfileRequest): google.cloud.dialogflow.v2.GetConversationProfileRequest; + + /** + * Encodes the specified GetConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationProfileRequest.verify|verify} messages. + * @param message GetConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationProfileRequest.verify|verify} messages. + * @param message GetConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetConversationProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetConversationProfileRequest; + + /** + * Decodes a GetConversationProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetConversationProfileRequest; + + /** + * Verifies a GetConversationProfileRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetConversationProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetConversationProfileRequest; + + /** + * Creates a plain object from a GetConversationProfileRequest message. Also converts values to other types if specified. + * @param message GetConversationProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetConversationProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetConversationProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetConversationProfileRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateConversationProfileRequest. */ + interface ICreateConversationProfileRequest { + + /** CreateConversationProfileRequest parent */ + parent?: (string|null); + + /** CreateConversationProfileRequest conversationProfile */ + conversationProfile?: (google.cloud.dialogflow.v2.IConversationProfile|null); + } + + /** Represents a CreateConversationProfileRequest. */ + class CreateConversationProfileRequest implements ICreateConversationProfileRequest { + + /** + * Constructs a new CreateConversationProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateConversationProfileRequest); + + /** CreateConversationProfileRequest parent. */ + public parent: string; + + /** CreateConversationProfileRequest conversationProfile. */ + public conversationProfile?: (google.cloud.dialogflow.v2.IConversationProfile|null); + + /** + * Creates a new CreateConversationProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationProfileRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateConversationProfileRequest): google.cloud.dialogflow.v2.CreateConversationProfileRequest; + + /** + * Encodes the specified CreateConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationProfileRequest.verify|verify} messages. + * @param message CreateConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationProfileRequest.verify|verify} messages. + * @param message CreateConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateConversationProfileRequest; + + /** + * Decodes a CreateConversationProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateConversationProfileRequest; + + /** + * Verifies a CreateConversationProfileRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateConversationProfileRequest; + + /** + * Creates a plain object from a CreateConversationProfileRequest message. Also converts values to other types if specified. + * @param message CreateConversationProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateConversationProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationProfileRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateConversationProfileRequest. */ + interface IUpdateConversationProfileRequest { + + /** UpdateConversationProfileRequest conversationProfile */ + conversationProfile?: (google.cloud.dialogflow.v2.IConversationProfile|null); + + /** UpdateConversationProfileRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateConversationProfileRequest. */ + class UpdateConversationProfileRequest implements IUpdateConversationProfileRequest { + + /** + * Constructs a new UpdateConversationProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateConversationProfileRequest); + + /** UpdateConversationProfileRequest conversationProfile. */ + public conversationProfile?: (google.cloud.dialogflow.v2.IConversationProfile|null); + + /** UpdateConversationProfileRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateConversationProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateConversationProfileRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateConversationProfileRequest): google.cloud.dialogflow.v2.UpdateConversationProfileRequest; + + /** + * Encodes the specified UpdateConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateConversationProfileRequest.verify|verify} messages. + * @param message UpdateConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateConversationProfileRequest.verify|verify} messages. + * @param message UpdateConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateConversationProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateConversationProfileRequest; + + /** + * Decodes an UpdateConversationProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateConversationProfileRequest; + + /** + * Verifies an UpdateConversationProfileRequest message. + * @param message Plain 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 UpdateConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateConversationProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateConversationProfileRequest; + + /** + * Creates a plain object from an UpdateConversationProfileRequest message. Also converts values to other types if specified. + * @param message UpdateConversationProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateConversationProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateConversationProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateConversationProfileRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteConversationProfileRequest. */ + interface IDeleteConversationProfileRequest { + + /** DeleteConversationProfileRequest name */ + name?: (string|null); + } + + /** Represents a DeleteConversationProfileRequest. */ + class DeleteConversationProfileRequest implements IDeleteConversationProfileRequest { + + /** + * Constructs a new DeleteConversationProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteConversationProfileRequest); + + /** DeleteConversationProfileRequest name. */ + public name: string; + + /** + * Creates a new DeleteConversationProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteConversationProfileRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteConversationProfileRequest): google.cloud.dialogflow.v2.DeleteConversationProfileRequest; + + /** + * Encodes the specified DeleteConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationProfileRequest.verify|verify} messages. + * @param message DeleteConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationProfileRequest.verify|verify} messages. + * @param message DeleteConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteConversationProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteConversationProfileRequest; + + /** + * Decodes a DeleteConversationProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteConversationProfileRequest; + + /** + * Verifies a DeleteConversationProfileRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteConversationProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteConversationProfileRequest; + + /** + * Creates a plain object from a DeleteConversationProfileRequest message. Also converts values to other types if specified. + * @param message DeleteConversationProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteConversationProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteConversationProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteConversationProfileRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AutomatedAgentConfig. */ + interface IAutomatedAgentConfig { + + /** AutomatedAgentConfig agent */ + agent?: (string|null); + } + + /** Represents an AutomatedAgentConfig. */ + class AutomatedAgentConfig implements IAutomatedAgentConfig { + + /** + * Constructs a new AutomatedAgentConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IAutomatedAgentConfig); + + /** AutomatedAgentConfig agent. */ + public agent: string; + + /** + * Creates a new AutomatedAgentConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AutomatedAgentConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IAutomatedAgentConfig): google.cloud.dialogflow.v2.AutomatedAgentConfig; + + /** + * Encodes the specified AutomatedAgentConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.AutomatedAgentConfig.verify|verify} messages. + * @param message AutomatedAgentConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IAutomatedAgentConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AutomatedAgentConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AutomatedAgentConfig.verify|verify} messages. + * @param message AutomatedAgentConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IAutomatedAgentConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AutomatedAgentConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AutomatedAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.AutomatedAgentConfig; + + /** + * Decodes an AutomatedAgentConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AutomatedAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.AutomatedAgentConfig; + + /** + * Verifies an AutomatedAgentConfig message. + * @param message Plain 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 AutomatedAgentConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AutomatedAgentConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.AutomatedAgentConfig; + + /** + * Creates a plain object from an AutomatedAgentConfig message. Also converts values to other types if specified. + * @param message AutomatedAgentConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.AutomatedAgentConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AutomatedAgentConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AutomatedAgentConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a HumanAgentAssistantConfig. */ + interface IHumanAgentAssistantConfig { + + /** HumanAgentAssistantConfig notificationConfig */ + notificationConfig?: (google.cloud.dialogflow.v2.INotificationConfig|null); + + /** HumanAgentAssistantConfig humanAgentSuggestionConfig */ + humanAgentSuggestionConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig|null); + + /** HumanAgentAssistantConfig endUserSuggestionConfig */ + endUserSuggestionConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig|null); + + /** HumanAgentAssistantConfig messageAnalysisConfig */ + messageAnalysisConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig|null); + } + + /** Represents a HumanAgentAssistantConfig. */ + class HumanAgentAssistantConfig implements IHumanAgentAssistantConfig { + + /** + * Constructs a new HumanAgentAssistantConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IHumanAgentAssistantConfig); + + /** HumanAgentAssistantConfig notificationConfig. */ + public notificationConfig?: (google.cloud.dialogflow.v2.INotificationConfig|null); + + /** HumanAgentAssistantConfig humanAgentSuggestionConfig. */ + public humanAgentSuggestionConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig|null); + + /** HumanAgentAssistantConfig endUserSuggestionConfig. */ + public endUserSuggestionConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig|null); + + /** HumanAgentAssistantConfig messageAnalysisConfig. */ + public messageAnalysisConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig|null); + + /** + * Creates a new HumanAgentAssistantConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanAgentAssistantConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IHumanAgentAssistantConfig): google.cloud.dialogflow.v2.HumanAgentAssistantConfig; + + /** + * Encodes the specified HumanAgentAssistantConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.verify|verify} messages. + * @param message HumanAgentAssistantConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IHumanAgentAssistantConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanAgentAssistantConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.verify|verify} messages. + * @param message HumanAgentAssistantConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IHumanAgentAssistantConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanAgentAssistantConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanAgentAssistantConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig; + + /** + * Decodes a HumanAgentAssistantConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanAgentAssistantConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig; + + /** + * Verifies a HumanAgentAssistantConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanAgentAssistantConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanAgentAssistantConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig; + + /** + * Creates a plain object from a HumanAgentAssistantConfig message. Also converts values to other types if specified. + * @param message HumanAgentAssistantConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanAgentAssistantConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanAgentAssistantConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace HumanAgentAssistantConfig { + + /** Properties of a SuggestionTriggerSettings. */ + interface ISuggestionTriggerSettings { + + /** SuggestionTriggerSettings noSmalltalk */ + noSmalltalk?: (boolean|null); + + /** SuggestionTriggerSettings onlyEndUser */ + onlyEndUser?: (boolean|null); + } + + /** Represents a SuggestionTriggerSettings. */ + class SuggestionTriggerSettings implements ISuggestionTriggerSettings { + + /** + * Constructs a new SuggestionTriggerSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings); + + /** SuggestionTriggerSettings noSmalltalk. */ + public noSmalltalk: boolean; + + /** SuggestionTriggerSettings onlyEndUser. */ + public onlyEndUser: boolean; + + /** + * Creates a new SuggestionTriggerSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionTriggerSettings instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings; + + /** + * Encodes the specified SuggestionTriggerSettings message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify|verify} messages. + * @param message SuggestionTriggerSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionTriggerSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify|verify} messages. + * @param message SuggestionTriggerSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionTriggerSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionTriggerSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings; + + /** + * Decodes a SuggestionTriggerSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionTriggerSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings; + + /** + * Verifies a SuggestionTriggerSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionTriggerSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionTriggerSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings; + + /** + * Creates a plain object from a SuggestionTriggerSettings message. Also converts values to other types if specified. + * @param message SuggestionTriggerSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionTriggerSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionTriggerSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestionFeatureConfig. */ + interface ISuggestionFeatureConfig { + + /** SuggestionFeatureConfig suggestionFeature */ + suggestionFeature?: (google.cloud.dialogflow.v2.ISuggestionFeature|null); + + /** SuggestionFeatureConfig enableEventBasedSuggestion */ + enableEventBasedSuggestion?: (boolean|null); + + /** SuggestionFeatureConfig suggestionTriggerSettings */ + suggestionTriggerSettings?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings|null); + + /** SuggestionFeatureConfig queryConfig */ + queryConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig|null); + + /** SuggestionFeatureConfig conversationModelConfig */ + conversationModelConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig|null); + + /** SuggestionFeatureConfig conversationProcessConfig */ + conversationProcessConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig|null); + } + + /** Represents a SuggestionFeatureConfig. */ + class SuggestionFeatureConfig implements ISuggestionFeatureConfig { + + /** + * Constructs a new SuggestionFeatureConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig); + + /** SuggestionFeatureConfig suggestionFeature. */ + public suggestionFeature?: (google.cloud.dialogflow.v2.ISuggestionFeature|null); + + /** SuggestionFeatureConfig enableEventBasedSuggestion. */ + public enableEventBasedSuggestion: boolean; + + /** SuggestionFeatureConfig suggestionTriggerSettings. */ + public suggestionTriggerSettings?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings|null); + + /** SuggestionFeatureConfig queryConfig. */ + public queryConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig|null); + + /** SuggestionFeatureConfig conversationModelConfig. */ + public conversationModelConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig|null); + + /** SuggestionFeatureConfig conversationProcessConfig. */ + public conversationProcessConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig|null); + + /** + * Creates a new SuggestionFeatureConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionFeatureConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig; + + /** + * Encodes the specified SuggestionFeatureConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify|verify} messages. + * @param message SuggestionFeatureConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionFeatureConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify|verify} messages. + * @param message SuggestionFeatureConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionFeatureConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionFeatureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig; + + /** + * Decodes a SuggestionFeatureConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionFeatureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig; + + /** + * Verifies a SuggestionFeatureConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionFeatureConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionFeatureConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig; + + /** + * Creates a plain object from a SuggestionFeatureConfig message. Also converts values to other types if specified. + * @param message SuggestionFeatureConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionFeatureConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionFeatureConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestionConfig. */ + interface ISuggestionConfig { + + /** SuggestionConfig featureConfigs */ + featureConfigs?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig[]|null); + + /** SuggestionConfig groupSuggestionResponses */ + groupSuggestionResponses?: (boolean|null); + } + + /** Represents a SuggestionConfig. */ + class SuggestionConfig implements ISuggestionConfig { + + /** + * Constructs a new SuggestionConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig); + + /** SuggestionConfig featureConfigs. */ + public featureConfigs: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig[]; + + /** SuggestionConfig groupSuggestionResponses. */ + public groupSuggestionResponses: boolean; + + /** + * Creates a new SuggestionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig; + + /** + * Encodes the specified SuggestionConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.verify|verify} messages. + * @param message SuggestionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.verify|verify} messages. + * @param message SuggestionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig; + + /** + * Decodes a SuggestionConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig; + + /** + * Verifies a SuggestionConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig; + + /** + * Creates a plain object from a SuggestionConfig message. Also converts values to other types if specified. + * @param message SuggestionConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestionQueryConfig. */ + interface ISuggestionQueryConfig { + + /** SuggestionQueryConfig knowledgeBaseQuerySource */ + knowledgeBaseQuerySource?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource|null); + + /** SuggestionQueryConfig documentQuerySource */ + documentQuerySource?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource|null); + + /** SuggestionQueryConfig dialogflowQuerySource */ + dialogflowQuerySource?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource|null); + + /** SuggestionQueryConfig maxResults */ + maxResults?: (number|null); + + /** SuggestionQueryConfig confidenceThreshold */ + confidenceThreshold?: (number|null); + + /** SuggestionQueryConfig contextFilterSettings */ + contextFilterSettings?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings|null); + } + + /** Represents a SuggestionQueryConfig. */ + class SuggestionQueryConfig implements ISuggestionQueryConfig { + + /** + * Constructs a new SuggestionQueryConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig); + + /** SuggestionQueryConfig knowledgeBaseQuerySource. */ + public knowledgeBaseQuerySource?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource|null); + + /** SuggestionQueryConfig documentQuerySource. */ + public documentQuerySource?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource|null); + + /** SuggestionQueryConfig dialogflowQuerySource. */ + public dialogflowQuerySource?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource|null); + + /** SuggestionQueryConfig maxResults. */ + public maxResults: number; + + /** SuggestionQueryConfig confidenceThreshold. */ + public confidenceThreshold: number; + + /** SuggestionQueryConfig contextFilterSettings. */ + public contextFilterSettings?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings|null); + + /** SuggestionQueryConfig querySource. */ + public querySource?: ("knowledgeBaseQuerySource"|"documentQuerySource"|"dialogflowQuerySource"); + + /** + * Creates a new SuggestionQueryConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionQueryConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig; + + /** + * Encodes the specified SuggestionQueryConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.verify|verify} messages. + * @param message SuggestionQueryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionQueryConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.verify|verify} messages. + * @param message SuggestionQueryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionQueryConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionQueryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig; + + /** + * Decodes a SuggestionQueryConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionQueryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig; + + /** + * Verifies a SuggestionQueryConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionQueryConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionQueryConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig; + + /** + * Creates a plain object from a SuggestionQueryConfig message. Also converts values to other types if specified. + * @param message SuggestionQueryConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionQueryConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionQueryConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SuggestionQueryConfig { + + /** Properties of a KnowledgeBaseQuerySource. */ + interface IKnowledgeBaseQuerySource { + + /** KnowledgeBaseQuerySource knowledgeBases */ + knowledgeBases?: (string[]|null); + } + + /** Represents a KnowledgeBaseQuerySource. */ + class KnowledgeBaseQuerySource implements IKnowledgeBaseQuerySource { + + /** + * Constructs a new KnowledgeBaseQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource); + + /** KnowledgeBaseQuerySource knowledgeBases. */ + public knowledgeBases: string[]; + + /** + * Creates a new KnowledgeBaseQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns KnowledgeBaseQuerySource instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource; + + /** + * Encodes the specified KnowledgeBaseQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify|verify} messages. + * @param message KnowledgeBaseQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KnowledgeBaseQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify|verify} messages. + * @param message KnowledgeBaseQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KnowledgeBaseQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KnowledgeBaseQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource; + + /** + * Decodes a KnowledgeBaseQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KnowledgeBaseQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource; + + /** + * Verifies a KnowledgeBaseQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KnowledgeBaseQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KnowledgeBaseQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource; + + /** + * Creates a plain object from a KnowledgeBaseQuerySource message. Also converts values to other types if specified. + * @param message KnowledgeBaseQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KnowledgeBaseQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KnowledgeBaseQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentQuerySource. */ + interface IDocumentQuerySource { + + /** DocumentQuerySource documents */ + documents?: (string[]|null); + } + + /** Represents a DocumentQuerySource. */ + class DocumentQuerySource implements IDocumentQuerySource { + + /** + * Constructs a new DocumentQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource); + + /** DocumentQuerySource documents. */ + public documents: string[]; + + /** + * Creates a new DocumentQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentQuerySource instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource; + + /** + * Encodes the specified DocumentQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify|verify} messages. + * @param message DocumentQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify|verify} messages. + * @param message DocumentQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource; + + /** + * Decodes a DocumentQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource; + + /** + * Verifies a DocumentQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource; + + /** + * Creates a plain object from a DocumentQuerySource message. Also converts values to other types if specified. + * @param message DocumentQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DialogflowQuerySource. */ + interface IDialogflowQuerySource { + + /** DialogflowQuerySource agent */ + agent?: (string|null); + } + + /** Represents a DialogflowQuerySource. */ + class DialogflowQuerySource implements IDialogflowQuerySource { + + /** + * Constructs a new DialogflowQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource); + + /** DialogflowQuerySource agent. */ + public agent: string; + + /** + * Creates a new DialogflowQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns DialogflowQuerySource instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource; + + /** + * Encodes the specified DialogflowQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify|verify} messages. + * @param message DialogflowQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DialogflowQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify|verify} messages. + * @param message DialogflowQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DialogflowQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DialogflowQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource; + + /** + * Decodes a DialogflowQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DialogflowQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource; + + /** + * Verifies a DialogflowQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DialogflowQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DialogflowQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource; + + /** + * Creates a plain object from a DialogflowQuerySource message. Also converts values to other types if specified. + * @param message DialogflowQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DialogflowQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DialogflowQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ContextFilterSettings. */ + interface IContextFilterSettings { + + /** ContextFilterSettings dropHandoffMessages */ + dropHandoffMessages?: (boolean|null); + + /** ContextFilterSettings dropVirtualAgentMessages */ + dropVirtualAgentMessages?: (boolean|null); + + /** ContextFilterSettings dropIvrMessages */ + dropIvrMessages?: (boolean|null); + } + + /** Represents a ContextFilterSettings. */ + class ContextFilterSettings implements IContextFilterSettings { + + /** + * Constructs a new ContextFilterSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings); + + /** ContextFilterSettings dropHandoffMessages. */ + public dropHandoffMessages: boolean; + + /** ContextFilterSettings dropVirtualAgentMessages. */ + public dropVirtualAgentMessages: boolean; + + /** ContextFilterSettings dropIvrMessages. */ + public dropIvrMessages: boolean; + + /** + * Creates a new ContextFilterSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns ContextFilterSettings instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings; + + /** + * Encodes the specified ContextFilterSettings message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify|verify} messages. + * @param message ContextFilterSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ContextFilterSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify|verify} messages. + * @param message ContextFilterSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ContextFilterSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ContextFilterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings; + + /** + * Decodes a ContextFilterSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ContextFilterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings; + + /** + * Verifies a ContextFilterSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ContextFilterSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ContextFilterSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings; + + /** + * Creates a plain object from a ContextFilterSettings message. Also converts values to other types if specified. + * @param message ContextFilterSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ContextFilterSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ContextFilterSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ConversationModelConfig. */ + interface IConversationModelConfig { + + /** ConversationModelConfig model */ + model?: (string|null); + } + + /** Represents a ConversationModelConfig. */ + class ConversationModelConfig implements IConversationModelConfig { + + /** + * Constructs a new ConversationModelConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig); + + /** ConversationModelConfig model. */ + public model: string; + + /** + * Creates a new ConversationModelConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationModelConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig; + + /** + * Encodes the specified ConversationModelConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.verify|verify} messages. + * @param message ConversationModelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationModelConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.verify|verify} messages. + * @param message ConversationModelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationModelConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationModelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig; + + /** + * Decodes a ConversationModelConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationModelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig; + + /** + * Verifies a ConversationModelConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationModelConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationModelConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig; + + /** + * Creates a plain object from a ConversationModelConfig message. Also converts values to other types if specified. + * @param message ConversationModelConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationModelConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationModelConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ConversationProcessConfig. */ + interface IConversationProcessConfig { + + /** ConversationProcessConfig recentSentencesCount */ + recentSentencesCount?: (number|null); + } + + /** Represents a ConversationProcessConfig. */ + class ConversationProcessConfig implements IConversationProcessConfig { + + /** + * Constructs a new ConversationProcessConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig); + + /** ConversationProcessConfig recentSentencesCount. */ + public recentSentencesCount: number; + + /** + * Creates a new ConversationProcessConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationProcessConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig; + + /** + * Encodes the specified ConversationProcessConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig.verify|verify} messages. + * @param message ConversationProcessConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationProcessConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig.verify|verify} messages. + * @param message ConversationProcessConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationProcessConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationProcessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig; + + /** + * Decodes a ConversationProcessConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationProcessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig; + + /** + * Verifies a ConversationProcessConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationProcessConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationProcessConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig; + + /** + * Creates a plain object from a ConversationProcessConfig message. Also converts values to other types if specified. + * @param message ConversationProcessConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationProcessConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationProcessConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MessageAnalysisConfig. */ + interface IMessageAnalysisConfig { + + /** MessageAnalysisConfig enableEntityExtraction */ + enableEntityExtraction?: (boolean|null); + + /** MessageAnalysisConfig enableSentimentAnalysis */ + enableSentimentAnalysis?: (boolean|null); + } + + /** Represents a MessageAnalysisConfig. */ + class MessageAnalysisConfig implements IMessageAnalysisConfig { + + /** + * Constructs a new MessageAnalysisConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig); + + /** MessageAnalysisConfig enableEntityExtraction. */ + public enableEntityExtraction: boolean; + + /** MessageAnalysisConfig enableSentimentAnalysis. */ + public enableSentimentAnalysis: boolean; + + /** + * Creates a new MessageAnalysisConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageAnalysisConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig; + + /** + * Encodes the specified MessageAnalysisConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig.verify|verify} messages. + * @param message MessageAnalysisConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageAnalysisConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig.verify|verify} messages. + * @param message MessageAnalysisConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageAnalysisConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageAnalysisConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig; + + /** + * Decodes a MessageAnalysisConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageAnalysisConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig; + + /** + * Verifies a MessageAnalysisConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageAnalysisConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageAnalysisConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig; + + /** + * Creates a plain object from a MessageAnalysisConfig message. Also converts values to other types if specified. + * @param message MessageAnalysisConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageAnalysisConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageAnalysisConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a HumanAgentHandoffConfig. */ + interface IHumanAgentHandoffConfig { + + /** HumanAgentHandoffConfig livePersonConfig */ + livePersonConfig?: (google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig|null); + + /** HumanAgentHandoffConfig salesforceLiveAgentConfig */ + salesforceLiveAgentConfig?: (google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig|null); + } + + /** Represents a HumanAgentHandoffConfig. */ + class HumanAgentHandoffConfig implements IHumanAgentHandoffConfig { + + /** + * Constructs a new HumanAgentHandoffConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IHumanAgentHandoffConfig); + + /** HumanAgentHandoffConfig livePersonConfig. */ + public livePersonConfig?: (google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig|null); + + /** HumanAgentHandoffConfig salesforceLiveAgentConfig. */ + public salesforceLiveAgentConfig?: (google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig|null); + + /** HumanAgentHandoffConfig agentService. */ + public agentService?: ("livePersonConfig"|"salesforceLiveAgentConfig"); + + /** + * Creates a new HumanAgentHandoffConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanAgentHandoffConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IHumanAgentHandoffConfig): google.cloud.dialogflow.v2.HumanAgentHandoffConfig; + + /** + * Encodes the specified HumanAgentHandoffConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.verify|verify} messages. + * @param message HumanAgentHandoffConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IHumanAgentHandoffConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanAgentHandoffConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.verify|verify} messages. + * @param message HumanAgentHandoffConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IHumanAgentHandoffConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanAgentHandoffConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanAgentHandoffConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentHandoffConfig; + + /** + * Decodes a HumanAgentHandoffConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanAgentHandoffConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentHandoffConfig; + + /** + * Verifies a HumanAgentHandoffConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanAgentHandoffConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanAgentHandoffConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentHandoffConfig; + + /** + * Creates a plain object from a HumanAgentHandoffConfig message. Also converts values to other types if specified. + * @param message HumanAgentHandoffConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentHandoffConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanAgentHandoffConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanAgentHandoffConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace HumanAgentHandoffConfig { + + /** Properties of a LivePersonConfig. */ + interface ILivePersonConfig { + + /** LivePersonConfig accountNumber */ + accountNumber?: (string|null); + } + + /** Represents a LivePersonConfig. */ + class LivePersonConfig implements ILivePersonConfig { + + /** + * Constructs a new LivePersonConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig); + + /** LivePersonConfig accountNumber. */ + public accountNumber: string; + + /** + * Creates a new LivePersonConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns LivePersonConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig): google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig; + + /** + * Encodes the specified LivePersonConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig.verify|verify} messages. + * @param message LivePersonConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LivePersonConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig.verify|verify} messages. + * @param message LivePersonConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LivePersonConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LivePersonConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig; + + /** + * Decodes a LivePersonConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LivePersonConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig; + + /** + * Verifies a LivePersonConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LivePersonConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LivePersonConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig; + + /** + * Creates a plain object from a LivePersonConfig message. Also converts values to other types if specified. + * @param message LivePersonConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LivePersonConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LivePersonConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SalesforceLiveAgentConfig. */ + interface ISalesforceLiveAgentConfig { + + /** SalesforceLiveAgentConfig organizationId */ + organizationId?: (string|null); + + /** SalesforceLiveAgentConfig deploymentId */ + deploymentId?: (string|null); + + /** SalesforceLiveAgentConfig buttonId */ + buttonId?: (string|null); + + /** SalesforceLiveAgentConfig endpointDomain */ + endpointDomain?: (string|null); + } + + /** Represents a SalesforceLiveAgentConfig. */ + class SalesforceLiveAgentConfig implements ISalesforceLiveAgentConfig { + + /** + * Constructs a new SalesforceLiveAgentConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig); + + /** SalesforceLiveAgentConfig organizationId. */ + public organizationId: string; + + /** SalesforceLiveAgentConfig deploymentId. */ + public deploymentId: string; + + /** SalesforceLiveAgentConfig buttonId. */ + public buttonId: string; + + /** SalesforceLiveAgentConfig endpointDomain. */ + public endpointDomain: string; + + /** + * Creates a new SalesforceLiveAgentConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SalesforceLiveAgentConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig): google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig; + + /** + * Encodes the specified SalesforceLiveAgentConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify|verify} messages. + * @param message SalesforceLiveAgentConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SalesforceLiveAgentConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify|verify} messages. + * @param message SalesforceLiveAgentConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SalesforceLiveAgentConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SalesforceLiveAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig; + + /** + * Decodes a SalesforceLiveAgentConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SalesforceLiveAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig; + + /** + * Verifies a SalesforceLiveAgentConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SalesforceLiveAgentConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SalesforceLiveAgentConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig; + + /** + * Creates a plain object from a SalesforceLiveAgentConfig message. Also converts values to other types if specified. + * @param message SalesforceLiveAgentConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SalesforceLiveAgentConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SalesforceLiveAgentConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a NotificationConfig. */ + interface INotificationConfig { + + /** NotificationConfig topic */ + topic?: (string|null); + + /** NotificationConfig messageFormat */ + messageFormat?: (google.cloud.dialogflow.v2.NotificationConfig.MessageFormat|keyof typeof google.cloud.dialogflow.v2.NotificationConfig.MessageFormat|null); + } + + /** Represents a NotificationConfig. */ + class NotificationConfig implements INotificationConfig { + + /** + * Constructs a new NotificationConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.INotificationConfig); + + /** NotificationConfig topic. */ + public topic: string; + + /** NotificationConfig messageFormat. */ + public messageFormat: (google.cloud.dialogflow.v2.NotificationConfig.MessageFormat|keyof typeof google.cloud.dialogflow.v2.NotificationConfig.MessageFormat); + + /** + * Creates a new NotificationConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns NotificationConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.INotificationConfig): google.cloud.dialogflow.v2.NotificationConfig; + + /** + * Encodes the specified NotificationConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.NotificationConfig.verify|verify} messages. + * @param message NotificationConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.INotificationConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NotificationConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.NotificationConfig.verify|verify} messages. + * @param message NotificationConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.INotificationConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NotificationConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NotificationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.NotificationConfig; + + /** + * Decodes a NotificationConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NotificationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.NotificationConfig; + + /** + * Verifies a NotificationConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NotificationConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NotificationConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.NotificationConfig; + + /** + * Creates a plain object from a NotificationConfig message. Also converts values to other types if specified. + * @param message NotificationConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.NotificationConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NotificationConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NotificationConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace NotificationConfig { + + /** MessageFormat enum. */ + enum MessageFormat { + MESSAGE_FORMAT_UNSPECIFIED = 0, + PROTO = 1, + JSON = 2 + } + } + + /** Properties of a LoggingConfig. */ + interface ILoggingConfig { + + /** LoggingConfig enableStackdriverLogging */ + enableStackdriverLogging?: (boolean|null); + } + + /** Represents a LoggingConfig. */ + class LoggingConfig implements ILoggingConfig { + + /** + * Constructs a new LoggingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ILoggingConfig); + + /** LoggingConfig enableStackdriverLogging. */ + public enableStackdriverLogging: boolean; + + /** + * Creates a new LoggingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns LoggingConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ILoggingConfig): google.cloud.dialogflow.v2.LoggingConfig; + + /** + * Encodes the specified LoggingConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.LoggingConfig.verify|verify} messages. + * @param message LoggingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ILoggingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LoggingConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.LoggingConfig.verify|verify} messages. + * @param message LoggingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ILoggingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LoggingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LoggingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.LoggingConfig; + + /** + * Decodes a LoggingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LoggingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.LoggingConfig; + + /** + * Verifies a LoggingConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LoggingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LoggingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.LoggingConfig; + + /** + * Creates a plain object from a LoggingConfig message. Also converts values to other types if specified. + * @param message LoggingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.LoggingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LoggingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LoggingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestionFeature. */ + interface ISuggestionFeature { + + /** SuggestionFeature type */ + type?: (google.cloud.dialogflow.v2.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2.SuggestionFeature.Type|null); + } + + /** Represents a SuggestionFeature. */ + class SuggestionFeature implements ISuggestionFeature { + + /** + * Constructs a new SuggestionFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISuggestionFeature); + + /** SuggestionFeature type. */ + public type: (google.cloud.dialogflow.v2.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2.SuggestionFeature.Type); + + /** + * Creates a new SuggestionFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionFeature instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISuggestionFeature): google.cloud.dialogflow.v2.SuggestionFeature; + + /** + * Encodes the specified SuggestionFeature message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestionFeature.verify|verify} messages. + * @param message SuggestionFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISuggestionFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionFeature message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestionFeature.verify|verify} messages. + * @param message SuggestionFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISuggestionFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SuggestionFeature; + + /** + * Decodes a SuggestionFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SuggestionFeature; + + /** + * Verifies a SuggestionFeature message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionFeature + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SuggestionFeature; + + /** + * Creates a plain object from a SuggestionFeature message. Also converts values to other types if specified. + * @param message SuggestionFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SuggestionFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SuggestionFeature { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + ARTICLE_SUGGESTION = 1, + FAQ = 2, + SMART_REPLY = 3 + } + } + + /** Properties of a SetSuggestionFeatureConfigRequest. */ + interface ISetSuggestionFeatureConfigRequest { + + /** SetSuggestionFeatureConfigRequest conversationProfile */ + conversationProfile?: (string|null); + + /** SetSuggestionFeatureConfigRequest participantRole */ + participantRole?: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role|null); + + /** SetSuggestionFeatureConfigRequest suggestionFeatureConfig */ + suggestionFeatureConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig|null); + } + + /** Represents a SetSuggestionFeatureConfigRequest. */ + class SetSuggestionFeatureConfigRequest implements ISetSuggestionFeatureConfigRequest { + + /** + * Constructs a new SetSuggestionFeatureConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest); + + /** SetSuggestionFeatureConfigRequest conversationProfile. */ + public conversationProfile: string; + + /** SetSuggestionFeatureConfigRequest participantRole. */ + public participantRole: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role); + + /** SetSuggestionFeatureConfigRequest suggestionFeatureConfig. */ + public suggestionFeatureConfig?: (google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig|null); + + /** + * Creates a new SetSuggestionFeatureConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetSuggestionFeatureConfigRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest): google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest; + + /** + * Encodes the specified SetSuggestionFeatureConfigRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest.verify|verify} messages. + * @param message SetSuggestionFeatureConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetSuggestionFeatureConfigRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest.verify|verify} messages. + * @param message SetSuggestionFeatureConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetSuggestionFeatureConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest; + + /** + * Decodes a SetSuggestionFeatureConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest; + + /** + * Verifies a SetSuggestionFeatureConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetSuggestionFeatureConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetSuggestionFeatureConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest; + + /** + * Creates a plain object from a SetSuggestionFeatureConfigRequest message. Also converts values to other types if specified. + * @param message SetSuggestionFeatureConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetSuggestionFeatureConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetSuggestionFeatureConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ClearSuggestionFeatureConfigRequest. */ + interface IClearSuggestionFeatureConfigRequest { + + /** ClearSuggestionFeatureConfigRequest conversationProfile */ + conversationProfile?: (string|null); + + /** ClearSuggestionFeatureConfigRequest participantRole */ + participantRole?: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role|null); + + /** ClearSuggestionFeatureConfigRequest suggestionFeatureType */ + suggestionFeatureType?: (google.cloud.dialogflow.v2.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2.SuggestionFeature.Type|null); + } + + /** Represents a ClearSuggestionFeatureConfigRequest. */ + class ClearSuggestionFeatureConfigRequest implements IClearSuggestionFeatureConfigRequest { + + /** + * Constructs a new ClearSuggestionFeatureConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest); + + /** ClearSuggestionFeatureConfigRequest conversationProfile. */ + public conversationProfile: string; + + /** ClearSuggestionFeatureConfigRequest participantRole. */ + public participantRole: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role); + + /** ClearSuggestionFeatureConfigRequest suggestionFeatureType. */ + public suggestionFeatureType: (google.cloud.dialogflow.v2.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2.SuggestionFeature.Type); + + /** + * Creates a new ClearSuggestionFeatureConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ClearSuggestionFeatureConfigRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest): google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest; + + /** + * Encodes the specified ClearSuggestionFeatureConfigRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest.verify|verify} messages. + * @param message ClearSuggestionFeatureConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClearSuggestionFeatureConfigRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest.verify|verify} messages. + * @param message ClearSuggestionFeatureConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClearSuggestionFeatureConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClearSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest; + + /** + * Decodes a ClearSuggestionFeatureConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClearSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest; + + /** + * Verifies a ClearSuggestionFeatureConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClearSuggestionFeatureConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClearSuggestionFeatureConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest; + + /** + * Creates a plain object from a ClearSuggestionFeatureConfigRequest message. Also converts values to other types if specified. + * @param message ClearSuggestionFeatureConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClearSuggestionFeatureConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ClearSuggestionFeatureConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SetSuggestionFeatureConfigOperationMetadata. */ + interface ISetSuggestionFeatureConfigOperationMetadata { + + /** SetSuggestionFeatureConfigOperationMetadata conversationProfile */ + conversationProfile?: (string|null); + + /** SetSuggestionFeatureConfigOperationMetadata participantRole */ + participantRole?: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role|null); + + /** SetSuggestionFeatureConfigOperationMetadata suggestionFeatureType */ + suggestionFeatureType?: (google.cloud.dialogflow.v2.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2.SuggestionFeature.Type|null); + + /** SetSuggestionFeatureConfigOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SetSuggestionFeatureConfigOperationMetadata. */ + class SetSuggestionFeatureConfigOperationMetadata implements ISetSuggestionFeatureConfigOperationMetadata { + + /** + * Constructs a new SetSuggestionFeatureConfigOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata); + + /** SetSuggestionFeatureConfigOperationMetadata conversationProfile. */ + public conversationProfile: string; + + /** SetSuggestionFeatureConfigOperationMetadata participantRole. */ + public participantRole: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role); + + /** SetSuggestionFeatureConfigOperationMetadata suggestionFeatureType. */ + public suggestionFeatureType: (google.cloud.dialogflow.v2.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2.SuggestionFeature.Type); + + /** SetSuggestionFeatureConfigOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SetSuggestionFeatureConfigOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns SetSuggestionFeatureConfigOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata): google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata; + + /** + * Encodes the specified SetSuggestionFeatureConfigOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @param message SetSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetSuggestionFeatureConfigOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @param message SetSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata; + + /** + * Decodes a SetSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata; + + /** + * Verifies a SetSuggestionFeatureConfigOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetSuggestionFeatureConfigOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetSuggestionFeatureConfigOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata; + + /** + * Creates a plain object from a SetSuggestionFeatureConfigOperationMetadata message. Also converts values to other types if specified. + * @param message SetSuggestionFeatureConfigOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetSuggestionFeatureConfigOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetSuggestionFeatureConfigOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ClearSuggestionFeatureConfigOperationMetadata. */ + interface IClearSuggestionFeatureConfigOperationMetadata { + + /** ClearSuggestionFeatureConfigOperationMetadata conversationProfile */ + conversationProfile?: (string|null); + + /** ClearSuggestionFeatureConfigOperationMetadata participantRole */ + participantRole?: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role|null); + + /** ClearSuggestionFeatureConfigOperationMetadata suggestionFeatureType */ + suggestionFeatureType?: (google.cloud.dialogflow.v2.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2.SuggestionFeature.Type|null); + + /** ClearSuggestionFeatureConfigOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a ClearSuggestionFeatureConfigOperationMetadata. */ + class ClearSuggestionFeatureConfigOperationMetadata implements IClearSuggestionFeatureConfigOperationMetadata { + + /** + * Constructs a new ClearSuggestionFeatureConfigOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata); + + /** ClearSuggestionFeatureConfigOperationMetadata conversationProfile. */ + public conversationProfile: string; + + /** ClearSuggestionFeatureConfigOperationMetadata participantRole. */ + public participantRole: (google.cloud.dialogflow.v2.Participant.Role|keyof typeof google.cloud.dialogflow.v2.Participant.Role); + + /** ClearSuggestionFeatureConfigOperationMetadata suggestionFeatureType. */ + public suggestionFeatureType: (google.cloud.dialogflow.v2.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2.SuggestionFeature.Type); + + /** ClearSuggestionFeatureConfigOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ClearSuggestionFeatureConfigOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ClearSuggestionFeatureConfigOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata): google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata; + + /** + * Encodes the specified ClearSuggestionFeatureConfigOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @param message ClearSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClearSuggestionFeatureConfigOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @param message ClearSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClearSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClearSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata; + + /** + * Decodes a ClearSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClearSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata; + + /** + * Verifies a ClearSuggestionFeatureConfigOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClearSuggestionFeatureConfigOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClearSuggestionFeatureConfigOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata; + + /** + * Creates a plain object from a ClearSuggestionFeatureConfigOperationMetadata message. Also converts values to other types if specified. + * @param message ClearSuggestionFeatureConfigOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClearSuggestionFeatureConfigOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ClearSuggestionFeatureConfigOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Documents */ + class Documents extends $protobuf.rpc.Service { + + /** + * Constructs a new Documents 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 Documents 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): Documents; + + /** + * Calls ListDocuments. + * @param request ListDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListDocumentsResponse + */ + public listDocuments(request: google.cloud.dialogflow.v2.IListDocumentsRequest, callback: google.cloud.dialogflow.v2.Documents.ListDocumentsCallback): void; + + /** + * Calls ListDocuments. + * @param request ListDocumentsRequest message or plain object + * @returns Promise + */ + public listDocuments(request: google.cloud.dialogflow.v2.IListDocumentsRequest): Promise; + + /** + * Calls GetDocument. + * @param request GetDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Document + */ + public getDocument(request: google.cloud.dialogflow.v2.IGetDocumentRequest, callback: google.cloud.dialogflow.v2.Documents.GetDocumentCallback): void; + + /** + * Calls GetDocument. + * @param request GetDocumentRequest message or plain object + * @returns Promise + */ + public getDocument(request: google.cloud.dialogflow.v2.IGetDocumentRequest): Promise; + + /** + * Calls CreateDocument. + * @param request CreateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createDocument(request: google.cloud.dialogflow.v2.ICreateDocumentRequest, callback: google.cloud.dialogflow.v2.Documents.CreateDocumentCallback): void; + + /** + * Calls CreateDocument. + * @param request CreateDocumentRequest message or plain object + * @returns Promise + */ + public createDocument(request: google.cloud.dialogflow.v2.ICreateDocumentRequest): Promise; + + /** + * Calls ImportDocuments. + * @param request ImportDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importDocuments(request: google.cloud.dialogflow.v2.IImportDocumentsRequest, callback: google.cloud.dialogflow.v2.Documents.ImportDocumentsCallback): void; + + /** + * Calls ImportDocuments. + * @param request ImportDocumentsRequest message or plain object + * @returns Promise + */ + public importDocuments(request: google.cloud.dialogflow.v2.IImportDocumentsRequest): Promise; + + /** + * Calls DeleteDocument. + * @param request DeleteDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteDocument(request: google.cloud.dialogflow.v2.IDeleteDocumentRequest, callback: google.cloud.dialogflow.v2.Documents.DeleteDocumentCallback): void; + + /** + * Calls DeleteDocument. + * @param request DeleteDocumentRequest message or plain object + * @returns Promise + */ + public deleteDocument(request: google.cloud.dialogflow.v2.IDeleteDocumentRequest): Promise; + + /** + * Calls UpdateDocument. + * @param request UpdateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateDocument(request: google.cloud.dialogflow.v2.IUpdateDocumentRequest, callback: google.cloud.dialogflow.v2.Documents.UpdateDocumentCallback): void; + + /** + * Calls UpdateDocument. + * @param request UpdateDocumentRequest message or plain object + * @returns Promise + */ + public updateDocument(request: google.cloud.dialogflow.v2.IUpdateDocumentRequest): Promise; + + /** + * Calls ReloadDocument. + * @param request ReloadDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public reloadDocument(request: google.cloud.dialogflow.v2.IReloadDocumentRequest, callback: google.cloud.dialogflow.v2.Documents.ReloadDocumentCallback): void; + + /** + * Calls ReloadDocument. + * @param request ReloadDocumentRequest message or plain object + * @returns Promise + */ + public reloadDocument(request: google.cloud.dialogflow.v2.IReloadDocumentRequest): Promise; + + /** + * Calls ExportDocument. + * @param request ExportDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public exportDocument(request: google.cloud.dialogflow.v2.IExportDocumentRequest, callback: google.cloud.dialogflow.v2.Documents.ExportDocumentCallback): void; + + /** + * Calls ExportDocument. + * @param request ExportDocumentRequest message or plain object + * @returns Promise + */ + public exportDocument(request: google.cloud.dialogflow.v2.IExportDocumentRequest): Promise; + } + + namespace Documents { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|listDocuments}. + * @param error Error, if any + * @param [response] ListDocumentsResponse + */ + type ListDocumentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListDocumentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|getDocument}. + * @param error Error, if any + * @param [response] Document + */ + type GetDocumentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Document) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|createDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|importDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|deleteDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|updateDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|reloadDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type ReloadDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|exportDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a Document. */ + interface IDocument { + + /** Document name */ + name?: (string|null); + + /** Document displayName */ + displayName?: (string|null); + + /** Document mimeType */ + mimeType?: (string|null); + + /** Document knowledgeTypes */ + knowledgeTypes?: (google.cloud.dialogflow.v2.Document.KnowledgeType[]|null); + + /** Document contentUri */ + contentUri?: (string|null); + + /** Document rawContent */ + rawContent?: (Uint8Array|string|null); + + /** Document enableAutoReload */ + enableAutoReload?: (boolean|null); + + /** Document latestReloadStatus */ + latestReloadStatus?: (google.cloud.dialogflow.v2.Document.IReloadStatus|null); + + /** Document metadata */ + metadata?: ({ [k: string]: string }|null); + + /** Document state */ + state?: (google.cloud.dialogflow.v2.Document.State|keyof typeof google.cloud.dialogflow.v2.Document.State|null); + } + + /** Represents a Document. */ + class Document implements IDocument { + + /** + * Constructs a new Document. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDocument); + + /** Document name. */ + public name: string; + + /** Document displayName. */ + public displayName: string; + + /** Document mimeType. */ + public mimeType: string; + + /** Document knowledgeTypes. */ + public knowledgeTypes: google.cloud.dialogflow.v2.Document.KnowledgeType[]; + + /** Document contentUri. */ + public contentUri?: (string|null); + + /** Document rawContent. */ + public rawContent?: (Uint8Array|string|null); + + /** Document enableAutoReload. */ + public enableAutoReload: boolean; + + /** Document latestReloadStatus. */ + public latestReloadStatus?: (google.cloud.dialogflow.v2.Document.IReloadStatus|null); + + /** Document metadata. */ + public metadata: { [k: string]: string }; + + /** Document state. */ + public state: (google.cloud.dialogflow.v2.Document.State|keyof typeof google.cloud.dialogflow.v2.Document.State); + + /** Document source. */ + public source?: ("contentUri"|"rawContent"); + + /** + * Creates a new Document instance using the specified properties. + * @param [properties] Properties to set + * @returns Document instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDocument): google.cloud.dialogflow.v2.Document; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.dialogflow.v2.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Document message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Document; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Document; + + /** + * Verifies a Document message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Document + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Document; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @param message Document + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Document, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Document to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Document + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Document { + + /** KnowledgeType enum. */ + enum KnowledgeType { + KNOWLEDGE_TYPE_UNSPECIFIED = 0, + FAQ = 1, + EXTRACTIVE_QA = 2, + ARTICLE_SUGGESTION = 3, + AGENT_FACING_SMART_REPLY = 4 + } + + /** Properties of a ReloadStatus. */ + interface IReloadStatus { + + /** ReloadStatus time */ + time?: (google.protobuf.ITimestamp|null); + + /** ReloadStatus status */ + status?: (google.rpc.IStatus|null); + } + + /** Represents a ReloadStatus. */ + class ReloadStatus implements IReloadStatus { + + /** + * Constructs a new ReloadStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Document.IReloadStatus); + + /** ReloadStatus time. */ + public time?: (google.protobuf.ITimestamp|null); + + /** ReloadStatus status. */ + public status?: (google.rpc.IStatus|null); + + /** + * Creates a new ReloadStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns ReloadStatus instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Document.IReloadStatus): google.cloud.dialogflow.v2.Document.ReloadStatus; + + /** + * Encodes the specified ReloadStatus message. Does not implicitly {@link google.cloud.dialogflow.v2.Document.ReloadStatus.verify|verify} messages. + * @param message ReloadStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Document.IReloadStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReloadStatus message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Document.ReloadStatus.verify|verify} messages. + * @param message ReloadStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Document.IReloadStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReloadStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReloadStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Document.ReloadStatus; + + /** + * Decodes a ReloadStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReloadStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Document.ReloadStatus; + + /** + * Verifies a ReloadStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReloadStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReloadStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Document.ReloadStatus; + + /** + * Creates a plain object from a ReloadStatus message. Also converts values to other types if specified. + * @param message ReloadStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Document.ReloadStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReloadStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReloadStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + ACTIVE = 2, + UPDATING = 3, + RELOADING = 4, + DELETING = 5 + } + } + + /** Properties of a GetDocumentRequest. */ + interface IGetDocumentRequest { + + /** GetDocumentRequest name */ + name?: (string|null); + } + + /** Represents a GetDocumentRequest. */ + class GetDocumentRequest implements IGetDocumentRequest { + + /** + * Constructs a new GetDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetDocumentRequest); + + /** GetDocumentRequest name. */ + public name: string; + + /** + * Creates a new GetDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetDocumentRequest): google.cloud.dialogflow.v2.GetDocumentRequest; + + /** + * Encodes the specified GetDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetDocumentRequest.verify|verify} messages. + * @param message GetDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetDocumentRequest.verify|verify} messages. + * @param message GetDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetDocumentRequest; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetDocumentRequest; + + /** + * Verifies a GetDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetDocumentRequest; + + /** + * Creates a plain object from a GetDocumentRequest message. Also converts values to other types if specified. + * @param message GetDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListDocumentsRequest. */ + interface IListDocumentsRequest { + + /** ListDocumentsRequest parent */ + parent?: (string|null); + + /** ListDocumentsRequest pageSize */ + pageSize?: (number|null); + + /** ListDocumentsRequest pageToken */ + pageToken?: (string|null); + + /** ListDocumentsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListDocumentsRequest. */ + class ListDocumentsRequest implements IListDocumentsRequest { + + /** + * Constructs a new ListDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListDocumentsRequest); + + /** ListDocumentsRequest parent. */ + public parent: string; + + /** ListDocumentsRequest pageSize. */ + public pageSize: number; + + /** ListDocumentsRequest pageToken. */ + public pageToken: string; + + /** ListDocumentsRequest filter. */ + public filter: string; + + /** + * Creates a new ListDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDocumentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListDocumentsRequest): google.cloud.dialogflow.v2.ListDocumentsRequest; + + /** + * Encodes the specified ListDocumentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListDocumentsRequest.verify|verify} messages. + * @param message ListDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListDocumentsRequest.verify|verify} messages. + * @param message ListDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListDocumentsRequest; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListDocumentsRequest; + + /** + * Verifies a ListDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListDocumentsRequest; + + /** + * Creates a plain object from a ListDocumentsRequest message. Also converts values to other types if specified. + * @param message ListDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListDocumentsResponse. */ + interface IListDocumentsResponse { + + /** ListDocumentsResponse documents */ + documents?: (google.cloud.dialogflow.v2.IDocument[]|null); + + /** ListDocumentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListDocumentsResponse. */ + class ListDocumentsResponse implements IListDocumentsResponse { + + /** + * Constructs a new ListDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListDocumentsResponse); + + /** ListDocumentsResponse documents. */ + public documents: google.cloud.dialogflow.v2.IDocument[]; + + /** ListDocumentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDocumentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListDocumentsResponse): google.cloud.dialogflow.v2.ListDocumentsResponse; + + /** + * Encodes the specified ListDocumentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListDocumentsResponse.verify|verify} messages. + * @param message ListDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListDocumentsResponse.verify|verify} messages. + * @param message ListDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListDocumentsResponse; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListDocumentsResponse; + + /** + * Verifies a ListDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListDocumentsResponse; + + /** + * Creates a plain object from a ListDocumentsResponse message. Also converts values to other types if specified. + * @param message ListDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateDocumentRequest. */ + interface ICreateDocumentRequest { + + /** CreateDocumentRequest parent */ + parent?: (string|null); + + /** CreateDocumentRequest document */ + document?: (google.cloud.dialogflow.v2.IDocument|null); + } + + /** Represents a CreateDocumentRequest. */ + class CreateDocumentRequest implements ICreateDocumentRequest { + + /** + * Constructs a new CreateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateDocumentRequest); + + /** CreateDocumentRequest parent. */ + public parent: string; + + /** CreateDocumentRequest document. */ + public document?: (google.cloud.dialogflow.v2.IDocument|null); + + /** + * Creates a new CreateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateDocumentRequest): google.cloud.dialogflow.v2.CreateDocumentRequest; + + /** + * Encodes the specified CreateDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateDocumentRequest.verify|verify} messages. + * @param message CreateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateDocumentRequest.verify|verify} messages. + * @param message CreateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateDocumentRequest; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateDocumentRequest; + + /** + * Verifies a CreateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateDocumentRequest; + + /** + * Creates a plain object from a CreateDocumentRequest message. Also converts values to other types if specified. + * @param message CreateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportDocumentsRequest. */ + interface IImportDocumentsRequest { + + /** ImportDocumentsRequest parent */ + parent?: (string|null); + + /** ImportDocumentsRequest gcsSource */ + gcsSource?: (google.cloud.dialogflow.v2.IGcsSources|null); + + /** ImportDocumentsRequest documentTemplate */ + documentTemplate?: (google.cloud.dialogflow.v2.IImportDocumentTemplate|null); + + /** ImportDocumentsRequest importGcsCustomMetadata */ + importGcsCustomMetadata?: (boolean|null); + } + + /** Represents an ImportDocumentsRequest. */ + class ImportDocumentsRequest implements IImportDocumentsRequest { + + /** + * Constructs a new ImportDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IImportDocumentsRequest); + + /** ImportDocumentsRequest parent. */ + public parent: string; + + /** ImportDocumentsRequest gcsSource. */ + public gcsSource?: (google.cloud.dialogflow.v2.IGcsSources|null); + + /** ImportDocumentsRequest documentTemplate. */ + public documentTemplate?: (google.cloud.dialogflow.v2.IImportDocumentTemplate|null); + + /** ImportDocumentsRequest importGcsCustomMetadata. */ + public importGcsCustomMetadata: boolean; + + /** ImportDocumentsRequest source. */ + public source?: "gcsSource"; + + /** + * Creates a new ImportDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportDocumentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IImportDocumentsRequest): google.cloud.dialogflow.v2.ImportDocumentsRequest; + + /** + * Encodes the specified ImportDocumentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentsRequest.verify|verify} messages. + * @param message ImportDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IImportDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentsRequest.verify|verify} messages. + * @param message ImportDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IImportDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ImportDocumentsRequest; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ImportDocumentsRequest; + + /** + * Verifies an ImportDocumentsRequest message. + * @param message Plain 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 ImportDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ImportDocumentsRequest; + + /** + * Creates a plain object from an ImportDocumentsRequest message. Also converts values to other types if specified. + * @param message ImportDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ImportDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportDocumentTemplate. */ + interface IImportDocumentTemplate { + + /** ImportDocumentTemplate mimeType */ + mimeType?: (string|null); + + /** ImportDocumentTemplate knowledgeTypes */ + knowledgeTypes?: (google.cloud.dialogflow.v2.Document.KnowledgeType[]|null); + + /** ImportDocumentTemplate metadata */ + metadata?: ({ [k: string]: string }|null); + } + + /** Represents an ImportDocumentTemplate. */ + class ImportDocumentTemplate implements IImportDocumentTemplate { + + /** + * Constructs a new ImportDocumentTemplate. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IImportDocumentTemplate); + + /** ImportDocumentTemplate mimeType. */ + public mimeType: string; + + /** ImportDocumentTemplate knowledgeTypes. */ + public knowledgeTypes: google.cloud.dialogflow.v2.Document.KnowledgeType[]; + + /** ImportDocumentTemplate metadata. */ + public metadata: { [k: string]: string }; + + /** + * Creates a new ImportDocumentTemplate instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportDocumentTemplate instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IImportDocumentTemplate): google.cloud.dialogflow.v2.ImportDocumentTemplate; + + /** + * Encodes the specified ImportDocumentTemplate message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentTemplate.verify|verify} messages. + * @param message ImportDocumentTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IImportDocumentTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportDocumentTemplate message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentTemplate.verify|verify} messages. + * @param message ImportDocumentTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IImportDocumentTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportDocumentTemplate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportDocumentTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ImportDocumentTemplate; + + /** + * Decodes an ImportDocumentTemplate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportDocumentTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ImportDocumentTemplate; + + /** + * Verifies an ImportDocumentTemplate message. + * @param message Plain 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 ImportDocumentTemplate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportDocumentTemplate + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ImportDocumentTemplate; + + /** + * Creates a plain object from an ImportDocumentTemplate message. Also converts values to other types if specified. + * @param message ImportDocumentTemplate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ImportDocumentTemplate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportDocumentTemplate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportDocumentTemplate + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportDocumentsResponse. */ + interface IImportDocumentsResponse { + + /** ImportDocumentsResponse warnings */ + warnings?: (google.rpc.IStatus[]|null); + } + + /** Represents an ImportDocumentsResponse. */ + class ImportDocumentsResponse implements IImportDocumentsResponse { + + /** + * Constructs a new ImportDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IImportDocumentsResponse); + + /** ImportDocumentsResponse warnings. */ + public warnings: google.rpc.IStatus[]; + + /** + * Creates a new ImportDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportDocumentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IImportDocumentsResponse): google.cloud.dialogflow.v2.ImportDocumentsResponse; + + /** + * Encodes the specified ImportDocumentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentsResponse.verify|verify} messages. + * @param message ImportDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IImportDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentsResponse.verify|verify} messages. + * @param message ImportDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IImportDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ImportDocumentsResponse; + + /** + * Decodes an ImportDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ImportDocumentsResponse; + + /** + * Verifies an ImportDocumentsResponse message. + * @param message Plain 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 ImportDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ImportDocumentsResponse; + + /** + * Creates a plain object from an ImportDocumentsResponse message. Also converts values to other types if specified. + * @param message ImportDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ImportDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteDocumentRequest. */ + interface IDeleteDocumentRequest { + + /** DeleteDocumentRequest name */ + name?: (string|null); + } + + /** Represents a DeleteDocumentRequest. */ + class DeleteDocumentRequest implements IDeleteDocumentRequest { + + /** + * Constructs a new DeleteDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteDocumentRequest); + + /** DeleteDocumentRequest name. */ + public name: string; + + /** + * Creates a new DeleteDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteDocumentRequest): google.cloud.dialogflow.v2.DeleteDocumentRequest; + + /** + * Encodes the specified DeleteDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteDocumentRequest.verify|verify} messages. + * @param message DeleteDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteDocumentRequest.verify|verify} messages. + * @param message DeleteDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteDocumentRequest; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteDocumentRequest; + + /** + * Verifies a DeleteDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteDocumentRequest; + + /** + * Creates a plain object from a DeleteDocumentRequest message. Also converts values to other types if specified. + * @param message DeleteDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateDocumentRequest. */ + interface IUpdateDocumentRequest { + + /** UpdateDocumentRequest document */ + document?: (google.cloud.dialogflow.v2.IDocument|null); + + /** UpdateDocumentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateDocumentRequest. */ + class UpdateDocumentRequest implements IUpdateDocumentRequest { + + /** + * Constructs a new UpdateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateDocumentRequest); + + /** UpdateDocumentRequest document. */ + public document?: (google.cloud.dialogflow.v2.IDocument|null); + + /** UpdateDocumentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateDocumentRequest): google.cloud.dialogflow.v2.UpdateDocumentRequest; + + /** + * Encodes the specified UpdateDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateDocumentRequest.verify|verify} messages. + * @param message UpdateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateDocumentRequest.verify|verify} messages. + * @param message UpdateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateDocumentRequest; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateDocumentRequest; + + /** + * Verifies an UpdateDocumentRequest message. + * @param message Plain 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 UpdateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateDocumentRequest; + + /** + * Creates a plain object from an UpdateDocumentRequest message. Also converts values to other types if specified. + * @param message UpdateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReloadDocumentRequest. */ + interface IReloadDocumentRequest { + + /** ReloadDocumentRequest name */ + name?: (string|null); + + /** ReloadDocumentRequest contentUri */ + contentUri?: (string|null); + + /** ReloadDocumentRequest importGcsCustomMetadata */ + importGcsCustomMetadata?: (boolean|null); + + /** ReloadDocumentRequest smartMessagingPartialUpdate */ + smartMessagingPartialUpdate?: (boolean|null); + } + + /** Represents a ReloadDocumentRequest. */ + class ReloadDocumentRequest implements IReloadDocumentRequest { + + /** + * Constructs a new ReloadDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IReloadDocumentRequest); + + /** ReloadDocumentRequest name. */ + public name: string; + + /** ReloadDocumentRequest contentUri. */ + public contentUri?: (string|null); + + /** ReloadDocumentRequest importGcsCustomMetadata. */ + public importGcsCustomMetadata: boolean; + + /** ReloadDocumentRequest smartMessagingPartialUpdate. */ + public smartMessagingPartialUpdate: boolean; + + /** ReloadDocumentRequest source. */ + public source?: "contentUri"; + + /** + * Creates a new ReloadDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ReloadDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IReloadDocumentRequest): google.cloud.dialogflow.v2.ReloadDocumentRequest; + + /** + * Encodes the specified ReloadDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ReloadDocumentRequest.verify|verify} messages. + * @param message ReloadDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IReloadDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReloadDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ReloadDocumentRequest.verify|verify} messages. + * @param message ReloadDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IReloadDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReloadDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReloadDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ReloadDocumentRequest; + + /** + * Decodes a ReloadDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReloadDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ReloadDocumentRequest; + + /** + * Verifies a ReloadDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReloadDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReloadDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ReloadDocumentRequest; + + /** + * Creates a plain object from a ReloadDocumentRequest message. Also converts values to other types if specified. + * @param message ReloadDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ReloadDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReloadDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReloadDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportDocumentRequest. */ + interface IExportDocumentRequest { + + /** ExportDocumentRequest name */ + name?: (string|null); + + /** ExportDocumentRequest gcsDestination */ + gcsDestination?: (google.cloud.dialogflow.v2.IGcsDestination|null); + + /** ExportDocumentRequest exportFullContent */ + exportFullContent?: (boolean|null); + + /** ExportDocumentRequest smartMessagingPartialUpdate */ + smartMessagingPartialUpdate?: (boolean|null); + } + + /** Represents an ExportDocumentRequest. */ + class ExportDocumentRequest implements IExportDocumentRequest { + + /** + * Constructs a new ExportDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IExportDocumentRequest); + + /** ExportDocumentRequest name. */ + public name: string; + + /** ExportDocumentRequest gcsDestination. */ + public gcsDestination?: (google.cloud.dialogflow.v2.IGcsDestination|null); + + /** ExportDocumentRequest exportFullContent. */ + public exportFullContent: boolean; + + /** ExportDocumentRequest smartMessagingPartialUpdate. */ + public smartMessagingPartialUpdate: boolean; + + /** ExportDocumentRequest destination. */ + public destination?: "gcsDestination"; + + /** + * Creates a new ExportDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IExportDocumentRequest): google.cloud.dialogflow.v2.ExportDocumentRequest; + + /** + * Encodes the specified ExportDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportDocumentRequest.verify|verify} messages. + * @param message ExportDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IExportDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportDocumentRequest.verify|verify} messages. + * @param message ExportDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IExportDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ExportDocumentRequest; + + /** + * Decodes an ExportDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ExportDocumentRequest; + + /** + * Verifies an ExportDocumentRequest message. + * @param message Plain 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 ExportDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ExportDocumentRequest; + + /** + * Creates a plain object from an ExportDocumentRequest message. Also converts values to other types if specified. + * @param message ExportDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ExportDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportOperationMetadata. */ + interface IExportOperationMetadata { + + /** ExportOperationMetadata exportedGcsDestination */ + exportedGcsDestination?: (google.cloud.dialogflow.v2.IGcsDestination|null); + } + + /** Represents an ExportOperationMetadata. */ + class ExportOperationMetadata implements IExportOperationMetadata { + + /** + * Constructs a new ExportOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IExportOperationMetadata); + + /** ExportOperationMetadata exportedGcsDestination. */ + public exportedGcsDestination?: (google.cloud.dialogflow.v2.IGcsDestination|null); + + /** + * Creates a new ExportOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IExportOperationMetadata): google.cloud.dialogflow.v2.ExportOperationMetadata; + + /** + * Encodes the specified ExportOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportOperationMetadata.verify|verify} messages. + * @param message ExportOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IExportOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportOperationMetadata.verify|verify} messages. + * @param message ExportOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IExportOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ExportOperationMetadata; + + /** + * Decodes an ExportOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ExportOperationMetadata; + + /** + * Verifies an ExportOperationMetadata message. + * @param message Plain 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 ExportOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ExportOperationMetadata; + + /** + * Creates a plain object from an ExportOperationMetadata message. Also converts values to other types if specified. + * @param message ExportOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ExportOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a KnowledgeOperationMetadata. */ + interface IKnowledgeOperationMetadata { + + /** KnowledgeOperationMetadata state */ + state?: (google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State|null); + + /** KnowledgeOperationMetadata knowledgeBase */ + knowledgeBase?: (string|null); + + /** KnowledgeOperationMetadata exportOperationMetadata */ + exportOperationMetadata?: (google.cloud.dialogflow.v2.IExportOperationMetadata|null); + } + + /** Represents a KnowledgeOperationMetadata. */ + class KnowledgeOperationMetadata implements IKnowledgeOperationMetadata { + + /** + * Constructs a new KnowledgeOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IKnowledgeOperationMetadata); + + /** KnowledgeOperationMetadata state. */ + public state: (google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State); + + /** KnowledgeOperationMetadata knowledgeBase. */ + public knowledgeBase: string; + + /** KnowledgeOperationMetadata exportOperationMetadata. */ + public exportOperationMetadata?: (google.cloud.dialogflow.v2.IExportOperationMetadata|null); + + /** KnowledgeOperationMetadata operationMetadata. */ + public operationMetadata?: "exportOperationMetadata"; + + /** + * Creates a new KnowledgeOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns KnowledgeOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IKnowledgeOperationMetadata): google.cloud.dialogflow.v2.KnowledgeOperationMetadata; + + /** + * Encodes the specified KnowledgeOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata.verify|verify} messages. + * @param message KnowledgeOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IKnowledgeOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KnowledgeOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata.verify|verify} messages. + * @param message KnowledgeOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IKnowledgeOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KnowledgeOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KnowledgeOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.KnowledgeOperationMetadata; + + /** + * Decodes a KnowledgeOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KnowledgeOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.KnowledgeOperationMetadata; + + /** + * Verifies a KnowledgeOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KnowledgeOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KnowledgeOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.KnowledgeOperationMetadata; + + /** + * Creates a plain object from a KnowledgeOperationMetadata message. Also converts values to other types if specified. + * @param message KnowledgeOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.KnowledgeOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KnowledgeOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KnowledgeOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace KnowledgeOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + PENDING = 1, + RUNNING = 2, + DONE = 3 + } + } + + /** Represents an Environments */ + class Environments extends $protobuf.rpc.Service { + + /** + * Constructs a new Environments 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 Environments 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): Environments; + + /** + * Calls ListEnvironments. + * @param request ListEnvironmentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListEnvironmentsResponse + */ + public listEnvironments(request: google.cloud.dialogflow.v2.IListEnvironmentsRequest, callback: google.cloud.dialogflow.v2.Environments.ListEnvironmentsCallback): void; + + /** + * Calls ListEnvironments. + * @param request ListEnvironmentsRequest message or plain object + * @returns Promise + */ + public listEnvironments(request: google.cloud.dialogflow.v2.IListEnvironmentsRequest): Promise; + + /** + * Calls GetEnvironment. + * @param request GetEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Environment + */ + public getEnvironment(request: google.cloud.dialogflow.v2.IGetEnvironmentRequest, callback: google.cloud.dialogflow.v2.Environments.GetEnvironmentCallback): void; + + /** + * Calls GetEnvironment. + * @param request GetEnvironmentRequest message or plain object + * @returns Promise + */ + public getEnvironment(request: google.cloud.dialogflow.v2.IGetEnvironmentRequest): Promise; + + /** + * Calls CreateEnvironment. + * @param request CreateEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Environment + */ + public createEnvironment(request: google.cloud.dialogflow.v2.ICreateEnvironmentRequest, callback: google.cloud.dialogflow.v2.Environments.CreateEnvironmentCallback): void; + + /** + * Calls CreateEnvironment. + * @param request CreateEnvironmentRequest message or plain object + * @returns Promise + */ + public createEnvironment(request: google.cloud.dialogflow.v2.ICreateEnvironmentRequest): Promise; + + /** + * Calls UpdateEnvironment. + * @param request UpdateEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Environment + */ + public updateEnvironment(request: google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, callback: google.cloud.dialogflow.v2.Environments.UpdateEnvironmentCallback): void; + + /** + * Calls UpdateEnvironment. + * @param request UpdateEnvironmentRequest message or plain object + * @returns Promise + */ + public updateEnvironment(request: google.cloud.dialogflow.v2.IUpdateEnvironmentRequest): Promise; + + /** + * Calls DeleteEnvironment. + * @param request DeleteEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteEnvironment(request: google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, callback: google.cloud.dialogflow.v2.Environments.DeleteEnvironmentCallback): void; + + /** + * Calls DeleteEnvironment. + * @param request DeleteEnvironmentRequest message or plain object + * @returns Promise + */ + public deleteEnvironment(request: google.cloud.dialogflow.v2.IDeleteEnvironmentRequest): Promise; + + /** + * Calls GetEnvironmentHistory. + * @param request GetEnvironmentHistoryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EnvironmentHistory + */ + public getEnvironmentHistory(request: google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, callback: google.cloud.dialogflow.v2.Environments.GetEnvironmentHistoryCallback): void; + + /** + * Calls GetEnvironmentHistory. + * @param request GetEnvironmentHistoryRequest message or plain object + * @returns Promise + */ + public getEnvironmentHistory(request: google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest): Promise; + } + + namespace Environments { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|listEnvironments}. + * @param error Error, if any + * @param [response] ListEnvironmentsResponse + */ + type ListEnvironmentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListEnvironmentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|getEnvironment}. + * @param error Error, if any + * @param [response] Environment + */ + type GetEnvironmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Environment) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|createEnvironment}. + * @param error Error, if any + * @param [response] Environment + */ + type CreateEnvironmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Environment) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|updateEnvironment}. + * @param error Error, if any + * @param [response] Environment + */ + type UpdateEnvironmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Environment) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|deleteEnvironment}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteEnvironmentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|getEnvironmentHistory}. + * @param error Error, if any + * @param [response] EnvironmentHistory + */ + type GetEnvironmentHistoryCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.EnvironmentHistory) => void; + } + + /** Properties of an Environment. */ + interface IEnvironment { + + /** Environment name */ + name?: (string|null); + + /** Environment description */ + description?: (string|null); + + /** Environment agentVersion */ + agentVersion?: (string|null); + + /** Environment state */ + state?: (google.cloud.dialogflow.v2.Environment.State|keyof typeof google.cloud.dialogflow.v2.Environment.State|null); + + /** Environment updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Environment textToSpeechSettings */ + textToSpeechSettings?: (google.cloud.dialogflow.v2.ITextToSpeechSettings|null); + + /** Environment fulfillment */ + fulfillment?: (google.cloud.dialogflow.v2.IFulfillment|null); + } + + /** Represents an Environment. */ + class Environment implements IEnvironment { + + /** + * Constructs a new Environment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IEnvironment); + + /** Environment name. */ + public name: string; + + /** Environment description. */ + public description: string; + + /** Environment agentVersion. */ + public agentVersion: string; + + /** Environment state. */ + public state: (google.cloud.dialogflow.v2.Environment.State|keyof typeof google.cloud.dialogflow.v2.Environment.State); + + /** Environment updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Environment textToSpeechSettings. */ + public textToSpeechSettings?: (google.cloud.dialogflow.v2.ITextToSpeechSettings|null); + + /** Environment fulfillment. */ + public fulfillment?: (google.cloud.dialogflow.v2.IFulfillment|null); + + /** + * Creates a new Environment instance using the specified properties. + * @param [properties] Properties to set + * @returns Environment instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IEnvironment): google.cloud.dialogflow.v2.Environment; + + /** + * Encodes the specified Environment message. Does not implicitly {@link google.cloud.dialogflow.v2.Environment.verify|verify} messages. + * @param message Environment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IEnvironment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Environment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Environment.verify|verify} messages. + * @param message Environment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IEnvironment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Environment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Environment; + + /** + * Decodes an Environment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Environment; + + /** + * Verifies an Environment message. + * @param message Plain 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 Environment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Environment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Environment; + + /** + * Creates a plain object from an Environment message. Also converts values to other types if specified. + * @param message Environment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Environment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Environment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Environment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Environment { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + STOPPED = 1, + LOADING = 2, + RUNNING = 3 + } + } + + /** Properties of a TextToSpeechSettings. */ + interface ITextToSpeechSettings { + + /** TextToSpeechSettings enableTextToSpeech */ + enableTextToSpeech?: (boolean|null); + + /** TextToSpeechSettings outputAudioEncoding */ + outputAudioEncoding?: (google.cloud.dialogflow.v2.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.v2.OutputAudioEncoding|null); + + /** TextToSpeechSettings sampleRateHertz */ + sampleRateHertz?: (number|null); + + /** TextToSpeechSettings synthesizeSpeechConfigs */ + synthesizeSpeechConfigs?: ({ [k: string]: google.cloud.dialogflow.v2.ISynthesizeSpeechConfig }|null); + } + + /** Represents a TextToSpeechSettings. */ + class TextToSpeechSettings implements ITextToSpeechSettings { + + /** + * Constructs a new TextToSpeechSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ITextToSpeechSettings); + + /** TextToSpeechSettings enableTextToSpeech. */ + public enableTextToSpeech: boolean; + + /** TextToSpeechSettings outputAudioEncoding. */ + public outputAudioEncoding: (google.cloud.dialogflow.v2.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.v2.OutputAudioEncoding); + + /** TextToSpeechSettings sampleRateHertz. */ + public sampleRateHertz: number; + + /** TextToSpeechSettings synthesizeSpeechConfigs. */ + public synthesizeSpeechConfigs: { [k: string]: google.cloud.dialogflow.v2.ISynthesizeSpeechConfig }; + + /** + * Creates a new TextToSpeechSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns TextToSpeechSettings instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ITextToSpeechSettings): google.cloud.dialogflow.v2.TextToSpeechSettings; + + /** + * Encodes the specified TextToSpeechSettings message. Does not implicitly {@link google.cloud.dialogflow.v2.TextToSpeechSettings.verify|verify} messages. + * @param message TextToSpeechSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ITextToSpeechSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextToSpeechSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.TextToSpeechSettings.verify|verify} messages. + * @param message TextToSpeechSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ITextToSpeechSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextToSpeechSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextToSpeechSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.TextToSpeechSettings; + + /** + * Decodes a TextToSpeechSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextToSpeechSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.TextToSpeechSettings; + + /** + * Verifies a TextToSpeechSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextToSpeechSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextToSpeechSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.TextToSpeechSettings; + + /** + * Creates a plain object from a TextToSpeechSettings message. Also converts values to other types if specified. + * @param message TextToSpeechSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.TextToSpeechSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextToSpeechSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextToSpeechSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEnvironmentsRequest. */ + interface IListEnvironmentsRequest { + + /** ListEnvironmentsRequest parent */ + parent?: (string|null); + + /** ListEnvironmentsRequest pageSize */ + pageSize?: (number|null); + + /** ListEnvironmentsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListEnvironmentsRequest. */ + class ListEnvironmentsRequest implements IListEnvironmentsRequest { + + /** + * Constructs a new ListEnvironmentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListEnvironmentsRequest); + + /** ListEnvironmentsRequest parent. */ + public parent: string; + + /** ListEnvironmentsRequest pageSize. */ + public pageSize: number; + + /** ListEnvironmentsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListEnvironmentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEnvironmentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListEnvironmentsRequest): google.cloud.dialogflow.v2.ListEnvironmentsRequest; + + /** + * Encodes the specified ListEnvironmentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListEnvironmentsRequest.verify|verify} messages. + * @param message ListEnvironmentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListEnvironmentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEnvironmentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListEnvironmentsRequest.verify|verify} messages. + * @param message ListEnvironmentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListEnvironmentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListEnvironmentsRequest; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListEnvironmentsRequest; + + /** + * Verifies a ListEnvironmentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEnvironmentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEnvironmentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListEnvironmentsRequest; + + /** + * Creates a plain object from a ListEnvironmentsRequest message. Also converts values to other types if specified. + * @param message ListEnvironmentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListEnvironmentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEnvironmentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEnvironmentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEnvironmentsResponse. */ + interface IListEnvironmentsResponse { + + /** ListEnvironmentsResponse environments */ + environments?: (google.cloud.dialogflow.v2.IEnvironment[]|null); + + /** ListEnvironmentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListEnvironmentsResponse. */ + class ListEnvironmentsResponse implements IListEnvironmentsResponse { + + /** + * Constructs a new ListEnvironmentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListEnvironmentsResponse); + + /** ListEnvironmentsResponse environments. */ + public environments: google.cloud.dialogflow.v2.IEnvironment[]; + + /** ListEnvironmentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListEnvironmentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEnvironmentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListEnvironmentsResponse): google.cloud.dialogflow.v2.ListEnvironmentsResponse; + + /** + * Encodes the specified ListEnvironmentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListEnvironmentsResponse.verify|verify} messages. + * @param message ListEnvironmentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListEnvironmentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEnvironmentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListEnvironmentsResponse.verify|verify} messages. + * @param message ListEnvironmentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListEnvironmentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListEnvironmentsResponse; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListEnvironmentsResponse; + + /** + * Verifies a ListEnvironmentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEnvironmentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEnvironmentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListEnvironmentsResponse; + + /** + * Creates a plain object from a ListEnvironmentsResponse message. Also converts values to other types if specified. + * @param message ListEnvironmentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListEnvironmentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEnvironmentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEnvironmentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetEnvironmentRequest. */ + interface IGetEnvironmentRequest { + + /** GetEnvironmentRequest name */ + name?: (string|null); + } + + /** Represents a GetEnvironmentRequest. */ + class GetEnvironmentRequest implements IGetEnvironmentRequest { + + /** + * Constructs a new GetEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetEnvironmentRequest); + + /** GetEnvironmentRequest name. */ + public name: string; + + /** + * Creates a new GetEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetEnvironmentRequest): google.cloud.dialogflow.v2.GetEnvironmentRequest; + + /** + * Encodes the specified GetEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetEnvironmentRequest.verify|verify} messages. + * @param message GetEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetEnvironmentRequest.verify|verify} messages. + * @param message GetEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetEnvironmentRequest; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetEnvironmentRequest; + + /** + * Verifies a GetEnvironmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetEnvironmentRequest; + + /** + * Creates a plain object from a GetEnvironmentRequest message. Also converts values to other types if specified. + * @param message GetEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetEnvironmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateEnvironmentRequest. */ + interface ICreateEnvironmentRequest { + + /** CreateEnvironmentRequest parent */ + parent?: (string|null); + + /** CreateEnvironmentRequest environment */ + environment?: (google.cloud.dialogflow.v2.IEnvironment|null); + + /** CreateEnvironmentRequest environmentId */ + environmentId?: (string|null); + } + + /** Represents a CreateEnvironmentRequest. */ + class CreateEnvironmentRequest implements ICreateEnvironmentRequest { + + /** + * Constructs a new CreateEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateEnvironmentRequest); + + /** CreateEnvironmentRequest parent. */ + public parent: string; + + /** CreateEnvironmentRequest environment. */ + public environment?: (google.cloud.dialogflow.v2.IEnvironment|null); + + /** CreateEnvironmentRequest environmentId. */ + public environmentId: string; + + /** + * Creates a new CreateEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateEnvironmentRequest): google.cloud.dialogflow.v2.CreateEnvironmentRequest; + + /** + * Encodes the specified CreateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateEnvironmentRequest.verify|verify} messages. + * @param message CreateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateEnvironmentRequest.verify|verify} messages. + * @param message CreateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateEnvironmentRequest; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateEnvironmentRequest; + + /** + * Verifies a CreateEnvironmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateEnvironmentRequest; + + /** + * Creates a plain object from a CreateEnvironmentRequest message. Also converts values to other types if specified. + * @param message CreateEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateEnvironmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateEnvironmentRequest. */ + interface IUpdateEnvironmentRequest { + + /** UpdateEnvironmentRequest environment */ + environment?: (google.cloud.dialogflow.v2.IEnvironment|null); + + /** UpdateEnvironmentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateEnvironmentRequest allowLoadToDraftAndDiscardChanges */ + allowLoadToDraftAndDiscardChanges?: (boolean|null); + } + + /** Represents an UpdateEnvironmentRequest. */ + class UpdateEnvironmentRequest implements IUpdateEnvironmentRequest { + + /** + * Constructs a new UpdateEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateEnvironmentRequest); + + /** UpdateEnvironmentRequest environment. */ + public environment?: (google.cloud.dialogflow.v2.IEnvironment|null); + + /** UpdateEnvironmentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateEnvironmentRequest allowLoadToDraftAndDiscardChanges. */ + public allowLoadToDraftAndDiscardChanges: boolean; + + /** + * Creates a new UpdateEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateEnvironmentRequest): google.cloud.dialogflow.v2.UpdateEnvironmentRequest; + + /** + * Encodes the specified UpdateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateEnvironmentRequest.verify|verify} messages. + * @param message UpdateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateEnvironmentRequest.verify|verify} messages. + * @param message UpdateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateEnvironmentRequest; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateEnvironmentRequest; + + /** + * Verifies an UpdateEnvironmentRequest message. + * @param message Plain 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 UpdateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateEnvironmentRequest; + + /** + * Creates a plain object from an UpdateEnvironmentRequest message. Also converts values to other types if specified. + * @param message UpdateEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateEnvironmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteEnvironmentRequest. */ + interface IDeleteEnvironmentRequest { + + /** DeleteEnvironmentRequest name */ + name?: (string|null); + } + + /** Represents a DeleteEnvironmentRequest. */ + class DeleteEnvironmentRequest implements IDeleteEnvironmentRequest { + + /** + * Constructs a new DeleteEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteEnvironmentRequest); + + /** DeleteEnvironmentRequest name. */ + public name: string; + + /** + * Creates a new DeleteEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteEnvironmentRequest): google.cloud.dialogflow.v2.DeleteEnvironmentRequest; + + /** + * Encodes the specified DeleteEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteEnvironmentRequest.verify|verify} messages. + * @param message DeleteEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteEnvironmentRequest.verify|verify} messages. + * @param message DeleteEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteEnvironmentRequest; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteEnvironmentRequest; + + /** + * Verifies a DeleteEnvironmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteEnvironmentRequest; + + /** + * Creates a plain object from a DeleteEnvironmentRequest message. Also converts values to other types if specified. + * @param message DeleteEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteEnvironmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetEnvironmentHistoryRequest. */ + interface IGetEnvironmentHistoryRequest { + + /** GetEnvironmentHistoryRequest parent */ + parent?: (string|null); + + /** GetEnvironmentHistoryRequest pageSize */ + pageSize?: (number|null); + + /** GetEnvironmentHistoryRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a GetEnvironmentHistoryRequest. */ + class GetEnvironmentHistoryRequest implements IGetEnvironmentHistoryRequest { + + /** + * Constructs a new GetEnvironmentHistoryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest); + + /** GetEnvironmentHistoryRequest parent. */ + public parent: string; + + /** GetEnvironmentHistoryRequest pageSize. */ + public pageSize: number; + + /** GetEnvironmentHistoryRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new GetEnvironmentHistoryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEnvironmentHistoryRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest): google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest; + + /** + * Encodes the specified GetEnvironmentHistoryRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest.verify|verify} messages. + * @param message GetEnvironmentHistoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEnvironmentHistoryRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest.verify|verify} messages. + * @param message GetEnvironmentHistoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEnvironmentHistoryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest; + + /** + * Decodes a GetEnvironmentHistoryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest; + + /** + * Verifies a GetEnvironmentHistoryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetEnvironmentHistoryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEnvironmentHistoryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest; + + /** + * Creates a plain object from a GetEnvironmentHistoryRequest message. Also converts values to other types if specified. + * @param message GetEnvironmentHistoryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEnvironmentHistoryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetEnvironmentHistoryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnvironmentHistory. */ + interface IEnvironmentHistory { + + /** EnvironmentHistory parent */ + parent?: (string|null); + + /** EnvironmentHistory entries */ + entries?: (google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[]|null); + + /** EnvironmentHistory nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents an EnvironmentHistory. */ + class EnvironmentHistory implements IEnvironmentHistory { + + /** + * Constructs a new EnvironmentHistory. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IEnvironmentHistory); + + /** EnvironmentHistory parent. */ + public parent: string; + + /** EnvironmentHistory entries. */ + public entries: google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[]; + + /** EnvironmentHistory nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new EnvironmentHistory instance using the specified properties. + * @param [properties] Properties to set + * @returns EnvironmentHistory instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IEnvironmentHistory): google.cloud.dialogflow.v2.EnvironmentHistory; + + /** + * Encodes the specified EnvironmentHistory message. Does not implicitly {@link google.cloud.dialogflow.v2.EnvironmentHistory.verify|verify} messages. + * @param message EnvironmentHistory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IEnvironmentHistory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnvironmentHistory message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EnvironmentHistory.verify|verify} messages. + * @param message EnvironmentHistory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IEnvironmentHistory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnvironmentHistory message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnvironmentHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.EnvironmentHistory; + + /** + * Decodes an EnvironmentHistory message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnvironmentHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.EnvironmentHistory; + + /** + * Verifies an EnvironmentHistory message. + * @param message Plain 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 EnvironmentHistory message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnvironmentHistory + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.EnvironmentHistory; + + /** + * Creates a plain object from an EnvironmentHistory message. Also converts values to other types if specified. + * @param message EnvironmentHistory + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.EnvironmentHistory, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnvironmentHistory to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnvironmentHistory + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EnvironmentHistory { + + /** Properties of an Entry. */ + interface IEntry { + + /** Entry agentVersion */ + agentVersion?: (string|null); + + /** Entry description */ + description?: (string|null); + + /** Entry createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an Entry. */ + class Entry implements IEntry { + + /** + * Constructs a new Entry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.EnvironmentHistory.IEntry); + + /** Entry agentVersion. */ + public agentVersion: string; + + /** Entry description. */ + public description: string; + + /** Entry createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Entry instance using the specified properties. + * @param [properties] Properties to set + * @returns Entry instance + */ + public static create(properties?: google.cloud.dialogflow.v2.EnvironmentHistory.IEntry): google.cloud.dialogflow.v2.EnvironmentHistory.Entry; + + /** + * Encodes the specified Entry message. Does not implicitly {@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry.verify|verify} messages. + * @param message Entry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.EnvironmentHistory.IEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entry message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry.verify|verify} messages. + * @param message Entry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.EnvironmentHistory.IEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.EnvironmentHistory.Entry; + + /** + * Decodes an Entry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.EnvironmentHistory.Entry; + + /** + * Verifies an Entry message. + * @param message Plain 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 Entry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.EnvironmentHistory.Entry; + + /** + * Creates a plain object from an Entry message. Also converts values to other types if specified. + * @param message Entry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.EnvironmentHistory.Entry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Represents a Fulfillments */ + class Fulfillments extends $protobuf.rpc.Service { + + /** + * Constructs a new Fulfillments 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 Fulfillments 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): Fulfillments; + + /** + * Calls GetFulfillment. + * @param request GetFulfillmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Fulfillment + */ + public getFulfillment(request: google.cloud.dialogflow.v2.IGetFulfillmentRequest, callback: google.cloud.dialogflow.v2.Fulfillments.GetFulfillmentCallback): void; + + /** + * Calls GetFulfillment. + * @param request GetFulfillmentRequest message or plain object + * @returns Promise + */ + public getFulfillment(request: google.cloud.dialogflow.v2.IGetFulfillmentRequest): Promise; + + /** + * Calls UpdateFulfillment. + * @param request UpdateFulfillmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Fulfillment + */ + public updateFulfillment(request: google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, callback: google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillmentCallback): void; + + /** + * Calls UpdateFulfillment. + * @param request UpdateFulfillmentRequest message or plain object + * @returns Promise + */ + public updateFulfillment(request: google.cloud.dialogflow.v2.IUpdateFulfillmentRequest): Promise; + } + + namespace Fulfillments { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Fulfillments|getFulfillment}. + * @param error Error, if any + * @param [response] Fulfillment + */ + type GetFulfillmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Fulfillment) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Fulfillments|updateFulfillment}. + * @param error Error, if any + * @param [response] Fulfillment + */ + type UpdateFulfillmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Fulfillment) => void; + } + + /** Properties of a Fulfillment. */ + interface IFulfillment { + + /** Fulfillment name */ + name?: (string|null); + + /** Fulfillment displayName */ + displayName?: (string|null); + + /** Fulfillment genericWebService */ + genericWebService?: (google.cloud.dialogflow.v2.Fulfillment.IGenericWebService|null); + + /** Fulfillment enabled */ + enabled?: (boolean|null); + + /** Fulfillment features */ + features?: (google.cloud.dialogflow.v2.Fulfillment.IFeature[]|null); + } + + /** Represents a Fulfillment. */ + class Fulfillment implements IFulfillment { + + /** + * Constructs a new Fulfillment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IFulfillment); + + /** Fulfillment name. */ + public name: string; + + /** Fulfillment displayName. */ + public displayName: string; + + /** Fulfillment genericWebService. */ + public genericWebService?: (google.cloud.dialogflow.v2.Fulfillment.IGenericWebService|null); + + /** Fulfillment enabled. */ + public enabled: boolean; + + /** Fulfillment features. */ + public features: google.cloud.dialogflow.v2.Fulfillment.IFeature[]; + + /** Fulfillment fulfillment. */ + public fulfillment?: "genericWebService"; + + /** + * Creates a new Fulfillment instance using the specified properties. + * @param [properties] Properties to set + * @returns Fulfillment instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IFulfillment): google.cloud.dialogflow.v2.Fulfillment; + + /** + * Encodes the specified Fulfillment message. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.verify|verify} messages. + * @param message Fulfillment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IFulfillment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Fulfillment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.verify|verify} messages. + * @param message Fulfillment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IFulfillment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Fulfillment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Fulfillment; + + /** + * Decodes a Fulfillment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Fulfillment; + + /** + * Verifies a Fulfillment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Fulfillment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Fulfillment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Fulfillment; + + /** + * Creates a plain object from a Fulfillment message. Also converts values to other types if specified. + * @param message Fulfillment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Fulfillment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Fulfillment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Fulfillment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Fulfillment { + + /** Properties of a GenericWebService. */ + interface IGenericWebService { + + /** GenericWebService uri */ + uri?: (string|null); + + /** GenericWebService username */ + username?: (string|null); + + /** GenericWebService password */ + password?: (string|null); + + /** GenericWebService requestHeaders */ + requestHeaders?: ({ [k: string]: string }|null); + + /** GenericWebService isCloudFunction */ + isCloudFunction?: (boolean|null); + } + + /** Represents a GenericWebService. */ + class GenericWebService implements IGenericWebService { + + /** + * Constructs a new GenericWebService. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Fulfillment.IGenericWebService); + + /** GenericWebService uri. */ + public uri: string; + + /** GenericWebService username. */ + public username: string; + + /** GenericWebService password. */ + public password: string; + + /** GenericWebService requestHeaders. */ + public requestHeaders: { [k: string]: string }; + + /** GenericWebService isCloudFunction. */ + public isCloudFunction: boolean; + + /** + * Creates a new GenericWebService instance using the specified properties. + * @param [properties] Properties to set + * @returns GenericWebService instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Fulfillment.IGenericWebService): google.cloud.dialogflow.v2.Fulfillment.GenericWebService; + + /** + * Encodes the specified GenericWebService message. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.GenericWebService.verify|verify} messages. + * @param message GenericWebService message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.Fulfillment.IGenericWebService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenericWebService message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.GenericWebService.verify|verify} messages. + * @param message GenericWebService message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.Fulfillment.IGenericWebService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenericWebService message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Fulfillment.GenericWebService; + + /** + * Decodes a GenericWebService message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Fulfillment.GenericWebService; + + /** + * Verifies a GenericWebService message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenericWebService message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenericWebService + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Fulfillment.GenericWebService; + + /** + * Creates a plain object from a GenericWebService message. Also converts values to other types if specified. + * @param message GenericWebService + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Fulfillment.GenericWebService, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenericWebService to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenericWebService + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Feature. */ + interface IFeature { + + /** Feature type */ + type?: (google.cloud.dialogflow.v2.Fulfillment.Feature.Type|keyof typeof google.cloud.dialogflow.v2.Fulfillment.Feature.Type|null); + } + + /** Represents a Feature. */ + class Feature implements IFeature { + + /** + * Constructs a new Feature. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.Fulfillment.IFeature); + + /** Feature type. */ + public type: (google.cloud.dialogflow.v2.Fulfillment.Feature.Type|keyof typeof google.cloud.dialogflow.v2.Fulfillment.Feature.Type); + + /** + * Creates a new Feature instance using the specified properties. + * @param [properties] Properties to set + * @returns Feature instance + */ + public static create(properties?: google.cloud.dialogflow.v2.Fulfillment.IFeature): google.cloud.dialogflow.v2.Fulfillment.Feature; + + /** + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.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, + SMALLTALK = 1 + } + } + } + + /** Properties of a GetFulfillmentRequest. */ + interface IGetFulfillmentRequest { + + /** GetFulfillmentRequest name */ + name?: (string|null); + } + + /** Represents a GetFulfillmentRequest. */ + class GetFulfillmentRequest implements IGetFulfillmentRequest { + + /** + * Constructs a new GetFulfillmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetFulfillmentRequest); + + /** GetFulfillmentRequest name. */ + public name: string; + + /** + * Creates a new GetFulfillmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetFulfillmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetFulfillmentRequest): google.cloud.dialogflow.v2.GetFulfillmentRequest; + + /** + * Encodes the specified GetFulfillmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetFulfillmentRequest.verify|verify} messages. + * @param message GetFulfillmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetFulfillmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetFulfillmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetFulfillmentRequest.verify|verify} messages. + * @param message GetFulfillmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetFulfillmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetFulfillmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetFulfillmentRequest; + + /** + * Decodes a GetFulfillmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetFulfillmentRequest; + + /** + * Verifies a GetFulfillmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetFulfillmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetFulfillmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetFulfillmentRequest; + + /** + * Creates a plain object from a GetFulfillmentRequest message. Also converts values to other types if specified. + * @param message GetFulfillmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetFulfillmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetFulfillmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetFulfillmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateFulfillmentRequest. */ + interface IUpdateFulfillmentRequest { + + /** UpdateFulfillmentRequest fulfillment */ + fulfillment?: (google.cloud.dialogflow.v2.IFulfillment|null); + + /** UpdateFulfillmentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateFulfillmentRequest. */ + class UpdateFulfillmentRequest implements IUpdateFulfillmentRequest { + + /** + * Constructs a new UpdateFulfillmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateFulfillmentRequest); + + /** UpdateFulfillmentRequest fulfillment. */ + public fulfillment?: (google.cloud.dialogflow.v2.IFulfillment|null); + + /** UpdateFulfillmentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateFulfillmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateFulfillmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateFulfillmentRequest): google.cloud.dialogflow.v2.UpdateFulfillmentRequest; + + /** + * Encodes the specified UpdateFulfillmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateFulfillmentRequest.verify|verify} messages. + * @param message UpdateFulfillmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateFulfillmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateFulfillmentRequest.verify|verify} messages. + * @param message UpdateFulfillmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateFulfillmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateFulfillmentRequest; + + /** + * Decodes an UpdateFulfillmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateFulfillmentRequest; + + /** + * Verifies an UpdateFulfillmentRequest message. + * @param message Plain 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 UpdateFulfillmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateFulfillmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateFulfillmentRequest; + + /** + * Creates a plain object from an UpdateFulfillmentRequest message. Also converts values to other types if specified. + * @param message UpdateFulfillmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateFulfillmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateFulfillmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateFulfillmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a HumanAgentAssistantEvent. */ + interface IHumanAgentAssistantEvent { + + /** HumanAgentAssistantEvent conversation */ + conversation?: (string|null); + + /** HumanAgentAssistantEvent participant */ + participant?: (string|null); + + /** HumanAgentAssistantEvent suggestionResults */ + suggestionResults?: (google.cloud.dialogflow.v2.ISuggestionResult[]|null); + } + + /** Represents a HumanAgentAssistantEvent. */ + class HumanAgentAssistantEvent implements IHumanAgentAssistantEvent { + + /** + * Constructs a new HumanAgentAssistantEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IHumanAgentAssistantEvent); + + /** HumanAgentAssistantEvent conversation. */ + public conversation: string; + + /** HumanAgentAssistantEvent participant. */ + public participant: string; + + /** HumanAgentAssistantEvent suggestionResults. */ + public suggestionResults: google.cloud.dialogflow.v2.ISuggestionResult[]; + + /** + * Creates a new HumanAgentAssistantEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanAgentAssistantEvent instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IHumanAgentAssistantEvent): google.cloud.dialogflow.v2.HumanAgentAssistantEvent; + + /** + * Encodes the specified HumanAgentAssistantEvent message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantEvent.verify|verify} messages. + * @param message HumanAgentAssistantEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IHumanAgentAssistantEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanAgentAssistantEvent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantEvent.verify|verify} messages. + * @param message HumanAgentAssistantEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IHumanAgentAssistantEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanAgentAssistantEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanAgentAssistantEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.HumanAgentAssistantEvent; + + /** + * Decodes a HumanAgentAssistantEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanAgentAssistantEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.HumanAgentAssistantEvent; + + /** + * Verifies a HumanAgentAssistantEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanAgentAssistantEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanAgentAssistantEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.HumanAgentAssistantEvent; + + /** + * Creates a plain object from a HumanAgentAssistantEvent message. Also converts values to other types if specified. + * @param message HumanAgentAssistantEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.HumanAgentAssistantEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanAgentAssistantEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanAgentAssistantEvent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a KnowledgeBases */ + class KnowledgeBases extends $protobuf.rpc.Service { + + /** + * Constructs a new KnowledgeBases 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 KnowledgeBases 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): KnowledgeBases; + + /** + * Calls ListKnowledgeBases. + * @param request ListKnowledgeBasesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListKnowledgeBasesResponse + */ + public listKnowledgeBases(request: google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, callback: google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBasesCallback): void; + + /** + * Calls ListKnowledgeBases. + * @param request ListKnowledgeBasesRequest message or plain object + * @returns Promise + */ + public listKnowledgeBases(request: google.cloud.dialogflow.v2.IListKnowledgeBasesRequest): Promise; + + /** + * Calls GetKnowledgeBase. + * @param request GetKnowledgeBaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and KnowledgeBase + */ + public getKnowledgeBase(request: google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, callback: google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBaseCallback): void; + + /** + * Calls GetKnowledgeBase. + * @param request GetKnowledgeBaseRequest message or plain object + * @returns Promise + */ + public getKnowledgeBase(request: google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest): Promise; + + /** + * Calls CreateKnowledgeBase. + * @param request CreateKnowledgeBaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and KnowledgeBase + */ + public createKnowledgeBase(request: google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, callback: google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBaseCallback): void; + + /** + * Calls CreateKnowledgeBase. + * @param request CreateKnowledgeBaseRequest message or plain object + * @returns Promise + */ + public createKnowledgeBase(request: google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest): Promise; + + /** + * Calls DeleteKnowledgeBase. + * @param request DeleteKnowledgeBaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteKnowledgeBase(request: google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, callback: google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBaseCallback): void; + + /** + * Calls DeleteKnowledgeBase. + * @param request DeleteKnowledgeBaseRequest message or plain object + * @returns Promise + */ + public deleteKnowledgeBase(request: google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest): Promise; + + /** + * Calls UpdateKnowledgeBase. + * @param request UpdateKnowledgeBaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and KnowledgeBase + */ + public updateKnowledgeBase(request: google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, callback: google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBaseCallback): void; + + /** + * Calls UpdateKnowledgeBase. + * @param request UpdateKnowledgeBaseRequest message or plain object + * @returns Promise + */ + public updateKnowledgeBase(request: google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest): Promise; + } + + namespace KnowledgeBases { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|listKnowledgeBases}. + * @param error Error, if any + * @param [response] ListKnowledgeBasesResponse + */ + type ListKnowledgeBasesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListKnowledgeBasesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|getKnowledgeBase}. + * @param error Error, if any + * @param [response] KnowledgeBase + */ + type GetKnowledgeBaseCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.KnowledgeBase) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|createKnowledgeBase}. + * @param error Error, if any + * @param [response] KnowledgeBase + */ + type CreateKnowledgeBaseCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.KnowledgeBase) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|deleteKnowledgeBase}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteKnowledgeBaseCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|updateKnowledgeBase}. + * @param error Error, if any + * @param [response] KnowledgeBase + */ + type UpdateKnowledgeBaseCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.KnowledgeBase) => void; + } + + /** Properties of a KnowledgeBase. */ + interface IKnowledgeBase { + + /** KnowledgeBase name */ + name?: (string|null); + + /** KnowledgeBase displayName */ + displayName?: (string|null); + + /** KnowledgeBase languageCode */ + languageCode?: (string|null); + } + + /** Represents a KnowledgeBase. */ + class KnowledgeBase implements IKnowledgeBase { + + /** + * Constructs a new KnowledgeBase. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IKnowledgeBase); + + /** KnowledgeBase name. */ + public name: string; + + /** KnowledgeBase displayName. */ + public displayName: string; + + /** KnowledgeBase languageCode. */ + public languageCode: string; + + /** + * Creates a new KnowledgeBase instance using the specified properties. + * @param [properties] Properties to set + * @returns KnowledgeBase instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IKnowledgeBase): google.cloud.dialogflow.v2.KnowledgeBase; + + /** + * Encodes the specified KnowledgeBase message. Does not implicitly {@link google.cloud.dialogflow.v2.KnowledgeBase.verify|verify} messages. + * @param message KnowledgeBase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IKnowledgeBase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KnowledgeBase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.KnowledgeBase.verify|verify} messages. + * @param message KnowledgeBase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IKnowledgeBase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KnowledgeBase message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KnowledgeBase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.KnowledgeBase; + + /** + * Decodes a KnowledgeBase message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KnowledgeBase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.KnowledgeBase; + + /** + * Verifies a KnowledgeBase message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KnowledgeBase message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KnowledgeBase + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.KnowledgeBase; + + /** + * Creates a plain object from a KnowledgeBase message. Also converts values to other types if specified. + * @param message KnowledgeBase + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.KnowledgeBase, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KnowledgeBase to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KnowledgeBase + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListKnowledgeBasesRequest. */ + interface IListKnowledgeBasesRequest { + + /** ListKnowledgeBasesRequest parent */ + parent?: (string|null); + + /** ListKnowledgeBasesRequest pageSize */ + pageSize?: (number|null); + + /** ListKnowledgeBasesRequest pageToken */ + pageToken?: (string|null); + + /** ListKnowledgeBasesRequest filter */ + filter?: (string|null); + } + + /** Represents a ListKnowledgeBasesRequest. */ + class ListKnowledgeBasesRequest implements IListKnowledgeBasesRequest { + + /** + * Constructs a new ListKnowledgeBasesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListKnowledgeBasesRequest); + + /** ListKnowledgeBasesRequest parent. */ + public parent: string; + + /** ListKnowledgeBasesRequest pageSize. */ + public pageSize: number; + + /** ListKnowledgeBasesRequest pageToken. */ + public pageToken: string; + + /** ListKnowledgeBasesRequest filter. */ + public filter: string; + + /** + * Creates a new ListKnowledgeBasesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKnowledgeBasesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListKnowledgeBasesRequest): google.cloud.dialogflow.v2.ListKnowledgeBasesRequest; + + /** + * Encodes the specified ListKnowledgeBasesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListKnowledgeBasesRequest.verify|verify} messages. + * @param message ListKnowledgeBasesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKnowledgeBasesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListKnowledgeBasesRequest.verify|verify} messages. + * @param message ListKnowledgeBasesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKnowledgeBasesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKnowledgeBasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListKnowledgeBasesRequest; + + /** + * Decodes a ListKnowledgeBasesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKnowledgeBasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListKnowledgeBasesRequest; + + /** + * Verifies a ListKnowledgeBasesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKnowledgeBasesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKnowledgeBasesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListKnowledgeBasesRequest; + + /** + * Creates a plain object from a ListKnowledgeBasesRequest message. Also converts values to other types if specified. + * @param message ListKnowledgeBasesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListKnowledgeBasesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKnowledgeBasesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListKnowledgeBasesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListKnowledgeBasesResponse. */ + interface IListKnowledgeBasesResponse { + + /** ListKnowledgeBasesResponse knowledgeBases */ + knowledgeBases?: (google.cloud.dialogflow.v2.IKnowledgeBase[]|null); + + /** ListKnowledgeBasesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListKnowledgeBasesResponse. */ + class ListKnowledgeBasesResponse implements IListKnowledgeBasesResponse { + + /** + * Constructs a new ListKnowledgeBasesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListKnowledgeBasesResponse); + + /** ListKnowledgeBasesResponse knowledgeBases. */ + public knowledgeBases: google.cloud.dialogflow.v2.IKnowledgeBase[]; + + /** ListKnowledgeBasesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListKnowledgeBasesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKnowledgeBasesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListKnowledgeBasesResponse): google.cloud.dialogflow.v2.ListKnowledgeBasesResponse; + + /** + * Encodes the specified ListKnowledgeBasesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListKnowledgeBasesResponse.verify|verify} messages. + * @param message ListKnowledgeBasesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListKnowledgeBasesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKnowledgeBasesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListKnowledgeBasesResponse.verify|verify} messages. + * @param message ListKnowledgeBasesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListKnowledgeBasesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKnowledgeBasesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKnowledgeBasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListKnowledgeBasesResponse; + + /** + * Decodes a ListKnowledgeBasesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKnowledgeBasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListKnowledgeBasesResponse; + + /** + * Verifies a ListKnowledgeBasesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKnowledgeBasesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKnowledgeBasesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListKnowledgeBasesResponse; + + /** + * Creates a plain object from a ListKnowledgeBasesResponse message. Also converts values to other types if specified. + * @param message ListKnowledgeBasesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListKnowledgeBasesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKnowledgeBasesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListKnowledgeBasesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetKnowledgeBaseRequest. */ + interface IGetKnowledgeBaseRequest { + + /** GetKnowledgeBaseRequest name */ + name?: (string|null); + } + + /** Represents a GetKnowledgeBaseRequest. */ + class GetKnowledgeBaseRequest implements IGetKnowledgeBaseRequest { + + /** + * Constructs a new GetKnowledgeBaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest); + + /** GetKnowledgeBaseRequest name. */ + public name: string; + + /** + * Creates a new GetKnowledgeBaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetKnowledgeBaseRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest): google.cloud.dialogflow.v2.GetKnowledgeBaseRequest; + + /** + * Encodes the specified GetKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetKnowledgeBaseRequest.verify|verify} messages. + * @param message GetKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetKnowledgeBaseRequest.verify|verify} messages. + * @param message GetKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetKnowledgeBaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetKnowledgeBaseRequest; + + /** + * Decodes a GetKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetKnowledgeBaseRequest; + + /** + * Verifies a GetKnowledgeBaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetKnowledgeBaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetKnowledgeBaseRequest; + + /** + * Creates a plain object from a GetKnowledgeBaseRequest message. Also converts values to other types if specified. + * @param message GetKnowledgeBaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetKnowledgeBaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetKnowledgeBaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetKnowledgeBaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateKnowledgeBaseRequest. */ + interface ICreateKnowledgeBaseRequest { + + /** CreateKnowledgeBaseRequest parent */ + parent?: (string|null); + + /** CreateKnowledgeBaseRequest knowledgeBase */ + knowledgeBase?: (google.cloud.dialogflow.v2.IKnowledgeBase|null); + } + + /** Represents a CreateKnowledgeBaseRequest. */ + class CreateKnowledgeBaseRequest implements ICreateKnowledgeBaseRequest { + + /** + * Constructs a new CreateKnowledgeBaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest); + + /** CreateKnowledgeBaseRequest parent. */ + public parent: string; + + /** CreateKnowledgeBaseRequest knowledgeBase. */ + public knowledgeBase?: (google.cloud.dialogflow.v2.IKnowledgeBase|null); + + /** + * Creates a new CreateKnowledgeBaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateKnowledgeBaseRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest): google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest; + + /** + * Encodes the specified CreateKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest.verify|verify} messages. + * @param message CreateKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest.verify|verify} messages. + * @param message CreateKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateKnowledgeBaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest; + + /** + * Decodes a CreateKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest; + + /** + * Verifies a CreateKnowledgeBaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateKnowledgeBaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest; + + /** + * Creates a plain object from a CreateKnowledgeBaseRequest message. Also converts values to other types if specified. + * @param message CreateKnowledgeBaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateKnowledgeBaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateKnowledgeBaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteKnowledgeBaseRequest. */ + interface IDeleteKnowledgeBaseRequest { + + /** DeleteKnowledgeBaseRequest name */ + name?: (string|null); + + /** DeleteKnowledgeBaseRequest force */ + force?: (boolean|null); + } + + /** Represents a DeleteKnowledgeBaseRequest. */ + class DeleteKnowledgeBaseRequest implements IDeleteKnowledgeBaseRequest { + + /** + * Constructs a new DeleteKnowledgeBaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest); + + /** DeleteKnowledgeBaseRequest name. */ + public name: string; + + /** DeleteKnowledgeBaseRequest force. */ + public force: boolean; + + /** + * Creates a new DeleteKnowledgeBaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteKnowledgeBaseRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest): google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest; + + /** + * Encodes the specified DeleteKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest.verify|verify} messages. + * @param message DeleteKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest.verify|verify} messages. + * @param message DeleteKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteKnowledgeBaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest; + + /** + * Decodes a DeleteKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest; + + /** + * Verifies a DeleteKnowledgeBaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteKnowledgeBaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest; + + /** + * Creates a plain object from a DeleteKnowledgeBaseRequest message. Also converts values to other types if specified. + * @param message DeleteKnowledgeBaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteKnowledgeBaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteKnowledgeBaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateKnowledgeBaseRequest. */ + interface IUpdateKnowledgeBaseRequest { + + /** UpdateKnowledgeBaseRequest knowledgeBase */ + knowledgeBase?: (google.cloud.dialogflow.v2.IKnowledgeBase|null); + + /** UpdateKnowledgeBaseRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateKnowledgeBaseRequest. */ + class UpdateKnowledgeBaseRequest implements IUpdateKnowledgeBaseRequest { + + /** + * Constructs a new UpdateKnowledgeBaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest); + + /** UpdateKnowledgeBaseRequest knowledgeBase. */ + public knowledgeBase?: (google.cloud.dialogflow.v2.IKnowledgeBase|null); + + /** UpdateKnowledgeBaseRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateKnowledgeBaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateKnowledgeBaseRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest): google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest; + + /** + * Encodes the specified UpdateKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest.verify|verify} messages. + * @param message UpdateKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest.verify|verify} messages. + * @param message UpdateKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateKnowledgeBaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest; + + /** + * Decodes an UpdateKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest; + + /** + * Verifies an UpdateKnowledgeBaseRequest message. + * @param message Plain 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 UpdateKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateKnowledgeBaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest; + + /** + * Creates a plain object from an UpdateKnowledgeBaseRequest message. Also converts values to other types if specified. + * @param message UpdateKnowledgeBaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateKnowledgeBaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateKnowledgeBaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Versions */ + class Versions extends $protobuf.rpc.Service { + + /** + * Constructs a new Versions 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 Versions 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): Versions; + + /** + * Calls ListVersions. + * @param request ListVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListVersionsResponse + */ + public listVersions(request: google.cloud.dialogflow.v2.IListVersionsRequest, callback: google.cloud.dialogflow.v2.Versions.ListVersionsCallback): void; + + /** + * Calls ListVersions. + * @param request ListVersionsRequest message or plain object + * @returns Promise + */ + public listVersions(request: google.cloud.dialogflow.v2.IListVersionsRequest): Promise; + + /** + * Calls GetVersion. + * @param request GetVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Version + */ + public getVersion(request: google.cloud.dialogflow.v2.IGetVersionRequest, callback: google.cloud.dialogflow.v2.Versions.GetVersionCallback): void; + + /** + * Calls GetVersion. + * @param request GetVersionRequest message or plain object + * @returns Promise + */ + public getVersion(request: google.cloud.dialogflow.v2.IGetVersionRequest): Promise; + + /** + * Calls CreateVersion. + * @param request CreateVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Version + */ + public createVersion(request: google.cloud.dialogflow.v2.ICreateVersionRequest, callback: google.cloud.dialogflow.v2.Versions.CreateVersionCallback): void; + + /** + * Calls CreateVersion. + * @param request CreateVersionRequest message or plain object + * @returns Promise + */ + public createVersion(request: google.cloud.dialogflow.v2.ICreateVersionRequest): Promise; + + /** + * Calls UpdateVersion. + * @param request UpdateVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Version + */ + public updateVersion(request: google.cloud.dialogflow.v2.IUpdateVersionRequest, callback: google.cloud.dialogflow.v2.Versions.UpdateVersionCallback): void; + + /** + * Calls UpdateVersion. + * @param request UpdateVersionRequest message or plain object + * @returns Promise + */ + public updateVersion(request: google.cloud.dialogflow.v2.IUpdateVersionRequest): Promise; + + /** + * Calls DeleteVersion. + * @param request DeleteVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteVersion(request: google.cloud.dialogflow.v2.IDeleteVersionRequest, callback: google.cloud.dialogflow.v2.Versions.DeleteVersionCallback): void; + + /** + * Calls DeleteVersion. + * @param request DeleteVersionRequest message or plain object + * @returns Promise + */ + public deleteVersion(request: google.cloud.dialogflow.v2.IDeleteVersionRequest): Promise; + } + + namespace Versions { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|listVersions}. + * @param error Error, if any + * @param [response] ListVersionsResponse + */ + type ListVersionsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.ListVersionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|getVersion}. + * @param error Error, if any + * @param [response] Version + */ + type GetVersionCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Version) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|createVersion}. + * @param error Error, if any + * @param [response] Version + */ + type CreateVersionCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Version) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|updateVersion}. + * @param error Error, if any + * @param [response] Version + */ + type UpdateVersionCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2.Version) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|deleteVersion}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteVersionCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a Version. */ + interface IVersion { + + /** Version name */ + name?: (string|null); + + /** Version description */ + description?: (string|null); + + /** Version versionNumber */ + versionNumber?: (number|null); + + /** Version createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Version status */ + status?: (google.cloud.dialogflow.v2.Version.VersionStatus|keyof typeof google.cloud.dialogflow.v2.Version.VersionStatus|null); + } + + /** Represents a Version. */ + class Version implements IVersion { + + /** + * Constructs a new Version. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IVersion); + + /** Version name. */ + public name: string; + + /** Version description. */ + public description: string; + + /** Version versionNumber. */ + public versionNumber: number; + + /** Version createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Version status. */ + public status: (google.cloud.dialogflow.v2.Version.VersionStatus|keyof typeof google.cloud.dialogflow.v2.Version.VersionStatus); + + /** + * Creates a new Version instance using the specified properties. + * @param [properties] Properties to set + * @returns Version instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IVersion): google.cloud.dialogflow.v2.Version; + + /** + * Encodes the specified Version message. Does not implicitly {@link google.cloud.dialogflow.v2.Version.verify|verify} messages. + * @param message Version message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Version message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Version.verify|verify} messages. + * @param message Version message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Version message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.Version; + + /** + * Decodes a Version message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.Version; + + /** + * Verifies a Version message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Version message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Version + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.Version; + + /** + * Creates a plain object from a Version message. Also converts values to other types if specified. + * @param message Version + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.Version, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Version to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Version + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Version { + + /** VersionStatus enum. */ + enum VersionStatus { + VERSION_STATUS_UNSPECIFIED = 0, + IN_PROGRESS = 1, + READY = 2, + FAILED = 3 + } + } + + /** Properties of a ListVersionsRequest. */ + interface IListVersionsRequest { + + /** ListVersionsRequest parent */ + parent?: (string|null); + + /** ListVersionsRequest pageSize */ + pageSize?: (number|null); + + /** ListVersionsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListVersionsRequest. */ + class ListVersionsRequest implements IListVersionsRequest { + + /** + * Constructs a new ListVersionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListVersionsRequest); + + /** ListVersionsRequest parent. */ + public parent: string; + + /** ListVersionsRequest pageSize. */ + public pageSize: number; + + /** ListVersionsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListVersionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListVersionsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListVersionsRequest): google.cloud.dialogflow.v2.ListVersionsRequest; + + /** + * Encodes the specified ListVersionsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListVersionsRequest.verify|verify} messages. + * @param message ListVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListVersionsRequest.verify|verify} messages. + * @param message ListVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListVersionsRequest; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListVersionsRequest; + + /** + * Verifies a ListVersionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListVersionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListVersionsRequest; + + /** + * Creates a plain object from a ListVersionsRequest message. Also converts values to other types if specified. + * @param message ListVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListVersionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListVersionsResponse. */ + interface IListVersionsResponse { + + /** ListVersionsResponse versions */ + versions?: (google.cloud.dialogflow.v2.IVersion[]|null); + + /** ListVersionsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListVersionsResponse. */ + class ListVersionsResponse implements IListVersionsResponse { + + /** + * Constructs a new ListVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IListVersionsResponse); + + /** ListVersionsResponse versions. */ + public versions: google.cloud.dialogflow.v2.IVersion[]; + + /** ListVersionsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListVersionsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IListVersionsResponse): google.cloud.dialogflow.v2.ListVersionsResponse; + + /** + * Encodes the specified ListVersionsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListVersionsResponse.verify|verify} messages. + * @param message ListVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IListVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListVersionsResponse.verify|verify} messages. + * @param message ListVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IListVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.ListVersionsResponse; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.ListVersionsResponse; + + /** + * Verifies a ListVersionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.ListVersionsResponse; + + /** + * Creates a plain object from a ListVersionsResponse message. Also converts values to other types if specified. + * @param message ListVersionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.ListVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListVersionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListVersionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetVersionRequest. */ + interface IGetVersionRequest { + + /** GetVersionRequest name */ + name?: (string|null); + } + + /** Represents a GetVersionRequest. */ + class GetVersionRequest implements IGetVersionRequest { + + /** + * Constructs a new GetVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IGetVersionRequest); + + /** GetVersionRequest name. */ + public name: string; + + /** + * Creates a new GetVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IGetVersionRequest): google.cloud.dialogflow.v2.GetVersionRequest; + + /** + * Encodes the specified GetVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetVersionRequest.verify|verify} messages. + * @param message GetVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IGetVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetVersionRequest.verify|verify} messages. + * @param message GetVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IGetVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.GetVersionRequest; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.GetVersionRequest; + + /** + * Verifies a GetVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.GetVersionRequest; + + /** + * Creates a plain object from a GetVersionRequest message. Also converts values to other types if specified. + * @param message GetVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.GetVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateVersionRequest. */ + interface ICreateVersionRequest { + + /** CreateVersionRequest parent */ + parent?: (string|null); + + /** CreateVersionRequest version */ + version?: (google.cloud.dialogflow.v2.IVersion|null); + } + + /** Represents a CreateVersionRequest. */ + class CreateVersionRequest implements ICreateVersionRequest { + + /** + * Constructs a new CreateVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.ICreateVersionRequest); + + /** CreateVersionRequest parent. */ + public parent: string; + + /** CreateVersionRequest version. */ + public version?: (google.cloud.dialogflow.v2.IVersion|null); + + /** + * Creates a new CreateVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.ICreateVersionRequest): google.cloud.dialogflow.v2.CreateVersionRequest; + + /** + * Encodes the specified CreateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateVersionRequest.verify|verify} messages. + * @param message CreateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.ICreateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateVersionRequest.verify|verify} messages. + * @param message CreateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.ICreateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.CreateVersionRequest; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.CreateVersionRequest; + + /** + * Verifies a CreateVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.CreateVersionRequest; + + /** + * Creates a plain object from a CreateVersionRequest message. Also converts values to other types if specified. + * @param message CreateVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.CreateVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateVersionRequest. */ + interface IUpdateVersionRequest { + + /** UpdateVersionRequest version */ + version?: (google.cloud.dialogflow.v2.IVersion|null); + + /** UpdateVersionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateVersionRequest. */ + class UpdateVersionRequest implements IUpdateVersionRequest { + + /** + * Constructs a new UpdateVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IUpdateVersionRequest); + + /** UpdateVersionRequest version. */ + public version?: (google.cloud.dialogflow.v2.IVersion|null); + + /** UpdateVersionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IUpdateVersionRequest): google.cloud.dialogflow.v2.UpdateVersionRequest; + + /** + * Encodes the specified UpdateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateVersionRequest.verify|verify} messages. + * @param message UpdateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IUpdateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateVersionRequest.verify|verify} messages. + * @param message UpdateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IUpdateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.UpdateVersionRequest; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.UpdateVersionRequest; + + /** + * Verifies an UpdateVersionRequest message. + * @param message Plain 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 UpdateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.UpdateVersionRequest; + + /** + * Creates a plain object from an UpdateVersionRequest message. Also converts values to other types if specified. + * @param message UpdateVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.UpdateVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteVersionRequest. */ + interface IDeleteVersionRequest { + + /** DeleteVersionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteVersionRequest. */ + class DeleteVersionRequest implements IDeleteVersionRequest { + + /** + * Constructs a new DeleteVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IDeleteVersionRequest); + + /** DeleteVersionRequest name. */ + public name: string; + + /** + * Creates a new DeleteVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IDeleteVersionRequest): google.cloud.dialogflow.v2.DeleteVersionRequest; + + /** + * Encodes the specified DeleteVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteVersionRequest.verify|verify} messages. + * @param message DeleteVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IDeleteVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteVersionRequest.verify|verify} messages. + * @param message DeleteVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IDeleteVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.DeleteVersionRequest; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.DeleteVersionRequest; + + /** + * Verifies a DeleteVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.DeleteVersionRequest; + + /** + * Creates a plain object from a DeleteVersionRequest message. Also converts values to other types if specified. + * @param message DeleteVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.DeleteVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WebhookRequest. */ + interface IWebhookRequest { + + /** WebhookRequest session */ + session?: (string|null); + + /** WebhookRequest responseId */ + responseId?: (string|null); + + /** WebhookRequest queryResult */ + queryResult?: (google.cloud.dialogflow.v2.IQueryResult|null); + + /** WebhookRequest originalDetectIntentRequest */ + originalDetectIntentRequest?: (google.cloud.dialogflow.v2.IOriginalDetectIntentRequest|null); + } + + /** Represents a WebhookRequest. */ + class WebhookRequest implements IWebhookRequest { + + /** + * Constructs a new WebhookRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IWebhookRequest); + + /** WebhookRequest session. */ + public session: string; + + /** WebhookRequest responseId. */ + public responseId: string; + + /** WebhookRequest queryResult. */ + public queryResult?: (google.cloud.dialogflow.v2.IQueryResult|null); + + /** WebhookRequest originalDetectIntentRequest. */ + public originalDetectIntentRequest?: (google.cloud.dialogflow.v2.IOriginalDetectIntentRequest|null); + + /** + * Creates a new WebhookRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WebhookRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IWebhookRequest): google.cloud.dialogflow.v2.WebhookRequest; + + /** + * Encodes the specified WebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.WebhookRequest.verify|verify} messages. + * @param message WebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.WebhookRequest.verify|verify} messages. + * @param message WebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.WebhookRequest; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.WebhookRequest; + + /** + * Verifies a WebhookRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebhookRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebhookRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.WebhookRequest; + + /** + * Creates a plain object from a WebhookRequest message. Also converts values to other types if specified. + * @param message WebhookRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.WebhookRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebhookRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WebhookRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WebhookResponse. */ + interface IWebhookResponse { + + /** WebhookResponse fulfillmentText */ + fulfillmentText?: (string|null); + + /** WebhookResponse fulfillmentMessages */ + fulfillmentMessages?: (google.cloud.dialogflow.v2.Intent.IMessage[]|null); + + /** WebhookResponse source */ + source?: (string|null); + + /** WebhookResponse payload */ + payload?: (google.protobuf.IStruct|null); + + /** WebhookResponse outputContexts */ + outputContexts?: (google.cloud.dialogflow.v2.IContext[]|null); + + /** WebhookResponse followupEventInput */ + followupEventInput?: (google.cloud.dialogflow.v2.IEventInput|null); + + /** WebhookResponse sessionEntityTypes */ + sessionEntityTypes?: (google.cloud.dialogflow.v2.ISessionEntityType[]|null); + } + + /** Represents a WebhookResponse. */ + class WebhookResponse implements IWebhookResponse { + + /** + * Constructs a new WebhookResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IWebhookResponse); + + /** WebhookResponse fulfillmentText. */ + public fulfillmentText: string; + + /** WebhookResponse fulfillmentMessages. */ + public fulfillmentMessages: google.cloud.dialogflow.v2.Intent.IMessage[]; + + /** WebhookResponse source. */ + public source: string; + + /** WebhookResponse payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** WebhookResponse outputContexts. */ + public outputContexts: google.cloud.dialogflow.v2.IContext[]; + + /** WebhookResponse followupEventInput. */ + public followupEventInput?: (google.cloud.dialogflow.v2.IEventInput|null); + + /** WebhookResponse sessionEntityTypes. */ + public sessionEntityTypes: google.cloud.dialogflow.v2.ISessionEntityType[]; + + /** + * Creates a new WebhookResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns WebhookResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IWebhookResponse): google.cloud.dialogflow.v2.WebhookResponse; + + /** + * Encodes the specified WebhookResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.WebhookResponse.verify|verify} messages. + * @param message WebhookResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IWebhookResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebhookResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.WebhookResponse.verify|verify} messages. + * @param message WebhookResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IWebhookResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.WebhookResponse; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.WebhookResponse; + + /** + * Verifies a WebhookResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebhookResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebhookResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.WebhookResponse; + + /** + * Creates a plain object from a WebhookResponse message. Also converts values to other types if specified. + * @param message WebhookResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.WebhookResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebhookResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WebhookResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OriginalDetectIntentRequest. */ + interface IOriginalDetectIntentRequest { + + /** OriginalDetectIntentRequest source */ + source?: (string|null); + + /** OriginalDetectIntentRequest version */ + version?: (string|null); + + /** OriginalDetectIntentRequest payload */ + payload?: (google.protobuf.IStruct|null); + } + + /** Represents an OriginalDetectIntentRequest. */ + class OriginalDetectIntentRequest implements IOriginalDetectIntentRequest { + + /** + * Constructs a new OriginalDetectIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2.IOriginalDetectIntentRequest); + + /** OriginalDetectIntentRequest source. */ + public source: string; + + /** OriginalDetectIntentRequest version. */ + public version: string; + + /** OriginalDetectIntentRequest payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** + * Creates a new OriginalDetectIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns OriginalDetectIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2.IOriginalDetectIntentRequest): google.cloud.dialogflow.v2.OriginalDetectIntentRequest; + + /** + * Encodes the specified OriginalDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.OriginalDetectIntentRequest.verify|verify} messages. + * @param message OriginalDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2.IOriginalDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OriginalDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.OriginalDetectIntentRequest.verify|verify} messages. + * @param message OriginalDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2.IOriginalDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OriginalDetectIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OriginalDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2.OriginalDetectIntentRequest; + + /** + * Decodes an OriginalDetectIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OriginalDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2.OriginalDetectIntentRequest; + + /** + * Verifies an OriginalDetectIntentRequest message. + * @param message Plain 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 OriginalDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OriginalDetectIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2.OriginalDetectIntentRequest; + + /** + * Creates a plain object from an OriginalDetectIntentRequest message. Also converts values to other types if specified. + * @param message OriginalDetectIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2.OriginalDetectIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OriginalDetectIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OriginalDetectIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace v2beta1. */ + namespace v2beta1 { + + /** Represents an Agents */ + class Agents extends $protobuf.rpc.Service { + + /** + * Constructs a new Agents 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 Agents 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): Agents; + + /** + * Calls GetAgent. + * @param request GetAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Agent + */ + public getAgent(request: google.cloud.dialogflow.v2beta1.IGetAgentRequest, callback: google.cloud.dialogflow.v2beta1.Agents.GetAgentCallback): void; + + /** + * Calls GetAgent. + * @param request GetAgentRequest message or plain object + * @returns Promise + */ + public getAgent(request: google.cloud.dialogflow.v2beta1.IGetAgentRequest): Promise; + + /** + * Calls SetAgent. + * @param request SetAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Agent + */ + public setAgent(request: google.cloud.dialogflow.v2beta1.ISetAgentRequest, callback: google.cloud.dialogflow.v2beta1.Agents.SetAgentCallback): void; + + /** + * Calls SetAgent. + * @param request SetAgentRequest message or plain object + * @returns Promise + */ + public setAgent(request: google.cloud.dialogflow.v2beta1.ISetAgentRequest): Promise; + + /** + * Calls DeleteAgent. + * @param request DeleteAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteAgent(request: google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, callback: google.cloud.dialogflow.v2beta1.Agents.DeleteAgentCallback): void; + + /** + * Calls DeleteAgent. + * @param request DeleteAgentRequest message or plain object + * @returns Promise + */ + public deleteAgent(request: google.cloud.dialogflow.v2beta1.IDeleteAgentRequest): Promise; + + /** + * Calls SearchAgents. + * @param request SearchAgentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SearchAgentsResponse + */ + public searchAgents(request: google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, callback: google.cloud.dialogflow.v2beta1.Agents.SearchAgentsCallback): void; + + /** + * Calls SearchAgents. + * @param request SearchAgentsRequest message or plain object + * @returns Promise + */ + public searchAgents(request: google.cloud.dialogflow.v2beta1.ISearchAgentsRequest): Promise; + + /** + * Calls TrainAgent. + * @param request TrainAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public trainAgent(request: google.cloud.dialogflow.v2beta1.ITrainAgentRequest, callback: google.cloud.dialogflow.v2beta1.Agents.TrainAgentCallback): void; + + /** + * Calls TrainAgent. + * @param request TrainAgentRequest message or plain object + * @returns Promise + */ + public trainAgent(request: google.cloud.dialogflow.v2beta1.ITrainAgentRequest): Promise; + + /** + * Calls ExportAgent. + * @param request ExportAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public exportAgent(request: google.cloud.dialogflow.v2beta1.IExportAgentRequest, callback: google.cloud.dialogflow.v2beta1.Agents.ExportAgentCallback): void; + + /** + * Calls ExportAgent. + * @param request ExportAgentRequest message or plain object + * @returns Promise + */ + public exportAgent(request: google.cloud.dialogflow.v2beta1.IExportAgentRequest): Promise; + + /** + * Calls ImportAgent. + * @param request ImportAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importAgent(request: google.cloud.dialogflow.v2beta1.IImportAgentRequest, callback: google.cloud.dialogflow.v2beta1.Agents.ImportAgentCallback): void; + + /** + * Calls ImportAgent. + * @param request ImportAgentRequest message or plain object + * @returns Promise + */ + public importAgent(request: google.cloud.dialogflow.v2beta1.IImportAgentRequest): Promise; + + /** + * Calls RestoreAgent. + * @param request RestoreAgentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public restoreAgent(request: google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, callback: google.cloud.dialogflow.v2beta1.Agents.RestoreAgentCallback): void; + + /** + * Calls RestoreAgent. + * @param request RestoreAgentRequest message or plain object + * @returns Promise + */ + public restoreAgent(request: google.cloud.dialogflow.v2beta1.IRestoreAgentRequest): Promise; + + /** + * Calls GetValidationResult. + * @param request GetValidationResultRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ValidationResult + */ + public getValidationResult(request: google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, callback: google.cloud.dialogflow.v2beta1.Agents.GetValidationResultCallback): void; + + /** + * Calls GetValidationResult. + * @param request GetValidationResultRequest message or plain object + * @returns Promise + */ + public getValidationResult(request: google.cloud.dialogflow.v2beta1.IGetValidationResultRequest): Promise; + } + + namespace Agents { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|getAgent}. + * @param error Error, if any + * @param [response] Agent + */ + type GetAgentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Agent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|setAgent}. + * @param error Error, if any + * @param [response] Agent + */ + type SetAgentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Agent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|deleteAgent}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteAgentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|searchAgents}. + * @param error Error, if any + * @param [response] SearchAgentsResponse + */ + type SearchAgentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.SearchAgentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|trainAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type TrainAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|exportAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|importAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|restoreAgent}. + * @param error Error, if any + * @param [response] Operation + */ + type RestoreAgentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|getValidationResult}. + * @param error Error, if any + * @param [response] ValidationResult + */ + type GetValidationResultCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ValidationResult) => void; + } + + /** Properties of an Agent. */ + interface IAgent { + + /** Agent parent */ + parent?: (string|null); + + /** Agent displayName */ + displayName?: (string|null); + + /** Agent defaultLanguageCode */ + defaultLanguageCode?: (string|null); + + /** Agent supportedLanguageCodes */ + supportedLanguageCodes?: (string[]|null); + + /** Agent timeZone */ + timeZone?: (string|null); + + /** Agent description */ + description?: (string|null); + + /** Agent avatarUri */ + avatarUri?: (string|null); + + /** Agent enableLogging */ + enableLogging?: (boolean|null); + + /** Agent matchMode */ + matchMode?: (google.cloud.dialogflow.v2beta1.Agent.MatchMode|keyof typeof google.cloud.dialogflow.v2beta1.Agent.MatchMode|null); + + /** Agent classificationThreshold */ + classificationThreshold?: (number|null); + + /** Agent apiVersion */ + apiVersion?: (google.cloud.dialogflow.v2beta1.Agent.ApiVersion|keyof typeof google.cloud.dialogflow.v2beta1.Agent.ApiVersion|null); + + /** Agent tier */ + tier?: (google.cloud.dialogflow.v2beta1.Agent.Tier|keyof typeof google.cloud.dialogflow.v2beta1.Agent.Tier|null); + } + + /** Represents an Agent. */ + class Agent implements IAgent { + + /** + * Constructs a new Agent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAgent); + + /** Agent parent. */ + public parent: string; + + /** Agent displayName. */ + public displayName: string; + + /** Agent defaultLanguageCode. */ + public defaultLanguageCode: string; + + /** Agent supportedLanguageCodes. */ + public supportedLanguageCodes: string[]; + + /** Agent timeZone. */ + public timeZone: string; + + /** Agent description. */ + public description: string; + + /** Agent avatarUri. */ + public avatarUri: string; + + /** Agent enableLogging. */ + public enableLogging: boolean; + + /** Agent matchMode. */ + public matchMode: (google.cloud.dialogflow.v2beta1.Agent.MatchMode|keyof typeof google.cloud.dialogflow.v2beta1.Agent.MatchMode); + + /** Agent classificationThreshold. */ + public classificationThreshold: number; + + /** Agent apiVersion. */ + public apiVersion: (google.cloud.dialogflow.v2beta1.Agent.ApiVersion|keyof typeof google.cloud.dialogflow.v2beta1.Agent.ApiVersion); + + /** Agent tier. */ + public tier: (google.cloud.dialogflow.v2beta1.Agent.Tier|keyof typeof google.cloud.dialogflow.v2beta1.Agent.Tier); + + /** + * Creates a new Agent instance using the specified properties. + * @param [properties] Properties to set + * @returns Agent instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAgent): google.cloud.dialogflow.v2beta1.Agent; + + /** + * Encodes the specified Agent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Agent.verify|verify} messages. + * @param message Agent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Agent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Agent.verify|verify} messages. + * @param message Agent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Agent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Agent; + + /** + * Decodes an Agent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Agent; + + /** + * Verifies an Agent message. + * @param message Plain 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 Agent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Agent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Agent; + + /** + * Creates a plain object from an Agent message. Also converts values to other types if specified. + * @param message Agent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Agent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Agent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Agent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Agent { + + /** MatchMode enum. */ + enum MatchMode { + MATCH_MODE_UNSPECIFIED = 0, + MATCH_MODE_HYBRID = 1, + MATCH_MODE_ML_ONLY = 2 + } + + /** ApiVersion enum. */ + enum ApiVersion { + API_VERSION_UNSPECIFIED = 0, + API_VERSION_V1 = 1, + API_VERSION_V2 = 2, + API_VERSION_V2_BETA_1 = 3 + } + + /** Tier enum. */ + enum Tier { + TIER_UNSPECIFIED = 0, + TIER_STANDARD = 1, + TIER_ENTERPRISE = 2, + TIER_ENTERPRISE_PLUS = 3 + } + } + + /** Properties of a GetAgentRequest. */ + interface IGetAgentRequest { + + /** GetAgentRequest parent */ + parent?: (string|null); + } + + /** Represents a GetAgentRequest. */ + class GetAgentRequest implements IGetAgentRequest { + + /** + * Constructs a new GetAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetAgentRequest); + + /** GetAgentRequest parent. */ + public parent: string; + + /** + * Creates a new GetAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetAgentRequest): google.cloud.dialogflow.v2beta1.GetAgentRequest; + + /** + * Encodes the specified GetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetAgentRequest.verify|verify} messages. + * @param message GetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetAgentRequest.verify|verify} messages. + * @param message GetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetAgentRequest; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetAgentRequest; + + /** + * Verifies a GetAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetAgentRequest; + + /** + * Creates a plain object from a GetAgentRequest message. Also converts values to other types if specified. + * @param message GetAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SetAgentRequest. */ + interface ISetAgentRequest { + + /** SetAgentRequest agent */ + agent?: (google.cloud.dialogflow.v2beta1.IAgent|null); + + /** SetAgentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a SetAgentRequest. */ + class SetAgentRequest implements ISetAgentRequest { + + /** + * Constructs a new SetAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISetAgentRequest); + + /** SetAgentRequest agent. */ + public agent?: (google.cloud.dialogflow.v2beta1.IAgent|null); + + /** SetAgentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new SetAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISetAgentRequest): google.cloud.dialogflow.v2beta1.SetAgentRequest; + + /** + * Encodes the specified SetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetAgentRequest.verify|verify} messages. + * @param message SetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetAgentRequest.verify|verify} messages. + * @param message SetAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISetAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SetAgentRequest; + + /** + * Decodes a SetAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SetAgentRequest; + + /** + * Verifies a SetAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SetAgentRequest; + + /** + * Creates a plain object from a SetAgentRequest message. Also converts values to other types if specified. + * @param message SetAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SetAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteAgentRequest. */ + interface IDeleteAgentRequest { + + /** DeleteAgentRequest parent */ + parent?: (string|null); + } + + /** Represents a DeleteAgentRequest. */ + class DeleteAgentRequest implements IDeleteAgentRequest { + + /** + * Constructs a new DeleteAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteAgentRequest); + + /** DeleteAgentRequest parent. */ + public parent: string; + + /** + * Creates a new DeleteAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteAgentRequest): google.cloud.dialogflow.v2beta1.DeleteAgentRequest; + + /** + * Encodes the specified DeleteAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteAgentRequest.verify|verify} messages. + * @param message DeleteAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteAgentRequest.verify|verify} messages. + * @param message DeleteAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteAgentRequest; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteAgentRequest; + + /** + * Verifies a DeleteAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteAgentRequest; + + /** + * Creates a plain object from a DeleteAgentRequest message. Also converts values to other types if specified. + * @param message DeleteAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SubAgent. */ + interface ISubAgent { + + /** SubAgent project */ + project?: (string|null); + + /** SubAgent environment */ + environment?: (string|null); + } + + /** Represents a SubAgent. */ + class SubAgent implements ISubAgent { + + /** + * Constructs a new SubAgent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISubAgent); + + /** SubAgent project. */ + public project: string; + + /** SubAgent environment. */ + public environment: string; + + /** + * Creates a new SubAgent instance using the specified properties. + * @param [properties] Properties to set + * @returns SubAgent instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISubAgent): google.cloud.dialogflow.v2beta1.SubAgent; + + /** + * Encodes the specified SubAgent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SubAgent.verify|verify} messages. + * @param message SubAgent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISubAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SubAgent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SubAgent.verify|verify} messages. + * @param message SubAgent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISubAgent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SubAgent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SubAgent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SubAgent; + + /** + * Decodes a SubAgent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SubAgent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SubAgent; + + /** + * Verifies a SubAgent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SubAgent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SubAgent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SubAgent; + + /** + * Creates a plain object from a SubAgent message. Also converts values to other types if specified. + * @param message SubAgent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SubAgent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SubAgent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SubAgent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchAgentsRequest. */ + interface ISearchAgentsRequest { + + /** SearchAgentsRequest parent */ + parent?: (string|null); + + /** SearchAgentsRequest pageSize */ + pageSize?: (number|null); + + /** SearchAgentsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a SearchAgentsRequest. */ + class SearchAgentsRequest implements ISearchAgentsRequest { + + /** + * Constructs a new SearchAgentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISearchAgentsRequest); + + /** SearchAgentsRequest parent. */ + public parent: string; + + /** SearchAgentsRequest pageSize. */ + public pageSize: number; + + /** SearchAgentsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new SearchAgentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchAgentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISearchAgentsRequest): google.cloud.dialogflow.v2beta1.SearchAgentsRequest; + + /** + * Encodes the specified SearchAgentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SearchAgentsRequest.verify|verify} messages. + * @param message SearchAgentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchAgentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SearchAgentsRequest.verify|verify} messages. + * @param message SearchAgentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchAgentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SearchAgentsRequest; + + /** + * Decodes a SearchAgentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SearchAgentsRequest; + + /** + * Verifies a SearchAgentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchAgentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchAgentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SearchAgentsRequest; + + /** + * Creates a plain object from a SearchAgentsRequest message. Also converts values to other types if specified. + * @param message SearchAgentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SearchAgentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchAgentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchAgentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SearchAgentsResponse. */ + interface ISearchAgentsResponse { + + /** SearchAgentsResponse agents */ + agents?: (google.cloud.dialogflow.v2beta1.IAgent[]|null); + + /** SearchAgentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a SearchAgentsResponse. */ + class SearchAgentsResponse implements ISearchAgentsResponse { + + /** + * Constructs a new SearchAgentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISearchAgentsResponse); + + /** SearchAgentsResponse agents. */ + public agents: google.cloud.dialogflow.v2beta1.IAgent[]; + + /** SearchAgentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new SearchAgentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SearchAgentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISearchAgentsResponse): google.cloud.dialogflow.v2beta1.SearchAgentsResponse; + + /** + * Encodes the specified SearchAgentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SearchAgentsResponse.verify|verify} messages. + * @param message SearchAgentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISearchAgentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SearchAgentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SearchAgentsResponse.verify|verify} messages. + * @param message SearchAgentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISearchAgentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SearchAgentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SearchAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SearchAgentsResponse; + + /** + * Decodes a SearchAgentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SearchAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SearchAgentsResponse; + + /** + * Verifies a SearchAgentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SearchAgentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SearchAgentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SearchAgentsResponse; + + /** + * Creates a plain object from a SearchAgentsResponse message. Also converts values to other types if specified. + * @param message SearchAgentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SearchAgentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SearchAgentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SearchAgentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TrainAgentRequest. */ + interface ITrainAgentRequest { + + /** TrainAgentRequest parent */ + parent?: (string|null); + } + + /** Represents a TrainAgentRequest. */ + class TrainAgentRequest implements ITrainAgentRequest { + + /** + * Constructs a new TrainAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ITrainAgentRequest); + + /** TrainAgentRequest parent. */ + public parent: string; + + /** + * Creates a new TrainAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns TrainAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ITrainAgentRequest): google.cloud.dialogflow.v2beta1.TrainAgentRequest; + + /** + * Encodes the specified TrainAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TrainAgentRequest.verify|verify} messages. + * @param message TrainAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ITrainAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TrainAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TrainAgentRequest.verify|verify} messages. + * @param message TrainAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ITrainAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TrainAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TrainAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.TrainAgentRequest; + + /** + * Decodes a TrainAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TrainAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.TrainAgentRequest; + + /** + * Verifies a TrainAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TrainAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TrainAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.TrainAgentRequest; + + /** + * Creates a plain object from a TrainAgentRequest message. Also converts values to other types if specified. + * @param message TrainAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.TrainAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TrainAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TrainAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportAgentRequest. */ + interface IExportAgentRequest { + + /** ExportAgentRequest parent */ + parent?: (string|null); + + /** ExportAgentRequest agentUri */ + agentUri?: (string|null); + } + + /** Represents an ExportAgentRequest. */ + class ExportAgentRequest implements IExportAgentRequest { + + /** + * Constructs a new ExportAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IExportAgentRequest); + + /** ExportAgentRequest parent. */ + public parent: string; + + /** ExportAgentRequest agentUri. */ + public agentUri: string; + + /** + * Creates a new ExportAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IExportAgentRequest): google.cloud.dialogflow.v2beta1.ExportAgentRequest; + + /** + * Encodes the specified ExportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportAgentRequest.verify|verify} messages. + * @param message ExportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IExportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportAgentRequest.verify|verify} messages. + * @param message ExportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IExportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ExportAgentRequest; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ExportAgentRequest; + + /** + * Verifies an ExportAgentRequest message. + * @param message Plain 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 ExportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ExportAgentRequest; + + /** + * Creates a plain object from an ExportAgentRequest message. Also converts values to other types if specified. + * @param message ExportAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ExportAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportAgentResponse. */ + interface IExportAgentResponse { + + /** ExportAgentResponse agentUri */ + agentUri?: (string|null); + + /** ExportAgentResponse agentContent */ + agentContent?: (Uint8Array|string|null); + } + + /** Represents an ExportAgentResponse. */ + class ExportAgentResponse implements IExportAgentResponse { + + /** + * Constructs a new ExportAgentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IExportAgentResponse); + + /** ExportAgentResponse agentUri. */ + public agentUri?: (string|null); + + /** ExportAgentResponse agentContent. */ + public agentContent?: (Uint8Array|string|null); + + /** ExportAgentResponse agent. */ + public agent?: ("agentUri"|"agentContent"); + + /** + * Creates a new ExportAgentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportAgentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IExportAgentResponse): google.cloud.dialogflow.v2beta1.ExportAgentResponse; + + /** + * Encodes the specified ExportAgentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportAgentResponse.verify|verify} messages. + * @param message ExportAgentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IExportAgentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportAgentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportAgentResponse.verify|verify} messages. + * @param message ExportAgentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IExportAgentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ExportAgentResponse; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ExportAgentResponse; + + /** + * Verifies an ExportAgentResponse message. + * @param message Plain 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 ExportAgentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportAgentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ExportAgentResponse; + + /** + * Creates a plain object from an ExportAgentResponse message. Also converts values to other types if specified. + * @param message ExportAgentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ExportAgentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportAgentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportAgentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportAgentRequest. */ + interface IImportAgentRequest { + + /** ImportAgentRequest parent */ + parent?: (string|null); + + /** ImportAgentRequest agentUri */ + agentUri?: (string|null); + + /** ImportAgentRequest agentContent */ + agentContent?: (Uint8Array|string|null); + } + + /** Represents an ImportAgentRequest. */ + class ImportAgentRequest implements IImportAgentRequest { + + /** + * Constructs a new ImportAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IImportAgentRequest); + + /** ImportAgentRequest parent. */ + public parent: string; + + /** ImportAgentRequest agentUri. */ + public agentUri?: (string|null); + + /** ImportAgentRequest agentContent. */ + public agentContent?: (Uint8Array|string|null); + + /** ImportAgentRequest agent. */ + public agent?: ("agentUri"|"agentContent"); + + /** + * Creates a new ImportAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IImportAgentRequest): google.cloud.dialogflow.v2beta1.ImportAgentRequest; + + /** + * Encodes the specified ImportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportAgentRequest.verify|verify} messages. + * @param message ImportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IImportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportAgentRequest.verify|verify} messages. + * @param message ImportAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IImportAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ImportAgentRequest; + + /** + * Decodes an ImportAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ImportAgentRequest; + + /** + * Verifies an ImportAgentRequest message. + * @param message Plain 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 ImportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ImportAgentRequest; + + /** + * Creates a plain object from an ImportAgentRequest message. Also converts values to other types if specified. + * @param message ImportAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ImportAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RestoreAgentRequest. */ + interface IRestoreAgentRequest { + + /** RestoreAgentRequest parent */ + parent?: (string|null); + + /** RestoreAgentRequest agentUri */ + agentUri?: (string|null); + + /** RestoreAgentRequest agentContent */ + agentContent?: (Uint8Array|string|null); + } + + /** Represents a RestoreAgentRequest. */ + class RestoreAgentRequest implements IRestoreAgentRequest { + + /** + * Constructs a new RestoreAgentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IRestoreAgentRequest); + + /** RestoreAgentRequest parent. */ + public parent: string; + + /** RestoreAgentRequest agentUri. */ + public agentUri?: (string|null); + + /** RestoreAgentRequest agentContent. */ + public agentContent?: (Uint8Array|string|null); + + /** RestoreAgentRequest agent. */ + public agent?: ("agentUri"|"agentContent"); + + /** + * Creates a new RestoreAgentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns RestoreAgentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IRestoreAgentRequest): google.cloud.dialogflow.v2beta1.RestoreAgentRequest; + + /** + * Encodes the specified RestoreAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.RestoreAgentRequest.verify|verify} messages. + * @param message RestoreAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RestoreAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.RestoreAgentRequest.verify|verify} messages. + * @param message RestoreAgentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.RestoreAgentRequest; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.RestoreAgentRequest; + + /** + * Verifies a RestoreAgentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RestoreAgentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RestoreAgentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.RestoreAgentRequest; + + /** + * Creates a plain object from a RestoreAgentRequest message. Also converts values to other types if specified. + * @param message RestoreAgentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.RestoreAgentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RestoreAgentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RestoreAgentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetValidationResultRequest. */ + interface IGetValidationResultRequest { + + /** GetValidationResultRequest parent */ + parent?: (string|null); + + /** GetValidationResultRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a GetValidationResultRequest. */ + class GetValidationResultRequest implements IGetValidationResultRequest { + + /** + * Constructs a new GetValidationResultRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetValidationResultRequest); + + /** GetValidationResultRequest parent. */ + public parent: string; + + /** GetValidationResultRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new GetValidationResultRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetValidationResultRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetValidationResultRequest): google.cloud.dialogflow.v2beta1.GetValidationResultRequest; + + /** + * Encodes the specified GetValidationResultRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetValidationResultRequest.verify|verify} messages. + * @param message GetValidationResultRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetValidationResultRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetValidationResultRequest.verify|verify} messages. + * @param message GetValidationResultRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetValidationResultRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetValidationResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetValidationResultRequest; + + /** + * Decodes a GetValidationResultRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetValidationResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetValidationResultRequest; + + /** + * Verifies a GetValidationResultRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetValidationResultRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetValidationResultRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetValidationResultRequest; + + /** + * Creates a plain object from a GetValidationResultRequest message. Also converts values to other types if specified. + * @param message GetValidationResultRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetValidationResultRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetValidationResultRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetValidationResultRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ValidationError. */ + interface IValidationError { + + /** ValidationError severity */ + severity?: (google.cloud.dialogflow.v2beta1.ValidationError.Severity|keyof typeof google.cloud.dialogflow.v2beta1.ValidationError.Severity|null); + + /** ValidationError entries */ + entries?: (string[]|null); + + /** ValidationError errorMessage */ + errorMessage?: (string|null); + } + + /** Represents a ValidationError. */ + class ValidationError implements IValidationError { + + /** + * Constructs a new ValidationError. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IValidationError); + + /** ValidationError severity. */ + public severity: (google.cloud.dialogflow.v2beta1.ValidationError.Severity|keyof typeof google.cloud.dialogflow.v2beta1.ValidationError.Severity); + + /** ValidationError entries. */ + public entries: string[]; + + /** ValidationError errorMessage. */ + public errorMessage: string; + + /** + * Creates a new ValidationError instance using the specified properties. + * @param [properties] Properties to set + * @returns ValidationError instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IValidationError): google.cloud.dialogflow.v2beta1.ValidationError; + + /** + * Encodes the specified ValidationError message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ValidationError.verify|verify} messages. + * @param message ValidationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IValidationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ValidationError message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ValidationError.verify|verify} messages. + * @param message ValidationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IValidationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValidationError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ValidationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ValidationError; + + /** + * Decodes a ValidationError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ValidationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ValidationError; + + /** + * Verifies a ValidationError message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ValidationError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ValidationError + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ValidationError; + + /** + * Creates a plain object from a ValidationError message. Also converts values to other types if specified. + * @param message ValidationError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ValidationError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ValidationError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ValidationError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ValidationError { + + /** Severity enum. */ + enum Severity { + SEVERITY_UNSPECIFIED = 0, + INFO = 1, + WARNING = 2, + ERROR = 3, + CRITICAL = 4 + } + } + + /** Properties of a ValidationResult. */ + interface IValidationResult { + + /** ValidationResult validationErrors */ + validationErrors?: (google.cloud.dialogflow.v2beta1.IValidationError[]|null); + } + + /** Represents a ValidationResult. */ + class ValidationResult implements IValidationResult { + + /** + * Constructs a new ValidationResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IValidationResult); + + /** ValidationResult validationErrors. */ + public validationErrors: google.cloud.dialogflow.v2beta1.IValidationError[]; + + /** + * Creates a new ValidationResult instance using the specified properties. + * @param [properties] Properties to set + * @returns ValidationResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IValidationResult): google.cloud.dialogflow.v2beta1.ValidationResult; + + /** + * Encodes the specified ValidationResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ValidationResult.verify|verify} messages. + * @param message ValidationResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IValidationResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ValidationResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ValidationResult.verify|verify} messages. + * @param message ValidationResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IValidationResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ValidationResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ValidationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ValidationResult; + + /** + * Decodes a ValidationResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ValidationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ValidationResult; + + /** + * Verifies a ValidationResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ValidationResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ValidationResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ValidationResult; + + /** + * Creates a plain object from a ValidationResult message. Also converts values to other types if specified. + * @param message ValidationResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ValidationResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ValidationResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ValidationResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents an AnswerRecords */ + class AnswerRecords extends $protobuf.rpc.Service { + + /** + * Constructs a new AnswerRecords 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 AnswerRecords 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): AnswerRecords; + + /** + * Calls GetAnswerRecord. + * @param request GetAnswerRecordRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AnswerRecord + */ + public getAnswerRecord(request: google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, callback: google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecordCallback): void; + + /** + * Calls GetAnswerRecord. + * @param request GetAnswerRecordRequest message or plain object + * @returns Promise + */ + public getAnswerRecord(request: google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest): Promise; + + /** + * Calls ListAnswerRecords. + * @param request ListAnswerRecordsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListAnswerRecordsResponse + */ + public listAnswerRecords(request: google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, callback: google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecordsCallback): void; + + /** + * Calls ListAnswerRecords. + * @param request ListAnswerRecordsRequest message or plain object + * @returns Promise + */ + public listAnswerRecords(request: google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest): Promise; + + /** + * Calls UpdateAnswerRecord. + * @param request UpdateAnswerRecordRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AnswerRecord + */ + public updateAnswerRecord(request: google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, callback: google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecordCallback): void; + + /** + * Calls UpdateAnswerRecord. + * @param request UpdateAnswerRecordRequest message or plain object + * @returns Promise + */ + public updateAnswerRecord(request: google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest): Promise; + } + + namespace AnswerRecords { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.AnswerRecords|getAnswerRecord}. + * @param error Error, if any + * @param [response] AnswerRecord + */ + type GetAnswerRecordCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.AnswerRecord) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.AnswerRecords|listAnswerRecords}. + * @param error Error, if any + * @param [response] ListAnswerRecordsResponse + */ + type ListAnswerRecordsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.AnswerRecords|updateAnswerRecord}. + * @param error Error, if any + * @param [response] AnswerRecord + */ + type UpdateAnswerRecordCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.AnswerRecord) => void; + } + + /** Properties of an AnswerRecord. */ + interface IAnswerRecord { + + /** AnswerRecord name */ + name?: (string|null); + + /** AnswerRecord answerFeedback */ + answerFeedback?: (google.cloud.dialogflow.v2beta1.IAnswerFeedback|null); + + /** AnswerRecord agentAssistantRecord */ + agentAssistantRecord?: (google.cloud.dialogflow.v2beta1.IAgentAssistantRecord|null); + } + + /** Represents an AnswerRecord. */ + class AnswerRecord implements IAnswerRecord { + + /** + * Constructs a new AnswerRecord. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAnswerRecord); + + /** AnswerRecord name. */ + public name: string; + + /** AnswerRecord answerFeedback. */ + public answerFeedback?: (google.cloud.dialogflow.v2beta1.IAnswerFeedback|null); + + /** AnswerRecord agentAssistantRecord. */ + public agentAssistantRecord?: (google.cloud.dialogflow.v2beta1.IAgentAssistantRecord|null); + + /** AnswerRecord record. */ + public record?: "agentAssistantRecord"; + + /** + * Creates a new AnswerRecord instance using the specified properties. + * @param [properties] Properties to set + * @returns AnswerRecord instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAnswerRecord): google.cloud.dialogflow.v2beta1.AnswerRecord; + + /** + * Encodes the specified AnswerRecord message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnswerRecord.verify|verify} messages. + * @param message AnswerRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAnswerRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnswerRecord message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnswerRecord.verify|verify} messages. + * @param message AnswerRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAnswerRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnswerRecord message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnswerRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AnswerRecord; + + /** + * Decodes an AnswerRecord message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnswerRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AnswerRecord; + + /** + * Verifies an AnswerRecord message. + * @param message Plain 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 AnswerRecord message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnswerRecord + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AnswerRecord; + + /** + * Creates a plain object from an AnswerRecord message. Also converts values to other types if specified. + * @param message AnswerRecord + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AnswerRecord, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnswerRecord to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnswerRecord + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AgentAssistantRecord. */ + interface IAgentAssistantRecord { + + /** AgentAssistantRecord articleSuggestionAnswer */ + articleSuggestionAnswer?: (google.cloud.dialogflow.v2beta1.IArticleAnswer|null); + + /** AgentAssistantRecord faqAnswer */ + faqAnswer?: (google.cloud.dialogflow.v2beta1.IFaqAnswer|null); + } + + /** Represents an AgentAssistantRecord. */ + class AgentAssistantRecord implements IAgentAssistantRecord { + + /** + * Constructs a new AgentAssistantRecord. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAgentAssistantRecord); + + /** AgentAssistantRecord articleSuggestionAnswer. */ + public articleSuggestionAnswer?: (google.cloud.dialogflow.v2beta1.IArticleAnswer|null); + + /** AgentAssistantRecord faqAnswer. */ + public faqAnswer?: (google.cloud.dialogflow.v2beta1.IFaqAnswer|null); + + /** AgentAssistantRecord answer. */ + public answer?: ("articleSuggestionAnswer"|"faqAnswer"); + + /** + * Creates a new AgentAssistantRecord instance using the specified properties. + * @param [properties] Properties to set + * @returns AgentAssistantRecord instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAgentAssistantRecord): google.cloud.dialogflow.v2beta1.AgentAssistantRecord; + + /** + * Encodes the specified AgentAssistantRecord message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantRecord.verify|verify} messages. + * @param message AgentAssistantRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAgentAssistantRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AgentAssistantRecord message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantRecord.verify|verify} messages. + * @param message AgentAssistantRecord message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAgentAssistantRecord, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AgentAssistantRecord message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AgentAssistantRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AgentAssistantRecord; + + /** + * Decodes an AgentAssistantRecord message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AgentAssistantRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AgentAssistantRecord; + + /** + * Verifies an AgentAssistantRecord message. + * @param message Plain 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 AgentAssistantRecord message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AgentAssistantRecord + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AgentAssistantRecord; + + /** + * Creates a plain object from an AgentAssistantRecord message. Also converts values to other types if specified. + * @param message AgentAssistantRecord + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AgentAssistantRecord, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AgentAssistantRecord to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AgentAssistantRecord + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnswerFeedback. */ + interface IAnswerFeedback { + + /** AnswerFeedback correctnessLevel */ + correctnessLevel?: (google.cloud.dialogflow.v2beta1.AnswerFeedback.CorrectnessLevel|keyof typeof google.cloud.dialogflow.v2beta1.AnswerFeedback.CorrectnessLevel|null); + + /** AnswerFeedback agentAssistantDetailFeedback */ + agentAssistantDetailFeedback?: (google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback|null); + + /** AnswerFeedback clicked */ + clicked?: (boolean|null); + + /** AnswerFeedback clickTime */ + clickTime?: (google.protobuf.ITimestamp|null); + + /** AnswerFeedback displayed */ + displayed?: (boolean|null); + + /** AnswerFeedback displayTime */ + displayTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an AnswerFeedback. */ + class AnswerFeedback implements IAnswerFeedback { + + /** + * Constructs a new AnswerFeedback. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAnswerFeedback); + + /** AnswerFeedback correctnessLevel. */ + public correctnessLevel: (google.cloud.dialogflow.v2beta1.AnswerFeedback.CorrectnessLevel|keyof typeof google.cloud.dialogflow.v2beta1.AnswerFeedback.CorrectnessLevel); + + /** AnswerFeedback agentAssistantDetailFeedback. */ + public agentAssistantDetailFeedback?: (google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback|null); + + /** AnswerFeedback clicked. */ + public clicked: boolean; + + /** AnswerFeedback clickTime. */ + public clickTime?: (google.protobuf.ITimestamp|null); + + /** AnswerFeedback displayed. */ + public displayed: boolean; + + /** AnswerFeedback displayTime. */ + public displayTime?: (google.protobuf.ITimestamp|null); + + /** AnswerFeedback detailFeedback. */ + public detailFeedback?: "agentAssistantDetailFeedback"; + + /** + * Creates a new AnswerFeedback instance using the specified properties. + * @param [properties] Properties to set + * @returns AnswerFeedback instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAnswerFeedback): google.cloud.dialogflow.v2beta1.AnswerFeedback; + + /** + * Encodes the specified AnswerFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnswerFeedback.verify|verify} messages. + * @param message AnswerFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAnswerFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnswerFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnswerFeedback.verify|verify} messages. + * @param message AnswerFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAnswerFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnswerFeedback message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnswerFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AnswerFeedback; + + /** + * Decodes an AnswerFeedback message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnswerFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AnswerFeedback; + + /** + * Verifies an AnswerFeedback message. + * @param message Plain 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 AnswerFeedback message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnswerFeedback + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AnswerFeedback; + + /** + * Creates a plain object from an AnswerFeedback message. Also converts values to other types if specified. + * @param message AnswerFeedback + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AnswerFeedback, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnswerFeedback to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnswerFeedback + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AnswerFeedback { + + /** CorrectnessLevel enum. */ + enum CorrectnessLevel { + CORRECTNESS_LEVEL_UNSPECIFIED = 0, + NOT_CORRECT = 1, + PARTIALLY_CORRECT = 2, + FULLY_CORRECT = 3 + } + } + + /** Properties of an AgentAssistantFeedback. */ + interface IAgentAssistantFeedback { + + /** AgentAssistantFeedback answerRelevance */ + answerRelevance?: (google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance|keyof typeof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance|null); + + /** AgentAssistantFeedback documentCorrectness */ + documentCorrectness?: (google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentCorrectness|keyof typeof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentCorrectness|null); + + /** AgentAssistantFeedback documentEfficiency */ + documentEfficiency?: (google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency|keyof typeof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency|null); + + /** AgentAssistantFeedback summarizationFeedback */ + summarizationFeedback?: (google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback|null); + } + + /** Represents an AgentAssistantFeedback. */ + class AgentAssistantFeedback implements IAgentAssistantFeedback { + + /** + * Constructs a new AgentAssistantFeedback. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback); + + /** AgentAssistantFeedback answerRelevance. */ + public answerRelevance: (google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance|keyof typeof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance); + + /** AgentAssistantFeedback documentCorrectness. */ + public documentCorrectness: (google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentCorrectness|keyof typeof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentCorrectness); + + /** AgentAssistantFeedback documentEfficiency. */ + public documentEfficiency: (google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency|keyof typeof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency); + + /** AgentAssistantFeedback summarizationFeedback. */ + public summarizationFeedback?: (google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback|null); + + /** + * Creates a new AgentAssistantFeedback instance using the specified properties. + * @param [properties] Properties to set + * @returns AgentAssistantFeedback instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback): google.cloud.dialogflow.v2beta1.AgentAssistantFeedback; + + /** + * Encodes the specified AgentAssistantFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.verify|verify} messages. + * @param message AgentAssistantFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AgentAssistantFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.verify|verify} messages. + * @param message AgentAssistantFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AgentAssistantFeedback message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AgentAssistantFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AgentAssistantFeedback; + + /** + * Decodes an AgentAssistantFeedback message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AgentAssistantFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AgentAssistantFeedback; + + /** + * Verifies an AgentAssistantFeedback message. + * @param message Plain 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 AgentAssistantFeedback message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AgentAssistantFeedback + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AgentAssistantFeedback; + + /** + * Creates a plain object from an AgentAssistantFeedback message. Also converts values to other types if specified. + * @param message AgentAssistantFeedback + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AgentAssistantFeedback, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AgentAssistantFeedback to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AgentAssistantFeedback + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AgentAssistantFeedback { + + /** AnswerRelevance enum. */ + enum AnswerRelevance { + ANSWER_RELEVANCE_UNSPECIFIED = 0, + IRRELEVANT = 1, + RELEVANT = 2 + } + + /** DocumentCorrectness enum. */ + enum DocumentCorrectness { + DOCUMENT_CORRECTNESS_UNSPECIFIED = 0, + INCORRECT = 1, + CORRECT = 2 + } + + /** DocumentEfficiency enum. */ + enum DocumentEfficiency { + DOCUMENT_EFFICIENCY_UNSPECIFIED = 0, + INEFFICIENT = 1, + EFFICIENT = 2 + } + + /** Properties of a SummarizationFeedback. */ + interface ISummarizationFeedback { + + /** SummarizationFeedback startTimestamp */ + startTimestamp?: (google.protobuf.ITimestamp|null); + + /** SummarizationFeedback submitTimestamp */ + submitTimestamp?: (google.protobuf.ITimestamp|null); + + /** SummarizationFeedback summaryText */ + summaryText?: (string|null); + } + + /** Represents a SummarizationFeedback. */ + class SummarizationFeedback implements ISummarizationFeedback { + + /** + * Constructs a new SummarizationFeedback. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback); + + /** SummarizationFeedback startTimestamp. */ + public startTimestamp?: (google.protobuf.ITimestamp|null); + + /** SummarizationFeedback submitTimestamp. */ + public submitTimestamp?: (google.protobuf.ITimestamp|null); + + /** SummarizationFeedback summaryText. */ + public summaryText: string; + + /** + * Creates a new SummarizationFeedback instance using the specified properties. + * @param [properties] Properties to set + * @returns SummarizationFeedback instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback): google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback; + + /** + * Encodes the specified SummarizationFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.verify|verify} messages. + * @param message SummarizationFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SummarizationFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.verify|verify} messages. + * @param message SummarizationFeedback message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SummarizationFeedback message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SummarizationFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback; + + /** + * Decodes a SummarizationFeedback message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SummarizationFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback; + + /** + * Verifies a SummarizationFeedback message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SummarizationFeedback message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SummarizationFeedback + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback; + + /** + * Creates a plain object from a SummarizationFeedback message. Also converts values to other types if specified. + * @param message SummarizationFeedback + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SummarizationFeedback to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SummarizationFeedback + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a GetAnswerRecordRequest. */ + interface IGetAnswerRecordRequest { + + /** GetAnswerRecordRequest name */ + name?: (string|null); + } + + /** Represents a GetAnswerRecordRequest. */ + class GetAnswerRecordRequest implements IGetAnswerRecordRequest { + + /** + * Constructs a new GetAnswerRecordRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest); + + /** GetAnswerRecordRequest name. */ + public name: string; + + /** + * Creates a new GetAnswerRecordRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetAnswerRecordRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest): google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest; + + /** + * Encodes the specified GetAnswerRecordRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest.verify|verify} messages. + * @param message GetAnswerRecordRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetAnswerRecordRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest.verify|verify} messages. + * @param message GetAnswerRecordRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetAnswerRecordRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest; + + /** + * Decodes a GetAnswerRecordRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest; + + /** + * Verifies a GetAnswerRecordRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetAnswerRecordRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetAnswerRecordRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest; + + /** + * Creates a plain object from a GetAnswerRecordRequest message. Also converts values to other types if specified. + * @param message GetAnswerRecordRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetAnswerRecordRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetAnswerRecordRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListAnswerRecordsRequest. */ + interface IListAnswerRecordsRequest { + + /** ListAnswerRecordsRequest parent */ + parent?: (string|null); + + /** ListAnswerRecordsRequest filter */ + filter?: (string|null); + + /** ListAnswerRecordsRequest pageSize */ + pageSize?: (number|null); + + /** ListAnswerRecordsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListAnswerRecordsRequest. */ + class ListAnswerRecordsRequest implements IListAnswerRecordsRequest { + + /** + * Constructs a new ListAnswerRecordsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest); + + /** ListAnswerRecordsRequest parent. */ + public parent: string; + + /** ListAnswerRecordsRequest filter. */ + public filter: string; + + /** ListAnswerRecordsRequest pageSize. */ + public pageSize: number; + + /** ListAnswerRecordsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListAnswerRecordsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAnswerRecordsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest): google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest; + + /** + * Encodes the specified ListAnswerRecordsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.verify|verify} messages. + * @param message ListAnswerRecordsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAnswerRecordsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.verify|verify} messages. + * @param message ListAnswerRecordsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAnswerRecordsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAnswerRecordsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest; + + /** + * Decodes a ListAnswerRecordsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAnswerRecordsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest; + + /** + * Verifies a ListAnswerRecordsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListAnswerRecordsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAnswerRecordsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest; + + /** + * Creates a plain object from a ListAnswerRecordsRequest message. Also converts values to other types if specified. + * @param message ListAnswerRecordsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAnswerRecordsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListAnswerRecordsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListAnswerRecordsResponse. */ + interface IListAnswerRecordsResponse { + + /** ListAnswerRecordsResponse answerRecords */ + answerRecords?: (google.cloud.dialogflow.v2beta1.IAnswerRecord[]|null); + + /** ListAnswerRecordsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListAnswerRecordsResponse. */ + class ListAnswerRecordsResponse implements IListAnswerRecordsResponse { + + /** + * Constructs a new ListAnswerRecordsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse); + + /** ListAnswerRecordsResponse answerRecords. */ + public answerRecords: google.cloud.dialogflow.v2beta1.IAnswerRecord[]; + + /** ListAnswerRecordsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListAnswerRecordsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListAnswerRecordsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse): google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse; + + /** + * Encodes the specified ListAnswerRecordsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.verify|verify} messages. + * @param message ListAnswerRecordsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListAnswerRecordsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.verify|verify} messages. + * @param message ListAnswerRecordsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListAnswerRecordsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListAnswerRecordsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse; + + /** + * Decodes a ListAnswerRecordsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListAnswerRecordsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse; + + /** + * Verifies a ListAnswerRecordsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListAnswerRecordsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListAnswerRecordsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse; + + /** + * Creates a plain object from a ListAnswerRecordsResponse message. Also converts values to other types if specified. + * @param message ListAnswerRecordsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListAnswerRecordsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListAnswerRecordsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateAnswerRecordRequest. */ + interface IUpdateAnswerRecordRequest { + + /** UpdateAnswerRecordRequest answerRecord */ + answerRecord?: (google.cloud.dialogflow.v2beta1.IAnswerRecord|null); + + /** UpdateAnswerRecordRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateAnswerRecordRequest. */ + class UpdateAnswerRecordRequest implements IUpdateAnswerRecordRequest { + + /** + * Constructs a new UpdateAnswerRecordRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest); + + /** UpdateAnswerRecordRequest answerRecord. */ + public answerRecord?: (google.cloud.dialogflow.v2beta1.IAnswerRecord|null); + + /** UpdateAnswerRecordRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateAnswerRecordRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateAnswerRecordRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest): google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest; + + /** + * Encodes the specified UpdateAnswerRecordRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest.verify|verify} messages. + * @param message UpdateAnswerRecordRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateAnswerRecordRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest.verify|verify} messages. + * @param message UpdateAnswerRecordRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateAnswerRecordRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest; + + /** + * Decodes an UpdateAnswerRecordRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest; + + /** + * Verifies an UpdateAnswerRecordRequest message. + * @param message Plain 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 UpdateAnswerRecordRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateAnswerRecordRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest; + + /** + * Creates a plain object from an UpdateAnswerRecordRequest message. Also converts values to other types if specified. + * @param message UpdateAnswerRecordRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateAnswerRecordRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateAnswerRecordRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Participants */ + class Participants extends $protobuf.rpc.Service { + + /** + * Constructs a new Participants 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 Participants 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): Participants; + + /** + * Calls CreateParticipant. + * @param request CreateParticipantRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Participant + */ + public createParticipant(request: google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, callback: google.cloud.dialogflow.v2beta1.Participants.CreateParticipantCallback): void; + + /** + * Calls CreateParticipant. + * @param request CreateParticipantRequest message or plain object + * @returns Promise + */ + public createParticipant(request: google.cloud.dialogflow.v2beta1.ICreateParticipantRequest): Promise; + + /** + * Calls GetParticipant. + * @param request GetParticipantRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Participant + */ + public getParticipant(request: google.cloud.dialogflow.v2beta1.IGetParticipantRequest, callback: google.cloud.dialogflow.v2beta1.Participants.GetParticipantCallback): void; + + /** + * Calls GetParticipant. + * @param request GetParticipantRequest message or plain object + * @returns Promise + */ + public getParticipant(request: google.cloud.dialogflow.v2beta1.IGetParticipantRequest): Promise; + + /** + * Calls ListParticipants. + * @param request ListParticipantsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListParticipantsResponse + */ + public listParticipants(request: google.cloud.dialogflow.v2beta1.IListParticipantsRequest, callback: google.cloud.dialogflow.v2beta1.Participants.ListParticipantsCallback): void; + + /** + * Calls ListParticipants. + * @param request ListParticipantsRequest message or plain object + * @returns Promise + */ + public listParticipants(request: google.cloud.dialogflow.v2beta1.IListParticipantsRequest): Promise; + + /** + * Calls UpdateParticipant. + * @param request UpdateParticipantRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Participant + */ + public updateParticipant(request: google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, callback: google.cloud.dialogflow.v2beta1.Participants.UpdateParticipantCallback): void; + + /** + * Calls UpdateParticipant. + * @param request UpdateParticipantRequest message or plain object + * @returns Promise + */ + public updateParticipant(request: google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest): Promise; + + /** + * Calls AnalyzeContent. + * @param request AnalyzeContentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and AnalyzeContentResponse + */ + public analyzeContent(request: google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, callback: google.cloud.dialogflow.v2beta1.Participants.AnalyzeContentCallback): void; + + /** + * Calls AnalyzeContent. + * @param request AnalyzeContentRequest message or plain object + * @returns Promise + */ + public analyzeContent(request: google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest): Promise; + + /** + * Calls StreamingAnalyzeContent. + * @param request StreamingAnalyzeContentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and StreamingAnalyzeContentResponse + */ + public streamingAnalyzeContent(request: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest, callback: google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContentCallback): void; + + /** + * Calls StreamingAnalyzeContent. + * @param request StreamingAnalyzeContentRequest message or plain object + * @returns Promise + */ + public streamingAnalyzeContent(request: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest): Promise; + + /** + * Calls SuggestArticles. + * @param request SuggestArticlesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SuggestArticlesResponse + */ + public suggestArticles(request: google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, callback: google.cloud.dialogflow.v2beta1.Participants.SuggestArticlesCallback): void; + + /** + * Calls SuggestArticles. + * @param request SuggestArticlesRequest message or plain object + * @returns Promise + */ + public suggestArticles(request: google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest): Promise; + + /** + * Calls SuggestFaqAnswers. + * @param request SuggestFaqAnswersRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SuggestFaqAnswersResponse + */ + public suggestFaqAnswers(request: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, callback: google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswersCallback): void; + + /** + * Calls SuggestFaqAnswers. + * @param request SuggestFaqAnswersRequest message or plain object + * @returns Promise + */ + public suggestFaqAnswers(request: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest): Promise; + + /** + * Calls SuggestSmartReplies. + * @param request SuggestSmartRepliesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SuggestSmartRepliesResponse + */ + public suggestSmartReplies(request: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, callback: google.cloud.dialogflow.v2beta1.Participants.SuggestSmartRepliesCallback): void; + + /** + * Calls SuggestSmartReplies. + * @param request SuggestSmartRepliesRequest message or plain object + * @returns Promise + */ + public suggestSmartReplies(request: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest): Promise; + + /** + * Calls ListSuggestions. + * @param request ListSuggestionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSuggestionsResponse + */ + public listSuggestions(request: google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, callback: google.cloud.dialogflow.v2beta1.Participants.ListSuggestionsCallback): void; + + /** + * Calls ListSuggestions. + * @param request ListSuggestionsRequest message or plain object + * @returns Promise + */ + public listSuggestions(request: google.cloud.dialogflow.v2beta1.IListSuggestionsRequest): Promise; + + /** + * Calls CompileSuggestion. + * @param request CompileSuggestionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and CompileSuggestionResponse + */ + public compileSuggestion(request: google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, callback: google.cloud.dialogflow.v2beta1.Participants.CompileSuggestionCallback): void; + + /** + * Calls CompileSuggestion. + * @param request CompileSuggestionRequest message or plain object + * @returns Promise + */ + public compileSuggestion(request: google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest): Promise; + } + + namespace Participants { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|createParticipant}. + * @param error Error, if any + * @param [response] Participant + */ + type CreateParticipantCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Participant) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|getParticipant}. + * @param error Error, if any + * @param [response] Participant + */ + type GetParticipantCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Participant) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|listParticipants}. + * @param error Error, if any + * @param [response] ListParticipantsResponse + */ + type ListParticipantsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListParticipantsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|updateParticipant}. + * @param error Error, if any + * @param [response] Participant + */ + type UpdateParticipantCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Participant) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|analyzeContent}. + * @param error Error, if any + * @param [response] AnalyzeContentResponse + */ + type AnalyzeContentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.AnalyzeContentResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|streamingAnalyzeContent}. + * @param error Error, if any + * @param [response] StreamingAnalyzeContentResponse + */ + type StreamingAnalyzeContentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|suggestArticles}. + * @param error Error, if any + * @param [response] SuggestArticlesResponse + */ + type SuggestArticlesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.SuggestArticlesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|suggestFaqAnswers}. + * @param error Error, if any + * @param [response] SuggestFaqAnswersResponse + */ + type SuggestFaqAnswersCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|suggestSmartReplies}. + * @param error Error, if any + * @param [response] SuggestSmartRepliesResponse + */ + type SuggestSmartRepliesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|listSuggestions}. + * @param error Error, if any + * @param [response] ListSuggestionsResponse + */ + type ListSuggestionsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListSuggestionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|compileSuggestion}. + * @param error Error, if any + * @param [response] CompileSuggestionResponse + */ + type CompileSuggestionCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.CompileSuggestionResponse) => void; + } + + /** Properties of a Participant. */ + interface IParticipant { + + /** Participant name */ + name?: (string|null); + + /** Participant role */ + role?: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role|null); + + /** Participant obfuscatedExternalUserId */ + obfuscatedExternalUserId?: (string|null); + + /** Participant documentsMetadataFilters */ + documentsMetadataFilters?: ({ [k: string]: string }|null); + } + + /** Represents a Participant. */ + class Participant implements IParticipant { + + /** + * Constructs a new Participant. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IParticipant); + + /** Participant name. */ + public name: string; + + /** Participant role. */ + public role: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role); + + /** Participant obfuscatedExternalUserId. */ + public obfuscatedExternalUserId: string; + + /** Participant documentsMetadataFilters. */ + public documentsMetadataFilters: { [k: string]: string }; + + /** + * Creates a new Participant instance using the specified properties. + * @param [properties] Properties to set + * @returns Participant instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IParticipant): google.cloud.dialogflow.v2beta1.Participant; + + /** + * Encodes the specified Participant message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Participant.verify|verify} messages. + * @param message Participant message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IParticipant, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Participant message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Participant.verify|verify} messages. + * @param message Participant message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IParticipant, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Participant message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Participant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Participant; + + /** + * Decodes a Participant message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Participant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Participant; + + /** + * Verifies a Participant message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Participant message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Participant + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Participant; + + /** + * Creates a plain object from a Participant message. Also converts values to other types if specified. + * @param message Participant + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Participant, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Participant to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Participant + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Participant { + + /** Role enum. */ + enum Role { + ROLE_UNSPECIFIED = 0, + HUMAN_AGENT = 1, + AUTOMATED_AGENT = 2, + END_USER = 3 + } + } + + /** Properties of a Message. */ + interface IMessage { + + /** Message name */ + name?: (string|null); + + /** Message content */ + content?: (string|null); + + /** Message languageCode */ + languageCode?: (string|null); + + /** Message participant */ + participant?: (string|null); + + /** Message participantRole */ + participantRole?: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role|null); + + /** Message createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Message sendTime */ + sendTime?: (google.protobuf.ITimestamp|null); + + /** Message messageAnnotation */ + messageAnnotation?: (google.cloud.dialogflow.v2beta1.IMessageAnnotation|null); + + /** Message sentimentAnalysis */ + sentimentAnalysis?: (google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult|null); + } + + /** Represents a Message. */ + class Message implements IMessage { + + /** + * Constructs a new Message. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IMessage); + + /** Message name. */ + public name: string; + + /** Message content. */ + public content: string; + + /** Message languageCode. */ + public languageCode: string; + + /** Message participant. */ + public participant: string; + + /** Message participantRole. */ + public participantRole: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role); + + /** Message createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Message sendTime. */ + public sendTime?: (google.protobuf.ITimestamp|null); + + /** Message messageAnnotation. */ + public messageAnnotation?: (google.cloud.dialogflow.v2beta1.IMessageAnnotation|null); + + /** Message sentimentAnalysis. */ + public sentimentAnalysis?: (google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult|null); + + /** + * Creates a new Message instance using the specified properties. + * @param [properties] Properties to set + * @returns Message instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IMessage): google.cloud.dialogflow.v2beta1.Message; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Message message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Message; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Message; + + /** + * Verifies a Message message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Message + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Message; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @param message Message + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Message, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Message to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Message + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateParticipantRequest. */ + interface ICreateParticipantRequest { + + /** CreateParticipantRequest parent */ + parent?: (string|null); + + /** CreateParticipantRequest participant */ + participant?: (google.cloud.dialogflow.v2beta1.IParticipant|null); + } + + /** Represents a CreateParticipantRequest. */ + class CreateParticipantRequest implements ICreateParticipantRequest { + + /** + * Constructs a new CreateParticipantRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateParticipantRequest); + + /** CreateParticipantRequest parent. */ + public parent: string; + + /** CreateParticipantRequest participant. */ + public participant?: (google.cloud.dialogflow.v2beta1.IParticipant|null); + + /** + * Creates a new CreateParticipantRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateParticipantRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateParticipantRequest): google.cloud.dialogflow.v2beta1.CreateParticipantRequest; + + /** + * Encodes the specified CreateParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateParticipantRequest.verify|verify} messages. + * @param message CreateParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateParticipantRequest.verify|verify} messages. + * @param message CreateParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateParticipantRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateParticipantRequest; + + /** + * Decodes a CreateParticipantRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateParticipantRequest; + + /** + * Verifies a CreateParticipantRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateParticipantRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateParticipantRequest; + + /** + * Creates a plain object from a CreateParticipantRequest message. Also converts values to other types if specified. + * @param message CreateParticipantRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateParticipantRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateParticipantRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateParticipantRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetParticipantRequest. */ + interface IGetParticipantRequest { + + /** GetParticipantRequest name */ + name?: (string|null); + } + + /** Represents a GetParticipantRequest. */ + class GetParticipantRequest implements IGetParticipantRequest { + + /** + * Constructs a new GetParticipantRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetParticipantRequest); + + /** GetParticipantRequest name. */ + public name: string; + + /** + * Creates a new GetParticipantRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetParticipantRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetParticipantRequest): google.cloud.dialogflow.v2beta1.GetParticipantRequest; + + /** + * Encodes the specified GetParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetParticipantRequest.verify|verify} messages. + * @param message GetParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetParticipantRequest.verify|verify} messages. + * @param message GetParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetParticipantRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetParticipantRequest; + + /** + * Decodes a GetParticipantRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetParticipantRequest; + + /** + * Verifies a GetParticipantRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetParticipantRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetParticipantRequest; + + /** + * Creates a plain object from a GetParticipantRequest message. Also converts values to other types if specified. + * @param message GetParticipantRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetParticipantRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetParticipantRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetParticipantRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListParticipantsRequest. */ + interface IListParticipantsRequest { + + /** ListParticipantsRequest parent */ + parent?: (string|null); + + /** ListParticipantsRequest pageSize */ + pageSize?: (number|null); + + /** ListParticipantsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListParticipantsRequest. */ + class ListParticipantsRequest implements IListParticipantsRequest { + + /** + * Constructs a new ListParticipantsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListParticipantsRequest); + + /** ListParticipantsRequest parent. */ + public parent: string; + + /** ListParticipantsRequest pageSize. */ + public pageSize: number; + + /** ListParticipantsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListParticipantsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListParticipantsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListParticipantsRequest): google.cloud.dialogflow.v2beta1.ListParticipantsRequest; + + /** + * Encodes the specified ListParticipantsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListParticipantsRequest.verify|verify} messages. + * @param message ListParticipantsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListParticipantsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListParticipantsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListParticipantsRequest.verify|verify} messages. + * @param message ListParticipantsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListParticipantsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListParticipantsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListParticipantsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListParticipantsRequest; + + /** + * Decodes a ListParticipantsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListParticipantsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListParticipantsRequest; + + /** + * Verifies a ListParticipantsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListParticipantsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListParticipantsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListParticipantsRequest; + + /** + * Creates a plain object from a ListParticipantsRequest message. Also converts values to other types if specified. + * @param message ListParticipantsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListParticipantsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListParticipantsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListParticipantsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListParticipantsResponse. */ + interface IListParticipantsResponse { + + /** ListParticipantsResponse participants */ + participants?: (google.cloud.dialogflow.v2beta1.IParticipant[]|null); + + /** ListParticipantsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListParticipantsResponse. */ + class ListParticipantsResponse implements IListParticipantsResponse { + + /** + * Constructs a new ListParticipantsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListParticipantsResponse); + + /** ListParticipantsResponse participants. */ + public participants: google.cloud.dialogflow.v2beta1.IParticipant[]; + + /** ListParticipantsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListParticipantsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListParticipantsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListParticipantsResponse): google.cloud.dialogflow.v2beta1.ListParticipantsResponse; + + /** + * Encodes the specified ListParticipantsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListParticipantsResponse.verify|verify} messages. + * @param message ListParticipantsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListParticipantsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListParticipantsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListParticipantsResponse.verify|verify} messages. + * @param message ListParticipantsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListParticipantsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListParticipantsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListParticipantsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListParticipantsResponse; + + /** + * Decodes a ListParticipantsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListParticipantsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListParticipantsResponse; + + /** + * Verifies a ListParticipantsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListParticipantsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListParticipantsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListParticipantsResponse; + + /** + * Creates a plain object from a ListParticipantsResponse message. Also converts values to other types if specified. + * @param message ListParticipantsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListParticipantsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListParticipantsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListParticipantsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateParticipantRequest. */ + interface IUpdateParticipantRequest { + + /** UpdateParticipantRequest participant */ + participant?: (google.cloud.dialogflow.v2beta1.IParticipant|null); + + /** UpdateParticipantRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateParticipantRequest. */ + class UpdateParticipantRequest implements IUpdateParticipantRequest { + + /** + * Constructs a new UpdateParticipantRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest); + + /** UpdateParticipantRequest participant. */ + public participant?: (google.cloud.dialogflow.v2beta1.IParticipant|null); + + /** UpdateParticipantRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateParticipantRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateParticipantRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest): google.cloud.dialogflow.v2beta1.UpdateParticipantRequest; + + /** + * Encodes the specified UpdateParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.verify|verify} messages. + * @param message UpdateParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.verify|verify} messages. + * @param message UpdateParticipantRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateParticipantRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateParticipantRequest; + + /** + * Decodes an UpdateParticipantRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateParticipantRequest; + + /** + * Verifies an UpdateParticipantRequest message. + * @param message Plain 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 UpdateParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateParticipantRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateParticipantRequest; + + /** + * Creates a plain object from an UpdateParticipantRequest message. Also converts values to other types if specified. + * @param message UpdateParticipantRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateParticipantRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateParticipantRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateParticipantRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AudioInput. */ + interface IAudioInput { + + /** AudioInput config */ + config?: (google.cloud.dialogflow.v2beta1.IInputAudioConfig|null); + + /** AudioInput audio */ + audio?: (Uint8Array|string|null); + } + + /** Represents an AudioInput. */ + class AudioInput implements IAudioInput { + + /** + * Constructs a new AudioInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAudioInput); + + /** AudioInput config. */ + public config?: (google.cloud.dialogflow.v2beta1.IInputAudioConfig|null); + + /** AudioInput audio. */ + public audio: (Uint8Array|string); + + /** + * Creates a new AudioInput instance using the specified properties. + * @param [properties] Properties to set + * @returns AudioInput instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAudioInput): google.cloud.dialogflow.v2beta1.AudioInput; + + /** + * Encodes the specified AudioInput message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AudioInput.verify|verify} messages. + * @param message AudioInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAudioInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AudioInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AudioInput.verify|verify} messages. + * @param message AudioInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAudioInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AudioInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AudioInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AudioInput; + + /** + * Decodes an AudioInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AudioInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AudioInput; + + /** + * Verifies an AudioInput message. + * @param message Plain 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 AudioInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AudioInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AudioInput; + + /** + * Creates a plain object from an AudioInput message. Also converts values to other types if specified. + * @param message AudioInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AudioInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AudioInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AudioInput + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OutputAudio. */ + interface IOutputAudio { + + /** OutputAudio config */ + config?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** OutputAudio audio */ + audio?: (Uint8Array|string|null); + } + + /** Represents an OutputAudio. */ + class OutputAudio implements IOutputAudio { + + /** + * Constructs a new OutputAudio. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IOutputAudio); + + /** OutputAudio config. */ + public config?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** OutputAudio audio. */ + public audio: (Uint8Array|string); + + /** + * Creates a new OutputAudio instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputAudio instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IOutputAudio): google.cloud.dialogflow.v2beta1.OutputAudio; + + /** + * Encodes the specified OutputAudio message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OutputAudio.verify|verify} messages. + * @param message OutputAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IOutputAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OutputAudio.verify|verify} messages. + * @param message OutputAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IOutputAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputAudio message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.OutputAudio; + + /** + * Decodes an OutputAudio message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.OutputAudio; + + /** + * Verifies an OutputAudio message. + * @param message Plain 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 OutputAudio message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputAudio + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.OutputAudio; + + /** + * Creates a plain object from an OutputAudio message. Also converts values to other types if specified. + * @param message OutputAudio + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.OutputAudio, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputAudio to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputAudio + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AutomatedAgentReply. */ + interface IAutomatedAgentReply { + + /** AutomatedAgentReply detectIntentResponse */ + detectIntentResponse?: (google.cloud.dialogflow.v2beta1.IDetectIntentResponse|null); + + /** AutomatedAgentReply responseMessages */ + responseMessages?: (google.cloud.dialogflow.v2beta1.IResponseMessage[]|null); + + /** AutomatedAgentReply intent */ + intent?: (string|null); + + /** AutomatedAgentReply event */ + event?: (string|null); + + /** AutomatedAgentReply matchConfidence */ + matchConfidence?: (number|null); + + /** AutomatedAgentReply parameters */ + parameters?: (google.protobuf.IStruct|null); + + /** AutomatedAgentReply cxSessionParameters */ + cxSessionParameters?: (google.protobuf.IStruct|null); + + /** AutomatedAgentReply automatedAgentReplyType */ + automatedAgentReplyType?: (google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType|keyof typeof google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType|null); + + /** AutomatedAgentReply allowCancellation */ + allowCancellation?: (boolean|null); + } + + /** Represents an AutomatedAgentReply. */ + class AutomatedAgentReply implements IAutomatedAgentReply { + + /** + * Constructs a new AutomatedAgentReply. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAutomatedAgentReply); + + /** AutomatedAgentReply detectIntentResponse. */ + public detectIntentResponse?: (google.cloud.dialogflow.v2beta1.IDetectIntentResponse|null); + + /** AutomatedAgentReply responseMessages. */ + public responseMessages: google.cloud.dialogflow.v2beta1.IResponseMessage[]; + + /** AutomatedAgentReply intent. */ + public intent?: (string|null); + + /** AutomatedAgentReply event. */ + public event?: (string|null); + + /** AutomatedAgentReply matchConfidence. */ + public matchConfidence: number; + + /** AutomatedAgentReply parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** AutomatedAgentReply cxSessionParameters. */ + public cxSessionParameters?: (google.protobuf.IStruct|null); + + /** AutomatedAgentReply automatedAgentReplyType. */ + public automatedAgentReplyType: (google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType|keyof typeof google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType); + + /** AutomatedAgentReply allowCancellation. */ + public allowCancellation: boolean; + + /** AutomatedAgentReply response. */ + public response?: "detectIntentResponse"; + + /** AutomatedAgentReply match. */ + public match?: ("intent"|"event"); + + /** + * Creates a new AutomatedAgentReply instance using the specified properties. + * @param [properties] Properties to set + * @returns AutomatedAgentReply instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAutomatedAgentReply): google.cloud.dialogflow.v2beta1.AutomatedAgentReply; + + /** + * Encodes the specified AutomatedAgentReply message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AutomatedAgentReply.verify|verify} messages. + * @param message AutomatedAgentReply message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAutomatedAgentReply, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AutomatedAgentReply message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AutomatedAgentReply.verify|verify} messages. + * @param message AutomatedAgentReply message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAutomatedAgentReply, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AutomatedAgentReply message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AutomatedAgentReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AutomatedAgentReply; + + /** + * Decodes an AutomatedAgentReply message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AutomatedAgentReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AutomatedAgentReply; + + /** + * Verifies an AutomatedAgentReply message. + * @param message Plain 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 AutomatedAgentReply message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AutomatedAgentReply + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AutomatedAgentReply; + + /** + * Creates a plain object from an AutomatedAgentReply message. Also converts values to other types if specified. + * @param message AutomatedAgentReply + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AutomatedAgentReply, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AutomatedAgentReply to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AutomatedAgentReply + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace AutomatedAgentReply { + + /** AutomatedAgentReplyType enum. */ + enum AutomatedAgentReplyType { + AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED = 0, + PARTIAL = 1, + FINAL = 2 + } + } + + /** Properties of a SuggestionFeature. */ + interface ISuggestionFeature { + + /** SuggestionFeature type */ + type?: (google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|null); + } + + /** Represents a SuggestionFeature. */ + class SuggestionFeature implements ISuggestionFeature { + + /** + * Constructs a new SuggestionFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestionFeature); + + /** SuggestionFeature type. */ + public type: (google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2beta1.SuggestionFeature.Type); + + /** + * Creates a new SuggestionFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionFeature instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestionFeature): google.cloud.dialogflow.v2beta1.SuggestionFeature; + + /** + * Encodes the specified SuggestionFeature message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestionFeature.verify|verify} messages. + * @param message SuggestionFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestionFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionFeature message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestionFeature.verify|verify} messages. + * @param message SuggestionFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestionFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestionFeature; + + /** + * Decodes a SuggestionFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestionFeature; + + /** + * Verifies a SuggestionFeature message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionFeature + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestionFeature; + + /** + * Creates a plain object from a SuggestionFeature message. Also converts values to other types if specified. + * @param message SuggestionFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestionFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SuggestionFeature { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + ARTICLE_SUGGESTION = 1, + FAQ = 2, + SMART_REPLY = 3, + CONVERSATION_SUMMARIZATION = 8 + } + } + + /** Properties of an AssistQueryParameters. */ + interface IAssistQueryParameters { + + /** AssistQueryParameters documentsMetadataFilters */ + documentsMetadataFilters?: ({ [k: string]: string }|null); + } + + /** Represents an AssistQueryParameters. */ + class AssistQueryParameters implements IAssistQueryParameters { + + /** + * Constructs a new AssistQueryParameters. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAssistQueryParameters); + + /** AssistQueryParameters documentsMetadataFilters. */ + public documentsMetadataFilters: { [k: string]: string }; + + /** + * Creates a new AssistQueryParameters instance using the specified properties. + * @param [properties] Properties to set + * @returns AssistQueryParameters instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAssistQueryParameters): google.cloud.dialogflow.v2beta1.AssistQueryParameters; + + /** + * Encodes the specified AssistQueryParameters message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AssistQueryParameters.verify|verify} messages. + * @param message AssistQueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAssistQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AssistQueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AssistQueryParameters.verify|verify} messages. + * @param message AssistQueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAssistQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AssistQueryParameters message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AssistQueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AssistQueryParameters; + + /** + * Decodes an AssistQueryParameters message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AssistQueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AssistQueryParameters; + + /** + * Verifies an AssistQueryParameters message. + * @param message Plain 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 AssistQueryParameters message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AssistQueryParameters + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AssistQueryParameters; + + /** + * Creates a plain object from an AssistQueryParameters message. Also converts values to other types if specified. + * @param message AssistQueryParameters + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AssistQueryParameters, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AssistQueryParameters to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AssistQueryParameters + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnalyzeContentRequest. */ + interface IAnalyzeContentRequest { + + /** AnalyzeContentRequest participant */ + participant?: (string|null); + + /** AnalyzeContentRequest textInput */ + textInput?: (google.cloud.dialogflow.v2beta1.ITextInput|null); + + /** AnalyzeContentRequest audioInput */ + audioInput?: (google.cloud.dialogflow.v2beta1.IAudioInput|null); + + /** AnalyzeContentRequest eventInput */ + eventInput?: (google.cloud.dialogflow.v2beta1.IEventInput|null); + + /** AnalyzeContentRequest replyAudioConfig */ + replyAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** AnalyzeContentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.v2beta1.IQueryParameters|null); + + /** AnalyzeContentRequest assistQueryParams */ + assistQueryParams?: (google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null); + + /** AnalyzeContentRequest cxParameters */ + cxParameters?: (google.protobuf.IStruct|null); + + /** AnalyzeContentRequest cxCurrentPage */ + cxCurrentPage?: (string|null); + + /** AnalyzeContentRequest messageSendTime */ + messageSendTime?: (google.protobuf.ITimestamp|null); + + /** AnalyzeContentRequest requestId */ + requestId?: (string|null); + } + + /** Represents an AnalyzeContentRequest. */ + class AnalyzeContentRequest implements IAnalyzeContentRequest { + + /** + * Constructs a new AnalyzeContentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest); + + /** AnalyzeContentRequest participant. */ + public participant: string; + + /** AnalyzeContentRequest textInput. */ + public textInput?: (google.cloud.dialogflow.v2beta1.ITextInput|null); + + /** AnalyzeContentRequest audioInput. */ + public audioInput?: (google.cloud.dialogflow.v2beta1.IAudioInput|null); + + /** AnalyzeContentRequest eventInput. */ + public eventInput?: (google.cloud.dialogflow.v2beta1.IEventInput|null); + + /** AnalyzeContentRequest replyAudioConfig. */ + public replyAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** AnalyzeContentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.v2beta1.IQueryParameters|null); + + /** AnalyzeContentRequest assistQueryParams. */ + public assistQueryParams?: (google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null); + + /** AnalyzeContentRequest cxParameters. */ + public cxParameters?: (google.protobuf.IStruct|null); + + /** AnalyzeContentRequest cxCurrentPage. */ + public cxCurrentPage: string; + + /** AnalyzeContentRequest messageSendTime. */ + public messageSendTime?: (google.protobuf.ITimestamp|null); + + /** AnalyzeContentRequest requestId. */ + public requestId: string; + + /** AnalyzeContentRequest input. */ + public input?: ("textInput"|"audioInput"|"eventInput"); + + /** + * Creates a new AnalyzeContentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns AnalyzeContentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest): google.cloud.dialogflow.v2beta1.AnalyzeContentRequest; + + /** + * Encodes the specified AnalyzeContentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.verify|verify} messages. + * @param message AnalyzeContentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnalyzeContentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.verify|verify} messages. + * @param message AnalyzeContentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnalyzeContentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AnalyzeContentRequest; + + /** + * Decodes an AnalyzeContentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AnalyzeContentRequest; + + /** + * Verifies an AnalyzeContentRequest message. + * @param message Plain 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 AnalyzeContentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnalyzeContentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AnalyzeContentRequest; + + /** + * Creates a plain object from an AnalyzeContentRequest message. Also converts values to other types if specified. + * @param message AnalyzeContentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AnalyzeContentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnalyzeContentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnalyzeContentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DtmfParameters. */ + interface IDtmfParameters { + + /** DtmfParameters acceptsDtmfInput */ + acceptsDtmfInput?: (boolean|null); + } + + /** Represents a DtmfParameters. */ + class DtmfParameters implements IDtmfParameters { + + /** + * Constructs a new DtmfParameters. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDtmfParameters); + + /** DtmfParameters acceptsDtmfInput. */ + public acceptsDtmfInput: boolean; + + /** + * Creates a new DtmfParameters instance using the specified properties. + * @param [properties] Properties to set + * @returns DtmfParameters instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDtmfParameters): google.cloud.dialogflow.v2beta1.DtmfParameters; + + /** + * Encodes the specified DtmfParameters message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DtmfParameters.verify|verify} messages. + * @param message DtmfParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDtmfParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DtmfParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DtmfParameters.verify|verify} messages. + * @param message DtmfParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDtmfParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DtmfParameters message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DtmfParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DtmfParameters; + + /** + * Decodes a DtmfParameters message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DtmfParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DtmfParameters; + + /** + * Verifies a DtmfParameters message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DtmfParameters message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DtmfParameters + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DtmfParameters; + + /** + * Creates a plain object from a DtmfParameters message. Also converts values to other types if specified. + * @param message DtmfParameters + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DtmfParameters, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DtmfParameters to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DtmfParameters + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnalyzeContentResponse. */ + interface IAnalyzeContentResponse { + + /** AnalyzeContentResponse replyText */ + replyText?: (string|null); + + /** AnalyzeContentResponse replyAudio */ + replyAudio?: (google.cloud.dialogflow.v2beta1.IOutputAudio|null); + + /** AnalyzeContentResponse automatedAgentReply */ + automatedAgentReply?: (google.cloud.dialogflow.v2beta1.IAutomatedAgentReply|null); + + /** AnalyzeContentResponse message */ + message?: (google.cloud.dialogflow.v2beta1.IMessage|null); + + /** AnalyzeContentResponse humanAgentSuggestionResults */ + humanAgentSuggestionResults?: (google.cloud.dialogflow.v2beta1.ISuggestionResult[]|null); + + /** AnalyzeContentResponse endUserSuggestionResults */ + endUserSuggestionResults?: (google.cloud.dialogflow.v2beta1.ISuggestionResult[]|null); + + /** AnalyzeContentResponse dtmfParameters */ + dtmfParameters?: (google.cloud.dialogflow.v2beta1.IDtmfParameters|null); + } + + /** Represents an AnalyzeContentResponse. */ + class AnalyzeContentResponse implements IAnalyzeContentResponse { + + /** + * Constructs a new AnalyzeContentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse); + + /** AnalyzeContentResponse replyText. */ + public replyText: string; + + /** AnalyzeContentResponse replyAudio. */ + public replyAudio?: (google.cloud.dialogflow.v2beta1.IOutputAudio|null); + + /** AnalyzeContentResponse automatedAgentReply. */ + public automatedAgentReply?: (google.cloud.dialogflow.v2beta1.IAutomatedAgentReply|null); + + /** AnalyzeContentResponse message. */ + public message?: (google.cloud.dialogflow.v2beta1.IMessage|null); + + /** AnalyzeContentResponse humanAgentSuggestionResults. */ + public humanAgentSuggestionResults: google.cloud.dialogflow.v2beta1.ISuggestionResult[]; + + /** AnalyzeContentResponse endUserSuggestionResults. */ + public endUserSuggestionResults: google.cloud.dialogflow.v2beta1.ISuggestionResult[]; + + /** AnalyzeContentResponse dtmfParameters. */ + public dtmfParameters?: (google.cloud.dialogflow.v2beta1.IDtmfParameters|null); + + /** + * Creates a new AnalyzeContentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns AnalyzeContentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse): google.cloud.dialogflow.v2beta1.AnalyzeContentResponse; + + /** + * Encodes the specified AnalyzeContentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.verify|verify} messages. + * @param message AnalyzeContentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnalyzeContentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.verify|verify} messages. + * @param message AnalyzeContentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnalyzeContentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AnalyzeContentResponse; + + /** + * Decodes an AnalyzeContentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AnalyzeContentResponse; + + /** + * Verifies an AnalyzeContentResponse message. + * @param message Plain 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 AnalyzeContentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnalyzeContentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AnalyzeContentResponse; + + /** + * Creates a plain object from an AnalyzeContentResponse message. Also converts values to other types if specified. + * @param message AnalyzeContentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AnalyzeContentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnalyzeContentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnalyzeContentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InputTextConfig. */ + interface IInputTextConfig { + + /** InputTextConfig languageCode */ + languageCode?: (string|null); + } + + /** Represents an InputTextConfig. */ + class InputTextConfig implements IInputTextConfig { + + /** + * Constructs a new InputTextConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IInputTextConfig); + + /** InputTextConfig languageCode. */ + public languageCode: string; + + /** + * Creates a new InputTextConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InputTextConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IInputTextConfig): google.cloud.dialogflow.v2beta1.InputTextConfig; + + /** + * Encodes the specified InputTextConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.InputTextConfig.verify|verify} messages. + * @param message InputTextConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IInputTextConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputTextConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.InputTextConfig.verify|verify} messages. + * @param message InputTextConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IInputTextConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InputTextConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InputTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.InputTextConfig; + + /** + * Decodes an InputTextConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InputTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.InputTextConfig; + + /** + * Verifies an InputTextConfig message. + * @param message Plain 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 InputTextConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InputTextConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.InputTextConfig; + + /** + * Creates a plain object from an InputTextConfig message. Also converts values to other types if specified. + * @param message InputTextConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.InputTextConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputTextConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InputTextConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingAnalyzeContentRequest. */ + interface IStreamingAnalyzeContentRequest { + + /** StreamingAnalyzeContentRequest participant */ + participant?: (string|null); + + /** StreamingAnalyzeContentRequest audioConfig */ + audioConfig?: (google.cloud.dialogflow.v2beta1.IInputAudioConfig|null); + + /** StreamingAnalyzeContentRequest textConfig */ + textConfig?: (google.cloud.dialogflow.v2beta1.IInputTextConfig|null); + + /** StreamingAnalyzeContentRequest replyAudioConfig */ + replyAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** StreamingAnalyzeContentRequest inputAudio */ + inputAudio?: (Uint8Array|string|null); + + /** StreamingAnalyzeContentRequest inputText */ + inputText?: (string|null); + + /** StreamingAnalyzeContentRequest inputDtmf */ + inputDtmf?: (google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null); + + /** StreamingAnalyzeContentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.v2beta1.IQueryParameters|null); + + /** StreamingAnalyzeContentRequest assistQueryParams */ + assistQueryParams?: (google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null); + + /** StreamingAnalyzeContentRequest cxParameters */ + cxParameters?: (google.protobuf.IStruct|null); + + /** StreamingAnalyzeContentRequest cxCurrentPage */ + cxCurrentPage?: (string|null); + + /** StreamingAnalyzeContentRequest enablePartialAutomatedAgentReply */ + enablePartialAutomatedAgentReply?: (boolean|null); + } + + /** Represents a StreamingAnalyzeContentRequest. */ + class StreamingAnalyzeContentRequest implements IStreamingAnalyzeContentRequest { + + /** + * Constructs a new StreamingAnalyzeContentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest); + + /** StreamingAnalyzeContentRequest participant. */ + public participant: string; + + /** StreamingAnalyzeContentRequest audioConfig. */ + public audioConfig?: (google.cloud.dialogflow.v2beta1.IInputAudioConfig|null); + + /** StreamingAnalyzeContentRequest textConfig. */ + public textConfig?: (google.cloud.dialogflow.v2beta1.IInputTextConfig|null); + + /** StreamingAnalyzeContentRequest replyAudioConfig. */ + public replyAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** StreamingAnalyzeContentRequest inputAudio. */ + public inputAudio?: (Uint8Array|string|null); + + /** StreamingAnalyzeContentRequest inputText. */ + public inputText?: (string|null); + + /** StreamingAnalyzeContentRequest inputDtmf. */ + public inputDtmf?: (google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null); + + /** StreamingAnalyzeContentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.v2beta1.IQueryParameters|null); + + /** StreamingAnalyzeContentRequest assistQueryParams. */ + public assistQueryParams?: (google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null); + + /** StreamingAnalyzeContentRequest cxParameters. */ + public cxParameters?: (google.protobuf.IStruct|null); + + /** StreamingAnalyzeContentRequest cxCurrentPage. */ + public cxCurrentPage: string; + + /** StreamingAnalyzeContentRequest enablePartialAutomatedAgentReply. */ + public enablePartialAutomatedAgentReply: boolean; + + /** StreamingAnalyzeContentRequest config. */ + public config?: ("audioConfig"|"textConfig"); + + /** StreamingAnalyzeContentRequest input. */ + public input?: ("inputAudio"|"inputText"|"inputDtmf"); + + /** + * Creates a new StreamingAnalyzeContentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingAnalyzeContentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest): google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest; + + /** + * Encodes the specified StreamingAnalyzeContentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.verify|verify} messages. + * @param message StreamingAnalyzeContentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingAnalyzeContentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.verify|verify} messages. + * @param message StreamingAnalyzeContentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingAnalyzeContentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingAnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest; + + /** + * Decodes a StreamingAnalyzeContentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingAnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest; + + /** + * Verifies a StreamingAnalyzeContentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingAnalyzeContentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingAnalyzeContentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest; + + /** + * Creates a plain object from a StreamingAnalyzeContentRequest message. Also converts values to other types if specified. + * @param message StreamingAnalyzeContentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingAnalyzeContentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingAnalyzeContentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingAnalyzeContentResponse. */ + interface IStreamingAnalyzeContentResponse { + + /** StreamingAnalyzeContentResponse recognitionResult */ + recognitionResult?: (google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult|null); + + /** StreamingAnalyzeContentResponse replyText */ + replyText?: (string|null); + + /** StreamingAnalyzeContentResponse replyAudio */ + replyAudio?: (google.cloud.dialogflow.v2beta1.IOutputAudio|null); + + /** StreamingAnalyzeContentResponse automatedAgentReply */ + automatedAgentReply?: (google.cloud.dialogflow.v2beta1.IAutomatedAgentReply|null); + + /** StreamingAnalyzeContentResponse message */ + message?: (google.cloud.dialogflow.v2beta1.IMessage|null); + + /** StreamingAnalyzeContentResponse humanAgentSuggestionResults */ + humanAgentSuggestionResults?: (google.cloud.dialogflow.v2beta1.ISuggestionResult[]|null); + + /** StreamingAnalyzeContentResponse endUserSuggestionResults */ + endUserSuggestionResults?: (google.cloud.dialogflow.v2beta1.ISuggestionResult[]|null); + + /** StreamingAnalyzeContentResponse dtmfParameters */ + dtmfParameters?: (google.cloud.dialogflow.v2beta1.IDtmfParameters|null); + } + + /** Represents a StreamingAnalyzeContentResponse. */ + class StreamingAnalyzeContentResponse implements IStreamingAnalyzeContentResponse { + + /** + * Constructs a new StreamingAnalyzeContentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentResponse); + + /** StreamingAnalyzeContentResponse recognitionResult. */ + public recognitionResult?: (google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult|null); + + /** StreamingAnalyzeContentResponse replyText. */ + public replyText: string; + + /** StreamingAnalyzeContentResponse replyAudio. */ + public replyAudio?: (google.cloud.dialogflow.v2beta1.IOutputAudio|null); + + /** StreamingAnalyzeContentResponse automatedAgentReply. */ + public automatedAgentReply?: (google.cloud.dialogflow.v2beta1.IAutomatedAgentReply|null); + + /** StreamingAnalyzeContentResponse message. */ + public message?: (google.cloud.dialogflow.v2beta1.IMessage|null); + + /** StreamingAnalyzeContentResponse humanAgentSuggestionResults. */ + public humanAgentSuggestionResults: google.cloud.dialogflow.v2beta1.ISuggestionResult[]; + + /** StreamingAnalyzeContentResponse endUserSuggestionResults. */ + public endUserSuggestionResults: google.cloud.dialogflow.v2beta1.ISuggestionResult[]; + + /** StreamingAnalyzeContentResponse dtmfParameters. */ + public dtmfParameters?: (google.cloud.dialogflow.v2beta1.IDtmfParameters|null); + + /** + * Creates a new StreamingAnalyzeContentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingAnalyzeContentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentResponse): google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse; + + /** + * Encodes the specified StreamingAnalyzeContentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.verify|verify} messages. + * @param message StreamingAnalyzeContentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingAnalyzeContentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.verify|verify} messages. + * @param message StreamingAnalyzeContentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingAnalyzeContentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingAnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse; + + /** + * Decodes a StreamingAnalyzeContentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingAnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse; + + /** + * Verifies a StreamingAnalyzeContentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingAnalyzeContentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingAnalyzeContentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse; + + /** + * Creates a plain object from a StreamingAnalyzeContentResponse message. Also converts values to other types if specified. + * @param message StreamingAnalyzeContentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingAnalyzeContentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingAnalyzeContentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AnnotatedMessagePart. */ + interface IAnnotatedMessagePart { + + /** AnnotatedMessagePart text */ + text?: (string|null); + + /** AnnotatedMessagePart entityType */ + entityType?: (string|null); + + /** AnnotatedMessagePart formattedValue */ + formattedValue?: (google.protobuf.IValue|null); + } + + /** Represents an AnnotatedMessagePart. */ + class AnnotatedMessagePart implements IAnnotatedMessagePart { + + /** + * Constructs a new AnnotatedMessagePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart); + + /** AnnotatedMessagePart text. */ + public text: string; + + /** AnnotatedMessagePart entityType. */ + public entityType: string; + + /** AnnotatedMessagePart formattedValue. */ + public formattedValue?: (google.protobuf.IValue|null); + + /** + * Creates a new AnnotatedMessagePart instance using the specified properties. + * @param [properties] Properties to set + * @returns AnnotatedMessagePart instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart): google.cloud.dialogflow.v2beta1.AnnotatedMessagePart; + + /** + * Encodes the specified AnnotatedMessagePart message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.verify|verify} messages. + * @param message AnnotatedMessagePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AnnotatedMessagePart message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.verify|verify} messages. + * @param message AnnotatedMessagePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AnnotatedMessagePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AnnotatedMessagePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AnnotatedMessagePart; + + /** + * Decodes an AnnotatedMessagePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AnnotatedMessagePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AnnotatedMessagePart; + + /** + * Verifies an AnnotatedMessagePart message. + * @param message Plain 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 AnnotatedMessagePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AnnotatedMessagePart + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AnnotatedMessagePart; + + /** + * Creates a plain object from an AnnotatedMessagePart message. Also converts values to other types if specified. + * @param message AnnotatedMessagePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AnnotatedMessagePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AnnotatedMessagePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AnnotatedMessagePart + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MessageAnnotation. */ + interface IMessageAnnotation { + + /** MessageAnnotation parts */ + parts?: (google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart[]|null); + + /** MessageAnnotation containEntities */ + containEntities?: (boolean|null); + } + + /** Represents a MessageAnnotation. */ + class MessageAnnotation implements IMessageAnnotation { + + /** + * Constructs a new MessageAnnotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IMessageAnnotation); + + /** MessageAnnotation parts. */ + public parts: google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart[]; + + /** MessageAnnotation containEntities. */ + public containEntities: boolean; + + /** + * Creates a new MessageAnnotation instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageAnnotation instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IMessageAnnotation): google.cloud.dialogflow.v2beta1.MessageAnnotation; + + /** + * Encodes the specified MessageAnnotation message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.MessageAnnotation.verify|verify} messages. + * @param message MessageAnnotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IMessageAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageAnnotation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.MessageAnnotation.verify|verify} messages. + * @param message MessageAnnotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IMessageAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageAnnotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.MessageAnnotation; + + /** + * Decodes a MessageAnnotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.MessageAnnotation; + + /** + * Verifies a MessageAnnotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageAnnotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageAnnotation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.MessageAnnotation; + + /** + * Creates a plain object from a MessageAnnotation message. Also converts values to other types if specified. + * @param message MessageAnnotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.MessageAnnotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageAnnotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageAnnotation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ArticleAnswer. */ + interface IArticleAnswer { + + /** ArticleAnswer title */ + title?: (string|null); + + /** ArticleAnswer uri */ + uri?: (string|null); + + /** ArticleAnswer snippets */ + snippets?: (string[]|null); + + /** ArticleAnswer metadata */ + metadata?: ({ [k: string]: string }|null); + + /** ArticleAnswer answerRecord */ + answerRecord?: (string|null); + } + + /** Represents an ArticleAnswer. */ + class ArticleAnswer implements IArticleAnswer { + + /** + * Constructs a new ArticleAnswer. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IArticleAnswer); + + /** ArticleAnswer title. */ + public title: string; + + /** ArticleAnswer uri. */ + public uri: string; + + /** ArticleAnswer snippets. */ + public snippets: string[]; + + /** ArticleAnswer metadata. */ + public metadata: { [k: string]: string }; + + /** ArticleAnswer answerRecord. */ + public answerRecord: string; + + /** + * Creates a new ArticleAnswer instance using the specified properties. + * @param [properties] Properties to set + * @returns ArticleAnswer instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IArticleAnswer): google.cloud.dialogflow.v2beta1.ArticleAnswer; + + /** + * Encodes the specified ArticleAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ArticleAnswer.verify|verify} messages. + * @param message ArticleAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IArticleAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ArticleAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ArticleAnswer.verify|verify} messages. + * @param message ArticleAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IArticleAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ArticleAnswer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ArticleAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ArticleAnswer; + + /** + * Decodes an ArticleAnswer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ArticleAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ArticleAnswer; + + /** + * Verifies an ArticleAnswer message. + * @param message Plain 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 ArticleAnswer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ArticleAnswer + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ArticleAnswer; + + /** + * Creates a plain object from an ArticleAnswer message. Also converts values to other types if specified. + * @param message ArticleAnswer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ArticleAnswer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ArticleAnswer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ArticleAnswer + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FaqAnswer. */ + interface IFaqAnswer { + + /** FaqAnswer answer */ + answer?: (string|null); + + /** FaqAnswer confidence */ + confidence?: (number|null); + + /** FaqAnswer question */ + question?: (string|null); + + /** FaqAnswer source */ + source?: (string|null); + + /** FaqAnswer metadata */ + metadata?: ({ [k: string]: string }|null); + + /** FaqAnswer answerRecord */ + answerRecord?: (string|null); + } + + /** Represents a FaqAnswer. */ + class FaqAnswer implements IFaqAnswer { + + /** + * Constructs a new FaqAnswer. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IFaqAnswer); + + /** FaqAnswer answer. */ + public answer: string; + + /** FaqAnswer confidence. */ + public confidence: number; + + /** FaqAnswer question. */ + public question: string; + + /** FaqAnswer source. */ + public source: string; + + /** FaqAnswer metadata. */ + public metadata: { [k: string]: string }; + + /** FaqAnswer answerRecord. */ + public answerRecord: string; + + /** + * Creates a new FaqAnswer instance using the specified properties. + * @param [properties] Properties to set + * @returns FaqAnswer instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IFaqAnswer): google.cloud.dialogflow.v2beta1.FaqAnswer; + + /** + * Encodes the specified FaqAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.FaqAnswer.verify|verify} messages. + * @param message FaqAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IFaqAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FaqAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.FaqAnswer.verify|verify} messages. + * @param message FaqAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IFaqAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.FaqAnswer; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.FaqAnswer; + + /** + * Verifies a FaqAnswer message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FaqAnswer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FaqAnswer + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.FaqAnswer; + + /** + * Creates a plain object from a FaqAnswer message. Also converts values to other types if specified. + * @param message FaqAnswer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.FaqAnswer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FaqAnswer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FaqAnswer + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SmartReplyAnswer. */ + interface ISmartReplyAnswer { + + /** SmartReplyAnswer reply */ + reply?: (string|null); + + /** SmartReplyAnswer confidence */ + confidence?: (number|null); + + /** SmartReplyAnswer answerRecord */ + answerRecord?: (string|null); + } + + /** Represents a SmartReplyAnswer. */ + class SmartReplyAnswer implements ISmartReplyAnswer { + + /** + * Constructs a new SmartReplyAnswer. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISmartReplyAnswer); + + /** SmartReplyAnswer reply. */ + public reply: string; + + /** SmartReplyAnswer confidence. */ + public confidence: number; + + /** SmartReplyAnswer answerRecord. */ + public answerRecord: string; + + /** + * Creates a new SmartReplyAnswer instance using the specified properties. + * @param [properties] Properties to set + * @returns SmartReplyAnswer instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISmartReplyAnswer): google.cloud.dialogflow.v2beta1.SmartReplyAnswer; + + /** + * Encodes the specified SmartReplyAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SmartReplyAnswer.verify|verify} messages. + * @param message SmartReplyAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISmartReplyAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SmartReplyAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SmartReplyAnswer.verify|verify} messages. + * @param message SmartReplyAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISmartReplyAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SmartReplyAnswer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SmartReplyAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SmartReplyAnswer; + + /** + * Decodes a SmartReplyAnswer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SmartReplyAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SmartReplyAnswer; + + /** + * Verifies a SmartReplyAnswer message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SmartReplyAnswer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SmartReplyAnswer + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SmartReplyAnswer; + + /** + * Creates a plain object from a SmartReplyAnswer message. Also converts values to other types if specified. + * @param message SmartReplyAnswer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SmartReplyAnswer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SmartReplyAnswer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SmartReplyAnswer + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestionResult. */ + interface ISuggestionResult { + + /** SuggestionResult error */ + error?: (google.rpc.IStatus|null); + + /** SuggestionResult suggestArticlesResponse */ + suggestArticlesResponse?: (google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse|null); + + /** SuggestionResult suggestFaqAnswersResponse */ + suggestFaqAnswersResponse?: (google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse|null); + + /** SuggestionResult suggestSmartRepliesResponse */ + suggestSmartRepliesResponse?: (google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse|null); + } + + /** Represents a SuggestionResult. */ + class SuggestionResult implements ISuggestionResult { + + /** + * Constructs a new SuggestionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestionResult); + + /** SuggestionResult error. */ + public error?: (google.rpc.IStatus|null); + + /** SuggestionResult suggestArticlesResponse. */ + public suggestArticlesResponse?: (google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse|null); + + /** SuggestionResult suggestFaqAnswersResponse. */ + public suggestFaqAnswersResponse?: (google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse|null); + + /** SuggestionResult suggestSmartRepliesResponse. */ + public suggestSmartRepliesResponse?: (google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse|null); + + /** SuggestionResult suggestionResponse. */ + public suggestionResponse?: ("error"|"suggestArticlesResponse"|"suggestFaqAnswersResponse"|"suggestSmartRepliesResponse"); + + /** + * Creates a new SuggestionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestionResult): google.cloud.dialogflow.v2beta1.SuggestionResult; + + /** + * Encodes the specified SuggestionResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestionResult.verify|verify} messages. + * @param message SuggestionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestionResult.verify|verify} messages. + * @param message SuggestionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestionResult; + + /** + * Decodes a SuggestionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestionResult; + + /** + * Verifies a SuggestionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestionResult; + + /** + * Creates a plain object from a SuggestionResult message. Also converts values to other types if specified. + * @param message SuggestionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestArticlesRequest. */ + interface ISuggestArticlesRequest { + + /** SuggestArticlesRequest parent */ + parent?: (string|null); + + /** SuggestArticlesRequest latestMessage */ + latestMessage?: (string|null); + + /** SuggestArticlesRequest contextSize */ + contextSize?: (number|null); + + /** SuggestArticlesRequest assistQueryParams */ + assistQueryParams?: (google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null); + } + + /** Represents a SuggestArticlesRequest. */ + class SuggestArticlesRequest implements ISuggestArticlesRequest { + + /** + * Constructs a new SuggestArticlesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest); + + /** SuggestArticlesRequest parent. */ + public parent: string; + + /** SuggestArticlesRequest latestMessage. */ + public latestMessage: string; + + /** SuggestArticlesRequest contextSize. */ + public contextSize: number; + + /** SuggestArticlesRequest assistQueryParams. */ + public assistQueryParams?: (google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null); + + /** + * Creates a new SuggestArticlesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestArticlesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest): google.cloud.dialogflow.v2beta1.SuggestArticlesRequest; + + /** + * Encodes the specified SuggestArticlesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.verify|verify} messages. + * @param message SuggestArticlesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestArticlesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.verify|verify} messages. + * @param message SuggestArticlesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestArticlesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestArticlesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestArticlesRequest; + + /** + * Decodes a SuggestArticlesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestArticlesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestArticlesRequest; + + /** + * Verifies a SuggestArticlesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestArticlesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestArticlesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestArticlesRequest; + + /** + * Creates a plain object from a SuggestArticlesRequest message. Also converts values to other types if specified. + * @param message SuggestArticlesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestArticlesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestArticlesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestArticlesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestArticlesResponse. */ + interface ISuggestArticlesResponse { + + /** SuggestArticlesResponse articleAnswers */ + articleAnswers?: (google.cloud.dialogflow.v2beta1.IArticleAnswer[]|null); + + /** SuggestArticlesResponse latestMessage */ + latestMessage?: (string|null); + + /** SuggestArticlesResponse contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestArticlesResponse. */ + class SuggestArticlesResponse implements ISuggestArticlesResponse { + + /** + * Constructs a new SuggestArticlesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse); + + /** SuggestArticlesResponse articleAnswers. */ + public articleAnswers: google.cloud.dialogflow.v2beta1.IArticleAnswer[]; + + /** SuggestArticlesResponse latestMessage. */ + public latestMessage: string; + + /** SuggestArticlesResponse contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestArticlesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestArticlesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse): google.cloud.dialogflow.v2beta1.SuggestArticlesResponse; + + /** + * Encodes the specified SuggestArticlesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.verify|verify} messages. + * @param message SuggestArticlesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestArticlesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.verify|verify} messages. + * @param message SuggestArticlesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestArticlesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestArticlesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestArticlesResponse; + + /** + * Decodes a SuggestArticlesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestArticlesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestArticlesResponse; + + /** + * Verifies a SuggestArticlesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestArticlesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestArticlesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestArticlesResponse; + + /** + * Creates a plain object from a SuggestArticlesResponse message. Also converts values to other types if specified. + * @param message SuggestArticlesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestArticlesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestArticlesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestArticlesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestFaqAnswersRequest. */ + interface ISuggestFaqAnswersRequest { + + /** SuggestFaqAnswersRequest parent */ + parent?: (string|null); + + /** SuggestFaqAnswersRequest latestMessage */ + latestMessage?: (string|null); + + /** SuggestFaqAnswersRequest contextSize */ + contextSize?: (number|null); + + /** SuggestFaqAnswersRequest assistQueryParams */ + assistQueryParams?: (google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null); + } + + /** Represents a SuggestFaqAnswersRequest. */ + class SuggestFaqAnswersRequest implements ISuggestFaqAnswersRequest { + + /** + * Constructs a new SuggestFaqAnswersRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest); + + /** SuggestFaqAnswersRequest parent. */ + public parent: string; + + /** SuggestFaqAnswersRequest latestMessage. */ + public latestMessage: string; + + /** SuggestFaqAnswersRequest contextSize. */ + public contextSize: number; + + /** SuggestFaqAnswersRequest assistQueryParams. */ + public assistQueryParams?: (google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null); + + /** + * Creates a new SuggestFaqAnswersRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestFaqAnswersRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest): google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest; + + /** + * Encodes the specified SuggestFaqAnswersRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest.verify|verify} messages. + * @param message SuggestFaqAnswersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestFaqAnswersRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest.verify|verify} messages. + * @param message SuggestFaqAnswersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestFaqAnswersRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestFaqAnswersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest; + + /** + * Decodes a SuggestFaqAnswersRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestFaqAnswersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest; + + /** + * Verifies a SuggestFaqAnswersRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestFaqAnswersRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestFaqAnswersRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest; + + /** + * Creates a plain object from a SuggestFaqAnswersRequest message. Also converts values to other types if specified. + * @param message SuggestFaqAnswersRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestFaqAnswersRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestFaqAnswersRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestFaqAnswersResponse. */ + interface ISuggestFaqAnswersResponse { + + /** SuggestFaqAnswersResponse faqAnswers */ + faqAnswers?: (google.cloud.dialogflow.v2beta1.IFaqAnswer[]|null); + + /** SuggestFaqAnswersResponse latestMessage */ + latestMessage?: (string|null); + + /** SuggestFaqAnswersResponse contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestFaqAnswersResponse. */ + class SuggestFaqAnswersResponse implements ISuggestFaqAnswersResponse { + + /** + * Constructs a new SuggestFaqAnswersResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse); + + /** SuggestFaqAnswersResponse faqAnswers. */ + public faqAnswers: google.cloud.dialogflow.v2beta1.IFaqAnswer[]; + + /** SuggestFaqAnswersResponse latestMessage. */ + public latestMessage: string; + + /** SuggestFaqAnswersResponse contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestFaqAnswersResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestFaqAnswersResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse): google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse; + + /** + * Encodes the specified SuggestFaqAnswersResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.verify|verify} messages. + * @param message SuggestFaqAnswersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestFaqAnswersResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.verify|verify} messages. + * @param message SuggestFaqAnswersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestFaqAnswersResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestFaqAnswersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse; + + /** + * Decodes a SuggestFaqAnswersResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestFaqAnswersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse; + + /** + * Verifies a SuggestFaqAnswersResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestFaqAnswersResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestFaqAnswersResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse; + + /** + * Creates a plain object from a SuggestFaqAnswersResponse message. Also converts values to other types if specified. + * @param message SuggestFaqAnswersResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestFaqAnswersResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestFaqAnswersResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestSmartRepliesRequest. */ + interface ISuggestSmartRepliesRequest { + + /** SuggestSmartRepliesRequest parent */ + parent?: (string|null); + + /** SuggestSmartRepliesRequest currentTextInput */ + currentTextInput?: (google.cloud.dialogflow.v2beta1.ITextInput|null); + + /** SuggestSmartRepliesRequest latestMessage */ + latestMessage?: (string|null); + + /** SuggestSmartRepliesRequest contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestSmartRepliesRequest. */ + class SuggestSmartRepliesRequest implements ISuggestSmartRepliesRequest { + + /** + * Constructs a new SuggestSmartRepliesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest); + + /** SuggestSmartRepliesRequest parent. */ + public parent: string; + + /** SuggestSmartRepliesRequest currentTextInput. */ + public currentTextInput?: (google.cloud.dialogflow.v2beta1.ITextInput|null); + + /** SuggestSmartRepliesRequest latestMessage. */ + public latestMessage: string; + + /** SuggestSmartRepliesRequest contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestSmartRepliesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestSmartRepliesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest): google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest; + + /** + * Encodes the specified SuggestSmartRepliesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.verify|verify} messages. + * @param message SuggestSmartRepliesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestSmartRepliesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.verify|verify} messages. + * @param message SuggestSmartRepliesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestSmartRepliesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestSmartRepliesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest; + + /** + * Decodes a SuggestSmartRepliesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestSmartRepliesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest; + + /** + * Verifies a SuggestSmartRepliesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestSmartRepliesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestSmartRepliesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest; + + /** + * Creates a plain object from a SuggestSmartRepliesRequest message. Also converts values to other types if specified. + * @param message SuggestSmartRepliesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestSmartRepliesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestSmartRepliesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestSmartRepliesResponse. */ + interface ISuggestSmartRepliesResponse { + + /** SuggestSmartRepliesResponse smartReplyAnswers */ + smartReplyAnswers?: (google.cloud.dialogflow.v2beta1.ISmartReplyAnswer[]|null); + + /** SuggestSmartRepliesResponse latestMessage */ + latestMessage?: (string|null); + + /** SuggestSmartRepliesResponse contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestSmartRepliesResponse. */ + class SuggestSmartRepliesResponse implements ISuggestSmartRepliesResponse { + + /** + * Constructs a new SuggestSmartRepliesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse); + + /** SuggestSmartRepliesResponse smartReplyAnswers. */ + public smartReplyAnswers: google.cloud.dialogflow.v2beta1.ISmartReplyAnswer[]; + + /** SuggestSmartRepliesResponse latestMessage. */ + public latestMessage: string; + + /** SuggestSmartRepliesResponse contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestSmartRepliesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestSmartRepliesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse): google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse; + + /** + * Encodes the specified SuggestSmartRepliesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.verify|verify} messages. + * @param message SuggestSmartRepliesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestSmartRepliesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.verify|verify} messages. + * @param message SuggestSmartRepliesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestSmartRepliesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestSmartRepliesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse; + + /** + * Decodes a SuggestSmartRepliesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestSmartRepliesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse; + + /** + * Verifies a SuggestSmartRepliesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestSmartRepliesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestSmartRepliesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse; + + /** + * Creates a plain object from a SuggestSmartRepliesResponse message. Also converts values to other types if specified. + * @param message SuggestSmartRepliesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestSmartRepliesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestSmartRepliesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Suggestion. */ + interface ISuggestion { + + /** Suggestion name */ + name?: (string|null); + + /** Suggestion articles */ + articles?: (google.cloud.dialogflow.v2beta1.Suggestion.IArticle[]|null); + + /** Suggestion faqAnswers */ + faqAnswers?: (google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer[]|null); + + /** Suggestion createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Suggestion latestMessage */ + latestMessage?: (string|null); + } + + /** Represents a Suggestion. */ + class Suggestion implements ISuggestion { + + /** + * Constructs a new Suggestion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestion); + + /** Suggestion name. */ + public name: string; + + /** Suggestion articles. */ + public articles: google.cloud.dialogflow.v2beta1.Suggestion.IArticle[]; + + /** Suggestion faqAnswers. */ + public faqAnswers: google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer[]; + + /** Suggestion createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Suggestion latestMessage. */ + public latestMessage: string; + + /** + * Creates a new Suggestion instance using the specified properties. + * @param [properties] Properties to set + * @returns Suggestion instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestion): google.cloud.dialogflow.v2beta1.Suggestion; + + /** + * Encodes the specified Suggestion message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.verify|verify} messages. + * @param message Suggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Suggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.verify|verify} messages. + * @param message Suggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Suggestion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Suggestion; + + /** + * Decodes a Suggestion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Suggestion; + + /** + * Verifies a Suggestion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Suggestion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Suggestion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Suggestion; + + /** + * Creates a plain object from a Suggestion message. Also converts values to other types if specified. + * @param message Suggestion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Suggestion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Suggestion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Suggestion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Suggestion { + + /** Properties of an Article. */ + interface IArticle { + + /** Article title */ + title?: (string|null); + + /** Article uri */ + uri?: (string|null); + + /** Article snippets */ + snippets?: (string[]|null); + + /** Article metadata */ + metadata?: ({ [k: string]: string }|null); + + /** Article answerRecord */ + answerRecord?: (string|null); + } + + /** Represents an Article. */ + class Article implements IArticle { + + /** + * Constructs a new Article. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Suggestion.IArticle); + + /** Article title. */ + public title: string; + + /** Article uri. */ + public uri: string; + + /** Article snippets. */ + public snippets: string[]; + + /** Article metadata. */ + public metadata: { [k: string]: string }; + + /** Article answerRecord. */ + public answerRecord: string; + + /** + * Creates a new Article instance using the specified properties. + * @param [properties] Properties to set + * @returns Article instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Suggestion.IArticle): google.cloud.dialogflow.v2beta1.Suggestion.Article; + + /** + * Encodes the specified Article message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.Article.verify|verify} messages. + * @param message Article message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Suggestion.IArticle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Article message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.Article.verify|verify} messages. + * @param message Article message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Suggestion.IArticle, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Article message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Article + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Suggestion.Article; + + /** + * Decodes an Article message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Article + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Suggestion.Article; + + /** + * Verifies an Article message. + * @param message Plain 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 Article message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Article + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Suggestion.Article; + + /** + * Creates a plain object from an Article message. Also converts values to other types if specified. + * @param message Article + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Suggestion.Article, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Article to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Article + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FaqAnswer. */ + interface IFaqAnswer { + + /** FaqAnswer answer */ + answer?: (string|null); + + /** FaqAnswer confidence */ + confidence?: (number|null); + + /** FaqAnswer question */ + question?: (string|null); + + /** FaqAnswer source */ + source?: (string|null); + + /** FaqAnswer metadata */ + metadata?: ({ [k: string]: string }|null); + + /** FaqAnswer answerRecord */ + answerRecord?: (string|null); + } + + /** Represents a FaqAnswer. */ + class FaqAnswer implements IFaqAnswer { + + /** + * Constructs a new FaqAnswer. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer); + + /** FaqAnswer answer. */ + public answer: string; + + /** FaqAnswer confidence. */ + public confidence: number; + + /** FaqAnswer question. */ + public question: string; + + /** FaqAnswer source. */ + public source: string; + + /** FaqAnswer metadata. */ + public metadata: { [k: string]: string }; + + /** FaqAnswer answerRecord. */ + public answerRecord: string; + + /** + * Creates a new FaqAnswer instance using the specified properties. + * @param [properties] Properties to set + * @returns FaqAnswer instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer): google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer; + + /** + * Encodes the specified FaqAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.verify|verify} messages. + * @param message FaqAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FaqAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.verify|verify} messages. + * @param message FaqAnswer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer; + + /** + * Verifies a FaqAnswer message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FaqAnswer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FaqAnswer + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer; + + /** + * Creates a plain object from a FaqAnswer message. Also converts values to other types if specified. + * @param message FaqAnswer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FaqAnswer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FaqAnswer + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ListSuggestionsRequest. */ + interface IListSuggestionsRequest { + + /** ListSuggestionsRequest parent */ + parent?: (string|null); + + /** ListSuggestionsRequest pageSize */ + pageSize?: (number|null); + + /** ListSuggestionsRequest pageToken */ + pageToken?: (string|null); + + /** ListSuggestionsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListSuggestionsRequest. */ + class ListSuggestionsRequest implements IListSuggestionsRequest { + + /** + * Constructs a new ListSuggestionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListSuggestionsRequest); + + /** ListSuggestionsRequest parent. */ + public parent: string; + + /** ListSuggestionsRequest pageSize. */ + public pageSize: number; + + /** ListSuggestionsRequest pageToken. */ + public pageToken: string; + + /** ListSuggestionsRequest filter. */ + public filter: string; + + /** + * Creates a new ListSuggestionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSuggestionsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListSuggestionsRequest): google.cloud.dialogflow.v2beta1.ListSuggestionsRequest; + + /** + * Encodes the specified ListSuggestionsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSuggestionsRequest.verify|verify} messages. + * @param message ListSuggestionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSuggestionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSuggestionsRequest.verify|verify} messages. + * @param message ListSuggestionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSuggestionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSuggestionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListSuggestionsRequest; + + /** + * Decodes a ListSuggestionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSuggestionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListSuggestionsRequest; + + /** + * Verifies a ListSuggestionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSuggestionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSuggestionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListSuggestionsRequest; + + /** + * Creates a plain object from a ListSuggestionsRequest message. Also converts values to other types if specified. + * @param message ListSuggestionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListSuggestionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSuggestionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSuggestionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSuggestionsResponse. */ + interface IListSuggestionsResponse { + + /** ListSuggestionsResponse suggestions */ + suggestions?: (google.cloud.dialogflow.v2beta1.ISuggestion[]|null); + + /** ListSuggestionsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListSuggestionsResponse. */ + class ListSuggestionsResponse implements IListSuggestionsResponse { + + /** + * Constructs a new ListSuggestionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListSuggestionsResponse); + + /** ListSuggestionsResponse suggestions. */ + public suggestions: google.cloud.dialogflow.v2beta1.ISuggestion[]; + + /** ListSuggestionsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListSuggestionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSuggestionsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListSuggestionsResponse): google.cloud.dialogflow.v2beta1.ListSuggestionsResponse; + + /** + * Encodes the specified ListSuggestionsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSuggestionsResponse.verify|verify} messages. + * @param message ListSuggestionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListSuggestionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSuggestionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSuggestionsResponse.verify|verify} messages. + * @param message ListSuggestionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListSuggestionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSuggestionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSuggestionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListSuggestionsResponse; + + /** + * Decodes a ListSuggestionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSuggestionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListSuggestionsResponse; + + /** + * Verifies a ListSuggestionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSuggestionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSuggestionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListSuggestionsResponse; + + /** + * Creates a plain object from a ListSuggestionsResponse message. Also converts values to other types if specified. + * @param message ListSuggestionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListSuggestionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSuggestionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSuggestionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CompileSuggestionRequest. */ + interface ICompileSuggestionRequest { + + /** CompileSuggestionRequest parent */ + parent?: (string|null); + + /** CompileSuggestionRequest latestMessage */ + latestMessage?: (string|null); + + /** CompileSuggestionRequest contextSize */ + contextSize?: (number|null); + } + + /** Represents a CompileSuggestionRequest. */ + class CompileSuggestionRequest implements ICompileSuggestionRequest { + + /** + * Constructs a new CompileSuggestionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest); + + /** CompileSuggestionRequest parent. */ + public parent: string; + + /** CompileSuggestionRequest latestMessage. */ + public latestMessage: string; + + /** CompileSuggestionRequest contextSize. */ + public contextSize: number; + + /** + * Creates a new CompileSuggestionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CompileSuggestionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest): google.cloud.dialogflow.v2beta1.CompileSuggestionRequest; + + /** + * Encodes the specified CompileSuggestionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompileSuggestionRequest.verify|verify} messages. + * @param message CompileSuggestionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompileSuggestionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompileSuggestionRequest.verify|verify} messages. + * @param message CompileSuggestionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompileSuggestionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompileSuggestionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CompileSuggestionRequest; + + /** + * Decodes a CompileSuggestionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompileSuggestionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CompileSuggestionRequest; + + /** + * Verifies a CompileSuggestionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompileSuggestionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompileSuggestionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CompileSuggestionRequest; + + /** + * Creates a plain object from a CompileSuggestionRequest message. Also converts values to other types if specified. + * @param message CompileSuggestionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CompileSuggestionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompileSuggestionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompileSuggestionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CompileSuggestionResponse. */ + interface ICompileSuggestionResponse { + + /** CompileSuggestionResponse suggestion */ + suggestion?: (google.cloud.dialogflow.v2beta1.ISuggestion|null); + + /** CompileSuggestionResponse latestMessage */ + latestMessage?: (string|null); + + /** CompileSuggestionResponse contextSize */ + contextSize?: (number|null); + } + + /** Represents a CompileSuggestionResponse. */ + class CompileSuggestionResponse implements ICompileSuggestionResponse { + + /** + * Constructs a new CompileSuggestionResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse); + + /** CompileSuggestionResponse suggestion. */ + public suggestion?: (google.cloud.dialogflow.v2beta1.ISuggestion|null); + + /** CompileSuggestionResponse latestMessage. */ + public latestMessage: string; + + /** CompileSuggestionResponse contextSize. */ + public contextSize: number; + + /** + * Creates a new CompileSuggestionResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns CompileSuggestionResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse): google.cloud.dialogflow.v2beta1.CompileSuggestionResponse; + + /** + * Encodes the specified CompileSuggestionResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompileSuggestionResponse.verify|verify} messages. + * @param message CompileSuggestionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompileSuggestionResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompileSuggestionResponse.verify|verify} messages. + * @param message CompileSuggestionResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompileSuggestionResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompileSuggestionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CompileSuggestionResponse; + + /** + * Decodes a CompileSuggestionResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompileSuggestionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CompileSuggestionResponse; + + /** + * Verifies a CompileSuggestionResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompileSuggestionResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompileSuggestionResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CompileSuggestionResponse; + + /** + * Creates a plain object from a CompileSuggestionResponse message. Also converts values to other types if specified. + * @param message CompileSuggestionResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CompileSuggestionResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompileSuggestionResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompileSuggestionResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ResponseMessage. */ + interface IResponseMessage { + + /** ResponseMessage text */ + text?: (google.cloud.dialogflow.v2beta1.ResponseMessage.IText|null); + + /** ResponseMessage payload */ + payload?: (google.protobuf.IStruct|null); + + /** ResponseMessage liveAgentHandoff */ + liveAgentHandoff?: (google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff|null); + + /** ResponseMessage endInteraction */ + endInteraction?: (google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction|null); + + /** ResponseMessage mixedAudio */ + mixedAudio?: (google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio|null); + + /** ResponseMessage telephonyTransferCall */ + telephonyTransferCall?: (google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall|null); + } + + /** Represents a ResponseMessage. */ + class ResponseMessage implements IResponseMessage { + + /** + * Constructs a new ResponseMessage. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IResponseMessage); + + /** ResponseMessage text. */ + public text?: (google.cloud.dialogflow.v2beta1.ResponseMessage.IText|null); + + /** ResponseMessage payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** ResponseMessage liveAgentHandoff. */ + public liveAgentHandoff?: (google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff|null); + + /** ResponseMessage endInteraction. */ + public endInteraction?: (google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction|null); + + /** ResponseMessage mixedAudio. */ + public mixedAudio?: (google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio|null); + + /** ResponseMessage telephonyTransferCall. */ + public telephonyTransferCall?: (google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall|null); + + /** ResponseMessage message. */ + public message?: ("text"|"payload"|"liveAgentHandoff"|"endInteraction"|"mixedAudio"|"telephonyTransferCall"); + + /** + * Creates a new ResponseMessage instance using the specified properties. + * @param [properties] Properties to set + * @returns ResponseMessage instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IResponseMessage): google.cloud.dialogflow.v2beta1.ResponseMessage; + + /** + * Encodes the specified ResponseMessage message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.verify|verify} messages. + * @param message ResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResponseMessage message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.verify|verify} messages. + * @param message ResponseMessage message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IResponseMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResponseMessage message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ResponseMessage; + + /** + * Decodes a ResponseMessage message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ResponseMessage; + + /** + * Verifies a ResponseMessage message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResponseMessage message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResponseMessage + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ResponseMessage; + + /** + * Creates a plain object from a ResponseMessage message. Also converts values to other types if specified. + * @param message ResponseMessage + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ResponseMessage, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResponseMessage to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResponseMessage + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ResponseMessage { + + /** Properties of a Text. */ + interface IText { + + /** Text text */ + text?: (string[]|null); + } + + /** Represents a Text. */ + class Text implements IText { + + /** + * Constructs a new Text. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.IText); + + /** Text text. */ + public text: string[]; + + /** + * Creates a new Text instance using the specified properties. + * @param [properties] Properties to set + * @returns Text instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.IText): google.cloud.dialogflow.v2beta1.ResponseMessage.Text; + + /** + * Encodes the specified Text message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ResponseMessage.IText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ResponseMessage.IText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Text message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ResponseMessage.Text; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ResponseMessage.Text; + + /** + * Verifies a Text message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Text message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Text + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ResponseMessage.Text; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @param message Text + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ResponseMessage.Text, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Text to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Text + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LiveAgentHandoff. */ + interface ILiveAgentHandoff { + + /** LiveAgentHandoff metadata */ + metadata?: (google.protobuf.IStruct|null); + } + + /** Represents a LiveAgentHandoff. */ + class LiveAgentHandoff implements ILiveAgentHandoff { + + /** + * Constructs a new LiveAgentHandoff. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff); + + /** LiveAgentHandoff metadata. */ + public metadata?: (google.protobuf.IStruct|null); + + /** + * Creates a new LiveAgentHandoff instance using the specified properties. + * @param [properties] Properties to set + * @returns LiveAgentHandoff instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff): google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff; + + /** + * Encodes the specified LiveAgentHandoff message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.verify|verify} messages. + * @param message LiveAgentHandoff message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LiveAgentHandoff message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.verify|verify} messages. + * @param message LiveAgentHandoff message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LiveAgentHandoff message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LiveAgentHandoff + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff; + + /** + * Decodes a LiveAgentHandoff message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LiveAgentHandoff + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff; + + /** + * Verifies a LiveAgentHandoff message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LiveAgentHandoff message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LiveAgentHandoff + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff; + + /** + * Creates a plain object from a LiveAgentHandoff message. Also converts values to other types if specified. + * @param message LiveAgentHandoff + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LiveAgentHandoff to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LiveAgentHandoff + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EndInteraction. */ + interface IEndInteraction { + } + + /** Represents an EndInteraction. */ + class EndInteraction implements IEndInteraction { + + /** + * Constructs a new EndInteraction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction); + + /** + * Creates a new EndInteraction instance using the specified properties. + * @param [properties] Properties to set + * @returns EndInteraction instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction): google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction; + + /** + * Encodes the specified EndInteraction message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.verify|verify} messages. + * @param message EndInteraction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EndInteraction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.verify|verify} messages. + * @param message EndInteraction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EndInteraction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EndInteraction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction; + + /** + * Decodes an EndInteraction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EndInteraction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction; + + /** + * Verifies an EndInteraction message. + * @param message Plain 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 EndInteraction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EndInteraction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction; + + /** + * Creates a plain object from an EndInteraction message. Also converts values to other types if specified. + * @param message EndInteraction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EndInteraction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EndInteraction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MixedAudio. */ + interface IMixedAudio { + + /** MixedAudio segments */ + segments?: (google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment[]|null); + } + + /** Represents a MixedAudio. */ + class MixedAudio implements IMixedAudio { + + /** + * Constructs a new MixedAudio. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio); + + /** MixedAudio segments. */ + public segments: google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment[]; + + /** + * Creates a new MixedAudio instance using the specified properties. + * @param [properties] Properties to set + * @returns MixedAudio instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio): google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio; + + /** + * Encodes the specified MixedAudio message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.verify|verify} messages. + * @param message MixedAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MixedAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.verify|verify} messages. + * @param message MixedAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MixedAudio message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MixedAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio; + + /** + * Decodes a MixedAudio message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MixedAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio; + + /** + * Verifies a MixedAudio message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MixedAudio message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MixedAudio + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio; + + /** + * Creates a plain object from a MixedAudio message. Also converts values to other types if specified. + * @param message MixedAudio + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MixedAudio to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MixedAudio + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MixedAudio { + + /** Properties of a Segment. */ + interface ISegment { + + /** Segment audio */ + audio?: (Uint8Array|string|null); + + /** Segment uri */ + uri?: (string|null); + + /** Segment allowPlaybackInterruption */ + allowPlaybackInterruption?: (boolean|null); + } + + /** Represents a Segment. */ + class Segment implements ISegment { + + /** + * Constructs a new Segment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment); + + /** Segment audio. */ + public audio?: (Uint8Array|string|null); + + /** Segment uri. */ + public uri?: (string|null); + + /** Segment allowPlaybackInterruption. */ + public allowPlaybackInterruption: boolean; + + /** Segment content. */ + public content?: ("audio"|"uri"); + + /** + * Creates a new Segment instance using the specified properties. + * @param [properties] Properties to set + * @returns Segment instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment): google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment; + + /** + * Encodes the specified Segment message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment.verify|verify} messages. + * @param message Segment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Segment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment.verify|verify} messages. + * @param message Segment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Segment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment; + + /** + * Decodes a Segment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment; + + /** + * Verifies a Segment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Segment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Segment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment; + + /** + * Creates a plain object from a Segment message. Also converts values to other types if specified. + * @param message Segment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Segment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Segment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a TelephonyTransferCall. */ + interface ITelephonyTransferCall { + + /** TelephonyTransferCall phoneNumber */ + phoneNumber?: (string|null); + + /** TelephonyTransferCall sipUri */ + sipUri?: (string|null); + } + + /** Represents a TelephonyTransferCall. */ + class TelephonyTransferCall implements ITelephonyTransferCall { + + /** + * Constructs a new TelephonyTransferCall. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall); + + /** TelephonyTransferCall phoneNumber. */ + public phoneNumber?: (string|null); + + /** TelephonyTransferCall sipUri. */ + public sipUri?: (string|null); + + /** TelephonyTransferCall endpoint. */ + public endpoint?: ("phoneNumber"|"sipUri"); + + /** + * Creates a new TelephonyTransferCall instance using the specified properties. + * @param [properties] Properties to set + * @returns TelephonyTransferCall instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall): google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall; + + /** + * Encodes the specified TelephonyTransferCall message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify|verify} messages. + * @param message TelephonyTransferCall message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TelephonyTransferCall message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify|verify} messages. + * @param message TelephonyTransferCall message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall; + + /** + * Verifies a TelephonyTransferCall message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TelephonyTransferCall message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TelephonyTransferCall + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall; + + /** + * Creates a plain object from a TelephonyTransferCall message. Also converts values to other types if specified. + * @param message TelephonyTransferCall + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TelephonyTransferCall to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TelephonyTransferCall + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** AudioEncoding enum. */ + enum AudioEncoding { + AUDIO_ENCODING_UNSPECIFIED = 0, + AUDIO_ENCODING_LINEAR_16 = 1, + AUDIO_ENCODING_FLAC = 2, + AUDIO_ENCODING_MULAW = 3, + AUDIO_ENCODING_AMR = 4, + AUDIO_ENCODING_AMR_WB = 5, + AUDIO_ENCODING_OGG_OPUS = 6, + AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7 + } + + /** Properties of a SpeechContext. */ + interface ISpeechContext { + + /** SpeechContext phrases */ + phrases?: (string[]|null); + + /** SpeechContext boost */ + boost?: (number|null); + } + + /** Represents a SpeechContext. */ + class SpeechContext implements ISpeechContext { + + /** + * Constructs a new SpeechContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISpeechContext); + + /** SpeechContext phrases. */ + public phrases: string[]; + + /** SpeechContext boost. */ + public boost: number; + + /** + * Creates a new SpeechContext instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechContext instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISpeechContext): google.cloud.dialogflow.v2beta1.SpeechContext; + + /** + * Encodes the specified SpeechContext message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechContext.verify|verify} messages. + * @param message SpeechContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISpeechContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechContext message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechContext.verify|verify} messages. + * @param message SpeechContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISpeechContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SpeechContext; + + /** + * Decodes a SpeechContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SpeechContext; + + /** + * Verifies a SpeechContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpeechContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SpeechContext; + + /** + * Creates a plain object from a SpeechContext message. Also converts values to other types if specified. + * @param message SpeechContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SpeechContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpeechContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpeechContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SpeechModelVariant enum. */ + enum SpeechModelVariant { + SPEECH_MODEL_VARIANT_UNSPECIFIED = 0, + USE_BEST_AVAILABLE = 1, + USE_STANDARD = 2, + USE_ENHANCED = 3 + } + + /** Properties of a SpeechWordInfo. */ + interface ISpeechWordInfo { + + /** SpeechWordInfo word */ + word?: (string|null); + + /** SpeechWordInfo startOffset */ + startOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo endOffset */ + endOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo confidence */ + confidence?: (number|null); + } + + /** Represents a SpeechWordInfo. */ + class SpeechWordInfo implements ISpeechWordInfo { + + /** + * Constructs a new SpeechWordInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISpeechWordInfo); + + /** SpeechWordInfo word. */ + public word: string; + + /** SpeechWordInfo startOffset. */ + public startOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo endOffset. */ + public endOffset?: (google.protobuf.IDuration|null); + + /** SpeechWordInfo confidence. */ + public confidence: number; + + /** + * Creates a new SpeechWordInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechWordInfo instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISpeechWordInfo): google.cloud.dialogflow.v2beta1.SpeechWordInfo; + + /** + * Encodes the specified SpeechWordInfo message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechWordInfo.verify|verify} messages. + * @param message SpeechWordInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISpeechWordInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechWordInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechWordInfo.verify|verify} messages. + * @param message SpeechWordInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISpeechWordInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SpeechWordInfo; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SpeechWordInfo; + + /** + * Verifies a SpeechWordInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpeechWordInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechWordInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SpeechWordInfo; + + /** + * Creates a plain object from a SpeechWordInfo message. Also converts values to other types if specified. + * @param message SpeechWordInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SpeechWordInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpeechWordInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpeechWordInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InputAudioConfig. */ + interface IInputAudioConfig { + + /** InputAudioConfig audioEncoding */ + audioEncoding?: (google.cloud.dialogflow.v2beta1.AudioEncoding|keyof typeof google.cloud.dialogflow.v2beta1.AudioEncoding|null); + + /** InputAudioConfig sampleRateHertz */ + sampleRateHertz?: (number|null); + + /** InputAudioConfig languageCode */ + languageCode?: (string|null); + + /** InputAudioConfig enableWordInfo */ + enableWordInfo?: (boolean|null); + + /** InputAudioConfig phraseHints */ + phraseHints?: (string[]|null); + + /** InputAudioConfig speechContexts */ + speechContexts?: (google.cloud.dialogflow.v2beta1.ISpeechContext[]|null); + + /** InputAudioConfig model */ + model?: (string|null); + + /** InputAudioConfig modelVariant */ + modelVariant?: (google.cloud.dialogflow.v2beta1.SpeechModelVariant|keyof typeof google.cloud.dialogflow.v2beta1.SpeechModelVariant|null); + + /** InputAudioConfig singleUtterance */ + singleUtterance?: (boolean|null); + + /** InputAudioConfig disableNoSpeechRecognizedEvent */ + disableNoSpeechRecognizedEvent?: (boolean|null); + } + + /** Represents an InputAudioConfig. */ + class InputAudioConfig implements IInputAudioConfig { + + /** + * Constructs a new InputAudioConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IInputAudioConfig); + + /** InputAudioConfig audioEncoding. */ + public audioEncoding: (google.cloud.dialogflow.v2beta1.AudioEncoding|keyof typeof google.cloud.dialogflow.v2beta1.AudioEncoding); + + /** InputAudioConfig sampleRateHertz. */ + public sampleRateHertz: number; + + /** InputAudioConfig languageCode. */ + public languageCode: string; + + /** InputAudioConfig enableWordInfo. */ + public enableWordInfo: boolean; + + /** InputAudioConfig phraseHints. */ + public phraseHints: string[]; + + /** InputAudioConfig speechContexts. */ + public speechContexts: google.cloud.dialogflow.v2beta1.ISpeechContext[]; + + /** InputAudioConfig model. */ + public model: string; + + /** InputAudioConfig modelVariant. */ + public modelVariant: (google.cloud.dialogflow.v2beta1.SpeechModelVariant|keyof typeof google.cloud.dialogflow.v2beta1.SpeechModelVariant); + + /** InputAudioConfig singleUtterance. */ + public singleUtterance: boolean; + + /** InputAudioConfig disableNoSpeechRecognizedEvent. */ + public disableNoSpeechRecognizedEvent: boolean; + + /** + * Creates a new InputAudioConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InputAudioConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IInputAudioConfig): google.cloud.dialogflow.v2beta1.InputAudioConfig; + + /** + * Encodes the specified InputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.InputAudioConfig.verify|verify} messages. + * @param message InputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IInputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.InputAudioConfig.verify|verify} messages. + * @param message InputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IInputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.InputAudioConfig; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.InputAudioConfig; + + /** + * Verifies an InputAudioConfig message. + * @param message Plain 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 InputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InputAudioConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.InputAudioConfig; + + /** + * Creates a plain object from an InputAudioConfig message. Also converts values to other types if specified. + * @param message InputAudioConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.InputAudioConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InputAudioConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InputAudioConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SsmlVoiceGender enum. */ + enum SsmlVoiceGender { + SSML_VOICE_GENDER_UNSPECIFIED = 0, + SSML_VOICE_GENDER_MALE = 1, + SSML_VOICE_GENDER_FEMALE = 2, + SSML_VOICE_GENDER_NEUTRAL = 3 + } + + /** Properties of a VoiceSelectionParams. */ + interface IVoiceSelectionParams { + + /** VoiceSelectionParams name */ + name?: (string|null); + + /** VoiceSelectionParams ssmlGender */ + ssmlGender?: (google.cloud.dialogflow.v2beta1.SsmlVoiceGender|keyof typeof google.cloud.dialogflow.v2beta1.SsmlVoiceGender|null); + } + + /** Represents a VoiceSelectionParams. */ + class VoiceSelectionParams implements IVoiceSelectionParams { + + /** + * Constructs a new VoiceSelectionParams. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IVoiceSelectionParams); + + /** VoiceSelectionParams name. */ + public name: string; + + /** VoiceSelectionParams ssmlGender. */ + public ssmlGender: (google.cloud.dialogflow.v2beta1.SsmlVoiceGender|keyof typeof google.cloud.dialogflow.v2beta1.SsmlVoiceGender); + + /** + * Creates a new VoiceSelectionParams instance using the specified properties. + * @param [properties] Properties to set + * @returns VoiceSelectionParams instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IVoiceSelectionParams): google.cloud.dialogflow.v2beta1.VoiceSelectionParams; + + /** + * Encodes the specified VoiceSelectionParams message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.VoiceSelectionParams.verify|verify} messages. + * @param message VoiceSelectionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IVoiceSelectionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VoiceSelectionParams message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.VoiceSelectionParams.verify|verify} messages. + * @param message VoiceSelectionParams message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IVoiceSelectionParams, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.VoiceSelectionParams; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.VoiceSelectionParams; + + /** + * Verifies a VoiceSelectionParams message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VoiceSelectionParams message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VoiceSelectionParams + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.VoiceSelectionParams; + + /** + * Creates a plain object from a VoiceSelectionParams message. Also converts values to other types if specified. + * @param message VoiceSelectionParams + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.VoiceSelectionParams, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VoiceSelectionParams to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VoiceSelectionParams + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SynthesizeSpeechConfig. */ + interface ISynthesizeSpeechConfig { + + /** SynthesizeSpeechConfig speakingRate */ + speakingRate?: (number|null); + + /** SynthesizeSpeechConfig pitch */ + pitch?: (number|null); + + /** SynthesizeSpeechConfig volumeGainDb */ + volumeGainDb?: (number|null); + + /** SynthesizeSpeechConfig effectsProfileId */ + effectsProfileId?: (string[]|null); + + /** SynthesizeSpeechConfig voice */ + voice?: (google.cloud.dialogflow.v2beta1.IVoiceSelectionParams|null); + } + + /** Represents a SynthesizeSpeechConfig. */ + class SynthesizeSpeechConfig implements ISynthesizeSpeechConfig { + + /** + * Constructs a new SynthesizeSpeechConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig); + + /** SynthesizeSpeechConfig speakingRate. */ + public speakingRate: number; + + /** SynthesizeSpeechConfig pitch. */ + public pitch: number; + + /** SynthesizeSpeechConfig volumeGainDb. */ + public volumeGainDb: number; + + /** SynthesizeSpeechConfig effectsProfileId. */ + public effectsProfileId: string[]; + + /** SynthesizeSpeechConfig voice. */ + public voice?: (google.cloud.dialogflow.v2beta1.IVoiceSelectionParams|null); + + /** + * Creates a new SynthesizeSpeechConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SynthesizeSpeechConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig): google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig; + + /** + * Encodes the specified SynthesizeSpeechConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.verify|verify} messages. + * @param message SynthesizeSpeechConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SynthesizeSpeechConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.verify|verify} messages. + * @param message SynthesizeSpeechConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig; + + /** + * Verifies a SynthesizeSpeechConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SynthesizeSpeechConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SynthesizeSpeechConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig; + + /** + * Creates a plain object from a SynthesizeSpeechConfig message. Also converts values to other types if specified. + * @param message SynthesizeSpeechConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SynthesizeSpeechConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SynthesizeSpeechConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** OutputAudioEncoding enum. */ + enum OutputAudioEncoding { + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0, + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1, + OUTPUT_AUDIO_ENCODING_MP3 = 2, + OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4, + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3, + OUTPUT_AUDIO_ENCODING_MULAW = 5 + } + + /** Properties of an OutputAudioConfig. */ + interface IOutputAudioConfig { + + /** OutputAudioConfig audioEncoding */ + audioEncoding?: (google.cloud.dialogflow.v2beta1.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.v2beta1.OutputAudioEncoding|null); + + /** OutputAudioConfig sampleRateHertz */ + sampleRateHertz?: (number|null); + + /** OutputAudioConfig synthesizeSpeechConfig */ + synthesizeSpeechConfig?: (google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig|null); + } + + /** Represents an OutputAudioConfig. */ + class OutputAudioConfig implements IOutputAudioConfig { + + /** + * Constructs a new OutputAudioConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IOutputAudioConfig); + + /** OutputAudioConfig audioEncoding. */ + public audioEncoding: (google.cloud.dialogflow.v2beta1.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.v2beta1.OutputAudioEncoding); + + /** OutputAudioConfig sampleRateHertz. */ + public sampleRateHertz: number; + + /** OutputAudioConfig synthesizeSpeechConfig. */ + public synthesizeSpeechConfig?: (google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig|null); + + /** + * Creates a new OutputAudioConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns OutputAudioConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IOutputAudioConfig): google.cloud.dialogflow.v2beta1.OutputAudioConfig; + + /** + * Encodes the specified OutputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify|verify} messages. + * @param message OutputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IOutputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OutputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify|verify} messages. + * @param message OutputAudioConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IOutputAudioConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.OutputAudioConfig; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.OutputAudioConfig; + + /** + * Verifies an OutputAudioConfig message. + * @param message Plain 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 OutputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OutputAudioConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.OutputAudioConfig; + + /** + * Creates a plain object from an OutputAudioConfig message. Also converts values to other types if specified. + * @param message OutputAudioConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.OutputAudioConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OutputAudioConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OutputAudioConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** TelephonyDtmf enum. */ + enum TelephonyDtmf { + TELEPHONY_DTMF_UNSPECIFIED = 0, + DTMF_ONE = 1, + DTMF_TWO = 2, + DTMF_THREE = 3, + DTMF_FOUR = 4, + DTMF_FIVE = 5, + DTMF_SIX = 6, + DTMF_SEVEN = 7, + DTMF_EIGHT = 8, + DTMF_NINE = 9, + DTMF_ZERO = 10, + DTMF_A = 11, + DTMF_B = 12, + DTMF_C = 13, + DTMF_D = 14, + DTMF_STAR = 15, + DTMF_POUND = 16 + } + + /** Properties of a TelephonyDtmfEvents. */ + interface ITelephonyDtmfEvents { + + /** TelephonyDtmfEvents dtmfEvents */ + dtmfEvents?: (google.cloud.dialogflow.v2beta1.TelephonyDtmf[]|null); + } + + /** Represents a TelephonyDtmfEvents. */ + class TelephonyDtmfEvents implements ITelephonyDtmfEvents { + + /** + * Constructs a new TelephonyDtmfEvents. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents); + + /** TelephonyDtmfEvents dtmfEvents. */ + public dtmfEvents: google.cloud.dialogflow.v2beta1.TelephonyDtmf[]; + + /** + * Creates a new TelephonyDtmfEvents instance using the specified properties. + * @param [properties] Properties to set + * @returns TelephonyDtmfEvents instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents): google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents; + + /** + * Encodes the specified TelephonyDtmfEvents message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.verify|verify} messages. + * @param message TelephonyDtmfEvents message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TelephonyDtmfEvents message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.verify|verify} messages. + * @param message TelephonyDtmfEvents message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TelephonyDtmfEvents message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TelephonyDtmfEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents; + + /** + * Decodes a TelephonyDtmfEvents message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TelephonyDtmfEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents; + + /** + * Verifies a TelephonyDtmfEvents message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TelephonyDtmfEvents message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TelephonyDtmfEvents + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents; + + /** + * Creates a plain object from a TelephonyDtmfEvents message. Also converts values to other types if specified. + * @param message TelephonyDtmfEvents + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TelephonyDtmfEvents to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TelephonyDtmfEvents + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SpeechToTextConfig. */ + interface ISpeechToTextConfig { + + /** SpeechToTextConfig speechModelVariant */ + speechModelVariant?: (google.cloud.dialogflow.v2beta1.SpeechModelVariant|keyof typeof google.cloud.dialogflow.v2beta1.SpeechModelVariant|null); + + /** SpeechToTextConfig model */ + model?: (string|null); + } + + /** Represents a SpeechToTextConfig. */ + class SpeechToTextConfig implements ISpeechToTextConfig { + + /** + * Constructs a new SpeechToTextConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISpeechToTextConfig); + + /** SpeechToTextConfig speechModelVariant. */ + public speechModelVariant: (google.cloud.dialogflow.v2beta1.SpeechModelVariant|keyof typeof google.cloud.dialogflow.v2beta1.SpeechModelVariant); + + /** SpeechToTextConfig model. */ + public model: string; + + /** + * Creates a new SpeechToTextConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SpeechToTextConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISpeechToTextConfig): google.cloud.dialogflow.v2beta1.SpeechToTextConfig; + + /** + * Encodes the specified SpeechToTextConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechToTextConfig.verify|verify} messages. + * @param message SpeechToTextConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISpeechToTextConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SpeechToTextConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechToTextConfig.verify|verify} messages. + * @param message SpeechToTextConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISpeechToTextConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SpeechToTextConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SpeechToTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SpeechToTextConfig; + + /** + * Decodes a SpeechToTextConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SpeechToTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SpeechToTextConfig; + + /** + * Verifies a SpeechToTextConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SpeechToTextConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SpeechToTextConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SpeechToTextConfig; + + /** + * Creates a plain object from a SpeechToTextConfig message. Also converts values to other types if specified. + * @param message SpeechToTextConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SpeechToTextConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SpeechToTextConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SpeechToTextConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Sessions */ + class Sessions extends $protobuf.rpc.Service { + + /** + * Constructs a new Sessions 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 Sessions 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): Sessions; + + /** + * Calls DetectIntent. + * @param request DetectIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DetectIntentResponse + */ + public detectIntent(request: google.cloud.dialogflow.v2beta1.IDetectIntentRequest, callback: google.cloud.dialogflow.v2beta1.Sessions.DetectIntentCallback): void; + + /** + * Calls DetectIntent. + * @param request DetectIntentRequest message or plain object + * @returns Promise + */ + public detectIntent(request: google.cloud.dialogflow.v2beta1.IDetectIntentRequest): Promise; + + /** + * Calls StreamingDetectIntent. + * @param request StreamingDetectIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and StreamingDetectIntentResponse + */ + public streamingDetectIntent(request: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest, callback: google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntentCallback): void; + + /** + * Calls StreamingDetectIntent. + * @param request StreamingDetectIntentRequest message or plain object + * @returns Promise + */ + public streamingDetectIntent(request: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest): Promise; + } + + namespace Sessions { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Sessions|detectIntent}. + * @param error Error, if any + * @param [response] DetectIntentResponse + */ + type DetectIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.DetectIntentResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Sessions|streamingDetectIntent}. + * @param error Error, if any + * @param [response] StreamingDetectIntentResponse + */ + type StreamingDetectIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse) => void; + } + + /** Properties of a DetectIntentRequest. */ + interface IDetectIntentRequest { + + /** DetectIntentRequest session */ + session?: (string|null); + + /** DetectIntentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.v2beta1.IQueryParameters|null); + + /** DetectIntentRequest queryInput */ + queryInput?: (google.cloud.dialogflow.v2beta1.IQueryInput|null); + + /** DetectIntentRequest outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** DetectIntentRequest outputAudioConfigMask */ + outputAudioConfigMask?: (google.protobuf.IFieldMask|null); + + /** DetectIntentRequest inputAudio */ + inputAudio?: (Uint8Array|string|null); + } + + /** Represents a DetectIntentRequest. */ + class DetectIntentRequest implements IDetectIntentRequest { + + /** + * Constructs a new DetectIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDetectIntentRequest); + + /** DetectIntentRequest session. */ + public session: string; + + /** DetectIntentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.v2beta1.IQueryParameters|null); + + /** DetectIntentRequest queryInput. */ + public queryInput?: (google.cloud.dialogflow.v2beta1.IQueryInput|null); + + /** DetectIntentRequest outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** DetectIntentRequest outputAudioConfigMask. */ + public outputAudioConfigMask?: (google.protobuf.IFieldMask|null); + + /** DetectIntentRequest inputAudio. */ + public inputAudio: (Uint8Array|string); + + /** + * Creates a new DetectIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDetectIntentRequest): google.cloud.dialogflow.v2beta1.DetectIntentRequest; + + /** + * Encodes the specified DetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.verify|verify} messages. + * @param message DetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.verify|verify} messages. + * @param message DetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DetectIntentRequest; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DetectIntentRequest; + + /** + * Verifies a DetectIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DetectIntentRequest; + + /** + * Creates a plain object from a DetectIntentRequest message. Also converts values to other types if specified. + * @param message DetectIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DetectIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DetectIntentResponse. */ + interface IDetectIntentResponse { + + /** DetectIntentResponse responseId */ + responseId?: (string|null); + + /** DetectIntentResponse queryResult */ + queryResult?: (google.cloud.dialogflow.v2beta1.IQueryResult|null); + + /** DetectIntentResponse alternativeQueryResults */ + alternativeQueryResults?: (google.cloud.dialogflow.v2beta1.IQueryResult[]|null); + + /** DetectIntentResponse webhookStatus */ + webhookStatus?: (google.rpc.IStatus|null); + + /** DetectIntentResponse outputAudio */ + outputAudio?: (Uint8Array|string|null); + + /** DetectIntentResponse outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + } + + /** Represents a DetectIntentResponse. */ + class DetectIntentResponse implements IDetectIntentResponse { + + /** + * Constructs a new DetectIntentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDetectIntentResponse); + + /** DetectIntentResponse responseId. */ + public responseId: string; + + /** DetectIntentResponse queryResult. */ + public queryResult?: (google.cloud.dialogflow.v2beta1.IQueryResult|null); + + /** DetectIntentResponse alternativeQueryResults. */ + public alternativeQueryResults: google.cloud.dialogflow.v2beta1.IQueryResult[]; + + /** DetectIntentResponse webhookStatus. */ + public webhookStatus?: (google.rpc.IStatus|null); + + /** DetectIntentResponse outputAudio. */ + public outputAudio: (Uint8Array|string); + + /** DetectIntentResponse outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** + * Creates a new DetectIntentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DetectIntentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDetectIntentResponse): google.cloud.dialogflow.v2beta1.DetectIntentResponse; + + /** + * Encodes the specified DetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DetectIntentResponse.verify|verify} messages. + * @param message DetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DetectIntentResponse.verify|verify} messages. + * @param message DetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DetectIntentResponse; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DetectIntentResponse; + + /** + * Verifies a DetectIntentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DetectIntentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DetectIntentResponse; + + /** + * Creates a plain object from a DetectIntentResponse message. Also converts values to other types if specified. + * @param message DetectIntentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DetectIntentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DetectIntentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DetectIntentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryParameters. */ + interface IQueryParameters { + + /** QueryParameters timeZone */ + timeZone?: (string|null); + + /** QueryParameters geoLocation */ + geoLocation?: (google.type.ILatLng|null); + + /** QueryParameters contexts */ + contexts?: (google.cloud.dialogflow.v2beta1.IContext[]|null); + + /** QueryParameters resetContexts */ + resetContexts?: (boolean|null); + + /** QueryParameters sessionEntityTypes */ + sessionEntityTypes?: (google.cloud.dialogflow.v2beta1.ISessionEntityType[]|null); + + /** QueryParameters payload */ + payload?: (google.protobuf.IStruct|null); + + /** QueryParameters knowledgeBaseNames */ + knowledgeBaseNames?: (string[]|null); + + /** QueryParameters sentimentAnalysisRequestConfig */ + sentimentAnalysisRequestConfig?: (google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig|null); + + /** QueryParameters subAgents */ + subAgents?: (google.cloud.dialogflow.v2beta1.ISubAgent[]|null); + + /** QueryParameters webhookHeaders */ + webhookHeaders?: ({ [k: string]: string }|null); + } + + /** Represents a QueryParameters. */ + class QueryParameters implements IQueryParameters { + + /** + * Constructs a new QueryParameters. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IQueryParameters); + + /** QueryParameters timeZone. */ + public timeZone: string; + + /** QueryParameters geoLocation. */ + public geoLocation?: (google.type.ILatLng|null); + + /** QueryParameters contexts. */ + public contexts: google.cloud.dialogflow.v2beta1.IContext[]; + + /** QueryParameters resetContexts. */ + public resetContexts: boolean; + + /** QueryParameters sessionEntityTypes. */ + public sessionEntityTypes: google.cloud.dialogflow.v2beta1.ISessionEntityType[]; + + /** QueryParameters payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** QueryParameters knowledgeBaseNames. */ + public knowledgeBaseNames: string[]; + + /** QueryParameters sentimentAnalysisRequestConfig. */ + public sentimentAnalysisRequestConfig?: (google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig|null); + + /** QueryParameters subAgents. */ + public subAgents: google.cloud.dialogflow.v2beta1.ISubAgent[]; + + /** QueryParameters webhookHeaders. */ + public webhookHeaders: { [k: string]: string }; + + /** + * Creates a new QueryParameters instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryParameters instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IQueryParameters): google.cloud.dialogflow.v2beta1.QueryParameters; + + /** + * Encodes the specified QueryParameters message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryParameters.verify|verify} messages. + * @param message QueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryParameters.verify|verify} messages. + * @param message QueryParameters message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IQueryParameters, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryParameters message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.QueryParameters; + + /** + * Decodes a QueryParameters message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.QueryParameters; + + /** + * Verifies a QueryParameters message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryParameters message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryParameters + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.QueryParameters; + + /** + * Creates a plain object from a QueryParameters message. Also converts values to other types if specified. + * @param message QueryParameters + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.QueryParameters, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryParameters to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryParameters + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryInput. */ + interface IQueryInput { + + /** QueryInput audioConfig */ + audioConfig?: (google.cloud.dialogflow.v2beta1.IInputAudioConfig|null); + + /** QueryInput text */ + text?: (google.cloud.dialogflow.v2beta1.ITextInput|null); + + /** QueryInput event */ + event?: (google.cloud.dialogflow.v2beta1.IEventInput|null); + + /** QueryInput dtmf */ + dtmf?: (google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null); + } + + /** Represents a QueryInput. */ + class QueryInput implements IQueryInput { + + /** + * Constructs a new QueryInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IQueryInput); + + /** QueryInput audioConfig. */ + public audioConfig?: (google.cloud.dialogflow.v2beta1.IInputAudioConfig|null); + + /** QueryInput text. */ + public text?: (google.cloud.dialogflow.v2beta1.ITextInput|null); + + /** QueryInput event. */ + public event?: (google.cloud.dialogflow.v2beta1.IEventInput|null); + + /** QueryInput dtmf. */ + public dtmf?: (google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null); + + /** QueryInput input. */ + public input?: ("audioConfig"|"text"|"event"|"dtmf"); + + /** + * Creates a new QueryInput instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryInput instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IQueryInput): google.cloud.dialogflow.v2beta1.QueryInput; + + /** + * Encodes the specified QueryInput message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryInput.verify|verify} messages. + * @param message QueryInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IQueryInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryInput.verify|verify} messages. + * @param message QueryInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IQueryInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.QueryInput; + + /** + * Decodes a QueryInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.QueryInput; + + /** + * Verifies a QueryInput message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.QueryInput; + + /** + * Creates a plain object from a QueryInput message. Also converts values to other types if specified. + * @param message QueryInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.QueryInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryInput + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a QueryResult. */ + interface IQueryResult { + + /** QueryResult queryText */ + queryText?: (string|null); + + /** QueryResult languageCode */ + languageCode?: (string|null); + + /** QueryResult speechRecognitionConfidence */ + speechRecognitionConfidence?: (number|null); + + /** QueryResult action */ + action?: (string|null); + + /** QueryResult parameters */ + parameters?: (google.protobuf.IStruct|null); + + /** QueryResult allRequiredParamsPresent */ + allRequiredParamsPresent?: (boolean|null); + + /** QueryResult cancelsSlotFilling */ + cancelsSlotFilling?: (boolean|null); + + /** QueryResult fulfillmentText */ + fulfillmentText?: (string|null); + + /** QueryResult fulfillmentMessages */ + fulfillmentMessages?: (google.cloud.dialogflow.v2beta1.Intent.IMessage[]|null); + + /** QueryResult webhookSource */ + webhookSource?: (string|null); + + /** QueryResult webhookPayload */ + webhookPayload?: (google.protobuf.IStruct|null); + + /** QueryResult outputContexts */ + outputContexts?: (google.cloud.dialogflow.v2beta1.IContext[]|null); + + /** QueryResult intent */ + intent?: (google.cloud.dialogflow.v2beta1.IIntent|null); + + /** QueryResult intentDetectionConfidence */ + intentDetectionConfidence?: (number|null); + + /** QueryResult diagnosticInfo */ + diagnosticInfo?: (google.protobuf.IStruct|null); + + /** QueryResult sentimentAnalysisResult */ + sentimentAnalysisResult?: (google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult|null); + + /** QueryResult knowledgeAnswers */ + knowledgeAnswers?: (google.cloud.dialogflow.v2beta1.IKnowledgeAnswers|null); + } + + /** Represents a QueryResult. */ + class QueryResult implements IQueryResult { + + /** + * Constructs a new QueryResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IQueryResult); + + /** QueryResult queryText. */ + public queryText: string; + + /** QueryResult languageCode. */ + public languageCode: string; + + /** QueryResult speechRecognitionConfidence. */ + public speechRecognitionConfidence: number; + + /** QueryResult action. */ + public action: string; + + /** QueryResult parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** QueryResult allRequiredParamsPresent. */ + public allRequiredParamsPresent: boolean; + + /** QueryResult cancelsSlotFilling. */ + public cancelsSlotFilling: boolean; + + /** QueryResult fulfillmentText. */ + public fulfillmentText: string; + + /** QueryResult fulfillmentMessages. */ + public fulfillmentMessages: google.cloud.dialogflow.v2beta1.Intent.IMessage[]; + + /** QueryResult webhookSource. */ + public webhookSource: string; + + /** QueryResult webhookPayload. */ + public webhookPayload?: (google.protobuf.IStruct|null); + + /** QueryResult outputContexts. */ + public outputContexts: google.cloud.dialogflow.v2beta1.IContext[]; + + /** QueryResult intent. */ + public intent?: (google.cloud.dialogflow.v2beta1.IIntent|null); + + /** QueryResult intentDetectionConfidence. */ + public intentDetectionConfidence: number; + + /** QueryResult diagnosticInfo. */ + public diagnosticInfo?: (google.protobuf.IStruct|null); + + /** QueryResult sentimentAnalysisResult. */ + public sentimentAnalysisResult?: (google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult|null); + + /** QueryResult knowledgeAnswers. */ + public knowledgeAnswers?: (google.cloud.dialogflow.v2beta1.IKnowledgeAnswers|null); + + /** + * Creates a new QueryResult instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IQueryResult): google.cloud.dialogflow.v2beta1.QueryResult; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.QueryResult; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.QueryResult; + + /** + * Verifies a QueryResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.QueryResult; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @param message QueryResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.QueryResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a KnowledgeAnswers. */ + interface IKnowledgeAnswers { + + /** KnowledgeAnswers answers */ + answers?: (google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer[]|null); + } + + /** Represents a KnowledgeAnswers. */ + class KnowledgeAnswers implements IKnowledgeAnswers { + + /** + * Constructs a new KnowledgeAnswers. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IKnowledgeAnswers); + + /** KnowledgeAnswers answers. */ + public answers: google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer[]; + + /** + * Creates a new KnowledgeAnswers instance using the specified properties. + * @param [properties] Properties to set + * @returns KnowledgeAnswers instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IKnowledgeAnswers): google.cloud.dialogflow.v2beta1.KnowledgeAnswers; + + /** + * Encodes the specified KnowledgeAnswers message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeAnswers.verify|verify} messages. + * @param message KnowledgeAnswers message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IKnowledgeAnswers, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KnowledgeAnswers message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeAnswers.verify|verify} messages. + * @param message KnowledgeAnswers message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IKnowledgeAnswers, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KnowledgeAnswers message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KnowledgeAnswers + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.KnowledgeAnswers; + + /** + * Decodes a KnowledgeAnswers message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KnowledgeAnswers + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.KnowledgeAnswers; + + /** + * Verifies a KnowledgeAnswers message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KnowledgeAnswers message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KnowledgeAnswers + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.KnowledgeAnswers; + + /** + * Creates a plain object from a KnowledgeAnswers message. Also converts values to other types if specified. + * @param message KnowledgeAnswers + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.KnowledgeAnswers, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KnowledgeAnswers to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KnowledgeAnswers + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace KnowledgeAnswers { + + /** Properties of an Answer. */ + interface IAnswer { + + /** Answer source */ + source?: (string|null); + + /** Answer faqQuestion */ + faqQuestion?: (string|null); + + /** Answer answer */ + answer?: (string|null); + + /** Answer matchConfidenceLevel */ + matchConfidenceLevel?: (google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel|keyof typeof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel|null); + + /** Answer matchConfidence */ + matchConfidence?: (number|null); + } + + /** Represents an Answer. */ + class Answer implements IAnswer { + + /** + * Constructs a new Answer. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer); + + /** Answer source. */ + public source: string; + + /** Answer faqQuestion. */ + public faqQuestion: string; + + /** Answer answer. */ + public answer: string; + + /** Answer matchConfidenceLevel. */ + public matchConfidenceLevel: (google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel|keyof typeof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel); + + /** Answer matchConfidence. */ + public matchConfidence: number; + + /** + * Creates a new Answer instance using the specified properties. + * @param [properties] Properties to set + * @returns Answer instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer): google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer; + + /** + * Encodes the specified Answer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.verify|verify} messages. + * @param message Answer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Answer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.verify|verify} messages. + * @param message Answer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Answer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Answer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer; + + /** + * Decodes an Answer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Answer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer; + + /** + * Verifies an Answer message. + * @param message Plain 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 Answer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Answer + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer; + + /** + * Creates a plain object from an Answer message. Also converts values to other types if specified. + * @param message Answer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Answer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Answer + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Answer { + + /** MatchConfidenceLevel enum. */ + enum MatchConfidenceLevel { + MATCH_CONFIDENCE_LEVEL_UNSPECIFIED = 0, + LOW = 1, + MEDIUM = 2, + HIGH = 3 + } + } + } + + /** Properties of a StreamingDetectIntentRequest. */ + interface IStreamingDetectIntentRequest { + + /** StreamingDetectIntentRequest session */ + session?: (string|null); + + /** StreamingDetectIntentRequest queryParams */ + queryParams?: (google.cloud.dialogflow.v2beta1.IQueryParameters|null); + + /** StreamingDetectIntentRequest queryInput */ + queryInput?: (google.cloud.dialogflow.v2beta1.IQueryInput|null); + + /** StreamingDetectIntentRequest singleUtterance */ + singleUtterance?: (boolean|null); + + /** StreamingDetectIntentRequest outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** StreamingDetectIntentRequest outputAudioConfigMask */ + outputAudioConfigMask?: (google.protobuf.IFieldMask|null); + + /** StreamingDetectIntentRequest inputAudio */ + inputAudio?: (Uint8Array|string|null); + } + + /** Represents a StreamingDetectIntentRequest. */ + class StreamingDetectIntentRequest implements IStreamingDetectIntentRequest { + + /** + * Constructs a new StreamingDetectIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest); + + /** StreamingDetectIntentRequest session. */ + public session: string; + + /** StreamingDetectIntentRequest queryParams. */ + public queryParams?: (google.cloud.dialogflow.v2beta1.IQueryParameters|null); + + /** StreamingDetectIntentRequest queryInput. */ + public queryInput?: (google.cloud.dialogflow.v2beta1.IQueryInput|null); + + /** StreamingDetectIntentRequest singleUtterance. */ + public singleUtterance: boolean; + + /** StreamingDetectIntentRequest outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** StreamingDetectIntentRequest outputAudioConfigMask. */ + public outputAudioConfigMask?: (google.protobuf.IFieldMask|null); + + /** StreamingDetectIntentRequest inputAudio. */ + public inputAudio: (Uint8Array|string); + + /** + * Creates a new StreamingDetectIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingDetectIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest): google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest; + + /** + * Encodes the specified StreamingDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.verify|verify} messages. + * @param message StreamingDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.verify|verify} messages. + * @param message StreamingDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest; + + /** + * Verifies a StreamingDetectIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingDetectIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest; + + /** + * Creates a plain object from a StreamingDetectIntentRequest message. Also converts values to other types if specified. + * @param message StreamingDetectIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingDetectIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingDetectIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingDetectIntentResponse. */ + interface IStreamingDetectIntentResponse { + + /** StreamingDetectIntentResponse responseId */ + responseId?: (string|null); + + /** StreamingDetectIntentResponse recognitionResult */ + recognitionResult?: (google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult|null); + + /** StreamingDetectIntentResponse queryResult */ + queryResult?: (google.cloud.dialogflow.v2beta1.IQueryResult|null); + + /** StreamingDetectIntentResponse alternativeQueryResults */ + alternativeQueryResults?: (google.cloud.dialogflow.v2beta1.IQueryResult[]|null); + + /** StreamingDetectIntentResponse webhookStatus */ + webhookStatus?: (google.rpc.IStatus|null); + + /** StreamingDetectIntentResponse outputAudio */ + outputAudio?: (Uint8Array|string|null); + + /** StreamingDetectIntentResponse outputAudioConfig */ + outputAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + } + + /** Represents a StreamingDetectIntentResponse. */ + class StreamingDetectIntentResponse implements IStreamingDetectIntentResponse { + + /** + * Constructs a new StreamingDetectIntentResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentResponse); + + /** StreamingDetectIntentResponse responseId. */ + public responseId: string; + + /** StreamingDetectIntentResponse recognitionResult. */ + public recognitionResult?: (google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult|null); + + /** StreamingDetectIntentResponse queryResult. */ + public queryResult?: (google.cloud.dialogflow.v2beta1.IQueryResult|null); + + /** StreamingDetectIntentResponse alternativeQueryResults. */ + public alternativeQueryResults: google.cloud.dialogflow.v2beta1.IQueryResult[]; + + /** StreamingDetectIntentResponse webhookStatus. */ + public webhookStatus?: (google.rpc.IStatus|null); + + /** StreamingDetectIntentResponse outputAudio. */ + public outputAudio: (Uint8Array|string); + + /** StreamingDetectIntentResponse outputAudioConfig. */ + public outputAudioConfig?: (google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null); + + /** + * Creates a new StreamingDetectIntentResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingDetectIntentResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentResponse): google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse; + + /** + * Encodes the specified StreamingDetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.verify|verify} messages. + * @param message StreamingDetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingDetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.verify|verify} messages. + * @param message StreamingDetectIntentResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IStreamingDetectIntentResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse; + + /** + * Verifies a StreamingDetectIntentResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingDetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingDetectIntentResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse; + + /** + * Creates a plain object from a StreamingDetectIntentResponse message. Also converts values to other types if specified. + * @param message StreamingDetectIntentResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingDetectIntentResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingDetectIntentResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingRecognitionResult. */ + interface IStreamingRecognitionResult { + + /** StreamingRecognitionResult messageType */ + messageType?: (google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType|keyof typeof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType|null); + + /** StreamingRecognitionResult transcript */ + transcript?: (string|null); + + /** StreamingRecognitionResult isFinal */ + isFinal?: (boolean|null); + + /** StreamingRecognitionResult confidence */ + confidence?: (number|null); + + /** StreamingRecognitionResult stability */ + stability?: (number|null); + + /** StreamingRecognitionResult speechWordInfo */ + speechWordInfo?: (google.cloud.dialogflow.v2beta1.ISpeechWordInfo[]|null); + + /** StreamingRecognitionResult speechEndOffset */ + speechEndOffset?: (google.protobuf.IDuration|null); + + /** StreamingRecognitionResult languageCode */ + languageCode?: (string|null); + + /** StreamingRecognitionResult dtmfDigits */ + dtmfDigits?: (google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null); + } + + /** Represents a StreamingRecognitionResult. */ + class StreamingRecognitionResult implements IStreamingRecognitionResult { + + /** + * Constructs a new StreamingRecognitionResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult); + + /** StreamingRecognitionResult messageType. */ + public messageType: (google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType|keyof typeof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType); + + /** StreamingRecognitionResult transcript. */ + public transcript: string; + + /** StreamingRecognitionResult isFinal. */ + public isFinal: boolean; + + /** StreamingRecognitionResult confidence. */ + public confidence: number; + + /** StreamingRecognitionResult stability. */ + public stability: number; + + /** StreamingRecognitionResult speechWordInfo. */ + public speechWordInfo: google.cloud.dialogflow.v2beta1.ISpeechWordInfo[]; + + /** StreamingRecognitionResult speechEndOffset. */ + public speechEndOffset?: (google.protobuf.IDuration|null); + + /** StreamingRecognitionResult languageCode. */ + public languageCode: string; + + /** StreamingRecognitionResult dtmfDigits. */ + public dtmfDigits?: (google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null); + + /** + * Creates a new StreamingRecognitionResult instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingRecognitionResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult): google.cloud.dialogflow.v2beta1.StreamingRecognitionResult; + + /** + * Encodes the specified StreamingRecognitionResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.verify|verify} messages. + * @param message StreamingRecognitionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.verify|verify} messages. + * @param message StreamingRecognitionResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.StreamingRecognitionResult; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.StreamingRecognitionResult; + + /** + * Verifies a StreamingRecognitionResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingRecognitionResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingRecognitionResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.StreamingRecognitionResult; + + /** + * Creates a plain object from a StreamingRecognitionResult message. Also converts values to other types if specified. + * @param message StreamingRecognitionResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.StreamingRecognitionResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingRecognitionResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingRecognitionResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace StreamingRecognitionResult { + + /** MessageType enum. */ + enum MessageType { + MESSAGE_TYPE_UNSPECIFIED = 0, + TRANSCRIPT = 1, + DTMF_DIGITS = 3, + END_OF_SINGLE_UTTERANCE = 2, + PARTIAL_DTMF_DIGITS = 4 + } + } + + /** Properties of a TextInput. */ + interface ITextInput { + + /** TextInput text */ + text?: (string|null); + + /** TextInput languageCode */ + languageCode?: (string|null); + } + + /** Represents a TextInput. */ + class TextInput implements ITextInput { + + /** + * Constructs a new TextInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ITextInput); + + /** TextInput text. */ + public text: string; + + /** TextInput languageCode. */ + public languageCode: string; + + /** + * Creates a new TextInput instance using the specified properties. + * @param [properties] Properties to set + * @returns TextInput instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ITextInput): google.cloud.dialogflow.v2beta1.TextInput; + + /** + * Encodes the specified TextInput message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TextInput.verify|verify} messages. + * @param message TextInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ITextInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TextInput.verify|verify} messages. + * @param message TextInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ITextInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.TextInput; + + /** + * Decodes a TextInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.TextInput; + + /** + * Verifies a TextInput message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.TextInput; + + /** + * Creates a plain object from a TextInput message. Also converts values to other types if specified. + * @param message TextInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.TextInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextInput + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EventInput. */ + interface IEventInput { + + /** EventInput name */ + name?: (string|null); + + /** EventInput parameters */ + parameters?: (google.protobuf.IStruct|null); + + /** EventInput languageCode */ + languageCode?: (string|null); + } + + /** Represents an EventInput. */ + class EventInput implements IEventInput { + + /** + * Constructs a new EventInput. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IEventInput); + + /** EventInput name. */ + public name: string; + + /** EventInput parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** EventInput languageCode. */ + public languageCode: string; + + /** + * Creates a new EventInput instance using the specified properties. + * @param [properties] Properties to set + * @returns EventInput instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IEventInput): google.cloud.dialogflow.v2beta1.EventInput; + + /** + * Encodes the specified EventInput message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EventInput.verify|verify} messages. + * @param message EventInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IEventInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EventInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EventInput.verify|verify} messages. + * @param message EventInput message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IEventInput, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EventInput message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.EventInput; + + /** + * Decodes an EventInput message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.EventInput; + + /** + * Verifies an EventInput message. + * @param message Plain 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 EventInput message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EventInput + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.EventInput; + + /** + * Creates a plain object from an EventInput message. Also converts values to other types if specified. + * @param message EventInput + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.EventInput, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EventInput to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EventInput + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SentimentAnalysisRequestConfig. */ + interface ISentimentAnalysisRequestConfig { + + /** SentimentAnalysisRequestConfig analyzeQueryTextSentiment */ + analyzeQueryTextSentiment?: (boolean|null); + } + + /** Represents a SentimentAnalysisRequestConfig. */ + class SentimentAnalysisRequestConfig implements ISentimentAnalysisRequestConfig { + + /** + * Constructs a new SentimentAnalysisRequestConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig); + + /** SentimentAnalysisRequestConfig analyzeQueryTextSentiment. */ + public analyzeQueryTextSentiment: boolean; + + /** + * Creates a new SentimentAnalysisRequestConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SentimentAnalysisRequestConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig): google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig; + + /** + * Encodes the specified SentimentAnalysisRequestConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.verify|verify} messages. + * @param message SentimentAnalysisRequestConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SentimentAnalysisRequestConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.verify|verify} messages. + * @param message SentimentAnalysisRequestConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SentimentAnalysisRequestConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SentimentAnalysisRequestConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig; + + /** + * Decodes a SentimentAnalysisRequestConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SentimentAnalysisRequestConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig; + + /** + * Verifies a SentimentAnalysisRequestConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SentimentAnalysisRequestConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SentimentAnalysisRequestConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig; + + /** + * Creates a plain object from a SentimentAnalysisRequestConfig message. Also converts values to other types if specified. + * @param message SentimentAnalysisRequestConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SentimentAnalysisRequestConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SentimentAnalysisRequestConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SentimentAnalysisResult. */ + interface ISentimentAnalysisResult { + + /** SentimentAnalysisResult queryTextSentiment */ + queryTextSentiment?: (google.cloud.dialogflow.v2beta1.ISentiment|null); + } + + /** Represents a SentimentAnalysisResult. */ + class SentimentAnalysisResult implements ISentimentAnalysisResult { + + /** + * Constructs a new SentimentAnalysisResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult); + + /** SentimentAnalysisResult queryTextSentiment. */ + public queryTextSentiment?: (google.cloud.dialogflow.v2beta1.ISentiment|null); + + /** + * Creates a new SentimentAnalysisResult instance using the specified properties. + * @param [properties] Properties to set + * @returns SentimentAnalysisResult instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult): google.cloud.dialogflow.v2beta1.SentimentAnalysisResult; + + /** + * Encodes the specified SentimentAnalysisResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.verify|verify} messages. + * @param message SentimentAnalysisResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SentimentAnalysisResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.verify|verify} messages. + * @param message SentimentAnalysisResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SentimentAnalysisResult; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SentimentAnalysisResult; + + /** + * Verifies a SentimentAnalysisResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SentimentAnalysisResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SentimentAnalysisResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SentimentAnalysisResult; + + /** + * Creates a plain object from a SentimentAnalysisResult message. Also converts values to other types if specified. + * @param message SentimentAnalysisResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SentimentAnalysisResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SentimentAnalysisResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SentimentAnalysisResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Sentiment. */ + interface ISentiment { + + /** Sentiment score */ + score?: (number|null); + + /** Sentiment magnitude */ + magnitude?: (number|null); + } + + /** Represents a Sentiment. */ + class Sentiment implements ISentiment { + + /** + * Constructs a new Sentiment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISentiment); + + /** Sentiment score. */ + public score: number; + + /** Sentiment magnitude. */ + public magnitude: number; + + /** + * Creates a new Sentiment instance using the specified properties. + * @param [properties] Properties to set + * @returns Sentiment instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISentiment): google.cloud.dialogflow.v2beta1.Sentiment; + + /** + * Encodes the specified Sentiment message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Sentiment.verify|verify} messages. + * @param message Sentiment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISentiment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Sentiment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Sentiment.verify|verify} messages. + * @param message Sentiment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISentiment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Sentiment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Sentiment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Sentiment; + + /** + * Decodes a Sentiment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Sentiment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Sentiment; + + /** + * Verifies a Sentiment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Sentiment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Sentiment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Sentiment; + + /** + * Creates a plain object from a Sentiment message. Also converts values to other types if specified. + * @param message Sentiment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Sentiment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Sentiment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Sentiment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Contexts */ + class Contexts extends $protobuf.rpc.Service { + + /** + * Constructs a new Contexts 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 Contexts 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): Contexts; + + /** + * Calls ListContexts. + * @param request ListContextsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListContextsResponse + */ + public listContexts(request: google.cloud.dialogflow.v2beta1.IListContextsRequest, callback: google.cloud.dialogflow.v2beta1.Contexts.ListContextsCallback): void; + + /** + * Calls ListContexts. + * @param request ListContextsRequest message or plain object + * @returns Promise + */ + public listContexts(request: google.cloud.dialogflow.v2beta1.IListContextsRequest): Promise; + + /** + * Calls GetContext. + * @param request GetContextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Context + */ + public getContext(request: google.cloud.dialogflow.v2beta1.IGetContextRequest, callback: google.cloud.dialogflow.v2beta1.Contexts.GetContextCallback): void; + + /** + * Calls GetContext. + * @param request GetContextRequest message or plain object + * @returns Promise + */ + public getContext(request: google.cloud.dialogflow.v2beta1.IGetContextRequest): Promise; + + /** + * Calls CreateContext. + * @param request CreateContextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Context + */ + public createContext(request: google.cloud.dialogflow.v2beta1.ICreateContextRequest, callback: google.cloud.dialogflow.v2beta1.Contexts.CreateContextCallback): void; + + /** + * Calls CreateContext. + * @param request CreateContextRequest message or plain object + * @returns Promise + */ + public createContext(request: google.cloud.dialogflow.v2beta1.ICreateContextRequest): Promise; + + /** + * Calls UpdateContext. + * @param request UpdateContextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Context + */ + public updateContext(request: google.cloud.dialogflow.v2beta1.IUpdateContextRequest, callback: google.cloud.dialogflow.v2beta1.Contexts.UpdateContextCallback): void; + + /** + * Calls UpdateContext. + * @param request UpdateContextRequest message or plain object + * @returns Promise + */ + public updateContext(request: google.cloud.dialogflow.v2beta1.IUpdateContextRequest): Promise; + + /** + * Calls DeleteContext. + * @param request DeleteContextRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteContext(request: google.cloud.dialogflow.v2beta1.IDeleteContextRequest, callback: google.cloud.dialogflow.v2beta1.Contexts.DeleteContextCallback): void; + + /** + * Calls DeleteContext. + * @param request DeleteContextRequest message or plain object + * @returns Promise + */ + public deleteContext(request: google.cloud.dialogflow.v2beta1.IDeleteContextRequest): Promise; + + /** + * Calls DeleteAllContexts. + * @param request DeleteAllContextsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteAllContexts(request: google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, callback: google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContextsCallback): void; + + /** + * Calls DeleteAllContexts. + * @param request DeleteAllContextsRequest message or plain object + * @returns Promise + */ + public deleteAllContexts(request: google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest): Promise; + } + + namespace Contexts { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|listContexts}. + * @param error Error, if any + * @param [response] ListContextsResponse + */ + type ListContextsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListContextsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|getContext}. + * @param error Error, if any + * @param [response] Context + */ + type GetContextCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Context) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|createContext}. + * @param error Error, if any + * @param [response] Context + */ + type CreateContextCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Context) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|updateContext}. + * @param error Error, if any + * @param [response] Context + */ + type UpdateContextCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Context) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|deleteContext}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteContextCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|deleteAllContexts}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteAllContextsCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a Context. */ + interface IContext { + + /** Context name */ + name?: (string|null); + + /** Context lifespanCount */ + lifespanCount?: (number|null); + + /** Context parameters */ + parameters?: (google.protobuf.IStruct|null); + } + + /** Represents a Context. */ + class Context implements IContext { + + /** + * Constructs a new Context. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IContext); + + /** Context name. */ + public name: string; + + /** Context lifespanCount. */ + public lifespanCount: number; + + /** Context parameters. */ + public parameters?: (google.protobuf.IStruct|null); + + /** + * Creates a new Context instance using the specified properties. + * @param [properties] Properties to set + * @returns Context instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IContext): google.cloud.dialogflow.v2beta1.Context; + + /** + * Encodes the specified Context message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Context.verify|verify} messages. + * @param message Context message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Context message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Context.verify|verify} messages. + * @param message Context message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Context message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Context + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Context; + + /** + * Decodes a Context message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Context + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Context; + + /** + * Verifies a Context message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Context message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Context + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Context; + + /** + * Creates a plain object from a Context message. Also converts values to other types if specified. + * @param message Context + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Context, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Context to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Context + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListContextsRequest. */ + interface IListContextsRequest { + + /** ListContextsRequest parent */ + parent?: (string|null); + + /** ListContextsRequest pageSize */ + pageSize?: (number|null); + + /** ListContextsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListContextsRequest. */ + class ListContextsRequest implements IListContextsRequest { + + /** + * Constructs a new ListContextsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListContextsRequest); + + /** ListContextsRequest parent. */ + public parent: string; + + /** ListContextsRequest pageSize. */ + public pageSize: number; + + /** ListContextsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListContextsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListContextsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListContextsRequest): google.cloud.dialogflow.v2beta1.ListContextsRequest; + + /** + * Encodes the specified ListContextsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListContextsRequest.verify|verify} messages. + * @param message ListContextsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListContextsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListContextsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListContextsRequest.verify|verify} messages. + * @param message ListContextsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListContextsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListContextsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListContextsRequest; + + /** + * Decodes a ListContextsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListContextsRequest; + + /** + * Verifies a ListContextsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListContextsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListContextsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListContextsRequest; + + /** + * Creates a plain object from a ListContextsRequest message. Also converts values to other types if specified. + * @param message ListContextsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListContextsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListContextsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListContextsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListContextsResponse. */ + interface IListContextsResponse { + + /** ListContextsResponse contexts */ + contexts?: (google.cloud.dialogflow.v2beta1.IContext[]|null); + + /** ListContextsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListContextsResponse. */ + class ListContextsResponse implements IListContextsResponse { + + /** + * Constructs a new ListContextsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListContextsResponse); + + /** ListContextsResponse contexts. */ + public contexts: google.cloud.dialogflow.v2beta1.IContext[]; + + /** ListContextsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListContextsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListContextsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListContextsResponse): google.cloud.dialogflow.v2beta1.ListContextsResponse; + + /** + * Encodes the specified ListContextsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListContextsResponse.verify|verify} messages. + * @param message ListContextsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListContextsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListContextsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListContextsResponse.verify|verify} messages. + * @param message ListContextsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListContextsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListContextsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListContextsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListContextsResponse; + + /** + * Decodes a ListContextsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListContextsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListContextsResponse; + + /** + * Verifies a ListContextsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListContextsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListContextsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListContextsResponse; + + /** + * Creates a plain object from a ListContextsResponse message. Also converts values to other types if specified. + * @param message ListContextsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListContextsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListContextsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListContextsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetContextRequest. */ + interface IGetContextRequest { + + /** GetContextRequest name */ + name?: (string|null); + } + + /** Represents a GetContextRequest. */ + class GetContextRequest implements IGetContextRequest { + + /** + * Constructs a new GetContextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetContextRequest); + + /** GetContextRequest name. */ + public name: string; + + /** + * Creates a new GetContextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetContextRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetContextRequest): google.cloud.dialogflow.v2beta1.GetContextRequest; + + /** + * Encodes the specified GetContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetContextRequest.verify|verify} messages. + * @param message GetContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetContextRequest.verify|verify} messages. + * @param message GetContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetContextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetContextRequest; + + /** + * Decodes a GetContextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetContextRequest; + + /** + * Verifies a GetContextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetContextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetContextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetContextRequest; + + /** + * Creates a plain object from a GetContextRequest message. Also converts values to other types if specified. + * @param message GetContextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetContextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetContextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetContextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateContextRequest. */ + interface ICreateContextRequest { + + /** CreateContextRequest parent */ + parent?: (string|null); + + /** CreateContextRequest context */ + context?: (google.cloud.dialogflow.v2beta1.IContext|null); + } + + /** Represents a CreateContextRequest. */ + class CreateContextRequest implements ICreateContextRequest { + + /** + * Constructs a new CreateContextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateContextRequest); + + /** CreateContextRequest parent. */ + public parent: string; + + /** CreateContextRequest context. */ + public context?: (google.cloud.dialogflow.v2beta1.IContext|null); + + /** + * Creates a new CreateContextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateContextRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateContextRequest): google.cloud.dialogflow.v2beta1.CreateContextRequest; + + /** + * Encodes the specified CreateContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateContextRequest.verify|verify} messages. + * @param message CreateContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateContextRequest.verify|verify} messages. + * @param message CreateContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateContextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateContextRequest; + + /** + * Decodes a CreateContextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateContextRequest; + + /** + * Verifies a CreateContextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateContextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateContextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateContextRequest; + + /** + * Creates a plain object from a CreateContextRequest message. Also converts values to other types if specified. + * @param message CreateContextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateContextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateContextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateContextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateContextRequest. */ + interface IUpdateContextRequest { + + /** UpdateContextRequest context */ + context?: (google.cloud.dialogflow.v2beta1.IContext|null); + + /** UpdateContextRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateContextRequest. */ + class UpdateContextRequest implements IUpdateContextRequest { + + /** + * Constructs a new UpdateContextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateContextRequest); + + /** UpdateContextRequest context. */ + public context?: (google.cloud.dialogflow.v2beta1.IContext|null); + + /** UpdateContextRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateContextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateContextRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateContextRequest): google.cloud.dialogflow.v2beta1.UpdateContextRequest; + + /** + * Encodes the specified UpdateContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateContextRequest.verify|verify} messages. + * @param message UpdateContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateContextRequest.verify|verify} messages. + * @param message UpdateContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateContextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateContextRequest; + + /** + * Decodes an UpdateContextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateContextRequest; + + /** + * Verifies an UpdateContextRequest message. + * @param message Plain 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 UpdateContextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateContextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateContextRequest; + + /** + * Creates a plain object from an UpdateContextRequest message. Also converts values to other types if specified. + * @param message UpdateContextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateContextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateContextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateContextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteContextRequest. */ + interface IDeleteContextRequest { + + /** DeleteContextRequest name */ + name?: (string|null); + } + + /** Represents a DeleteContextRequest. */ + class DeleteContextRequest implements IDeleteContextRequest { + + /** + * Constructs a new DeleteContextRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteContextRequest); + + /** DeleteContextRequest name. */ + public name: string; + + /** + * Creates a new DeleteContextRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteContextRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteContextRequest): google.cloud.dialogflow.v2beta1.DeleteContextRequest; + + /** + * Encodes the specified DeleteContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteContextRequest.verify|verify} messages. + * @param message DeleteContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteContextRequest.verify|verify} messages. + * @param message DeleteContextRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteContextRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteContextRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteContextRequest; + + /** + * Decodes a DeleteContextRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteContextRequest; + + /** + * Verifies a DeleteContextRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteContextRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteContextRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteContextRequest; + + /** + * Creates a plain object from a DeleteContextRequest message. Also converts values to other types if specified. + * @param message DeleteContextRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteContextRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteContextRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteContextRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteAllContextsRequest. */ + interface IDeleteAllContextsRequest { + + /** DeleteAllContextsRequest parent */ + parent?: (string|null); + } + + /** Represents a DeleteAllContextsRequest. */ + class DeleteAllContextsRequest implements IDeleteAllContextsRequest { + + /** + * Constructs a new DeleteAllContextsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest); + + /** DeleteAllContextsRequest parent. */ + public parent: string; + + /** + * Creates a new DeleteAllContextsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteAllContextsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest): google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest; + + /** + * Encodes the specified DeleteAllContextsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest.verify|verify} messages. + * @param message DeleteAllContextsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteAllContextsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest.verify|verify} messages. + * @param message DeleteAllContextsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteAllContextsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteAllContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest; + + /** + * Decodes a DeleteAllContextsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteAllContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest; + + /** + * Verifies a DeleteAllContextsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteAllContextsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteAllContextsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest; + + /** + * Creates a plain object from a DeleteAllContextsRequest message. Also converts values to other types if specified. + * @param message DeleteAllContextsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteAllContextsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteAllContextsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents an Intents */ + class Intents extends $protobuf.rpc.Service { + + /** + * Constructs a new Intents 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 Intents 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): Intents; + + /** + * Calls ListIntents. + * @param request ListIntentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListIntentsResponse + */ + public listIntents(request: google.cloud.dialogflow.v2beta1.IListIntentsRequest, callback: google.cloud.dialogflow.v2beta1.Intents.ListIntentsCallback): void; + + /** + * Calls ListIntents. + * @param request ListIntentsRequest message or plain object + * @returns Promise + */ + public listIntents(request: google.cloud.dialogflow.v2beta1.IListIntentsRequest): Promise; + + /** + * Calls GetIntent. + * @param request GetIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Intent + */ + public getIntent(request: google.cloud.dialogflow.v2beta1.IGetIntentRequest, callback: google.cloud.dialogflow.v2beta1.Intents.GetIntentCallback): void; + + /** + * Calls GetIntent. + * @param request GetIntentRequest message or plain object + * @returns Promise + */ + public getIntent(request: google.cloud.dialogflow.v2beta1.IGetIntentRequest): Promise; + + /** + * Calls CreateIntent. + * @param request CreateIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Intent + */ + public createIntent(request: google.cloud.dialogflow.v2beta1.ICreateIntentRequest, callback: google.cloud.dialogflow.v2beta1.Intents.CreateIntentCallback): void; + + /** + * Calls CreateIntent. + * @param request CreateIntentRequest message or plain object + * @returns Promise + */ + public createIntent(request: google.cloud.dialogflow.v2beta1.ICreateIntentRequest): Promise; + + /** + * Calls UpdateIntent. + * @param request UpdateIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Intent + */ + public updateIntent(request: google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, callback: google.cloud.dialogflow.v2beta1.Intents.UpdateIntentCallback): void; + + /** + * Calls UpdateIntent. + * @param request UpdateIntentRequest message or plain object + * @returns Promise + */ + public updateIntent(request: google.cloud.dialogflow.v2beta1.IUpdateIntentRequest): Promise; + + /** + * Calls DeleteIntent. + * @param request DeleteIntentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteIntent(request: google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, callback: google.cloud.dialogflow.v2beta1.Intents.DeleteIntentCallback): void; + + /** + * Calls DeleteIntent. + * @param request DeleteIntentRequest message or plain object + * @returns Promise + */ + public deleteIntent(request: google.cloud.dialogflow.v2beta1.IDeleteIntentRequest): Promise; + + /** + * Calls BatchUpdateIntents. + * @param request BatchUpdateIntentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchUpdateIntents(request: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, callback: google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntentsCallback): void; + + /** + * Calls BatchUpdateIntents. + * @param request BatchUpdateIntentsRequest message or plain object + * @returns Promise + */ + public batchUpdateIntents(request: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest): Promise; + + /** + * Calls BatchDeleteIntents. + * @param request BatchDeleteIntentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchDeleteIntents(request: google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, callback: google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntentsCallback): void; + + /** + * Calls BatchDeleteIntents. + * @param request BatchDeleteIntentsRequest message or plain object + * @returns Promise + */ + public batchDeleteIntents(request: google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest): Promise; + } + + namespace Intents { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|listIntents}. + * @param error Error, if any + * @param [response] ListIntentsResponse + */ + type ListIntentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListIntentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|getIntent}. + * @param error Error, if any + * @param [response] Intent + */ + type GetIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Intent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|createIntent}. + * @param error Error, if any + * @param [response] Intent + */ + type CreateIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Intent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|updateIntent}. + * @param error Error, if any + * @param [response] Intent + */ + type UpdateIntentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Intent) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|deleteIntent}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteIntentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|batchUpdateIntents}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchUpdateIntentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|batchDeleteIntents}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchDeleteIntentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an Intent. */ + interface IIntent { + + /** Intent name */ + name?: (string|null); + + /** Intent displayName */ + displayName?: (string|null); + + /** Intent webhookState */ + webhookState?: (google.cloud.dialogflow.v2beta1.Intent.WebhookState|keyof typeof google.cloud.dialogflow.v2beta1.Intent.WebhookState|null); + + /** Intent priority */ + priority?: (number|null); + + /** Intent isFallback */ + isFallback?: (boolean|null); + + /** Intent mlEnabled */ + mlEnabled?: (boolean|null); + + /** Intent mlDisabled */ + mlDisabled?: (boolean|null); + + /** Intent liveAgentHandoff */ + liveAgentHandoff?: (boolean|null); + + /** Intent endInteraction */ + endInteraction?: (boolean|null); + + /** Intent inputContextNames */ + inputContextNames?: (string[]|null); + + /** Intent events */ + events?: (string[]|null); + + /** Intent trainingPhrases */ + trainingPhrases?: (google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase[]|null); + + /** Intent action */ + action?: (string|null); + + /** Intent outputContexts */ + outputContexts?: (google.cloud.dialogflow.v2beta1.IContext[]|null); + + /** Intent resetContexts */ + resetContexts?: (boolean|null); + + /** Intent parameters */ + parameters?: (google.cloud.dialogflow.v2beta1.Intent.IParameter[]|null); + + /** Intent messages */ + messages?: (google.cloud.dialogflow.v2beta1.Intent.IMessage[]|null); + + /** Intent defaultResponsePlatforms */ + defaultResponsePlatforms?: (google.cloud.dialogflow.v2beta1.Intent.Message.Platform[]|null); + + /** Intent rootFollowupIntentName */ + rootFollowupIntentName?: (string|null); + + /** Intent parentFollowupIntentName */ + parentFollowupIntentName?: (string|null); + + /** Intent followupIntentInfo */ + followupIntentInfo?: (google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo[]|null); + } + + /** Represents an Intent. */ + class Intent implements IIntent { + + /** + * Constructs a new Intent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IIntent); + + /** Intent name. */ + public name: string; + + /** Intent displayName. */ + public displayName: string; + + /** Intent webhookState. */ + public webhookState: (google.cloud.dialogflow.v2beta1.Intent.WebhookState|keyof typeof google.cloud.dialogflow.v2beta1.Intent.WebhookState); + + /** Intent priority. */ + public priority: number; + + /** Intent isFallback. */ + public isFallback: boolean; + + /** Intent mlEnabled. */ + public mlEnabled: boolean; + + /** Intent mlDisabled. */ + public mlDisabled: boolean; + + /** Intent liveAgentHandoff. */ + public liveAgentHandoff: boolean; + + /** Intent endInteraction. */ + public endInteraction: boolean; + + /** Intent inputContextNames. */ + public inputContextNames: string[]; + + /** Intent events. */ + public events: string[]; + + /** Intent trainingPhrases. */ + public trainingPhrases: google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase[]; + + /** Intent action. */ + public action: string; + + /** Intent outputContexts. */ + public outputContexts: google.cloud.dialogflow.v2beta1.IContext[]; + + /** Intent resetContexts. */ + public resetContexts: boolean; + + /** Intent parameters. */ + public parameters: google.cloud.dialogflow.v2beta1.Intent.IParameter[]; + + /** Intent messages. */ + public messages: google.cloud.dialogflow.v2beta1.Intent.IMessage[]; + + /** Intent defaultResponsePlatforms. */ + public defaultResponsePlatforms: google.cloud.dialogflow.v2beta1.Intent.Message.Platform[]; + + /** Intent rootFollowupIntentName. */ + public rootFollowupIntentName: string; + + /** Intent parentFollowupIntentName. */ + public parentFollowupIntentName: string; + + /** Intent followupIntentInfo. */ + public followupIntentInfo: google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo[]; + + /** + * Creates a new Intent instance using the specified properties. + * @param [properties] Properties to set + * @returns Intent instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IIntent): google.cloud.dialogflow.v2beta1.Intent; + + /** + * Encodes the specified Intent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.verify|verify} messages. + * @param message Intent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IIntent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Intent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.verify|verify} messages. + * @param message Intent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IIntent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Intent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent; + + /** + * Decodes an Intent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent; + + /** + * Verifies an Intent message. + * @param message Plain 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 Intent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Intent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent; + + /** + * Creates a plain object from an Intent message. Also converts values to other types if specified. + * @param message Intent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Intent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Intent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Intent { + + /** WebhookState enum. */ + enum WebhookState { + WEBHOOK_STATE_UNSPECIFIED = 0, + WEBHOOK_STATE_ENABLED = 1, + WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING = 2 + } + + /** Properties of a TrainingPhrase. */ + interface ITrainingPhrase { + + /** TrainingPhrase name */ + name?: (string|null); + + /** TrainingPhrase type */ + type?: (google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type|keyof typeof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type|null); + + /** TrainingPhrase parts */ + parts?: (google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart[]|null); + + /** TrainingPhrase timesAddedCount */ + timesAddedCount?: (number|null); + } + + /** Represents a TrainingPhrase. */ + class TrainingPhrase implements ITrainingPhrase { + + /** + * Constructs a new TrainingPhrase. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase); + + /** TrainingPhrase name. */ + public name: string; + + /** TrainingPhrase type. */ + public type: (google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type|keyof typeof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type); + + /** TrainingPhrase parts. */ + public parts: google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart[]; + + /** TrainingPhrase timesAddedCount. */ + public timesAddedCount: number; + + /** + * Creates a new TrainingPhrase instance using the specified properties. + * @param [properties] Properties to set + * @returns TrainingPhrase instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase): google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase; + + /** + * Encodes the specified TrainingPhrase message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.verify|verify} messages. + * @param message TrainingPhrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TrainingPhrase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.verify|verify} messages. + * @param message TrainingPhrase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase; + + /** + * Verifies a TrainingPhrase message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TrainingPhrase message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TrainingPhrase + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase; + + /** + * Creates a plain object from a TrainingPhrase message. Also converts values to other types if specified. + * @param message TrainingPhrase + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TrainingPhrase to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TrainingPhrase + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace TrainingPhrase { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + EXAMPLE = 1, + TEMPLATE = 2 + } + + /** Properties of a Part. */ + interface IPart { + + /** Part text */ + text?: (string|null); + + /** Part entityType */ + entityType?: (string|null); + + /** Part alias */ + alias?: (string|null); + + /** Part userDefined */ + userDefined?: (boolean|null); + } + + /** Represents a Part. */ + class Part implements IPart { + + /** + * Constructs a new Part. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart); + + /** Part text. */ + public text: string; + + /** Part entityType. */ + public entityType: string; + + /** Part alias. */ + public alias: string; + + /** Part userDefined. */ + public userDefined: boolean; + + /** + * Creates a new Part instance using the specified properties. + * @param [properties] Properties to set + * @returns Part instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart): google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part; + + /** + * Encodes the specified Part message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.verify|verify} messages. + * @param message Part message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Part message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.verify|verify} messages. + * @param message Part message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Part message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part; + + /** + * Decodes a Part message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part; + + /** + * Verifies a Part message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Part message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Part + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part; + + /** + * Creates a plain object from a Part message. Also converts values to other types if specified. + * @param message Part + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Part to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Part + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a Parameter. */ + interface IParameter { + + /** Parameter name */ + name?: (string|null); + + /** Parameter displayName */ + displayName?: (string|null); + + /** Parameter value */ + value?: (string|null); + + /** Parameter defaultValue */ + defaultValue?: (string|null); + + /** Parameter entityTypeDisplayName */ + entityTypeDisplayName?: (string|null); + + /** Parameter mandatory */ + mandatory?: (boolean|null); + + /** Parameter prompts */ + prompts?: (string[]|null); + + /** Parameter isList */ + isList?: (boolean|null); + } + + /** Represents a Parameter. */ + class Parameter implements IParameter { + + /** + * Constructs a new Parameter. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.IParameter); + + /** Parameter name. */ + public name: string; + + /** Parameter displayName. */ + public displayName: string; + + /** Parameter value. */ + public value: string; + + /** Parameter defaultValue. */ + public defaultValue: string; + + /** Parameter entityTypeDisplayName. */ + public entityTypeDisplayName: string; + + /** Parameter mandatory. */ + public mandatory: boolean; + + /** Parameter prompts. */ + public prompts: string[]; + + /** Parameter isList. */ + public isList: boolean; + + /** + * Creates a new Parameter instance using the specified properties. + * @param [properties] Properties to set + * @returns Parameter instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.IParameter): google.cloud.dialogflow.v2beta1.Intent.Parameter; + + /** + * Encodes the specified Parameter message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Parameter.verify|verify} messages. + * @param message Parameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.IParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Parameter message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Parameter.verify|verify} messages. + * @param message Parameter message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.IParameter, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Parameter message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Parameter; + + /** + * Decodes a Parameter message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Parameter; + + /** + * Verifies a Parameter message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Parameter message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Parameter + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Parameter; + + /** + * Creates a plain object from a Parameter message. Also converts values to other types if specified. + * @param message Parameter + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Parameter, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Parameter to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Parameter + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Message. */ + interface IMessage { + + /** Message text */ + text?: (google.cloud.dialogflow.v2beta1.Intent.Message.IText|null); + + /** Message image */ + image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** Message quickReplies */ + quickReplies?: (google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies|null); + + /** Message card */ + card?: (google.cloud.dialogflow.v2beta1.Intent.Message.ICard|null); + + /** Message payload */ + payload?: (google.protobuf.IStruct|null); + + /** Message simpleResponses */ + simpleResponses?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses|null); + + /** Message basicCard */ + basicCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard|null); + + /** Message suggestions */ + suggestions?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions|null); + + /** Message linkOutSuggestion */ + linkOutSuggestion?: (google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion|null); + + /** Message listSelect */ + listSelect?: (google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect|null); + + /** Message carouselSelect */ + carouselSelect?: (google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect|null); + + /** Message telephonyPlayAudio */ + telephonyPlayAudio?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio|null); + + /** Message telephonySynthesizeSpeech */ + telephonySynthesizeSpeech?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech|null); + + /** Message telephonyTransferCall */ + telephonyTransferCall?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall|null); + + /** Message rbmText */ + rbmText?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText|null); + + /** Message rbmStandaloneRichCard */ + rbmStandaloneRichCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard|null); + + /** Message rbmCarouselRichCard */ + rbmCarouselRichCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard|null); + + /** Message browseCarouselCard */ + browseCarouselCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard|null); + + /** Message tableCard */ + tableCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard|null); + + /** Message mediaContent */ + mediaContent?: (google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent|null); + + /** Message platform */ + platform?: (google.cloud.dialogflow.v2beta1.Intent.Message.Platform|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.Platform|null); + } + + /** Represents a Message. */ + class Message implements IMessage { + + /** + * Constructs a new Message. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.IMessage); + + /** Message text. */ + public text?: (google.cloud.dialogflow.v2beta1.Intent.Message.IText|null); + + /** Message image. */ + public image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** Message quickReplies. */ + public quickReplies?: (google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies|null); + + /** Message card. */ + public card?: (google.cloud.dialogflow.v2beta1.Intent.Message.ICard|null); + + /** Message payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** Message simpleResponses. */ + public simpleResponses?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses|null); + + /** Message basicCard. */ + public basicCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard|null); + + /** Message suggestions. */ + public suggestions?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions|null); + + /** Message linkOutSuggestion. */ + public linkOutSuggestion?: (google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion|null); + + /** Message listSelect. */ + public listSelect?: (google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect|null); + + /** Message carouselSelect. */ + public carouselSelect?: (google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect|null); + + /** Message telephonyPlayAudio. */ + public telephonyPlayAudio?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio|null); + + /** Message telephonySynthesizeSpeech. */ + public telephonySynthesizeSpeech?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech|null); + + /** Message telephonyTransferCall. */ + public telephonyTransferCall?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall|null); + + /** Message rbmText. */ + public rbmText?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText|null); + + /** Message rbmStandaloneRichCard. */ + public rbmStandaloneRichCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard|null); + + /** Message rbmCarouselRichCard. */ + public rbmCarouselRichCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard|null); + + /** Message browseCarouselCard. */ + public browseCarouselCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard|null); + + /** Message tableCard. */ + public tableCard?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard|null); + + /** Message mediaContent. */ + public mediaContent?: (google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent|null); + + /** Message platform. */ + public platform: (google.cloud.dialogflow.v2beta1.Intent.Message.Platform|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.Platform); + + /** Message message. */ + public message?: ("text"|"image"|"quickReplies"|"card"|"payload"|"simpleResponses"|"basicCard"|"suggestions"|"linkOutSuggestion"|"listSelect"|"carouselSelect"|"telephonyPlayAudio"|"telephonySynthesizeSpeech"|"telephonyTransferCall"|"rbmText"|"rbmStandaloneRichCard"|"rbmCarouselRichCard"|"browseCarouselCard"|"tableCard"|"mediaContent"); + + /** + * Creates a new Message instance using the specified properties. + * @param [properties] Properties to set + * @returns Message instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.IMessage): google.cloud.dialogflow.v2beta1.Intent.Message; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Message message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message; + + /** + * Verifies a Message message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Message + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @param message Message + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Message to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Message + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Message { + + /** Platform enum. */ + enum Platform { + PLATFORM_UNSPECIFIED = 0, + FACEBOOK = 1, + SLACK = 2, + TELEGRAM = 3, + KIK = 4, + SKYPE = 5, + LINE = 6, + VIBER = 7, + ACTIONS_ON_GOOGLE = 8, + TELEPHONY = 10, + GOOGLE_HANGOUTS = 11 + } + + /** Properties of a Text. */ + interface IText { + + /** Text text */ + text?: (string[]|null); + } + + /** Represents a Text. */ + class Text implements IText { + + /** + * Constructs a new Text. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IText); + + /** Text text. */ + public text: string[]; + + /** + * Creates a new Text instance using the specified properties. + * @param [properties] Properties to set + * @returns Text instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IText): google.cloud.dialogflow.v2beta1.Intent.Message.Text; + + /** + * Encodes the specified Text message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Text.verify|verify} messages. + * @param message Text message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Text message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.Text; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.Text; + + /** + * Verifies a Text message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Text message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Text + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.Text; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @param message Text + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.Text, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Text to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Text + * @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 imageUri */ + imageUri?: (string|null); + + /** Image accessibilityText */ + accessibilityText?: (string|null); + } + + /** Represents an Image. */ + class Image implements IImage { + + /** + * Constructs a new Image. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IImage); + + /** Image imageUri. */ + public imageUri: string; + + /** Image accessibilityText. */ + public accessibilityText: string; + + /** + * Creates a new Image instance using the specified properties. + * @param [properties] Properties to set + * @returns Image instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IImage): google.cloud.dialogflow.v2beta1.Intent.Message.Image; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.IImage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.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 QuickReplies. */ + interface IQuickReplies { + + /** QuickReplies title */ + title?: (string|null); + + /** QuickReplies quickReplies */ + quickReplies?: (string[]|null); + } + + /** Represents a QuickReplies. */ + class QuickReplies implements IQuickReplies { + + /** + * Constructs a new QuickReplies. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies); + + /** QuickReplies title. */ + public title: string; + + /** QuickReplies quickReplies. */ + public quickReplies: string[]; + + /** + * Creates a new QuickReplies instance using the specified properties. + * @param [properties] Properties to set + * @returns QuickReplies instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies): google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies; + + /** + * Encodes the specified QuickReplies message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.verify|verify} messages. + * @param message QuickReplies message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QuickReplies message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.verify|verify} messages. + * @param message QuickReplies message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QuickReplies message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QuickReplies + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies; + + /** + * Decodes a QuickReplies message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QuickReplies + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies; + + /** + * Verifies a QuickReplies message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QuickReplies message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QuickReplies + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies; + + /** + * Creates a plain object from a QuickReplies message. Also converts values to other types if specified. + * @param message QuickReplies + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QuickReplies to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QuickReplies + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Card. */ + interface ICard { + + /** Card title */ + title?: (string|null); + + /** Card subtitle */ + subtitle?: (string|null); + + /** Card imageUri */ + imageUri?: (string|null); + + /** Card buttons */ + buttons?: (google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton[]|null); + } + + /** Represents a Card. */ + class Card implements ICard { + + /** + * Constructs a new Card. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ICard); + + /** Card title. */ + public title: string; + + /** Card subtitle. */ + public subtitle: string; + + /** Card imageUri. */ + public imageUri: string; + + /** Card buttons. */ + public buttons: google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton[]; + + /** + * Creates a new Card instance using the specified properties. + * @param [properties] Properties to set + * @returns Card instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ICard): google.cloud.dialogflow.v2beta1.Intent.Message.Card; + + /** + * Encodes the specified Card message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Card.verify|verify} messages. + * @param message Card message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ICard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Card message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Card.verify|verify} messages. + * @param message Card message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ICard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Card message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Card + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.Card; + + /** + * Decodes a Card message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Card + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.Card; + + /** + * Verifies a Card message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Card message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Card + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.Card; + + /** + * Creates a plain object from a Card message. Also converts values to other types if specified. + * @param message Card + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.Card, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Card to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Card + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Card { + + /** Properties of a Button. */ + interface IButton { + + /** Button text */ + text?: (string|null); + + /** Button postback */ + postback?: (string|null); + } + + /** Represents a Button. */ + class Button implements IButton { + + /** + * Constructs a new Button. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton); + + /** Button text. */ + public text: string; + + /** Button postback. */ + public postback: string; + + /** + * Creates a new Button instance using the specified properties. + * @param [properties] Properties to set + * @returns Button instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton): google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button; + + /** + * Encodes the specified Button message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Button message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button; + + /** + * Verifies a Button message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Button + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @param message Button + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Button to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Button + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SimpleResponse. */ + interface ISimpleResponse { + + /** SimpleResponse textToSpeech */ + textToSpeech?: (string|null); + + /** SimpleResponse ssml */ + ssml?: (string|null); + + /** SimpleResponse displayText */ + displayText?: (string|null); + } + + /** Represents a SimpleResponse. */ + class SimpleResponse implements ISimpleResponse { + + /** + * Constructs a new SimpleResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse); + + /** SimpleResponse textToSpeech. */ + public textToSpeech: string; + + /** SimpleResponse ssml. */ + public ssml: string; + + /** SimpleResponse displayText. */ + public displayText: string; + + /** + * Creates a new SimpleResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SimpleResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse): google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse; + + /** + * Encodes the specified SimpleResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.verify|verify} messages. + * @param message SimpleResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SimpleResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.verify|verify} messages. + * @param message SimpleResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SimpleResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SimpleResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse; + + /** + * Decodes a SimpleResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SimpleResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse; + + /** + * Verifies a SimpleResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SimpleResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SimpleResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse; + + /** + * Creates a plain object from a SimpleResponse message. Also converts values to other types if specified. + * @param message SimpleResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SimpleResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SimpleResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SimpleResponses. */ + interface ISimpleResponses { + + /** SimpleResponses simpleResponses */ + simpleResponses?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse[]|null); + } + + /** Represents a SimpleResponses. */ + class SimpleResponses implements ISimpleResponses { + + /** + * Constructs a new SimpleResponses. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses); + + /** SimpleResponses simpleResponses. */ + public simpleResponses: google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse[]; + + /** + * Creates a new SimpleResponses instance using the specified properties. + * @param [properties] Properties to set + * @returns SimpleResponses instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses): google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses; + + /** + * Encodes the specified SimpleResponses message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.verify|verify} messages. + * @param message SimpleResponses message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SimpleResponses message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.verify|verify} messages. + * @param message SimpleResponses message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SimpleResponses message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SimpleResponses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses; + + /** + * Decodes a SimpleResponses message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SimpleResponses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses; + + /** + * Verifies a SimpleResponses message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SimpleResponses message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SimpleResponses + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses; + + /** + * Creates a plain object from a SimpleResponses message. Also converts values to other types if specified. + * @param message SimpleResponses + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SimpleResponses to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SimpleResponses + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BasicCard. */ + interface IBasicCard { + + /** BasicCard title */ + title?: (string|null); + + /** BasicCard subtitle */ + subtitle?: (string|null); + + /** BasicCard formattedText */ + formattedText?: (string|null); + + /** BasicCard image */ + image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** BasicCard buttons */ + buttons?: (google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton[]|null); + } + + /** Represents a BasicCard. */ + class BasicCard implements IBasicCard { + + /** + * Constructs a new BasicCard. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard); + + /** BasicCard title. */ + public title: string; + + /** BasicCard subtitle. */ + public subtitle: string; + + /** BasicCard formattedText. */ + public formattedText: string; + + /** BasicCard image. */ + public image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** BasicCard buttons. */ + public buttons: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton[]; + + /** + * Creates a new BasicCard instance using the specified properties. + * @param [properties] Properties to set + * @returns BasicCard instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard; + + /** + * Encodes the specified BasicCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.verify|verify} messages. + * @param message BasicCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BasicCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.verify|verify} messages. + * @param message BasicCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BasicCard message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BasicCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard; + + /** + * Decodes a BasicCard message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BasicCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard; + + /** + * Verifies a BasicCard message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BasicCard message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BasicCard + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard; + + /** + * Creates a plain object from a BasicCard message. Also converts values to other types if specified. + * @param message BasicCard + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BasicCard to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BasicCard + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BasicCard { + + /** Properties of a Button. */ + interface IButton { + + /** Button title */ + title?: (string|null); + + /** Button openUriAction */ + openUriAction?: (google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction|null); + } + + /** Represents a Button. */ + class Button implements IButton { + + /** + * Constructs a new Button. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton); + + /** Button title. */ + public title: string; + + /** Button openUriAction. */ + public openUriAction?: (google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction|null); + + /** + * Creates a new Button instance using the specified properties. + * @param [properties] Properties to set + * @returns Button instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button; + + /** + * Encodes the specified Button message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.verify|verify} messages. + * @param message Button message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Button message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button; + + /** + * Verifies a Button message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Button + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @param message Button + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Button to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Button + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Button { + + /** Properties of an OpenUriAction. */ + interface IOpenUriAction { + + /** OpenUriAction uri */ + uri?: (string|null); + } + + /** Represents an OpenUriAction. */ + class OpenUriAction implements IOpenUriAction { + + /** + * Constructs a new OpenUriAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction); + + /** OpenUriAction uri. */ + public uri: string; + + /** + * Creates a new OpenUriAction instance using the specified properties. + * @param [properties] Properties to set + * @returns OpenUriAction instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction; + + /** + * Encodes the specified OpenUriAction message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.verify|verify} messages. + * @param message OpenUriAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OpenUriAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.verify|verify} messages. + * @param message OpenUriAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OpenUriAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OpenUriAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction; + + /** + * Decodes an OpenUriAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OpenUriAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction; + + /** + * Verifies an OpenUriAction message. + * @param message Plain 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 OpenUriAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OpenUriAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction; + + /** + * Creates a plain object from an OpenUriAction message. Also converts values to other types if specified. + * @param message OpenUriAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OpenUriAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OpenUriAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + + /** Properties of a Suggestion. */ + interface ISuggestion { + + /** Suggestion title */ + title?: (string|null); + } + + /** Represents a Suggestion. */ + class Suggestion implements ISuggestion { + + /** + * Constructs a new Suggestion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion); + + /** Suggestion title. */ + public title: string; + + /** + * Creates a new Suggestion instance using the specified properties. + * @param [properties] Properties to set + * @returns Suggestion instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion): google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion; + + /** + * Encodes the specified Suggestion message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.verify|verify} messages. + * @param message Suggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Suggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.verify|verify} messages. + * @param message Suggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Suggestion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion; + + /** + * Decodes a Suggestion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion; + + /** + * Verifies a Suggestion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Suggestion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Suggestion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion; + + /** + * Creates a plain object from a Suggestion message. Also converts values to other types if specified. + * @param message Suggestion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Suggestion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Suggestion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Suggestions. */ + interface ISuggestions { + + /** Suggestions suggestions */ + suggestions?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion[]|null); + } + + /** Represents a Suggestions. */ + class Suggestions implements ISuggestions { + + /** + * Constructs a new Suggestions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions); + + /** Suggestions suggestions. */ + public suggestions: google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion[]; + + /** + * Creates a new Suggestions instance using the specified properties. + * @param [properties] Properties to set + * @returns Suggestions instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions): google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions; + + /** + * Encodes the specified Suggestions message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.verify|verify} messages. + * @param message Suggestions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Suggestions message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.verify|verify} messages. + * @param message Suggestions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Suggestions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Suggestions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions; + + /** + * Decodes a Suggestions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Suggestions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions; + + /** + * Verifies a Suggestions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Suggestions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Suggestions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions; + + /** + * Creates a plain object from a Suggestions message. Also converts values to other types if specified. + * @param message Suggestions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Suggestions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Suggestions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LinkOutSuggestion. */ + interface ILinkOutSuggestion { + + /** LinkOutSuggestion destinationName */ + destinationName?: (string|null); + + /** LinkOutSuggestion uri */ + uri?: (string|null); + } + + /** Represents a LinkOutSuggestion. */ + class LinkOutSuggestion implements ILinkOutSuggestion { + + /** + * Constructs a new LinkOutSuggestion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion); + + /** LinkOutSuggestion destinationName. */ + public destinationName: string; + + /** LinkOutSuggestion uri. */ + public uri: string; + + /** + * Creates a new LinkOutSuggestion instance using the specified properties. + * @param [properties] Properties to set + * @returns LinkOutSuggestion instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion): google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion; + + /** + * Encodes the specified LinkOutSuggestion message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.verify|verify} messages. + * @param message LinkOutSuggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LinkOutSuggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.verify|verify} messages. + * @param message LinkOutSuggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LinkOutSuggestion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LinkOutSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion; + + /** + * Decodes a LinkOutSuggestion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LinkOutSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion; + + /** + * Verifies a LinkOutSuggestion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LinkOutSuggestion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LinkOutSuggestion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion; + + /** + * Creates a plain object from a LinkOutSuggestion message. Also converts values to other types if specified. + * @param message LinkOutSuggestion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LinkOutSuggestion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LinkOutSuggestion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSelect. */ + interface IListSelect { + + /** ListSelect title */ + title?: (string|null); + + /** ListSelect items */ + items?: (google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem[]|null); + + /** ListSelect subtitle */ + subtitle?: (string|null); + } + + /** Represents a ListSelect. */ + class ListSelect implements IListSelect { + + /** + * Constructs a new ListSelect. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect); + + /** ListSelect title. */ + public title: string; + + /** ListSelect items. */ + public items: google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem[]; + + /** ListSelect subtitle. */ + public subtitle: string; + + /** + * Creates a new ListSelect instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSelect instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect): google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect; + + /** + * Encodes the specified ListSelect message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.verify|verify} messages. + * @param message ListSelect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSelect message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.verify|verify} messages. + * @param message ListSelect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSelect message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect; + + /** + * Decodes a ListSelect message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect; + + /** + * Verifies a ListSelect message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSelect message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSelect + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect; + + /** + * Creates a plain object from a ListSelect message. Also converts values to other types if specified. + * @param message ListSelect + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSelect to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSelect + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ListSelect { + + /** Properties of an Item. */ + interface IItem { + + /** Item info */ + info?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo|null); + + /** Item title */ + title?: (string|null); + + /** Item description */ + description?: (string|null); + + /** Item image */ + image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + } + + /** Represents an Item. */ + class Item implements IItem { + + /** + * Constructs a new Item. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem); + + /** Item info. */ + public info?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo|null); + + /** Item title. */ + public title: string; + + /** Item description. */ + public description: string; + + /** Item image. */ + public image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** + * Creates a new Item instance using the specified properties. + * @param [properties] Properties to set + * @returns Item instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem): google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item; + + /** + * Encodes the specified Item message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.verify|verify} messages. + * @param message Item message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Item message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.verify|verify} messages. + * @param message Item message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Item message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item; + + /** + * Decodes an Item message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item; + + /** + * Verifies an Item message. + * @param message Plain 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 Item message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Item + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item; + + /** + * Creates a plain object from an Item message. Also converts values to other types if specified. + * @param message Item + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Item to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Item + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a CarouselSelect. */ + interface ICarouselSelect { + + /** CarouselSelect items */ + items?: (google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem[]|null); + } + + /** Represents a CarouselSelect. */ + class CarouselSelect implements ICarouselSelect { + + /** + * Constructs a new CarouselSelect. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect); + + /** CarouselSelect items. */ + public items: google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem[]; + + /** + * Creates a new CarouselSelect instance using the specified properties. + * @param [properties] Properties to set + * @returns CarouselSelect instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect): google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect; + + /** + * Encodes the specified CarouselSelect message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.verify|verify} messages. + * @param message CarouselSelect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CarouselSelect message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.verify|verify} messages. + * @param message CarouselSelect message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CarouselSelect message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CarouselSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect; + + /** + * Decodes a CarouselSelect message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CarouselSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect; + + /** + * Verifies a CarouselSelect message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CarouselSelect message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CarouselSelect + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect; + + /** + * Creates a plain object from a CarouselSelect message. Also converts values to other types if specified. + * @param message CarouselSelect + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CarouselSelect to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CarouselSelect + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace CarouselSelect { + + /** Properties of an Item. */ + interface IItem { + + /** Item info */ + info?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo|null); + + /** Item title */ + title?: (string|null); + + /** Item description */ + description?: (string|null); + + /** Item image */ + image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + } + + /** Represents an Item. */ + class Item implements IItem { + + /** + * Constructs a new Item. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem); + + /** Item info. */ + public info?: (google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo|null); + + /** Item title. */ + public title: string; + + /** Item description. */ + public description: string; + + /** Item image. */ + public image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** + * Creates a new Item instance using the specified properties. + * @param [properties] Properties to set + * @returns Item instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem): google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item; + + /** + * Encodes the specified Item message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.verify|verify} messages. + * @param message Item message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Item message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.verify|verify} messages. + * @param message Item message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Item message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item; + + /** + * Decodes an Item message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item; + + /** + * Verifies an Item message. + * @param message Plain 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 Item message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Item + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item; + + /** + * Creates a plain object from an Item message. Also converts values to other types if specified. + * @param message Item + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Item to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Item + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SelectItemInfo. */ + interface ISelectItemInfo { + + /** SelectItemInfo key */ + key?: (string|null); + + /** SelectItemInfo synonyms */ + synonyms?: (string[]|null); + } + + /** Represents a SelectItemInfo. */ + class SelectItemInfo implements ISelectItemInfo { + + /** + * Constructs a new SelectItemInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo); + + /** SelectItemInfo key. */ + public key: string; + + /** SelectItemInfo synonyms. */ + public synonyms: string[]; + + /** + * Creates a new SelectItemInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectItemInfo instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo): google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo; + + /** + * Encodes the specified SelectItemInfo message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.verify|verify} messages. + * @param message SelectItemInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectItemInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.verify|verify} messages. + * @param message SelectItemInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectItemInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectItemInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo; + + /** + * Decodes a SelectItemInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectItemInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo; + + /** + * Verifies a SelectItemInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SelectItemInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectItemInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo; + + /** + * Creates a plain object from a SelectItemInfo message. Also converts values to other types if specified. + * @param message SelectItemInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectItemInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectItemInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TelephonyPlayAudio. */ + interface ITelephonyPlayAudio { + + /** TelephonyPlayAudio audioUri */ + audioUri?: (string|null); + } + + /** Represents a TelephonyPlayAudio. */ + class TelephonyPlayAudio implements ITelephonyPlayAudio { + + /** + * Constructs a new TelephonyPlayAudio. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio); + + /** TelephonyPlayAudio audioUri. */ + public audioUri: string; + + /** + * Creates a new TelephonyPlayAudio instance using the specified properties. + * @param [properties] Properties to set + * @returns TelephonyPlayAudio instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio; + + /** + * Encodes the specified TelephonyPlayAudio message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.verify|verify} messages. + * @param message TelephonyPlayAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TelephonyPlayAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.verify|verify} messages. + * @param message TelephonyPlayAudio message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TelephonyPlayAudio message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TelephonyPlayAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio; + + /** + * Decodes a TelephonyPlayAudio message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TelephonyPlayAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio; + + /** + * Verifies a TelephonyPlayAudio message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TelephonyPlayAudio message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TelephonyPlayAudio + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio; + + /** + * Creates a plain object from a TelephonyPlayAudio message. Also converts values to other types if specified. + * @param message TelephonyPlayAudio + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TelephonyPlayAudio to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TelephonyPlayAudio + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TelephonySynthesizeSpeech. */ + interface ITelephonySynthesizeSpeech { + + /** TelephonySynthesizeSpeech text */ + text?: (string|null); + + /** TelephonySynthesizeSpeech ssml */ + ssml?: (string|null); + } + + /** Represents a TelephonySynthesizeSpeech. */ + class TelephonySynthesizeSpeech implements ITelephonySynthesizeSpeech { + + /** + * Constructs a new TelephonySynthesizeSpeech. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech); + + /** TelephonySynthesizeSpeech text. */ + public text?: (string|null); + + /** TelephonySynthesizeSpeech ssml. */ + public ssml?: (string|null); + + /** TelephonySynthesizeSpeech source. */ + public source?: ("text"|"ssml"); + + /** + * Creates a new TelephonySynthesizeSpeech instance using the specified properties. + * @param [properties] Properties to set + * @returns TelephonySynthesizeSpeech instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech; + + /** + * Encodes the specified TelephonySynthesizeSpeech message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.verify|verify} messages. + * @param message TelephonySynthesizeSpeech message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TelephonySynthesizeSpeech message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.verify|verify} messages. + * @param message TelephonySynthesizeSpeech message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TelephonySynthesizeSpeech message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TelephonySynthesizeSpeech + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech; + + /** + * Decodes a TelephonySynthesizeSpeech message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TelephonySynthesizeSpeech + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech; + + /** + * Verifies a TelephonySynthesizeSpeech message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TelephonySynthesizeSpeech message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TelephonySynthesizeSpeech + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech; + + /** + * Creates a plain object from a TelephonySynthesizeSpeech message. Also converts values to other types if specified. + * @param message TelephonySynthesizeSpeech + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TelephonySynthesizeSpeech to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TelephonySynthesizeSpeech + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TelephonyTransferCall. */ + interface ITelephonyTransferCall { + + /** TelephonyTransferCall phoneNumber */ + phoneNumber?: (string|null); + } + + /** Represents a TelephonyTransferCall. */ + class TelephonyTransferCall implements ITelephonyTransferCall { + + /** + * Constructs a new TelephonyTransferCall. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall); + + /** TelephonyTransferCall phoneNumber. */ + public phoneNumber: string; + + /** + * Creates a new TelephonyTransferCall instance using the specified properties. + * @param [properties] Properties to set + * @returns TelephonyTransferCall instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall; + + /** + * Encodes the specified TelephonyTransferCall message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.verify|verify} messages. + * @param message TelephonyTransferCall message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TelephonyTransferCall message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.verify|verify} messages. + * @param message TelephonyTransferCall message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall; + + /** + * Verifies a TelephonyTransferCall message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TelephonyTransferCall message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TelephonyTransferCall + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall; + + /** + * Creates a plain object from a TelephonyTransferCall message. Also converts values to other types if specified. + * @param message TelephonyTransferCall + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TelephonyTransferCall to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TelephonyTransferCall + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RbmText. */ + interface IRbmText { + + /** RbmText text */ + text?: (string|null); + + /** RbmText rbmSuggestion */ + rbmSuggestion?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion[]|null); + } + + /** Represents a RbmText. */ + class RbmText implements IRbmText { + + /** + * Constructs a new RbmText. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText); + + /** RbmText text. */ + public text: string; + + /** RbmText rbmSuggestion. */ + public rbmSuggestion: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion[]; + + /** + * Creates a new RbmText instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmText instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText): google.cloud.dialogflow.v2beta1.Intent.Message.RbmText; + + /** + * Encodes the specified RbmText message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.verify|verify} messages. + * @param message RbmText message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmText message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.verify|verify} messages. + * @param message RbmText message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmText message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmText; + + /** + * Decodes a RbmText message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmText; + + /** + * Verifies a RbmText message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmText message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmText + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmText; + + /** + * Creates a plain object from a RbmText message. Also converts values to other types if specified. + * @param message RbmText + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmText, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmText to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmText + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RbmCarouselCard. */ + interface IRbmCarouselCard { + + /** RbmCarouselCard cardWidth */ + cardWidth?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth|null); + + /** RbmCarouselCard cardContents */ + cardContents?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent[]|null); + } + + /** Represents a RbmCarouselCard. */ + class RbmCarouselCard implements IRbmCarouselCard { + + /** + * Constructs a new RbmCarouselCard. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard); + + /** RbmCarouselCard cardWidth. */ + public cardWidth: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth); + + /** RbmCarouselCard cardContents. */ + public cardContents: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent[]; + + /** + * Creates a new RbmCarouselCard instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmCarouselCard instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard; + + /** + * Encodes the specified RbmCarouselCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.verify|verify} messages. + * @param message RbmCarouselCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmCarouselCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.verify|verify} messages. + * @param message RbmCarouselCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmCarouselCard message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard; + + /** + * Decodes a RbmCarouselCard message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard; + + /** + * Verifies a RbmCarouselCard message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmCarouselCard message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmCarouselCard + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard; + + /** + * Creates a plain object from a RbmCarouselCard message. Also converts values to other types if specified. + * @param message RbmCarouselCard + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmCarouselCard to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmCarouselCard + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace RbmCarouselCard { + + /** CardWidth enum. */ + enum CardWidth { + CARD_WIDTH_UNSPECIFIED = 0, + SMALL = 1, + MEDIUM = 2 + } + } + + /** Properties of a RbmStandaloneCard. */ + interface IRbmStandaloneCard { + + /** RbmStandaloneCard cardOrientation */ + cardOrientation?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation|null); + + /** RbmStandaloneCard thumbnailImageAlignment */ + thumbnailImageAlignment?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment|null); + + /** RbmStandaloneCard cardContent */ + cardContent?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent|null); + } + + /** Represents a RbmStandaloneCard. */ + class RbmStandaloneCard implements IRbmStandaloneCard { + + /** + * Constructs a new RbmStandaloneCard. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard); + + /** RbmStandaloneCard cardOrientation. */ + public cardOrientation: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation); + + /** RbmStandaloneCard thumbnailImageAlignment. */ + public thumbnailImageAlignment: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment); + + /** RbmStandaloneCard cardContent. */ + public cardContent?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent|null); + + /** + * Creates a new RbmStandaloneCard instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmStandaloneCard instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard): google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard; + + /** + * Encodes the specified RbmStandaloneCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.verify|verify} messages. + * @param message RbmStandaloneCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmStandaloneCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.verify|verify} messages. + * @param message RbmStandaloneCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmStandaloneCard message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmStandaloneCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard; + + /** + * Decodes a RbmStandaloneCard message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmStandaloneCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard; + + /** + * Verifies a RbmStandaloneCard message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmStandaloneCard message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmStandaloneCard + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard; + + /** + * Creates a plain object from a RbmStandaloneCard message. Also converts values to other types if specified. + * @param message RbmStandaloneCard + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmStandaloneCard to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmStandaloneCard + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace RbmStandaloneCard { + + /** CardOrientation enum. */ + enum CardOrientation { + CARD_ORIENTATION_UNSPECIFIED = 0, + HORIZONTAL = 1, + VERTICAL = 2 + } + + /** ThumbnailImageAlignment enum. */ + enum ThumbnailImageAlignment { + THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED = 0, + LEFT = 1, + RIGHT = 2 + } + } + + /** Properties of a RbmCardContent. */ + interface IRbmCardContent { + + /** RbmCardContent title */ + title?: (string|null); + + /** RbmCardContent description */ + description?: (string|null); + + /** RbmCardContent media */ + media?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia|null); + + /** RbmCardContent suggestions */ + suggestions?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion[]|null); + } + + /** Represents a RbmCardContent. */ + class RbmCardContent implements IRbmCardContent { + + /** + * Constructs a new RbmCardContent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent); + + /** RbmCardContent title. */ + public title: string; + + /** RbmCardContent description. */ + public description: string; + + /** RbmCardContent media. */ + public media?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia|null); + + /** RbmCardContent suggestions. */ + public suggestions: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion[]; + + /** + * Creates a new RbmCardContent instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmCardContent instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent; + + /** + * Encodes the specified RbmCardContent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.verify|verify} messages. + * @param message RbmCardContent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmCardContent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.verify|verify} messages. + * @param message RbmCardContent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmCardContent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmCardContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent; + + /** + * Decodes a RbmCardContent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmCardContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent; + + /** + * Verifies a RbmCardContent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmCardContent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmCardContent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent; + + /** + * Creates a plain object from a RbmCardContent message. Also converts values to other types if specified. + * @param message RbmCardContent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmCardContent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmCardContent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace RbmCardContent { + + /** Properties of a RbmMedia. */ + interface IRbmMedia { + + /** RbmMedia fileUri */ + fileUri?: (string|null); + + /** RbmMedia thumbnailUri */ + thumbnailUri?: (string|null); + + /** RbmMedia height */ + height?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height|null); + } + + /** Represents a RbmMedia. */ + class RbmMedia implements IRbmMedia { + + /** + * Constructs a new RbmMedia. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia); + + /** RbmMedia fileUri. */ + public fileUri: string; + + /** RbmMedia thumbnailUri. */ + public thumbnailUri: string; + + /** RbmMedia height. */ + public height: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height); + + /** + * Creates a new RbmMedia instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmMedia instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia; + + /** + * Encodes the specified RbmMedia message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.verify|verify} messages. + * @param message RbmMedia message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmMedia message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.verify|verify} messages. + * @param message RbmMedia message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmMedia message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmMedia + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia; + + /** + * Decodes a RbmMedia message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmMedia + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia; + + /** + * Verifies a RbmMedia message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmMedia message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmMedia + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia; + + /** + * Creates a plain object from a RbmMedia message. Also converts values to other types if specified. + * @param message RbmMedia + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmMedia to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmMedia + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace RbmMedia { + + /** Height enum. */ + enum Height { + HEIGHT_UNSPECIFIED = 0, + SHORT = 1, + MEDIUM = 2, + TALL = 3 + } + } + } + + /** Properties of a RbmSuggestion. */ + interface IRbmSuggestion { + + /** RbmSuggestion reply */ + reply?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply|null); + + /** RbmSuggestion action */ + action?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction|null); + } + + /** Represents a RbmSuggestion. */ + class RbmSuggestion implements IRbmSuggestion { + + /** + * Constructs a new RbmSuggestion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion); + + /** RbmSuggestion reply. */ + public reply?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply|null); + + /** RbmSuggestion action. */ + public action?: (google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction|null); + + /** RbmSuggestion suggestion. */ + public suggestion?: ("reply"|"action"); + + /** + * Creates a new RbmSuggestion instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmSuggestion instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion; + + /** + * Encodes the specified RbmSuggestion message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.verify|verify} messages. + * @param message RbmSuggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmSuggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.verify|verify} messages. + * @param message RbmSuggestion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmSuggestion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion; + + /** + * Decodes a RbmSuggestion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion; + + /** + * Verifies a RbmSuggestion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmSuggestion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmSuggestion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion; + + /** + * Creates a plain object from a RbmSuggestion message. Also converts values to other types if specified. + * @param message RbmSuggestion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmSuggestion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmSuggestion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RbmSuggestedReply. */ + interface IRbmSuggestedReply { + + /** RbmSuggestedReply text */ + text?: (string|null); + + /** RbmSuggestedReply postbackData */ + postbackData?: (string|null); + } + + /** Represents a RbmSuggestedReply. */ + class RbmSuggestedReply implements IRbmSuggestedReply { + + /** + * Constructs a new RbmSuggestedReply. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply); + + /** RbmSuggestedReply text. */ + public text: string; + + /** RbmSuggestedReply postbackData. */ + public postbackData: string; + + /** + * Creates a new RbmSuggestedReply instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmSuggestedReply instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply; + + /** + * Encodes the specified RbmSuggestedReply message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.verify|verify} messages. + * @param message RbmSuggestedReply message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmSuggestedReply message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.verify|verify} messages. + * @param message RbmSuggestedReply message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmSuggestedReply message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmSuggestedReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply; + + /** + * Decodes a RbmSuggestedReply message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmSuggestedReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply; + + /** + * Verifies a RbmSuggestedReply message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmSuggestedReply message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmSuggestedReply + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply; + + /** + * Creates a plain object from a RbmSuggestedReply message. Also converts values to other types if specified. + * @param message RbmSuggestedReply + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmSuggestedReply to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmSuggestedReply + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RbmSuggestedAction. */ + interface IRbmSuggestedAction { + + /** RbmSuggestedAction text */ + text?: (string|null); + + /** RbmSuggestedAction postbackData */ + postbackData?: (string|null); + + /** RbmSuggestedAction dial */ + dial?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial|null); + + /** RbmSuggestedAction openUrl */ + openUrl?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri|null); + + /** RbmSuggestedAction shareLocation */ + shareLocation?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation|null); + } + + /** Represents a RbmSuggestedAction. */ + class RbmSuggestedAction implements IRbmSuggestedAction { + + /** + * Constructs a new RbmSuggestedAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction); + + /** RbmSuggestedAction text. */ + public text: string; + + /** RbmSuggestedAction postbackData. */ + public postbackData: string; + + /** RbmSuggestedAction dial. */ + public dial?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial|null); + + /** RbmSuggestedAction openUrl. */ + public openUrl?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri|null); + + /** RbmSuggestedAction shareLocation. */ + public shareLocation?: (google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation|null); + + /** RbmSuggestedAction action. */ + public action?: ("dial"|"openUrl"|"shareLocation"); + + /** + * Creates a new RbmSuggestedAction instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmSuggestedAction instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction; + + /** + * Encodes the specified RbmSuggestedAction message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.verify|verify} messages. + * @param message RbmSuggestedAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmSuggestedAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.verify|verify} messages. + * @param message RbmSuggestedAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmSuggestedAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmSuggestedAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction; + + /** + * Decodes a RbmSuggestedAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmSuggestedAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction; + + /** + * Verifies a RbmSuggestedAction message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmSuggestedAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmSuggestedAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction; + + /** + * Creates a plain object from a RbmSuggestedAction message. Also converts values to other types if specified. + * @param message RbmSuggestedAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmSuggestedAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmSuggestedAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace RbmSuggestedAction { + + /** Properties of a RbmSuggestedActionDial. */ + interface IRbmSuggestedActionDial { + + /** RbmSuggestedActionDial phoneNumber */ + phoneNumber?: (string|null); + } + + /** Represents a RbmSuggestedActionDial. */ + class RbmSuggestedActionDial implements IRbmSuggestedActionDial { + + /** + * Constructs a new RbmSuggestedActionDial. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial); + + /** RbmSuggestedActionDial phoneNumber. */ + public phoneNumber: string; + + /** + * Creates a new RbmSuggestedActionDial instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmSuggestedActionDial instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial; + + /** + * Encodes the specified RbmSuggestedActionDial message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.verify|verify} messages. + * @param message RbmSuggestedActionDial message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmSuggestedActionDial message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.verify|verify} messages. + * @param message RbmSuggestedActionDial message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmSuggestedActionDial message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmSuggestedActionDial + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial; + + /** + * Decodes a RbmSuggestedActionDial message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmSuggestedActionDial + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial; + + /** + * Verifies a RbmSuggestedActionDial message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmSuggestedActionDial message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmSuggestedActionDial + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial; + + /** + * Creates a plain object from a RbmSuggestedActionDial message. Also converts values to other types if specified. + * @param message RbmSuggestedActionDial + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmSuggestedActionDial to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmSuggestedActionDial + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RbmSuggestedActionOpenUri. */ + interface IRbmSuggestedActionOpenUri { + + /** RbmSuggestedActionOpenUri uri */ + uri?: (string|null); + } + + /** Represents a RbmSuggestedActionOpenUri. */ + class RbmSuggestedActionOpenUri implements IRbmSuggestedActionOpenUri { + + /** + * Constructs a new RbmSuggestedActionOpenUri. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri); + + /** RbmSuggestedActionOpenUri uri. */ + public uri: string; + + /** + * Creates a new RbmSuggestedActionOpenUri instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmSuggestedActionOpenUri instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri; + + /** + * Encodes the specified RbmSuggestedActionOpenUri message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.verify|verify} messages. + * @param message RbmSuggestedActionOpenUri message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmSuggestedActionOpenUri message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.verify|verify} messages. + * @param message RbmSuggestedActionOpenUri message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmSuggestedActionOpenUri message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmSuggestedActionOpenUri + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri; + + /** + * Decodes a RbmSuggestedActionOpenUri message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmSuggestedActionOpenUri + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri; + + /** + * Verifies a RbmSuggestedActionOpenUri message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmSuggestedActionOpenUri message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmSuggestedActionOpenUri + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri; + + /** + * Creates a plain object from a RbmSuggestedActionOpenUri message. Also converts values to other types if specified. + * @param message RbmSuggestedActionOpenUri + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmSuggestedActionOpenUri to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmSuggestedActionOpenUri + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RbmSuggestedActionShareLocation. */ + interface IRbmSuggestedActionShareLocation { + } + + /** Represents a RbmSuggestedActionShareLocation. */ + class RbmSuggestedActionShareLocation implements IRbmSuggestedActionShareLocation { + + /** + * Constructs a new RbmSuggestedActionShareLocation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation); + + /** + * Creates a new RbmSuggestedActionShareLocation instance using the specified properties. + * @param [properties] Properties to set + * @returns RbmSuggestedActionShareLocation instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation; + + /** + * Encodes the specified RbmSuggestedActionShareLocation message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation.verify|verify} messages. + * @param message RbmSuggestedActionShareLocation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RbmSuggestedActionShareLocation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation.verify|verify} messages. + * @param message RbmSuggestedActionShareLocation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RbmSuggestedActionShareLocation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RbmSuggestedActionShareLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation; + + /** + * Decodes a RbmSuggestedActionShareLocation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RbmSuggestedActionShareLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation; + + /** + * Verifies a RbmSuggestedActionShareLocation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RbmSuggestedActionShareLocation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RbmSuggestedActionShareLocation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation; + + /** + * Creates a plain object from a RbmSuggestedActionShareLocation message. Also converts values to other types if specified. + * @param message RbmSuggestedActionShareLocation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RbmSuggestedActionShareLocation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RbmSuggestedActionShareLocation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a MediaContent. */ + interface IMediaContent { + + /** MediaContent mediaType */ + mediaType?: (google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType|null); + + /** MediaContent mediaObjects */ + mediaObjects?: (google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject[]|null); + } + + /** Represents a MediaContent. */ + class MediaContent implements IMediaContent { + + /** + * Constructs a new MediaContent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent); + + /** MediaContent mediaType. */ + public mediaType: (google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType); + + /** MediaContent mediaObjects. */ + public mediaObjects: google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject[]; + + /** + * Creates a new MediaContent instance using the specified properties. + * @param [properties] Properties to set + * @returns MediaContent instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent): google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent; + + /** + * Encodes the specified MediaContent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.verify|verify} messages. + * @param message MediaContent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MediaContent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.verify|verify} messages. + * @param message MediaContent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MediaContent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MediaContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent; + + /** + * Decodes a MediaContent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MediaContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent; + + /** + * Verifies a MediaContent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MediaContent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MediaContent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent; + + /** + * Creates a plain object from a MediaContent message. Also converts values to other types if specified. + * @param message MediaContent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MediaContent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MediaContent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MediaContent { + + /** ResponseMediaType enum. */ + enum ResponseMediaType { + RESPONSE_MEDIA_TYPE_UNSPECIFIED = 0, + AUDIO = 1 + } + + /** Properties of a ResponseMediaObject. */ + interface IResponseMediaObject { + + /** ResponseMediaObject name */ + name?: (string|null); + + /** ResponseMediaObject description */ + description?: (string|null); + + /** ResponseMediaObject largeImage */ + largeImage?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** ResponseMediaObject icon */ + icon?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** ResponseMediaObject contentUrl */ + contentUrl?: (string|null); + } + + /** Represents a ResponseMediaObject. */ + class ResponseMediaObject implements IResponseMediaObject { + + /** + * Constructs a new ResponseMediaObject. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject); + + /** ResponseMediaObject name. */ + public name: string; + + /** ResponseMediaObject description. */ + public description: string; + + /** ResponseMediaObject largeImage. */ + public largeImage?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** ResponseMediaObject icon. */ + public icon?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** ResponseMediaObject contentUrl. */ + public contentUrl: string; + + /** ResponseMediaObject image. */ + public image?: ("largeImage"|"icon"); + + /** + * Creates a new ResponseMediaObject instance using the specified properties. + * @param [properties] Properties to set + * @returns ResponseMediaObject instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject): google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject; + + /** + * Encodes the specified ResponseMediaObject message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.verify|verify} messages. + * @param message ResponseMediaObject message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResponseMediaObject message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.verify|verify} messages. + * @param message ResponseMediaObject message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResponseMediaObject message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResponseMediaObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject; + + /** + * Decodes a ResponseMediaObject message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResponseMediaObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject; + + /** + * Verifies a ResponseMediaObject message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResponseMediaObject message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResponseMediaObject + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject; + + /** + * Creates a plain object from a ResponseMediaObject message. Also converts values to other types if specified. + * @param message ResponseMediaObject + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResponseMediaObject to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResponseMediaObject + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a BrowseCarouselCard. */ + interface IBrowseCarouselCard { + + /** BrowseCarouselCard items */ + items?: (google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem[]|null); + + /** BrowseCarouselCard imageDisplayOptions */ + imageDisplayOptions?: (google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions|null); + } + + /** Represents a BrowseCarouselCard. */ + class BrowseCarouselCard implements IBrowseCarouselCard { + + /** + * Constructs a new BrowseCarouselCard. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard); + + /** BrowseCarouselCard items. */ + public items: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem[]; + + /** BrowseCarouselCard imageDisplayOptions. */ + public imageDisplayOptions: (google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions); + + /** + * Creates a new BrowseCarouselCard instance using the specified properties. + * @param [properties] Properties to set + * @returns BrowseCarouselCard instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard; + + /** + * Encodes the specified BrowseCarouselCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.verify|verify} messages. + * @param message BrowseCarouselCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BrowseCarouselCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.verify|verify} messages. + * @param message BrowseCarouselCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BrowseCarouselCard message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BrowseCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard; + + /** + * Decodes a BrowseCarouselCard message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BrowseCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard; + + /** + * Verifies a BrowseCarouselCard message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BrowseCarouselCard message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BrowseCarouselCard + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard; + + /** + * Creates a plain object from a BrowseCarouselCard message. Also converts values to other types if specified. + * @param message BrowseCarouselCard + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BrowseCarouselCard to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BrowseCarouselCard + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BrowseCarouselCard { + + /** Properties of a BrowseCarouselCardItem. */ + interface IBrowseCarouselCardItem { + + /** BrowseCarouselCardItem openUriAction */ + openUriAction?: (google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction|null); + + /** BrowseCarouselCardItem title */ + title?: (string|null); + + /** BrowseCarouselCardItem description */ + description?: (string|null); + + /** BrowseCarouselCardItem image */ + image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** BrowseCarouselCardItem footer */ + footer?: (string|null); + } + + /** Represents a BrowseCarouselCardItem. */ + class BrowseCarouselCardItem implements IBrowseCarouselCardItem { + + /** + * Constructs a new BrowseCarouselCardItem. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem); + + /** BrowseCarouselCardItem openUriAction. */ + public openUriAction?: (google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction|null); + + /** BrowseCarouselCardItem title. */ + public title: string; + + /** BrowseCarouselCardItem description. */ + public description: string; + + /** BrowseCarouselCardItem image. */ + public image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** BrowseCarouselCardItem footer. */ + public footer: string; + + /** + * Creates a new BrowseCarouselCardItem instance using the specified properties. + * @param [properties] Properties to set + * @returns BrowseCarouselCardItem instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem; + + /** + * Encodes the specified BrowseCarouselCardItem message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify|verify} messages. + * @param message BrowseCarouselCardItem message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BrowseCarouselCardItem message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify|verify} messages. + * @param message BrowseCarouselCardItem message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BrowseCarouselCardItem message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BrowseCarouselCardItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem; + + /** + * Decodes a BrowseCarouselCardItem message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BrowseCarouselCardItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem; + + /** + * Verifies a BrowseCarouselCardItem message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BrowseCarouselCardItem message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BrowseCarouselCardItem + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem; + + /** + * Creates a plain object from a BrowseCarouselCardItem message. Also converts values to other types if specified. + * @param message BrowseCarouselCardItem + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BrowseCarouselCardItem to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BrowseCarouselCardItem + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BrowseCarouselCardItem { + + /** Properties of an OpenUrlAction. */ + interface IOpenUrlAction { + + /** OpenUrlAction url */ + url?: (string|null); + + /** OpenUrlAction urlTypeHint */ + urlTypeHint?: (google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint|null); + } + + /** Represents an OpenUrlAction. */ + class OpenUrlAction implements IOpenUrlAction { + + /** + * Constructs a new OpenUrlAction. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction); + + /** OpenUrlAction url. */ + public url: string; + + /** OpenUrlAction urlTypeHint. */ + public urlTypeHint: (google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint); + + /** + * Creates a new OpenUrlAction instance using the specified properties. + * @param [properties] Properties to set + * @returns OpenUrlAction instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction; + + /** + * Encodes the specified OpenUrlAction message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify|verify} messages. + * @param message OpenUrlAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OpenUrlAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify|verify} messages. + * @param message OpenUrlAction message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OpenUrlAction message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OpenUrlAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction; + + /** + * Decodes an OpenUrlAction message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OpenUrlAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction; + + /** + * Verifies an OpenUrlAction message. + * @param message Plain 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 OpenUrlAction message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OpenUrlAction + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction; + + /** + * Creates a plain object from an OpenUrlAction message. Also converts values to other types if specified. + * @param message OpenUrlAction + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OpenUrlAction to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OpenUrlAction + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace OpenUrlAction { + + /** UrlTypeHint enum. */ + enum UrlTypeHint { + URL_TYPE_HINT_UNSPECIFIED = 0, + AMP_ACTION = 1, + AMP_CONTENT = 2 + } + } + } + + /** ImageDisplayOptions enum. */ + enum ImageDisplayOptions { + IMAGE_DISPLAY_OPTIONS_UNSPECIFIED = 0, + GRAY = 1, + WHITE = 2, + CROPPED = 3, + BLURRED_BACKGROUND = 4 + } + } + + /** Properties of a TableCard. */ + interface ITableCard { + + /** TableCard title */ + title?: (string|null); + + /** TableCard subtitle */ + subtitle?: (string|null); + + /** TableCard image */ + image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** TableCard columnProperties */ + columnProperties?: (google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties[]|null); + + /** TableCard rows */ + rows?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow[]|null); + + /** TableCard buttons */ + buttons?: (google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton[]|null); + } + + /** Represents a TableCard. */ + class TableCard implements ITableCard { + + /** + * Constructs a new TableCard. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard); + + /** TableCard title. */ + public title: string; + + /** TableCard subtitle. */ + public subtitle: string; + + /** TableCard image. */ + public image?: (google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null); + + /** TableCard columnProperties. */ + public columnProperties: google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties[]; + + /** TableCard rows. */ + public rows: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow[]; + + /** TableCard buttons. */ + public buttons: google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton[]; + + /** + * Creates a new TableCard instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCard instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard): google.cloud.dialogflow.v2beta1.Intent.Message.TableCard; + + /** + * Encodes the specified TableCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.verify|verify} messages. + * @param message TableCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.verify|verify} messages. + * @param message TableCard message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCard message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.TableCard; + + /** + * Decodes a TableCard message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.TableCard; + + /** + * Verifies a TableCard message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCard message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCard + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.TableCard; + + /** + * Creates a plain object from a TableCard message. Also converts values to other types if specified. + * @param message TableCard + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.TableCard, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCard to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCard + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ColumnProperties. */ + interface IColumnProperties { + + /** ColumnProperties header */ + header?: (string|null); + + /** ColumnProperties horizontalAlignment */ + horizontalAlignment?: (google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment|null); + } + + /** Represents a ColumnProperties. */ + class ColumnProperties implements IColumnProperties { + + /** + * Constructs a new ColumnProperties. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties); + + /** ColumnProperties header. */ + public header: string; + + /** ColumnProperties horizontalAlignment. */ + public horizontalAlignment: (google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment|keyof typeof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment); + + /** + * Creates a new ColumnProperties instance using the specified properties. + * @param [properties] Properties to set + * @returns ColumnProperties instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties): google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties; + + /** + * Encodes the specified ColumnProperties message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.verify|verify} messages. + * @param message ColumnProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ColumnProperties message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.verify|verify} messages. + * @param message ColumnProperties message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ColumnProperties message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ColumnProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties; + + /** + * Decodes a ColumnProperties message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ColumnProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties; + + /** + * Verifies a ColumnProperties message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ColumnProperties message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ColumnProperties + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties; + + /** + * Creates a plain object from a ColumnProperties message. Also converts values to other types if specified. + * @param message ColumnProperties + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ColumnProperties to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ColumnProperties + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ColumnProperties { + + /** HorizontalAlignment enum. */ + enum HorizontalAlignment { + HORIZONTAL_ALIGNMENT_UNSPECIFIED = 0, + LEADING = 1, + CENTER = 2, + TRAILING = 3 + } + } + + /** Properties of a TableCardRow. */ + interface ITableCardRow { + + /** TableCardRow cells */ + cells?: (google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell[]|null); + + /** TableCardRow dividerAfter */ + dividerAfter?: (boolean|null); + } + + /** Represents a TableCardRow. */ + class TableCardRow implements ITableCardRow { + + /** + * Constructs a new TableCardRow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow); + + /** TableCardRow cells. */ + public cells: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell[]; + + /** TableCardRow dividerAfter. */ + public dividerAfter: boolean; + + /** + * Creates a new TableCardRow instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCardRow instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow): google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow; + + /** + * Encodes the specified TableCardRow message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.verify|verify} messages. + * @param message TableCardRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCardRow message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.verify|verify} messages. + * @param message TableCardRow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCardRow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCardRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow; + + /** + * Decodes a TableCardRow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCardRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow; + + /** + * Verifies a TableCardRow message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCardRow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCardRow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow; + + /** + * Creates a plain object from a TableCardRow message. Also converts values to other types if specified. + * @param message TableCardRow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCardRow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCardRow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TableCardCell. */ + interface ITableCardCell { + + /** TableCardCell text */ + text?: (string|null); + } + + /** Represents a TableCardCell. */ + class TableCardCell implements ITableCardCell { + + /** + * Constructs a new TableCardCell. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell); + + /** TableCardCell text. */ + public text: string; + + /** + * Creates a new TableCardCell instance using the specified properties. + * @param [properties] Properties to set + * @returns TableCardCell instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell): google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell; + + /** + * Encodes the specified TableCardCell message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.verify|verify} messages. + * @param message TableCardCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TableCardCell message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.verify|verify} messages. + * @param message TableCardCell message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TableCardCell message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TableCardCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell; + + /** + * Decodes a TableCardCell message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TableCardCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell; + + /** + * Verifies a TableCardCell message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TableCardCell message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TableCardCell + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell; + + /** + * Creates a plain object from a TableCardCell message. Also converts values to other types if specified. + * @param message TableCardCell + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TableCardCell to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TableCardCell + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a FollowupIntentInfo. */ + interface IFollowupIntentInfo { + + /** FollowupIntentInfo followupIntentName */ + followupIntentName?: (string|null); + + /** FollowupIntentInfo parentFollowupIntentName */ + parentFollowupIntentName?: (string|null); + } + + /** Represents a FollowupIntentInfo. */ + class FollowupIntentInfo implements IFollowupIntentInfo { + + /** + * Constructs a new FollowupIntentInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo); + + /** FollowupIntentInfo followupIntentName. */ + public followupIntentName: string; + + /** FollowupIntentInfo parentFollowupIntentName. */ + public parentFollowupIntentName: string; + + /** + * Creates a new FollowupIntentInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns FollowupIntentInfo instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo): google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo; + + /** + * Encodes the specified FollowupIntentInfo message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.verify|verify} messages. + * @param message FollowupIntentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FollowupIntentInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.verify|verify} messages. + * @param message FollowupIntentInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FollowupIntentInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FollowupIntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo; + + /** + * Decodes a FollowupIntentInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FollowupIntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo; + + /** + * Verifies a FollowupIntentInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FollowupIntentInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FollowupIntentInfo + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo; + + /** + * Creates a plain object from a FollowupIntentInfo message. Also converts values to other types if specified. + * @param message FollowupIntentInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FollowupIntentInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FollowupIntentInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ListIntentsRequest. */ + interface IListIntentsRequest { + + /** ListIntentsRequest parent */ + parent?: (string|null); + + /** ListIntentsRequest languageCode */ + languageCode?: (string|null); + + /** ListIntentsRequest intentView */ + intentView?: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView|null); + + /** ListIntentsRequest pageSize */ + pageSize?: (number|null); + + /** ListIntentsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListIntentsRequest. */ + class ListIntentsRequest implements IListIntentsRequest { + + /** + * Constructs a new ListIntentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListIntentsRequest); + + /** ListIntentsRequest parent. */ + public parent: string; + + /** ListIntentsRequest languageCode. */ + public languageCode: string; + + /** ListIntentsRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView); + + /** ListIntentsRequest pageSize. */ + public pageSize: number; + + /** ListIntentsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListIntentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListIntentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListIntentsRequest): google.cloud.dialogflow.v2beta1.ListIntentsRequest; + + /** + * Encodes the specified ListIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListIntentsRequest.verify|verify} messages. + * @param message ListIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListIntentsRequest.verify|verify} messages. + * @param message ListIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListIntentsRequest; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListIntentsRequest; + + /** + * Verifies a ListIntentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListIntentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListIntentsRequest; + + /** + * Creates a plain object from a ListIntentsRequest message. Also converts values to other types if specified. + * @param message ListIntentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListIntentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListIntentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListIntentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListIntentsResponse. */ + interface IListIntentsResponse { + + /** ListIntentsResponse intents */ + intents?: (google.cloud.dialogflow.v2beta1.IIntent[]|null); + + /** ListIntentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListIntentsResponse. */ + class ListIntentsResponse implements IListIntentsResponse { + + /** + * Constructs a new ListIntentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListIntentsResponse); + + /** ListIntentsResponse intents. */ + public intents: google.cloud.dialogflow.v2beta1.IIntent[]; + + /** ListIntentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListIntentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListIntentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListIntentsResponse): google.cloud.dialogflow.v2beta1.ListIntentsResponse; + + /** + * Encodes the specified ListIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListIntentsResponse.verify|verify} messages. + * @param message ListIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListIntentsResponse.verify|verify} messages. + * @param message ListIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListIntentsResponse; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListIntentsResponse; + + /** + * Verifies a ListIntentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListIntentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListIntentsResponse; + + /** + * Creates a plain object from a ListIntentsResponse message. Also converts values to other types if specified. + * @param message ListIntentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListIntentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListIntentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListIntentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetIntentRequest. */ + interface IGetIntentRequest { + + /** GetIntentRequest name */ + name?: (string|null); + + /** GetIntentRequest languageCode */ + languageCode?: (string|null); + + /** GetIntentRequest intentView */ + intentView?: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView|null); + } + + /** Represents a GetIntentRequest. */ + class GetIntentRequest implements IGetIntentRequest { + + /** + * Constructs a new GetIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetIntentRequest); + + /** GetIntentRequest name. */ + public name: string; + + /** GetIntentRequest languageCode. */ + public languageCode: string; + + /** GetIntentRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView); + + /** + * Creates a new GetIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetIntentRequest): google.cloud.dialogflow.v2beta1.GetIntentRequest; + + /** + * Encodes the specified GetIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetIntentRequest.verify|verify} messages. + * @param message GetIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetIntentRequest.verify|verify} messages. + * @param message GetIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetIntentRequest; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetIntentRequest; + + /** + * Verifies a GetIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetIntentRequest; + + /** + * Creates a plain object from a GetIntentRequest message. Also converts values to other types if specified. + * @param message GetIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateIntentRequest. */ + interface ICreateIntentRequest { + + /** CreateIntentRequest parent */ + parent?: (string|null); + + /** CreateIntentRequest intent */ + intent?: (google.cloud.dialogflow.v2beta1.IIntent|null); + + /** CreateIntentRequest languageCode */ + languageCode?: (string|null); + + /** CreateIntentRequest intentView */ + intentView?: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView|null); + } + + /** Represents a CreateIntentRequest. */ + class CreateIntentRequest implements ICreateIntentRequest { + + /** + * Constructs a new CreateIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateIntentRequest); + + /** CreateIntentRequest parent. */ + public parent: string; + + /** CreateIntentRequest intent. */ + public intent?: (google.cloud.dialogflow.v2beta1.IIntent|null); + + /** CreateIntentRequest languageCode. */ + public languageCode: string; + + /** CreateIntentRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView); + + /** + * Creates a new CreateIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateIntentRequest): google.cloud.dialogflow.v2beta1.CreateIntentRequest; + + /** + * Encodes the specified CreateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateIntentRequest.verify|verify} messages. + * @param message CreateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateIntentRequest.verify|verify} messages. + * @param message CreateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateIntentRequest; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateIntentRequest; + + /** + * Verifies a CreateIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateIntentRequest; + + /** + * Creates a plain object from a CreateIntentRequest message. Also converts values to other types if specified. + * @param message CreateIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateIntentRequest. */ + interface IUpdateIntentRequest { + + /** UpdateIntentRequest intent */ + intent?: (google.cloud.dialogflow.v2beta1.IIntent|null); + + /** UpdateIntentRequest languageCode */ + languageCode?: (string|null); + + /** UpdateIntentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateIntentRequest intentView */ + intentView?: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView|null); + } + + /** Represents an UpdateIntentRequest. */ + class UpdateIntentRequest implements IUpdateIntentRequest { + + /** + * Constructs a new UpdateIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateIntentRequest); + + /** UpdateIntentRequest intent. */ + public intent?: (google.cloud.dialogflow.v2beta1.IIntent|null); + + /** UpdateIntentRequest languageCode. */ + public languageCode: string; + + /** UpdateIntentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateIntentRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView); + + /** + * Creates a new UpdateIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateIntentRequest): google.cloud.dialogflow.v2beta1.UpdateIntentRequest; + + /** + * Encodes the specified UpdateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateIntentRequest.verify|verify} messages. + * @param message UpdateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateIntentRequest.verify|verify} messages. + * @param message UpdateIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateIntentRequest; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateIntentRequest; + + /** + * Verifies an UpdateIntentRequest message. + * @param message Plain 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 UpdateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateIntentRequest; + + /** + * Creates a plain object from an UpdateIntentRequest message. Also converts values to other types if specified. + * @param message UpdateIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteIntentRequest. */ + interface IDeleteIntentRequest { + + /** DeleteIntentRequest name */ + name?: (string|null); + } + + /** Represents a DeleteIntentRequest. */ + class DeleteIntentRequest implements IDeleteIntentRequest { + + /** + * Constructs a new DeleteIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteIntentRequest); + + /** DeleteIntentRequest name. */ + public name: string; + + /** + * Creates a new DeleteIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteIntentRequest): google.cloud.dialogflow.v2beta1.DeleteIntentRequest; + + /** + * Encodes the specified DeleteIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteIntentRequest.verify|verify} messages. + * @param message DeleteIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteIntentRequest.verify|verify} messages. + * @param message DeleteIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteIntentRequest; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteIntentRequest; + + /** + * Verifies a DeleteIntentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteIntentRequest; + + /** + * Creates a plain object from a DeleteIntentRequest message. Also converts values to other types if specified. + * @param message DeleteIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteIntentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateIntentsRequest. */ + interface IBatchUpdateIntentsRequest { + + /** BatchUpdateIntentsRequest parent */ + parent?: (string|null); + + /** BatchUpdateIntentsRequest intentBatchUri */ + intentBatchUri?: (string|null); + + /** BatchUpdateIntentsRequest intentBatchInline */ + intentBatchInline?: (google.cloud.dialogflow.v2beta1.IIntentBatch|null); + + /** BatchUpdateIntentsRequest languageCode */ + languageCode?: (string|null); + + /** BatchUpdateIntentsRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** BatchUpdateIntentsRequest intentView */ + intentView?: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView|null); + } + + /** Represents a BatchUpdateIntentsRequest. */ + class BatchUpdateIntentsRequest implements IBatchUpdateIntentsRequest { + + /** + * Constructs a new BatchUpdateIntentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest); + + /** BatchUpdateIntentsRequest parent. */ + public parent: string; + + /** BatchUpdateIntentsRequest intentBatchUri. */ + public intentBatchUri?: (string|null); + + /** BatchUpdateIntentsRequest intentBatchInline. */ + public intentBatchInline?: (google.cloud.dialogflow.v2beta1.IIntentBatch|null); + + /** BatchUpdateIntentsRequest languageCode. */ + public languageCode: string; + + /** BatchUpdateIntentsRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** BatchUpdateIntentsRequest intentView. */ + public intentView: (google.cloud.dialogflow.v2beta1.IntentView|keyof typeof google.cloud.dialogflow.v2beta1.IntentView); + + /** BatchUpdateIntentsRequest intentBatch. */ + public intentBatch?: ("intentBatchUri"|"intentBatchInline"); + + /** + * Creates a new BatchUpdateIntentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateIntentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest): google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest; + + /** + * Encodes the specified BatchUpdateIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.verify|verify} messages. + * @param message BatchUpdateIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.verify|verify} messages. + * @param message BatchUpdateIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateIntentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest; + + /** + * Decodes a BatchUpdateIntentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest; + + /** + * Verifies a BatchUpdateIntentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateIntentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest; + + /** + * Creates a plain object from a BatchUpdateIntentsRequest message. Also converts values to other types if specified. + * @param message BatchUpdateIntentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateIntentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateIntentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateIntentsResponse. */ + interface IBatchUpdateIntentsResponse { + + /** BatchUpdateIntentsResponse intents */ + intents?: (google.cloud.dialogflow.v2beta1.IIntent[]|null); + } + + /** Represents a BatchUpdateIntentsResponse. */ + class BatchUpdateIntentsResponse implements IBatchUpdateIntentsResponse { + + /** + * Constructs a new BatchUpdateIntentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse); + + /** BatchUpdateIntentsResponse intents. */ + public intents: google.cloud.dialogflow.v2beta1.IIntent[]; + + /** + * Creates a new BatchUpdateIntentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateIntentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse): google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse; + + /** + * Encodes the specified BatchUpdateIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse.verify|verify} messages. + * @param message BatchUpdateIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse.verify|verify} messages. + * @param message BatchUpdateIntentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateIntentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse; + + /** + * Decodes a BatchUpdateIntentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse; + + /** + * Verifies a BatchUpdateIntentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateIntentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse; + + /** + * Creates a plain object from a BatchUpdateIntentsResponse message. Also converts values to other types if specified. + * @param message BatchUpdateIntentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateIntentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateIntentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDeleteIntentsRequest. */ + interface IBatchDeleteIntentsRequest { + + /** BatchDeleteIntentsRequest parent */ + parent?: (string|null); + + /** BatchDeleteIntentsRequest intents */ + intents?: (google.cloud.dialogflow.v2beta1.IIntent[]|null); + } + + /** Represents a BatchDeleteIntentsRequest. */ + class BatchDeleteIntentsRequest implements IBatchDeleteIntentsRequest { + + /** + * Constructs a new BatchDeleteIntentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest); + + /** BatchDeleteIntentsRequest parent. */ + public parent: string; + + /** BatchDeleteIntentsRequest intents. */ + public intents: google.cloud.dialogflow.v2beta1.IIntent[]; + + /** + * Creates a new BatchDeleteIntentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDeleteIntentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest): google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest; + + /** + * Encodes the specified BatchDeleteIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest.verify|verify} messages. + * @param message BatchDeleteIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDeleteIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest.verify|verify} messages. + * @param message BatchDeleteIntentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDeleteIntentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDeleteIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest; + + /** + * Decodes a BatchDeleteIntentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDeleteIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest; + + /** + * Verifies a BatchDeleteIntentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDeleteIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDeleteIntentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest; + + /** + * Creates a plain object from a BatchDeleteIntentsRequest message. Also converts values to other types if specified. + * @param message BatchDeleteIntentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDeleteIntentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDeleteIntentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** IntentView enum. */ + enum IntentView { + INTENT_VIEW_UNSPECIFIED = 0, + INTENT_VIEW_FULL = 1 + } + + /** Properties of an IntentBatch. */ + interface IIntentBatch { + + /** IntentBatch intents */ + intents?: (google.cloud.dialogflow.v2beta1.IIntent[]|null); + } + + /** Represents an IntentBatch. */ + class IntentBatch implements IIntentBatch { + + /** + * Constructs a new IntentBatch. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IIntentBatch); + + /** IntentBatch intents. */ + public intents: google.cloud.dialogflow.v2beta1.IIntent[]; + + /** + * Creates a new IntentBatch instance using the specified properties. + * @param [properties] Properties to set + * @returns IntentBatch instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IIntentBatch): google.cloud.dialogflow.v2beta1.IntentBatch; + + /** + * Encodes the specified IntentBatch message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.IntentBatch.verify|verify} messages. + * @param message IntentBatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IIntentBatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IntentBatch message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.IntentBatch.verify|verify} messages. + * @param message IntentBatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IIntentBatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IntentBatch message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IntentBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.IntentBatch; + + /** + * Decodes an IntentBatch message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IntentBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.IntentBatch; + + /** + * Verifies an IntentBatch message. + * @param message Plain 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 IntentBatch message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IntentBatch + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.IntentBatch; + + /** + * Creates a plain object from an IntentBatch message. Also converts values to other types if specified. + * @param message IntentBatch + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.IntentBatch, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IntentBatch to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IntentBatch + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SessionEntityTypes */ + class SessionEntityTypes extends $protobuf.rpc.Service { + + /** + * Constructs a new SessionEntityTypes 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 SessionEntityTypes 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): SessionEntityTypes; + + /** + * Calls ListSessionEntityTypes. + * @param request ListSessionEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSessionEntityTypesResponse + */ + public listSessionEntityTypes(request: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, callback: google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypesCallback): void; + + /** + * Calls ListSessionEntityTypes. + * @param request ListSessionEntityTypesRequest message or plain object + * @returns Promise + */ + public listSessionEntityTypes(request: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest): Promise; + + /** + * Calls GetSessionEntityType. + * @param request GetSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SessionEntityType + */ + public getSessionEntityType(request: google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, callback: google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityTypeCallback): void; + + /** + * Calls GetSessionEntityType. + * @param request GetSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public getSessionEntityType(request: google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest): Promise; + + /** + * Calls CreateSessionEntityType. + * @param request CreateSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SessionEntityType + */ + public createSessionEntityType(request: google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, callback: google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityTypeCallback): void; + + /** + * Calls CreateSessionEntityType. + * @param request CreateSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public createSessionEntityType(request: google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest): Promise; + + /** + * Calls UpdateSessionEntityType. + * @param request UpdateSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SessionEntityType + */ + public updateSessionEntityType(request: google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, callback: google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityTypeCallback): void; + + /** + * Calls UpdateSessionEntityType. + * @param request UpdateSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public updateSessionEntityType(request: google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest): Promise; + + /** + * Calls DeleteSessionEntityType. + * @param request DeleteSessionEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteSessionEntityType(request: google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, callback: google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityTypeCallback): void; + + /** + * Calls DeleteSessionEntityType. + * @param request DeleteSessionEntityTypeRequest message or plain object + * @returns Promise + */ + public deleteSessionEntityType(request: google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest): Promise; + } + + namespace SessionEntityTypes { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|listSessionEntityTypes}. + * @param error Error, if any + * @param [response] ListSessionEntityTypesResponse + */ + type ListSessionEntityTypesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|getSessionEntityType}. + * @param error Error, if any + * @param [response] SessionEntityType + */ + type GetSessionEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.SessionEntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|createSessionEntityType}. + * @param error Error, if any + * @param [response] SessionEntityType + */ + type CreateSessionEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.SessionEntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|updateSessionEntityType}. + * @param error Error, if any + * @param [response] SessionEntityType + */ + type UpdateSessionEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.SessionEntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|deleteSessionEntityType}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteSessionEntityTypeCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a SessionEntityType. */ + interface ISessionEntityType { + + /** SessionEntityType name */ + name?: (string|null); + + /** SessionEntityType entityOverrideMode */ + entityOverrideMode?: (google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode|keyof typeof google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode|null); + + /** SessionEntityType entities */ + entities?: (google.cloud.dialogflow.v2beta1.EntityType.IEntity[]|null); + } + + /** Represents a SessionEntityType. */ + class SessionEntityType implements ISessionEntityType { + + /** + * Constructs a new SessionEntityType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISessionEntityType); + + /** SessionEntityType name. */ + public name: string; + + /** SessionEntityType entityOverrideMode. */ + public entityOverrideMode: (google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode|keyof typeof google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode); + + /** SessionEntityType entities. */ + public entities: google.cloud.dialogflow.v2beta1.EntityType.IEntity[]; + + /** + * Creates a new SessionEntityType instance using the specified properties. + * @param [properties] Properties to set + * @returns SessionEntityType instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISessionEntityType): google.cloud.dialogflow.v2beta1.SessionEntityType; + + /** + * Encodes the specified SessionEntityType message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SessionEntityType.verify|verify} messages. + * @param message SessionEntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISessionEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SessionEntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SessionEntityType.verify|verify} messages. + * @param message SessionEntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISessionEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SessionEntityType; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SessionEntityType; + + /** + * Verifies a SessionEntityType message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SessionEntityType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SessionEntityType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SessionEntityType; + + /** + * Creates a plain object from a SessionEntityType message. Also converts values to other types if specified. + * @param message SessionEntityType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SessionEntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SessionEntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SessionEntityType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SessionEntityType { + + /** EntityOverrideMode enum. */ + enum EntityOverrideMode { + ENTITY_OVERRIDE_MODE_UNSPECIFIED = 0, + ENTITY_OVERRIDE_MODE_OVERRIDE = 1, + ENTITY_OVERRIDE_MODE_SUPPLEMENT = 2 + } + } + + /** Properties of a ListSessionEntityTypesRequest. */ + interface IListSessionEntityTypesRequest { + + /** ListSessionEntityTypesRequest parent */ + parent?: (string|null); + + /** ListSessionEntityTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListSessionEntityTypesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListSessionEntityTypesRequest. */ + class ListSessionEntityTypesRequest implements IListSessionEntityTypesRequest { + + /** + * Constructs a new ListSessionEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest); + + /** ListSessionEntityTypesRequest parent. */ + public parent: string; + + /** ListSessionEntityTypesRequest pageSize. */ + public pageSize: number; + + /** ListSessionEntityTypesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListSessionEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSessionEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest): google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest; + + /** + * Encodes the specified ListSessionEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest.verify|verify} messages. + * @param message ListSessionEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSessionEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest.verify|verify} messages. + * @param message ListSessionEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest; + + /** + * Verifies a ListSessionEntityTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSessionEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSessionEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest; + + /** + * Creates a plain object from a ListSessionEntityTypesRequest message. Also converts values to other types if specified. + * @param message ListSessionEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSessionEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSessionEntityTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSessionEntityTypesResponse. */ + interface IListSessionEntityTypesResponse { + + /** ListSessionEntityTypesResponse sessionEntityTypes */ + sessionEntityTypes?: (google.cloud.dialogflow.v2beta1.ISessionEntityType[]|null); + + /** ListSessionEntityTypesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListSessionEntityTypesResponse. */ + class ListSessionEntityTypesResponse implements IListSessionEntityTypesResponse { + + /** + * Constructs a new ListSessionEntityTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse); + + /** ListSessionEntityTypesResponse sessionEntityTypes. */ + public sessionEntityTypes: google.cloud.dialogflow.v2beta1.ISessionEntityType[]; + + /** ListSessionEntityTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListSessionEntityTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSessionEntityTypesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse): google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse; + + /** + * Encodes the specified ListSessionEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse.verify|verify} messages. + * @param message ListSessionEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSessionEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse.verify|verify} messages. + * @param message ListSessionEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse; + + /** + * Verifies a ListSessionEntityTypesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSessionEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSessionEntityTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse; + + /** + * Creates a plain object from a ListSessionEntityTypesResponse message. Also converts values to other types if specified. + * @param message ListSessionEntityTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSessionEntityTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSessionEntityTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetSessionEntityTypeRequest. */ + interface IGetSessionEntityTypeRequest { + + /** GetSessionEntityTypeRequest name */ + name?: (string|null); + } + + /** Represents a GetSessionEntityTypeRequest. */ + class GetSessionEntityTypeRequest implements IGetSessionEntityTypeRequest { + + /** + * Constructs a new GetSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest); + + /** GetSessionEntityTypeRequest name. */ + public name: string; + + /** + * Creates a new GetSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest): google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest; + + /** + * Encodes the specified GetSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest.verify|verify} messages. + * @param message GetSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest.verify|verify} messages. + * @param message GetSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest; + + /** + * Verifies a GetSessionEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest; + + /** + * Creates a plain object from a GetSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message GetSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetSessionEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateSessionEntityTypeRequest. */ + interface ICreateSessionEntityTypeRequest { + + /** CreateSessionEntityTypeRequest parent */ + parent?: (string|null); + + /** CreateSessionEntityTypeRequest sessionEntityType */ + sessionEntityType?: (google.cloud.dialogflow.v2beta1.ISessionEntityType|null); + } + + /** Represents a CreateSessionEntityTypeRequest. */ + class CreateSessionEntityTypeRequest implements ICreateSessionEntityTypeRequest { + + /** + * Constructs a new CreateSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest); + + /** CreateSessionEntityTypeRequest parent. */ + public parent: string; + + /** CreateSessionEntityTypeRequest sessionEntityType. */ + public sessionEntityType?: (google.cloud.dialogflow.v2beta1.ISessionEntityType|null); + + /** + * Creates a new CreateSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest): google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest.verify|verify} messages. + * @param message CreateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest.verify|verify} messages. + * @param message CreateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest; + + /** + * Verifies a CreateSessionEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest; + + /** + * Creates a plain object from a CreateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message CreateSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateSessionEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateSessionEntityTypeRequest. */ + interface IUpdateSessionEntityTypeRequest { + + /** UpdateSessionEntityTypeRequest sessionEntityType */ + sessionEntityType?: (google.cloud.dialogflow.v2beta1.ISessionEntityType|null); + + /** UpdateSessionEntityTypeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateSessionEntityTypeRequest. */ + class UpdateSessionEntityTypeRequest implements IUpdateSessionEntityTypeRequest { + + /** + * Constructs a new UpdateSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest); + + /** UpdateSessionEntityTypeRequest sessionEntityType. */ + public sessionEntityType?: (google.cloud.dialogflow.v2beta1.ISessionEntityType|null); + + /** UpdateSessionEntityTypeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest): google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @param message UpdateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @param message UpdateSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest; + + /** + * Verifies an UpdateSessionEntityTypeRequest message. + * @param message Plain 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 UpdateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest; + + /** + * Creates a plain object from an UpdateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message UpdateSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateSessionEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteSessionEntityTypeRequest. */ + interface IDeleteSessionEntityTypeRequest { + + /** DeleteSessionEntityTypeRequest name */ + name?: (string|null); + } + + /** Represents a DeleteSessionEntityTypeRequest. */ + class DeleteSessionEntityTypeRequest implements IDeleteSessionEntityTypeRequest { + + /** + * Constructs a new DeleteSessionEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest); + + /** DeleteSessionEntityTypeRequest name. */ + public name: string; + + /** + * Creates a new DeleteSessionEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSessionEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest): google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @param message DeleteSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @param message DeleteSessionEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest; + + /** + * Verifies a DeleteSessionEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSessionEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest; + + /** + * Creates a plain object from a DeleteSessionEntityTypeRequest message. Also converts values to other types if specified. + * @param message DeleteSessionEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSessionEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteSessionEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents an EntityTypes */ + class EntityTypes extends $protobuf.rpc.Service { + + /** + * Constructs a new EntityTypes 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 EntityTypes 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): EntityTypes; + + /** + * Calls ListEntityTypes. + * @param request ListEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListEntityTypesResponse + */ + public listEntityTypes(request: google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypesCallback): void; + + /** + * Calls ListEntityTypes. + * @param request ListEntityTypesRequest message or plain object + * @returns Promise + */ + public listEntityTypes(request: google.cloud.dialogflow.v2beta1.IListEntityTypesRequest): Promise; + + /** + * Calls GetEntityType. + * @param request GetEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EntityType + */ + public getEntityType(request: google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityTypeCallback): void; + + /** + * Calls GetEntityType. + * @param request GetEntityTypeRequest message or plain object + * @returns Promise + */ + public getEntityType(request: google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest): Promise; + + /** + * Calls CreateEntityType. + * @param request CreateEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EntityType + */ + public createEntityType(request: google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityTypeCallback): void; + + /** + * Calls CreateEntityType. + * @param request CreateEntityTypeRequest message or plain object + * @returns Promise + */ + public createEntityType(request: google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest): Promise; + + /** + * Calls UpdateEntityType. + * @param request UpdateEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EntityType + */ + public updateEntityType(request: google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityTypeCallback): void; + + /** + * Calls UpdateEntityType. + * @param request UpdateEntityTypeRequest message or plain object + * @returns Promise + */ + public updateEntityType(request: google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest): Promise; + + /** + * Calls DeleteEntityType. + * @param request DeleteEntityTypeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteEntityType(request: google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityTypeCallback): void; + + /** + * Calls DeleteEntityType. + * @param request DeleteEntityTypeRequest message or plain object + * @returns Promise + */ + public deleteEntityType(request: google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest): Promise; + + /** + * Calls BatchUpdateEntityTypes. + * @param request BatchUpdateEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchUpdateEntityTypes(request: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypesCallback): void; + + /** + * Calls BatchUpdateEntityTypes. + * @param request BatchUpdateEntityTypesRequest message or plain object + * @returns Promise + */ + public batchUpdateEntityTypes(request: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest): Promise; + + /** + * Calls BatchDeleteEntityTypes. + * @param request BatchDeleteEntityTypesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchDeleteEntityTypes(request: google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypesCallback): void; + + /** + * Calls BatchDeleteEntityTypes. + * @param request BatchDeleteEntityTypesRequest message or plain object + * @returns Promise + */ + public batchDeleteEntityTypes(request: google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest): Promise; + + /** + * Calls BatchCreateEntities. + * @param request BatchCreateEntitiesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchCreateEntities(request: google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntitiesCallback): void; + + /** + * Calls BatchCreateEntities. + * @param request BatchCreateEntitiesRequest message or plain object + * @returns Promise + */ + public batchCreateEntities(request: google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest): Promise; + + /** + * Calls BatchUpdateEntities. + * @param request BatchUpdateEntitiesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchUpdateEntities(request: google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntitiesCallback): void; + + /** + * Calls BatchUpdateEntities. + * @param request BatchUpdateEntitiesRequest message or plain object + * @returns Promise + */ + public batchUpdateEntities(request: google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest): Promise; + + /** + * Calls BatchDeleteEntities. + * @param request BatchDeleteEntitiesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public batchDeleteEntities(request: google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, callback: google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntitiesCallback): void; + + /** + * Calls BatchDeleteEntities. + * @param request BatchDeleteEntitiesRequest message or plain object + * @returns Promise + */ + public batchDeleteEntities(request: google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest): Promise; + } + + namespace EntityTypes { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|listEntityTypes}. + * @param error Error, if any + * @param [response] ListEntityTypesResponse + */ + type ListEntityTypesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListEntityTypesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|getEntityType}. + * @param error Error, if any + * @param [response] EntityType + */ + type GetEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.EntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|createEntityType}. + * @param error Error, if any + * @param [response] EntityType + */ + type CreateEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.EntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|updateEntityType}. + * @param error Error, if any + * @param [response] EntityType + */ + type UpdateEntityTypeCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.EntityType) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|deleteEntityType}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteEntityTypeCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchUpdateEntityTypes}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchUpdateEntityTypesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchDeleteEntityTypes}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchDeleteEntityTypesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchCreateEntities}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchCreateEntitiesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchUpdateEntities}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchUpdateEntitiesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchDeleteEntities}. + * @param error Error, if any + * @param [response] Operation + */ + type BatchDeleteEntitiesCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of an EntityType. */ + interface IEntityType { + + /** EntityType name */ + name?: (string|null); + + /** EntityType displayName */ + displayName?: (string|null); + + /** EntityType kind */ + kind?: (google.cloud.dialogflow.v2beta1.EntityType.Kind|keyof typeof google.cloud.dialogflow.v2beta1.EntityType.Kind|null); + + /** EntityType autoExpansionMode */ + autoExpansionMode?: (google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode|keyof typeof google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode|null); + + /** EntityType entities */ + entities?: (google.cloud.dialogflow.v2beta1.EntityType.IEntity[]|null); + + /** EntityType enableFuzzyExtraction */ + enableFuzzyExtraction?: (boolean|null); + } + + /** Represents an EntityType. */ + class EntityType implements IEntityType { + + /** + * Constructs a new EntityType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IEntityType); + + /** EntityType name. */ + public name: string; + + /** EntityType displayName. */ + public displayName: string; + + /** EntityType kind. */ + public kind: (google.cloud.dialogflow.v2beta1.EntityType.Kind|keyof typeof google.cloud.dialogflow.v2beta1.EntityType.Kind); + + /** EntityType autoExpansionMode. */ + public autoExpansionMode: (google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode|keyof typeof google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode); + + /** EntityType entities. */ + public entities: google.cloud.dialogflow.v2beta1.EntityType.IEntity[]; + + /** EntityType enableFuzzyExtraction. */ + public enableFuzzyExtraction: boolean; + + /** + * Creates a new EntityType instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityType instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IEntityType): google.cloud.dialogflow.v2beta1.EntityType; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityType.verify|verify} messages. + * @param message EntityType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IEntityType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.EntityType; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.EntityType; + + /** + * Verifies an EntityType message. + * @param message Plain 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 EntityType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.EntityType; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @param message EntityType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.EntityType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EntityType { + + /** Kind enum. */ + enum Kind { + KIND_UNSPECIFIED = 0, + KIND_MAP = 1, + KIND_LIST = 2, + KIND_REGEXP = 3 + } + + /** AutoExpansionMode enum. */ + enum AutoExpansionMode { + AUTO_EXPANSION_MODE_UNSPECIFIED = 0, + AUTO_EXPANSION_MODE_DEFAULT = 1 + } + + /** Properties of an Entity. */ + interface IEntity { + + /** Entity value */ + value?: (string|null); + + /** Entity synonyms */ + synonyms?: (string[]|null); + } + + /** Represents an Entity. */ + class Entity implements IEntity { + + /** + * Constructs a new Entity. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.EntityType.IEntity); + + /** Entity value. */ + public value: string; + + /** Entity synonyms. */ + public synonyms: string[]; + + /** + * Creates a new Entity instance using the specified properties. + * @param [properties] Properties to set + * @returns Entity instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.EntityType.IEntity): google.cloud.dialogflow.v2beta1.EntityType.Entity; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityType.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.EntityType.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityType.Entity.verify|verify} messages. + * @param message Entity message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.EntityType.IEntity, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.EntityType.Entity; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.EntityType.Entity; + + /** + * Verifies an Entity message. + * @param message Plain 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 Entity message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entity + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.EntityType.Entity; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @param message Entity + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.EntityType.Entity, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entity to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entity + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ListEntityTypesRequest. */ + interface IListEntityTypesRequest { + + /** ListEntityTypesRequest parent */ + parent?: (string|null); + + /** ListEntityTypesRequest languageCode */ + languageCode?: (string|null); + + /** ListEntityTypesRequest pageSize */ + pageSize?: (number|null); + + /** ListEntityTypesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListEntityTypesRequest. */ + class ListEntityTypesRequest implements IListEntityTypesRequest { + + /** + * Constructs a new ListEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListEntityTypesRequest); + + /** ListEntityTypesRequest parent. */ + public parent: string; + + /** ListEntityTypesRequest languageCode. */ + public languageCode: string; + + /** ListEntityTypesRequest pageSize. */ + public pageSize: number; + + /** ListEntityTypesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListEntityTypesRequest): google.cloud.dialogflow.v2beta1.ListEntityTypesRequest; + + /** + * Encodes the specified ListEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEntityTypesRequest.verify|verify} messages. + * @param message ListEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEntityTypesRequest.verify|verify} messages. + * @param message ListEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListEntityTypesRequest; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListEntityTypesRequest; + + /** + * Verifies a ListEntityTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListEntityTypesRequest; + + /** + * Creates a plain object from a ListEntityTypesRequest message. Also converts values to other types if specified. + * @param message ListEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEntityTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEntityTypesResponse. */ + interface IListEntityTypesResponse { + + /** ListEntityTypesResponse entityTypes */ + entityTypes?: (google.cloud.dialogflow.v2beta1.IEntityType[]|null); + + /** ListEntityTypesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListEntityTypesResponse. */ + class ListEntityTypesResponse implements IListEntityTypesResponse { + + /** + * Constructs a new ListEntityTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListEntityTypesResponse); + + /** ListEntityTypesResponse entityTypes. */ + public entityTypes: google.cloud.dialogflow.v2beta1.IEntityType[]; + + /** ListEntityTypesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListEntityTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEntityTypesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListEntityTypesResponse): google.cloud.dialogflow.v2beta1.ListEntityTypesResponse; + + /** + * Encodes the specified ListEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEntityTypesResponse.verify|verify} messages. + * @param message ListEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEntityTypesResponse.verify|verify} messages. + * @param message ListEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListEntityTypesResponse; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListEntityTypesResponse; + + /** + * Verifies a ListEntityTypesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEntityTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListEntityTypesResponse; + + /** + * Creates a plain object from a ListEntityTypesResponse message. Also converts values to other types if specified. + * @param message ListEntityTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListEntityTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEntityTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEntityTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetEntityTypeRequest. */ + interface IGetEntityTypeRequest { + + /** GetEntityTypeRequest name */ + name?: (string|null); + + /** GetEntityTypeRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a GetEntityTypeRequest. */ + class GetEntityTypeRequest implements IGetEntityTypeRequest { + + /** + * Constructs a new GetEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest); + + /** GetEntityTypeRequest name. */ + public name: string; + + /** GetEntityTypeRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new GetEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest): google.cloud.dialogflow.v2beta1.GetEntityTypeRequest; + + /** + * Encodes the specified GetEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEntityTypeRequest.verify|verify} messages. + * @param message GetEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEntityTypeRequest.verify|verify} messages. + * @param message GetEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetEntityTypeRequest; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetEntityTypeRequest; + + /** + * Verifies a GetEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetEntityTypeRequest; + + /** + * Creates a plain object from a GetEntityTypeRequest message. Also converts values to other types if specified. + * @param message GetEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateEntityTypeRequest. */ + interface ICreateEntityTypeRequest { + + /** CreateEntityTypeRequest parent */ + parent?: (string|null); + + /** CreateEntityTypeRequest entityType */ + entityType?: (google.cloud.dialogflow.v2beta1.IEntityType|null); + + /** CreateEntityTypeRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a CreateEntityTypeRequest. */ + class CreateEntityTypeRequest implements ICreateEntityTypeRequest { + + /** + * Constructs a new CreateEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest); + + /** CreateEntityTypeRequest parent. */ + public parent: string; + + /** CreateEntityTypeRequest entityType. */ + public entityType?: (google.cloud.dialogflow.v2beta1.IEntityType|null); + + /** CreateEntityTypeRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new CreateEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest): google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest; + + /** + * Encodes the specified CreateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest.verify|verify} messages. + * @param message CreateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest.verify|verify} messages. + * @param message CreateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest; + + /** + * Verifies a CreateEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest; + + /** + * Creates a plain object from a CreateEntityTypeRequest message. Also converts values to other types if specified. + * @param message CreateEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateEntityTypeRequest. */ + interface IUpdateEntityTypeRequest { + + /** UpdateEntityTypeRequest entityType */ + entityType?: (google.cloud.dialogflow.v2beta1.IEntityType|null); + + /** UpdateEntityTypeRequest languageCode */ + languageCode?: (string|null); + + /** UpdateEntityTypeRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateEntityTypeRequest. */ + class UpdateEntityTypeRequest implements IUpdateEntityTypeRequest { + + /** + * Constructs a new UpdateEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest); + + /** UpdateEntityTypeRequest entityType. */ + public entityType?: (google.cloud.dialogflow.v2beta1.IEntityType|null); + + /** UpdateEntityTypeRequest languageCode. */ + public languageCode: string; + + /** UpdateEntityTypeRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest): google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest; + + /** + * Encodes the specified UpdateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest.verify|verify} messages. + * @param message UpdateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest.verify|verify} messages. + * @param message UpdateEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest; + + /** + * Verifies an UpdateEntityTypeRequest message. + * @param message Plain 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 UpdateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest; + + /** + * Creates a plain object from an UpdateEntityTypeRequest message. Also converts values to other types if specified. + * @param message UpdateEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteEntityTypeRequest. */ + interface IDeleteEntityTypeRequest { + + /** DeleteEntityTypeRequest name */ + name?: (string|null); + } + + /** Represents a DeleteEntityTypeRequest. */ + class DeleteEntityTypeRequest implements IDeleteEntityTypeRequest { + + /** + * Constructs a new DeleteEntityTypeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest); + + /** DeleteEntityTypeRequest name. */ + public name: string; + + /** + * Creates a new DeleteEntityTypeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteEntityTypeRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest): google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest; + + /** + * Encodes the specified DeleteEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest.verify|verify} messages. + * @param message DeleteEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest.verify|verify} messages. + * @param message DeleteEntityTypeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest; + + /** + * Verifies a DeleteEntityTypeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteEntityTypeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest; + + /** + * Creates a plain object from a DeleteEntityTypeRequest message. Also converts values to other types if specified. + * @param message DeleteEntityTypeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteEntityTypeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteEntityTypeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateEntityTypesRequest. */ + interface IBatchUpdateEntityTypesRequest { + + /** BatchUpdateEntityTypesRequest parent */ + parent?: (string|null); + + /** BatchUpdateEntityTypesRequest entityTypeBatchUri */ + entityTypeBatchUri?: (string|null); + + /** BatchUpdateEntityTypesRequest entityTypeBatchInline */ + entityTypeBatchInline?: (google.cloud.dialogflow.v2beta1.IEntityTypeBatch|null); + + /** BatchUpdateEntityTypesRequest languageCode */ + languageCode?: (string|null); + + /** BatchUpdateEntityTypesRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a BatchUpdateEntityTypesRequest. */ + class BatchUpdateEntityTypesRequest implements IBatchUpdateEntityTypesRequest { + + /** + * Constructs a new BatchUpdateEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest); + + /** BatchUpdateEntityTypesRequest parent. */ + public parent: string; + + /** BatchUpdateEntityTypesRequest entityTypeBatchUri. */ + public entityTypeBatchUri?: (string|null); + + /** BatchUpdateEntityTypesRequest entityTypeBatchInline. */ + public entityTypeBatchInline?: (google.cloud.dialogflow.v2beta1.IEntityTypeBatch|null); + + /** BatchUpdateEntityTypesRequest languageCode. */ + public languageCode: string; + + /** BatchUpdateEntityTypesRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** BatchUpdateEntityTypesRequest entityTypeBatch. */ + public entityTypeBatch?: ("entityTypeBatchUri"|"entityTypeBatchInline"); + + /** + * Creates a new BatchUpdateEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest): google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest; + + /** + * Encodes the specified BatchUpdateEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.verify|verify} messages. + * @param message BatchUpdateEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.verify|verify} messages. + * @param message BatchUpdateEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest; + + /** + * Decodes a BatchUpdateEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest; + + /** + * Verifies a BatchUpdateEntityTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest; + + /** + * Creates a plain object from a BatchUpdateEntityTypesRequest message. Also converts values to other types if specified. + * @param message BatchUpdateEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateEntityTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateEntityTypesResponse. */ + interface IBatchUpdateEntityTypesResponse { + + /** BatchUpdateEntityTypesResponse entityTypes */ + entityTypes?: (google.cloud.dialogflow.v2beta1.IEntityType[]|null); + } + + /** Represents a BatchUpdateEntityTypesResponse. */ + class BatchUpdateEntityTypesResponse implements IBatchUpdateEntityTypesResponse { + + /** + * Constructs a new BatchUpdateEntityTypesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse); + + /** BatchUpdateEntityTypesResponse entityTypes. */ + public entityTypes: google.cloud.dialogflow.v2beta1.IEntityType[]; + + /** + * Creates a new BatchUpdateEntityTypesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateEntityTypesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse): google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse; + + /** + * Encodes the specified BatchUpdateEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse.verify|verify} messages. + * @param message BatchUpdateEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse.verify|verify} messages. + * @param message BatchUpdateEntityTypesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateEntityTypesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse; + + /** + * Decodes a BatchUpdateEntityTypesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse; + + /** + * Verifies a BatchUpdateEntityTypesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateEntityTypesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse; + + /** + * Creates a plain object from a BatchUpdateEntityTypesResponse message. Also converts values to other types if specified. + * @param message BatchUpdateEntityTypesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateEntityTypesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateEntityTypesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDeleteEntityTypesRequest. */ + interface IBatchDeleteEntityTypesRequest { + + /** BatchDeleteEntityTypesRequest parent */ + parent?: (string|null); + + /** BatchDeleteEntityTypesRequest entityTypeNames */ + entityTypeNames?: (string[]|null); + } + + /** Represents a BatchDeleteEntityTypesRequest. */ + class BatchDeleteEntityTypesRequest implements IBatchDeleteEntityTypesRequest { + + /** + * Constructs a new BatchDeleteEntityTypesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest); + + /** BatchDeleteEntityTypesRequest parent. */ + public parent: string; + + /** BatchDeleteEntityTypesRequest entityTypeNames. */ + public entityTypeNames: string[]; + + /** + * Creates a new BatchDeleteEntityTypesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDeleteEntityTypesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest): google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest; + + /** + * Encodes the specified BatchDeleteEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest.verify|verify} messages. + * @param message BatchDeleteEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDeleteEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest.verify|verify} messages. + * @param message BatchDeleteEntityTypesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDeleteEntityTypesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDeleteEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest; + + /** + * Decodes a BatchDeleteEntityTypesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDeleteEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest; + + /** + * Verifies a BatchDeleteEntityTypesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDeleteEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDeleteEntityTypesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest; + + /** + * Creates a plain object from a BatchDeleteEntityTypesRequest message. Also converts values to other types if specified. + * @param message BatchDeleteEntityTypesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDeleteEntityTypesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDeleteEntityTypesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchCreateEntitiesRequest. */ + interface IBatchCreateEntitiesRequest { + + /** BatchCreateEntitiesRequest parent */ + parent?: (string|null); + + /** BatchCreateEntitiesRequest entities */ + entities?: (google.cloud.dialogflow.v2beta1.EntityType.IEntity[]|null); + + /** BatchCreateEntitiesRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a BatchCreateEntitiesRequest. */ + class BatchCreateEntitiesRequest implements IBatchCreateEntitiesRequest { + + /** + * Constructs a new BatchCreateEntitiesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest); + + /** BatchCreateEntitiesRequest parent. */ + public parent: string; + + /** BatchCreateEntitiesRequest entities. */ + public entities: google.cloud.dialogflow.v2beta1.EntityType.IEntity[]; + + /** BatchCreateEntitiesRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new BatchCreateEntitiesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchCreateEntitiesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest): google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest; + + /** + * Encodes the specified BatchCreateEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest.verify|verify} messages. + * @param message BatchCreateEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchCreateEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest.verify|verify} messages. + * @param message BatchCreateEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchCreateEntitiesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchCreateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest; + + /** + * Decodes a BatchCreateEntitiesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchCreateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest; + + /** + * Verifies a BatchCreateEntitiesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchCreateEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchCreateEntitiesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest; + + /** + * Creates a plain object from a BatchCreateEntitiesRequest message. Also converts values to other types if specified. + * @param message BatchCreateEntitiesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchCreateEntitiesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchCreateEntitiesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchUpdateEntitiesRequest. */ + interface IBatchUpdateEntitiesRequest { + + /** BatchUpdateEntitiesRequest parent */ + parent?: (string|null); + + /** BatchUpdateEntitiesRequest entities */ + entities?: (google.cloud.dialogflow.v2beta1.EntityType.IEntity[]|null); + + /** BatchUpdateEntitiesRequest languageCode */ + languageCode?: (string|null); + + /** BatchUpdateEntitiesRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents a BatchUpdateEntitiesRequest. */ + class BatchUpdateEntitiesRequest implements IBatchUpdateEntitiesRequest { + + /** + * Constructs a new BatchUpdateEntitiesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest); + + /** BatchUpdateEntitiesRequest parent. */ + public parent: string; + + /** BatchUpdateEntitiesRequest entities. */ + public entities: google.cloud.dialogflow.v2beta1.EntityType.IEntity[]; + + /** BatchUpdateEntitiesRequest languageCode. */ + public languageCode: string; + + /** BatchUpdateEntitiesRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new BatchUpdateEntitiesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchUpdateEntitiesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest): google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest; + + /** + * Encodes the specified BatchUpdateEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.verify|verify} messages. + * @param message BatchUpdateEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchUpdateEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.verify|verify} messages. + * @param message BatchUpdateEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchUpdateEntitiesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchUpdateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest; + + /** + * Decodes a BatchUpdateEntitiesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchUpdateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest; + + /** + * Verifies a BatchUpdateEntitiesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchUpdateEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchUpdateEntitiesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest; + + /** + * Creates a plain object from a BatchUpdateEntitiesRequest message. Also converts values to other types if specified. + * @param message BatchUpdateEntitiesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchUpdateEntitiesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchUpdateEntitiesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchDeleteEntitiesRequest. */ + interface IBatchDeleteEntitiesRequest { + + /** BatchDeleteEntitiesRequest parent */ + parent?: (string|null); + + /** BatchDeleteEntitiesRequest entityValues */ + entityValues?: (string[]|null); + + /** BatchDeleteEntitiesRequest languageCode */ + languageCode?: (string|null); + } + + /** Represents a BatchDeleteEntitiesRequest. */ + class BatchDeleteEntitiesRequest implements IBatchDeleteEntitiesRequest { + + /** + * Constructs a new BatchDeleteEntitiesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest); + + /** BatchDeleteEntitiesRequest parent. */ + public parent: string; + + /** BatchDeleteEntitiesRequest entityValues. */ + public entityValues: string[]; + + /** BatchDeleteEntitiesRequest languageCode. */ + public languageCode: string; + + /** + * Creates a new BatchDeleteEntitiesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchDeleteEntitiesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest): google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest; + + /** + * Encodes the specified BatchDeleteEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest.verify|verify} messages. + * @param message BatchDeleteEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchDeleteEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest.verify|verify} messages. + * @param message BatchDeleteEntitiesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchDeleteEntitiesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchDeleteEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest; + + /** + * Decodes a BatchDeleteEntitiesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchDeleteEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest; + + /** + * Verifies a BatchDeleteEntitiesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchDeleteEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchDeleteEntitiesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest; + + /** + * Creates a plain object from a BatchDeleteEntitiesRequest message. Also converts values to other types if specified. + * @param message BatchDeleteEntitiesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchDeleteEntitiesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchDeleteEntitiesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EntityTypeBatch. */ + interface IEntityTypeBatch { + + /** EntityTypeBatch entityTypes */ + entityTypes?: (google.cloud.dialogflow.v2beta1.IEntityType[]|null); + } + + /** Represents an EntityTypeBatch. */ + class EntityTypeBatch implements IEntityTypeBatch { + + /** + * Constructs a new EntityTypeBatch. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IEntityTypeBatch); + + /** EntityTypeBatch entityTypes. */ + public entityTypes: google.cloud.dialogflow.v2beta1.IEntityType[]; + + /** + * Creates a new EntityTypeBatch instance using the specified properties. + * @param [properties] Properties to set + * @returns EntityTypeBatch instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IEntityTypeBatch): google.cloud.dialogflow.v2beta1.EntityTypeBatch; + + /** + * Encodes the specified EntityTypeBatch message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityTypeBatch.verify|verify} messages. + * @param message EntityTypeBatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IEntityTypeBatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EntityTypeBatch message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityTypeBatch.verify|verify} messages. + * @param message EntityTypeBatch message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IEntityTypeBatch, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EntityTypeBatch message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EntityTypeBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.EntityTypeBatch; + + /** + * Decodes an EntityTypeBatch message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EntityTypeBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.EntityTypeBatch; + + /** + * Verifies an EntityTypeBatch message. + * @param message Plain 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 EntityTypeBatch message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EntityTypeBatch + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.EntityTypeBatch; + + /** + * Creates a plain object from an EntityTypeBatch message. Also converts values to other types if specified. + * @param message EntityTypeBatch + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.EntityTypeBatch, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EntityTypeBatch to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EntityTypeBatch + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Conversations */ + class Conversations extends $protobuf.rpc.Service { + + /** + * Constructs a new Conversations 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 Conversations 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): Conversations; + + /** + * Calls CreateConversation. + * @param request CreateConversationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Conversation + */ + public createConversation(request: google.cloud.dialogflow.v2beta1.ICreateConversationRequest, callback: google.cloud.dialogflow.v2beta1.Conversations.CreateConversationCallback): void; + + /** + * Calls CreateConversation. + * @param request CreateConversationRequest message or plain object + * @returns Promise + */ + public createConversation(request: google.cloud.dialogflow.v2beta1.ICreateConversationRequest): Promise; + + /** + * Calls ListConversations. + * @param request ListConversationsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListConversationsResponse + */ + public listConversations(request: google.cloud.dialogflow.v2beta1.IListConversationsRequest, callback: google.cloud.dialogflow.v2beta1.Conversations.ListConversationsCallback): void; + + /** + * Calls ListConversations. + * @param request ListConversationsRequest message or plain object + * @returns Promise + */ + public listConversations(request: google.cloud.dialogflow.v2beta1.IListConversationsRequest): Promise; + + /** + * Calls GetConversation. + * @param request GetConversationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Conversation + */ + public getConversation(request: google.cloud.dialogflow.v2beta1.IGetConversationRequest, callback: google.cloud.dialogflow.v2beta1.Conversations.GetConversationCallback): void; + + /** + * Calls GetConversation. + * @param request GetConversationRequest message or plain object + * @returns Promise + */ + public getConversation(request: google.cloud.dialogflow.v2beta1.IGetConversationRequest): Promise; + + /** + * Calls CompleteConversation. + * @param request CompleteConversationRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Conversation + */ + public completeConversation(request: google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, callback: google.cloud.dialogflow.v2beta1.Conversations.CompleteConversationCallback): void; + + /** + * Calls CompleteConversation. + * @param request CompleteConversationRequest message or plain object + * @returns Promise + */ + public completeConversation(request: google.cloud.dialogflow.v2beta1.ICompleteConversationRequest): Promise; + + /** + * Calls BatchCreateMessages. + * @param request BatchCreateMessagesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BatchCreateMessagesResponse + */ + public batchCreateMessages(request: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, callback: google.cloud.dialogflow.v2beta1.Conversations.BatchCreateMessagesCallback): void; + + /** + * Calls BatchCreateMessages. + * @param request BatchCreateMessagesRequest message or plain object + * @returns Promise + */ + public batchCreateMessages(request: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest): Promise; + + /** + * Calls ListMessages. + * @param request ListMessagesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListMessagesResponse + */ + public listMessages(request: google.cloud.dialogflow.v2beta1.IListMessagesRequest, callback: google.cloud.dialogflow.v2beta1.Conversations.ListMessagesCallback): void; + + /** + * Calls ListMessages. + * @param request ListMessagesRequest message or plain object + * @returns Promise + */ + public listMessages(request: google.cloud.dialogflow.v2beta1.IListMessagesRequest): Promise; + + /** + * Calls SuggestConversationSummary. + * @param request SuggestConversationSummaryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SuggestConversationSummaryResponse + */ + public suggestConversationSummary(request: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, callback: google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummaryCallback): void; + + /** + * Calls SuggestConversationSummary. + * @param request SuggestConversationSummaryRequest message or plain object + * @returns Promise + */ + public suggestConversationSummary(request: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest): Promise; + } + + namespace Conversations { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|createConversation}. + * @param error Error, if any + * @param [response] Conversation + */ + type CreateConversationCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Conversation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|listConversations}. + * @param error Error, if any + * @param [response] ListConversationsResponse + */ + type ListConversationsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListConversationsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|getConversation}. + * @param error Error, if any + * @param [response] Conversation + */ + type GetConversationCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Conversation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|completeConversation}. + * @param error Error, if any + * @param [response] Conversation + */ + type CompleteConversationCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Conversation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|batchCreateMessages}. + * @param error Error, if any + * @param [response] BatchCreateMessagesResponse + */ + type BatchCreateMessagesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|listMessages}. + * @param error Error, if any + * @param [response] ListMessagesResponse + */ + type ListMessagesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListMessagesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|suggestConversationSummary}. + * @param error Error, if any + * @param [response] SuggestConversationSummaryResponse + */ + type SuggestConversationSummaryCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse) => void; + } + + /** Properties of a Conversation. */ + interface IConversation { + + /** Conversation name */ + name?: (string|null); + + /** Conversation lifecycleState */ + lifecycleState?: (google.cloud.dialogflow.v2beta1.Conversation.LifecycleState|keyof typeof google.cloud.dialogflow.v2beta1.Conversation.LifecycleState|null); + + /** Conversation conversationProfile */ + conversationProfile?: (string|null); + + /** Conversation phoneNumber */ + phoneNumber?: (google.cloud.dialogflow.v2beta1.IConversationPhoneNumber|null); + + /** Conversation conversationStage */ + conversationStage?: (google.cloud.dialogflow.v2beta1.Conversation.ConversationStage|keyof typeof google.cloud.dialogflow.v2beta1.Conversation.ConversationStage|null); + + /** Conversation startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** Conversation endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Conversation. */ + class Conversation implements IConversation { + + /** + * Constructs a new Conversation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IConversation); + + /** Conversation name. */ + public name: string; + + /** Conversation lifecycleState. */ + public lifecycleState: (google.cloud.dialogflow.v2beta1.Conversation.LifecycleState|keyof typeof google.cloud.dialogflow.v2beta1.Conversation.LifecycleState); + + /** Conversation conversationProfile. */ + public conversationProfile: string; + + /** Conversation phoneNumber. */ + public phoneNumber?: (google.cloud.dialogflow.v2beta1.IConversationPhoneNumber|null); + + /** Conversation conversationStage. */ + public conversationStage: (google.cloud.dialogflow.v2beta1.Conversation.ConversationStage|keyof typeof google.cloud.dialogflow.v2beta1.Conversation.ConversationStage); + + /** Conversation startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** Conversation endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Conversation instance using the specified properties. + * @param [properties] Properties to set + * @returns Conversation instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IConversation): google.cloud.dialogflow.v2beta1.Conversation; + + /** + * Encodes the specified Conversation message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Conversation.verify|verify} messages. + * @param message Conversation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IConversation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Conversation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Conversation.verify|verify} messages. + * @param message Conversation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IConversation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Conversation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Conversation; + + /** + * Decodes a Conversation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Conversation; + + /** + * Verifies a Conversation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Conversation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Conversation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Conversation; + + /** + * Creates a plain object from a Conversation message. Also converts values to other types if specified. + * @param message Conversation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Conversation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Conversation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Conversation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Conversation { + + /** LifecycleState enum. */ + enum LifecycleState { + LIFECYCLE_STATE_UNSPECIFIED = 0, + IN_PROGRESS = 1, + COMPLETED = 2 + } + + /** ConversationStage enum. */ + enum ConversationStage { + CONVERSATION_STAGE_UNSPECIFIED = 0, + VIRTUAL_AGENT_STAGE = 1, + HUMAN_ASSIST_STAGE = 2 + } + } + + /** Properties of a ConversationPhoneNumber. */ + interface IConversationPhoneNumber { + + /** ConversationPhoneNumber phoneNumber */ + phoneNumber?: (string|null); + } + + /** Represents a ConversationPhoneNumber. */ + class ConversationPhoneNumber implements IConversationPhoneNumber { + + /** + * Constructs a new ConversationPhoneNumber. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IConversationPhoneNumber); + + /** ConversationPhoneNumber phoneNumber. */ + public phoneNumber: string; + + /** + * Creates a new ConversationPhoneNumber instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationPhoneNumber instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IConversationPhoneNumber): google.cloud.dialogflow.v2beta1.ConversationPhoneNumber; + + /** + * Encodes the specified ConversationPhoneNumber message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationPhoneNumber.verify|verify} messages. + * @param message ConversationPhoneNumber message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IConversationPhoneNumber, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationPhoneNumber message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationPhoneNumber.verify|verify} messages. + * @param message ConversationPhoneNumber message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IConversationPhoneNumber, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationPhoneNumber message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationPhoneNumber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ConversationPhoneNumber; + + /** + * Decodes a ConversationPhoneNumber message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationPhoneNumber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ConversationPhoneNumber; + + /** + * Verifies a ConversationPhoneNumber message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationPhoneNumber message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationPhoneNumber + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ConversationPhoneNumber; + + /** + * Creates a plain object from a ConversationPhoneNumber message. Also converts values to other types if specified. + * @param message ConversationPhoneNumber + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ConversationPhoneNumber, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationPhoneNumber to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationPhoneNumber + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateConversationRequest. */ + interface ICreateConversationRequest { + + /** CreateConversationRequest parent */ + parent?: (string|null); + + /** CreateConversationRequest conversation */ + conversation?: (google.cloud.dialogflow.v2beta1.IConversation|null); + + /** CreateConversationRequest conversationId */ + conversationId?: (string|null); + } + + /** Represents a CreateConversationRequest. */ + class CreateConversationRequest implements ICreateConversationRequest { + + /** + * Constructs a new CreateConversationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateConversationRequest); + + /** CreateConversationRequest parent. */ + public parent: string; + + /** CreateConversationRequest conversation. */ + public conversation?: (google.cloud.dialogflow.v2beta1.IConversation|null); + + /** CreateConversationRequest conversationId. */ + public conversationId: string; + + /** + * Creates a new CreateConversationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateConversationRequest): google.cloud.dialogflow.v2beta1.CreateConversationRequest; + + /** + * Encodes the specified CreateConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateConversationRequest.verify|verify} messages. + * @param message CreateConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateConversationRequest.verify|verify} messages. + * @param message CreateConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateConversationRequest; + + /** + * Decodes a CreateConversationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateConversationRequest; + + /** + * Verifies a CreateConversationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateConversationRequest; + + /** + * Creates a plain object from a CreateConversationRequest message. Also converts values to other types if specified. + * @param message CreateConversationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateConversationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationsRequest. */ + interface IListConversationsRequest { + + /** ListConversationsRequest parent */ + parent?: (string|null); + + /** ListConversationsRequest pageSize */ + pageSize?: (number|null); + + /** ListConversationsRequest pageToken */ + pageToken?: (string|null); + + /** ListConversationsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListConversationsRequest. */ + class ListConversationsRequest implements IListConversationsRequest { + + /** + * Constructs a new ListConversationsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListConversationsRequest); + + /** ListConversationsRequest parent. */ + public parent: string; + + /** ListConversationsRequest pageSize. */ + public pageSize: number; + + /** ListConversationsRequest pageToken. */ + public pageToken: string; + + /** ListConversationsRequest filter. */ + public filter: string; + + /** + * Creates a new ListConversationsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListConversationsRequest): google.cloud.dialogflow.v2beta1.ListConversationsRequest; + + /** + * Encodes the specified ListConversationsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationsRequest.verify|verify} messages. + * @param message ListConversationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListConversationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationsRequest.verify|verify} messages. + * @param message ListConversationsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListConversationsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListConversationsRequest; + + /** + * Decodes a ListConversationsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListConversationsRequest; + + /** + * Verifies a ListConversationsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListConversationsRequest; + + /** + * Creates a plain object from a ListConversationsRequest message. Also converts values to other types if specified. + * @param message ListConversationsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListConversationsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationsResponse. */ + interface IListConversationsResponse { + + /** ListConversationsResponse conversations */ + conversations?: (google.cloud.dialogflow.v2beta1.IConversation[]|null); + + /** ListConversationsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListConversationsResponse. */ + class ListConversationsResponse implements IListConversationsResponse { + + /** + * Constructs a new ListConversationsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListConversationsResponse); + + /** ListConversationsResponse conversations. */ + public conversations: google.cloud.dialogflow.v2beta1.IConversation[]; + + /** ListConversationsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListConversationsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListConversationsResponse): google.cloud.dialogflow.v2beta1.ListConversationsResponse; + + /** + * Encodes the specified ListConversationsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationsResponse.verify|verify} messages. + * @param message ListConversationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListConversationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationsResponse.verify|verify} messages. + * @param message ListConversationsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListConversationsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListConversationsResponse; + + /** + * Decodes a ListConversationsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListConversationsResponse; + + /** + * Verifies a ListConversationsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListConversationsResponse; + + /** + * Creates a plain object from a ListConversationsResponse message. Also converts values to other types if specified. + * @param message ListConversationsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListConversationsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetConversationRequest. */ + interface IGetConversationRequest { + + /** GetConversationRequest name */ + name?: (string|null); + } + + /** Represents a GetConversationRequest. */ + class GetConversationRequest implements IGetConversationRequest { + + /** + * Constructs a new GetConversationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetConversationRequest); + + /** GetConversationRequest name. */ + public name: string; + + /** + * Creates a new GetConversationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetConversationRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetConversationRequest): google.cloud.dialogflow.v2beta1.GetConversationRequest; + + /** + * Encodes the specified GetConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetConversationRequest.verify|verify} messages. + * @param message GetConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetConversationRequest.verify|verify} messages. + * @param message GetConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetConversationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetConversationRequest; + + /** + * Decodes a GetConversationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetConversationRequest; + + /** + * Verifies a GetConversationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetConversationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetConversationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetConversationRequest; + + /** + * Creates a plain object from a GetConversationRequest message. Also converts values to other types if specified. + * @param message GetConversationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetConversationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetConversationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetConversationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CompleteConversationRequest. */ + interface ICompleteConversationRequest { + + /** CompleteConversationRequest name */ + name?: (string|null); + } + + /** Represents a CompleteConversationRequest. */ + class CompleteConversationRequest implements ICompleteConversationRequest { + + /** + * Constructs a new CompleteConversationRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICompleteConversationRequest); + + /** CompleteConversationRequest name. */ + public name: string; + + /** + * Creates a new CompleteConversationRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CompleteConversationRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICompleteConversationRequest): google.cloud.dialogflow.v2beta1.CompleteConversationRequest; + + /** + * Encodes the specified CompleteConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompleteConversationRequest.verify|verify} messages. + * @param message CompleteConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CompleteConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompleteConversationRequest.verify|verify} messages. + * @param message CompleteConversationRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CompleteConversationRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CompleteConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CompleteConversationRequest; + + /** + * Decodes a CompleteConversationRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CompleteConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CompleteConversationRequest; + + /** + * Verifies a CompleteConversationRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CompleteConversationRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CompleteConversationRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CompleteConversationRequest; + + /** + * Creates a plain object from a CompleteConversationRequest message. Also converts values to other types if specified. + * @param message CompleteConversationRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CompleteConversationRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CompleteConversationRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CompleteConversationRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateMessageRequest. */ + interface ICreateMessageRequest { + + /** CreateMessageRequest parent */ + parent?: (string|null); + + /** CreateMessageRequest message */ + message?: (google.cloud.dialogflow.v2beta1.IMessage|null); + } + + /** Represents a CreateMessageRequest. */ + class CreateMessageRequest implements ICreateMessageRequest { + + /** + * Constructs a new CreateMessageRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateMessageRequest); + + /** CreateMessageRequest parent. */ + public parent: string; + + /** CreateMessageRequest message. */ + public message?: (google.cloud.dialogflow.v2beta1.IMessage|null); + + /** + * Creates a new CreateMessageRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateMessageRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateMessageRequest): google.cloud.dialogflow.v2beta1.CreateMessageRequest; + + /** + * Encodes the specified CreateMessageRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateMessageRequest.verify|verify} messages. + * @param message CreateMessageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateMessageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateMessageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateMessageRequest.verify|verify} messages. + * @param message CreateMessageRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateMessageRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateMessageRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateMessageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateMessageRequest; + + /** + * Decodes a CreateMessageRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateMessageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateMessageRequest; + + /** + * Verifies a CreateMessageRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateMessageRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateMessageRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateMessageRequest; + + /** + * Creates a plain object from a CreateMessageRequest message. Also converts values to other types if specified. + * @param message CreateMessageRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateMessageRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateMessageRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateMessageRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchCreateMessagesRequest. */ + interface IBatchCreateMessagesRequest { + + /** BatchCreateMessagesRequest parent */ + parent?: (string|null); + + /** BatchCreateMessagesRequest requests */ + requests?: (google.cloud.dialogflow.v2beta1.ICreateMessageRequest[]|null); + } + + /** Represents a BatchCreateMessagesRequest. */ + class BatchCreateMessagesRequest implements IBatchCreateMessagesRequest { + + /** + * Constructs a new BatchCreateMessagesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest); + + /** BatchCreateMessagesRequest parent. */ + public parent: string; + + /** BatchCreateMessagesRequest requests. */ + public requests: google.cloud.dialogflow.v2beta1.ICreateMessageRequest[]; + + /** + * Creates a new BatchCreateMessagesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchCreateMessagesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest): google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest; + + /** + * Encodes the specified BatchCreateMessagesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest.verify|verify} messages. + * @param message BatchCreateMessagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchCreateMessagesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest.verify|verify} messages. + * @param message BatchCreateMessagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchCreateMessagesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchCreateMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest; + + /** + * Decodes a BatchCreateMessagesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchCreateMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest; + + /** + * Verifies a BatchCreateMessagesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchCreateMessagesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchCreateMessagesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest; + + /** + * Creates a plain object from a BatchCreateMessagesRequest message. Also converts values to other types if specified. + * @param message BatchCreateMessagesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchCreateMessagesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchCreateMessagesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BatchCreateMessagesResponse. */ + interface IBatchCreateMessagesResponse { + + /** BatchCreateMessagesResponse messages */ + messages?: (google.cloud.dialogflow.v2beta1.IMessage[]|null); + } + + /** Represents a BatchCreateMessagesResponse. */ + class BatchCreateMessagesResponse implements IBatchCreateMessagesResponse { + + /** + * Constructs a new BatchCreateMessagesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse); + + /** BatchCreateMessagesResponse messages. */ + public messages: google.cloud.dialogflow.v2beta1.IMessage[]; + + /** + * Creates a new BatchCreateMessagesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BatchCreateMessagesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse): google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse; + + /** + * Encodes the specified BatchCreateMessagesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse.verify|verify} messages. + * @param message BatchCreateMessagesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BatchCreateMessagesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse.verify|verify} messages. + * @param message BatchCreateMessagesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BatchCreateMessagesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BatchCreateMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse; + + /** + * Decodes a BatchCreateMessagesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BatchCreateMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse; + + /** + * Verifies a BatchCreateMessagesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BatchCreateMessagesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BatchCreateMessagesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse; + + /** + * Creates a plain object from a BatchCreateMessagesResponse message. Also converts values to other types if specified. + * @param message BatchCreateMessagesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BatchCreateMessagesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BatchCreateMessagesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMessagesRequest. */ + interface IListMessagesRequest { + + /** ListMessagesRequest parent */ + parent?: (string|null); + + /** ListMessagesRequest filter */ + filter?: (string|null); + + /** ListMessagesRequest pageSize */ + pageSize?: (number|null); + + /** ListMessagesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListMessagesRequest. */ + class ListMessagesRequest implements IListMessagesRequest { + + /** + * Constructs a new ListMessagesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListMessagesRequest); + + /** ListMessagesRequest parent. */ + public parent: string; + + /** ListMessagesRequest filter. */ + public filter: string; + + /** ListMessagesRequest pageSize. */ + public pageSize: number; + + /** ListMessagesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListMessagesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMessagesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListMessagesRequest): google.cloud.dialogflow.v2beta1.ListMessagesRequest; + + /** + * Encodes the specified ListMessagesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListMessagesRequest.verify|verify} messages. + * @param message ListMessagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListMessagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMessagesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListMessagesRequest.verify|verify} messages. + * @param message ListMessagesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListMessagesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMessagesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListMessagesRequest; + + /** + * Decodes a ListMessagesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListMessagesRequest; + + /** + * Verifies a ListMessagesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMessagesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMessagesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListMessagesRequest; + + /** + * Creates a plain object from a ListMessagesRequest message. Also converts values to other types if specified. + * @param message ListMessagesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListMessagesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMessagesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMessagesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMessagesResponse. */ + interface IListMessagesResponse { + + /** ListMessagesResponse messages */ + messages?: (google.cloud.dialogflow.v2beta1.IMessage[]|null); + + /** ListMessagesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListMessagesResponse. */ + class ListMessagesResponse implements IListMessagesResponse { + + /** + * Constructs a new ListMessagesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListMessagesResponse); + + /** ListMessagesResponse messages. */ + public messages: google.cloud.dialogflow.v2beta1.IMessage[]; + + /** ListMessagesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListMessagesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMessagesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListMessagesResponse): google.cloud.dialogflow.v2beta1.ListMessagesResponse; + + /** + * Encodes the specified ListMessagesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListMessagesResponse.verify|verify} messages. + * @param message ListMessagesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListMessagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMessagesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListMessagesResponse.verify|verify} messages. + * @param message ListMessagesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListMessagesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMessagesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListMessagesResponse; + + /** + * Decodes a ListMessagesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListMessagesResponse; + + /** + * Verifies a ListMessagesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMessagesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMessagesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListMessagesResponse; + + /** + * Creates a plain object from a ListMessagesResponse message. Also converts values to other types if specified. + * @param message ListMessagesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListMessagesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMessagesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMessagesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestConversationSummaryRequest. */ + interface ISuggestConversationSummaryRequest { + + /** SuggestConversationSummaryRequest conversation */ + conversation?: (string|null); + + /** SuggestConversationSummaryRequest latestMessage */ + latestMessage?: (string|null); + + /** SuggestConversationSummaryRequest contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestConversationSummaryRequest. */ + class SuggestConversationSummaryRequest implements ISuggestConversationSummaryRequest { + + /** + * Constructs a new SuggestConversationSummaryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest); + + /** SuggestConversationSummaryRequest conversation. */ + public conversation: string; + + /** SuggestConversationSummaryRequest latestMessage. */ + public latestMessage: string; + + /** SuggestConversationSummaryRequest contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestConversationSummaryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestConversationSummaryRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest; + + /** + * Encodes the specified SuggestConversationSummaryRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest.verify|verify} messages. + * @param message SuggestConversationSummaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestConversationSummaryRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest.verify|verify} messages. + * @param message SuggestConversationSummaryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestConversationSummaryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestConversationSummaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest; + + /** + * Decodes a SuggestConversationSummaryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestConversationSummaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest; + + /** + * Verifies a SuggestConversationSummaryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestConversationSummaryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestConversationSummaryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest; + + /** + * Creates a plain object from a SuggestConversationSummaryRequest message. Also converts values to other types if specified. + * @param message SuggestConversationSummaryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestConversationSummaryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestConversationSummaryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestConversationSummaryResponse. */ + interface ISuggestConversationSummaryResponse { + + /** SuggestConversationSummaryResponse summary */ + summary?: (google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary|null); + + /** SuggestConversationSummaryResponse latestMessage */ + latestMessage?: (string|null); + + /** SuggestConversationSummaryResponse contextSize */ + contextSize?: (number|null); + } + + /** Represents a SuggestConversationSummaryResponse. */ + class SuggestConversationSummaryResponse implements ISuggestConversationSummaryResponse { + + /** + * Constructs a new SuggestConversationSummaryResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse); + + /** SuggestConversationSummaryResponse summary. */ + public summary?: (google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary|null); + + /** SuggestConversationSummaryResponse latestMessage. */ + public latestMessage: string; + + /** SuggestConversationSummaryResponse contextSize. */ + public contextSize: number; + + /** + * Creates a new SuggestConversationSummaryResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestConversationSummaryResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse; + + /** + * Encodes the specified SuggestConversationSummaryResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.verify|verify} messages. + * @param message SuggestConversationSummaryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestConversationSummaryResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.verify|verify} messages. + * @param message SuggestConversationSummaryResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestConversationSummaryResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestConversationSummaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse; + + /** + * Decodes a SuggestConversationSummaryResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestConversationSummaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse; + + /** + * Verifies a SuggestConversationSummaryResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestConversationSummaryResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestConversationSummaryResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse; + + /** + * Creates a plain object from a SuggestConversationSummaryResponse message. Also converts values to other types if specified. + * @param message SuggestConversationSummaryResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestConversationSummaryResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestConversationSummaryResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SuggestConversationSummaryResponse { + + /** Properties of a Summary. */ + interface ISummary { + + /** Summary text */ + text?: (string|null); + + /** Summary textSections */ + textSections?: ({ [k: string]: string }|null); + + /** Summary answerRecord */ + answerRecord?: (string|null); + } + + /** Represents a Summary. */ + class Summary implements ISummary { + + /** + * Constructs a new Summary. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary); + + /** Summary text. */ + public text: string; + + /** Summary textSections. */ + public textSections: { [k: string]: string }; + + /** Summary answerRecord. */ + public answerRecord: string; + + /** + * Creates a new Summary instance using the specified properties. + * @param [properties] Properties to set + * @returns Summary instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary; + + /** + * Encodes the specified Summary message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.verify|verify} messages. + * @param message Summary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Summary message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.verify|verify} messages. + * @param message Summary message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Summary message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Summary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary; + + /** + * Decodes a Summary message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Summary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary; + + /** + * Verifies a Summary message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Summary message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Summary + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary; + + /** + * Creates a plain object from a Summary message. Also converts values to other types if specified. + * @param message Summary + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Summary to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Summary + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ConversationEvent. */ + interface IConversationEvent { + + /** ConversationEvent conversation */ + conversation?: (string|null); + + /** ConversationEvent type */ + type?: (google.cloud.dialogflow.v2beta1.ConversationEvent.Type|keyof typeof google.cloud.dialogflow.v2beta1.ConversationEvent.Type|null); + + /** ConversationEvent errorStatus */ + errorStatus?: (google.rpc.IStatus|null); + + /** ConversationEvent newMessagePayload */ + newMessagePayload?: (google.cloud.dialogflow.v2beta1.IMessage|null); + } + + /** Represents a ConversationEvent. */ + class ConversationEvent implements IConversationEvent { + + /** + * Constructs a new ConversationEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IConversationEvent); + + /** ConversationEvent conversation. */ + public conversation: string; + + /** ConversationEvent type. */ + public type: (google.cloud.dialogflow.v2beta1.ConversationEvent.Type|keyof typeof google.cloud.dialogflow.v2beta1.ConversationEvent.Type); + + /** ConversationEvent errorStatus. */ + public errorStatus?: (google.rpc.IStatus|null); + + /** ConversationEvent newMessagePayload. */ + public newMessagePayload?: (google.cloud.dialogflow.v2beta1.IMessage|null); + + /** ConversationEvent payload. */ + public payload?: "newMessagePayload"; + + /** + * Creates a new ConversationEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationEvent instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IConversationEvent): google.cloud.dialogflow.v2beta1.ConversationEvent; + + /** + * Encodes the specified ConversationEvent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationEvent.verify|verify} messages. + * @param message ConversationEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IConversationEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationEvent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationEvent.verify|verify} messages. + * @param message ConversationEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IConversationEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ConversationEvent; + + /** + * Decodes a ConversationEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ConversationEvent; + + /** + * Verifies a ConversationEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ConversationEvent; + + /** + * Creates a plain object from a ConversationEvent message. Also converts values to other types if specified. + * @param message ConversationEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ConversationEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationEvent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ConversationEvent { + + /** Type enum. */ + enum Type { + TYPE_UNSPECIFIED = 0, + CONVERSATION_STARTED = 1, + CONVERSATION_FINISHED = 2, + HUMAN_INTERVENTION_NEEDED = 3, + NEW_MESSAGE = 5, + UNRECOVERABLE_ERROR = 4 + } + } + + /** Represents a ConversationProfiles */ + class ConversationProfiles extends $protobuf.rpc.Service { + + /** + * Constructs a new ConversationProfiles 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 ConversationProfiles 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): ConversationProfiles; + + /** + * Calls ListConversationProfiles. + * @param request ListConversationProfilesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListConversationProfilesResponse + */ + public listConversationProfiles(request: google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, callback: google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfilesCallback): void; + + /** + * Calls ListConversationProfiles. + * @param request ListConversationProfilesRequest message or plain object + * @returns Promise + */ + public listConversationProfiles(request: google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest): Promise; + + /** + * Calls GetConversationProfile. + * @param request GetConversationProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConversationProfile + */ + public getConversationProfile(request: google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, callback: google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfileCallback): void; + + /** + * Calls GetConversationProfile. + * @param request GetConversationProfileRequest message or plain object + * @returns Promise + */ + public getConversationProfile(request: google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest): Promise; + + /** + * Calls CreateConversationProfile. + * @param request CreateConversationProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConversationProfile + */ + public createConversationProfile(request: google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, callback: google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfileCallback): void; + + /** + * Calls CreateConversationProfile. + * @param request CreateConversationProfileRequest message or plain object + * @returns Promise + */ + public createConversationProfile(request: google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest): Promise; + + /** + * Calls UpdateConversationProfile. + * @param request UpdateConversationProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConversationProfile + */ + public updateConversationProfile(request: google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, callback: google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfileCallback): void; + + /** + * Calls UpdateConversationProfile. + * @param request UpdateConversationProfileRequest message or plain object + * @returns Promise + */ + public updateConversationProfile(request: google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest): Promise; + + /** + * Calls DeleteConversationProfile. + * @param request DeleteConversationProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteConversationProfile(request: google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, callback: google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfileCallback): void; + + /** + * Calls DeleteConversationProfile. + * @param request DeleteConversationProfileRequest message or plain object + * @returns Promise + */ + public deleteConversationProfile(request: google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest): Promise; + + /** + * Calls SetSuggestionFeatureConfig. + * @param request SetSuggestionFeatureConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public setSuggestionFeatureConfig(request: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, callback: google.cloud.dialogflow.v2beta1.ConversationProfiles.SetSuggestionFeatureConfigCallback): void; + + /** + * Calls SetSuggestionFeatureConfig. + * @param request SetSuggestionFeatureConfigRequest message or plain object + * @returns Promise + */ + public setSuggestionFeatureConfig(request: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest): Promise; + + /** + * Calls ClearSuggestionFeatureConfig. + * @param request ClearSuggestionFeatureConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public clearSuggestionFeatureConfig(request: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, callback: google.cloud.dialogflow.v2beta1.ConversationProfiles.ClearSuggestionFeatureConfigCallback): void; + + /** + * Calls ClearSuggestionFeatureConfig. + * @param request ClearSuggestionFeatureConfigRequest message or plain object + * @returns Promise + */ + public clearSuggestionFeatureConfig(request: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest): Promise; + } + + namespace ConversationProfiles { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|listConversationProfiles}. + * @param error Error, if any + * @param [response] ListConversationProfilesResponse + */ + type ListConversationProfilesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|getConversationProfile}. + * @param error Error, if any + * @param [response] ConversationProfile + */ + type GetConversationProfileCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ConversationProfile) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|createConversationProfile}. + * @param error Error, if any + * @param [response] ConversationProfile + */ + type CreateConversationProfileCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ConversationProfile) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|updateConversationProfile}. + * @param error Error, if any + * @param [response] ConversationProfile + */ + type UpdateConversationProfileCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ConversationProfile) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|deleteConversationProfile}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteConversationProfileCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|setSuggestionFeatureConfig}. + * @param error Error, if any + * @param [response] Operation + */ + type SetSuggestionFeatureConfigCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|clearSuggestionFeatureConfig}. + * @param error Error, if any + * @param [response] Operation + */ + type ClearSuggestionFeatureConfigCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a ConversationProfile. */ + interface IConversationProfile { + + /** ConversationProfile name */ + name?: (string|null); + + /** ConversationProfile displayName */ + displayName?: (string|null); + + /** ConversationProfile createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationProfile updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** ConversationProfile automatedAgentConfig */ + automatedAgentConfig?: (google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig|null); + + /** ConversationProfile humanAgentAssistantConfig */ + humanAgentAssistantConfig?: (google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig|null); + + /** ConversationProfile humanAgentHandoffConfig */ + humanAgentHandoffConfig?: (google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig|null); + + /** ConversationProfile notificationConfig */ + notificationConfig?: (google.cloud.dialogflow.v2beta1.INotificationConfig|null); + + /** ConversationProfile loggingConfig */ + loggingConfig?: (google.cloud.dialogflow.v2beta1.ILoggingConfig|null); + + /** ConversationProfile newMessageEventNotificationConfig */ + newMessageEventNotificationConfig?: (google.cloud.dialogflow.v2beta1.INotificationConfig|null); + + /** ConversationProfile sttConfig */ + sttConfig?: (google.cloud.dialogflow.v2beta1.ISpeechToTextConfig|null); + + /** ConversationProfile languageCode */ + languageCode?: (string|null); + + /** ConversationProfile timeZone */ + timeZone?: (string|null); + + /** ConversationProfile securitySettings */ + securitySettings?: (string|null); + } + + /** Represents a ConversationProfile. */ + class ConversationProfile implements IConversationProfile { + + /** + * Constructs a new ConversationProfile. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IConversationProfile); + + /** ConversationProfile name. */ + public name: string; + + /** ConversationProfile displayName. */ + public displayName: string; + + /** ConversationProfile createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** ConversationProfile updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** ConversationProfile automatedAgentConfig. */ + public automatedAgentConfig?: (google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig|null); + + /** ConversationProfile humanAgentAssistantConfig. */ + public humanAgentAssistantConfig?: (google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig|null); + + /** ConversationProfile humanAgentHandoffConfig. */ + public humanAgentHandoffConfig?: (google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig|null); + + /** ConversationProfile notificationConfig. */ + public notificationConfig?: (google.cloud.dialogflow.v2beta1.INotificationConfig|null); + + /** ConversationProfile loggingConfig. */ + public loggingConfig?: (google.cloud.dialogflow.v2beta1.ILoggingConfig|null); + + /** ConversationProfile newMessageEventNotificationConfig. */ + public newMessageEventNotificationConfig?: (google.cloud.dialogflow.v2beta1.INotificationConfig|null); + + /** ConversationProfile sttConfig. */ + public sttConfig?: (google.cloud.dialogflow.v2beta1.ISpeechToTextConfig|null); + + /** ConversationProfile languageCode. */ + public languageCode: string; + + /** ConversationProfile timeZone. */ + public timeZone: string; + + /** ConversationProfile securitySettings. */ + public securitySettings: string; + + /** + * Creates a new ConversationProfile instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationProfile instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IConversationProfile): google.cloud.dialogflow.v2beta1.ConversationProfile; + + /** + * Encodes the specified ConversationProfile message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationProfile.verify|verify} messages. + * @param message ConversationProfile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IConversationProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationProfile message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationProfile.verify|verify} messages. + * @param message ConversationProfile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IConversationProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationProfile message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ConversationProfile; + + /** + * Decodes a ConversationProfile message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ConversationProfile; + + /** + * Verifies a ConversationProfile message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationProfile message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationProfile + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ConversationProfile; + + /** + * Creates a plain object from a ConversationProfile message. Also converts values to other types if specified. + * @param message ConversationProfile + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ConversationProfile, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationProfile to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationProfile + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AutomatedAgentConfig. */ + interface IAutomatedAgentConfig { + + /** AutomatedAgentConfig agent */ + agent?: (string|null); + } + + /** Represents an AutomatedAgentConfig. */ + class AutomatedAgentConfig implements IAutomatedAgentConfig { + + /** + * Constructs a new AutomatedAgentConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig); + + /** AutomatedAgentConfig agent. */ + public agent: string; + + /** + * Creates a new AutomatedAgentConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns AutomatedAgentConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig): google.cloud.dialogflow.v2beta1.AutomatedAgentConfig; + + /** + * Encodes the specified AutomatedAgentConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AutomatedAgentConfig.verify|verify} messages. + * @param message AutomatedAgentConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AutomatedAgentConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AutomatedAgentConfig.verify|verify} messages. + * @param message AutomatedAgentConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AutomatedAgentConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AutomatedAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.AutomatedAgentConfig; + + /** + * Decodes an AutomatedAgentConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AutomatedAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.AutomatedAgentConfig; + + /** + * Verifies an AutomatedAgentConfig message. + * @param message Plain 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 AutomatedAgentConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AutomatedAgentConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.AutomatedAgentConfig; + + /** + * Creates a plain object from an AutomatedAgentConfig message. Also converts values to other types if specified. + * @param message AutomatedAgentConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.AutomatedAgentConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AutomatedAgentConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AutomatedAgentConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a HumanAgentAssistantConfig. */ + interface IHumanAgentAssistantConfig { + + /** HumanAgentAssistantConfig notificationConfig */ + notificationConfig?: (google.cloud.dialogflow.v2beta1.INotificationConfig|null); + + /** HumanAgentAssistantConfig humanAgentSuggestionConfig */ + humanAgentSuggestionConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig|null); + + /** HumanAgentAssistantConfig endUserSuggestionConfig */ + endUserSuggestionConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig|null); + + /** HumanAgentAssistantConfig messageAnalysisConfig */ + messageAnalysisConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig|null); + } + + /** Represents a HumanAgentAssistantConfig. */ + class HumanAgentAssistantConfig implements IHumanAgentAssistantConfig { + + /** + * Constructs a new HumanAgentAssistantConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig); + + /** HumanAgentAssistantConfig notificationConfig. */ + public notificationConfig?: (google.cloud.dialogflow.v2beta1.INotificationConfig|null); + + /** HumanAgentAssistantConfig humanAgentSuggestionConfig. */ + public humanAgentSuggestionConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig|null); + + /** HumanAgentAssistantConfig endUserSuggestionConfig. */ + public endUserSuggestionConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig|null); + + /** HumanAgentAssistantConfig messageAnalysisConfig. */ + public messageAnalysisConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig|null); + + /** + * Creates a new HumanAgentAssistantConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanAgentAssistantConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig; + + /** + * Encodes the specified HumanAgentAssistantConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.verify|verify} messages. + * @param message HumanAgentAssistantConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanAgentAssistantConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.verify|verify} messages. + * @param message HumanAgentAssistantConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanAgentAssistantConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanAgentAssistantConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig; + + /** + * Decodes a HumanAgentAssistantConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanAgentAssistantConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig; + + /** + * Verifies a HumanAgentAssistantConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanAgentAssistantConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanAgentAssistantConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig; + + /** + * Creates a plain object from a HumanAgentAssistantConfig message. Also converts values to other types if specified. + * @param message HumanAgentAssistantConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanAgentAssistantConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanAgentAssistantConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace HumanAgentAssistantConfig { + + /** Properties of a SuggestionTriggerSettings. */ + interface ISuggestionTriggerSettings { + + /** SuggestionTriggerSettings noSmallTalk */ + noSmallTalk?: (boolean|null); + + /** SuggestionTriggerSettings onlyEndUser */ + onlyEndUser?: (boolean|null); + } + + /** Represents a SuggestionTriggerSettings. */ + class SuggestionTriggerSettings implements ISuggestionTriggerSettings { + + /** + * Constructs a new SuggestionTriggerSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings); + + /** SuggestionTriggerSettings noSmallTalk. */ + public noSmallTalk: boolean; + + /** SuggestionTriggerSettings onlyEndUser. */ + public onlyEndUser: boolean; + + /** + * Creates a new SuggestionTriggerSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionTriggerSettings instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings; + + /** + * Encodes the specified SuggestionTriggerSettings message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify|verify} messages. + * @param message SuggestionTriggerSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionTriggerSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify|verify} messages. + * @param message SuggestionTriggerSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionTriggerSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionTriggerSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings; + + /** + * Decodes a SuggestionTriggerSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionTriggerSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings; + + /** + * Verifies a SuggestionTriggerSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionTriggerSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionTriggerSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings; + + /** + * Creates a plain object from a SuggestionTriggerSettings message. Also converts values to other types if specified. + * @param message SuggestionTriggerSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionTriggerSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionTriggerSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestionFeatureConfig. */ + interface ISuggestionFeatureConfig { + + /** SuggestionFeatureConfig suggestionFeature */ + suggestionFeature?: (google.cloud.dialogflow.v2beta1.ISuggestionFeature|null); + + /** SuggestionFeatureConfig enableEventBasedSuggestion */ + enableEventBasedSuggestion?: (boolean|null); + + /** SuggestionFeatureConfig suggestionTriggerSettings */ + suggestionTriggerSettings?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings|null); + + /** SuggestionFeatureConfig queryConfig */ + queryConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig|null); + + /** SuggestionFeatureConfig conversationModelConfig */ + conversationModelConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig|null); + + /** SuggestionFeatureConfig conversationProcessConfig */ + conversationProcessConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig|null); + } + + /** Represents a SuggestionFeatureConfig. */ + class SuggestionFeatureConfig implements ISuggestionFeatureConfig { + + /** + * Constructs a new SuggestionFeatureConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig); + + /** SuggestionFeatureConfig suggestionFeature. */ + public suggestionFeature?: (google.cloud.dialogflow.v2beta1.ISuggestionFeature|null); + + /** SuggestionFeatureConfig enableEventBasedSuggestion. */ + public enableEventBasedSuggestion: boolean; + + /** SuggestionFeatureConfig suggestionTriggerSettings. */ + public suggestionTriggerSettings?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings|null); + + /** SuggestionFeatureConfig queryConfig. */ + public queryConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig|null); + + /** SuggestionFeatureConfig conversationModelConfig. */ + public conversationModelConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig|null); + + /** SuggestionFeatureConfig conversationProcessConfig. */ + public conversationProcessConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig|null); + + /** + * Creates a new SuggestionFeatureConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionFeatureConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig; + + /** + * Encodes the specified SuggestionFeatureConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify|verify} messages. + * @param message SuggestionFeatureConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionFeatureConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify|verify} messages. + * @param message SuggestionFeatureConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionFeatureConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionFeatureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig; + + /** + * Decodes a SuggestionFeatureConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionFeatureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig; + + /** + * Verifies a SuggestionFeatureConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionFeatureConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionFeatureConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig; + + /** + * Creates a plain object from a SuggestionFeatureConfig message. Also converts values to other types if specified. + * @param message SuggestionFeatureConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionFeatureConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionFeatureConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestionConfig. */ + interface ISuggestionConfig { + + /** SuggestionConfig featureConfigs */ + featureConfigs?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig[]|null); + + /** SuggestionConfig groupSuggestionResponses */ + groupSuggestionResponses?: (boolean|null); + } + + /** Represents a SuggestionConfig. */ + class SuggestionConfig implements ISuggestionConfig { + + /** + * Constructs a new SuggestionConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig); + + /** SuggestionConfig featureConfigs. */ + public featureConfigs: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig[]; + + /** SuggestionConfig groupSuggestionResponses. */ + public groupSuggestionResponses: boolean; + + /** + * Creates a new SuggestionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig; + + /** + * Encodes the specified SuggestionConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.verify|verify} messages. + * @param message SuggestionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.verify|verify} messages. + * @param message SuggestionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig; + + /** + * Decodes a SuggestionConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig; + + /** + * Verifies a SuggestionConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig; + + /** + * Creates a plain object from a SuggestionConfig message. Also converts values to other types if specified. + * @param message SuggestionConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SuggestionQueryConfig. */ + interface ISuggestionQueryConfig { + + /** SuggestionQueryConfig knowledgeBaseQuerySource */ + knowledgeBaseQuerySource?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource|null); + + /** SuggestionQueryConfig documentQuerySource */ + documentQuerySource?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource|null); + + /** SuggestionQueryConfig dialogflowQuerySource */ + dialogflowQuerySource?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource|null); + + /** SuggestionQueryConfig maxResults */ + maxResults?: (number|null); + + /** SuggestionQueryConfig confidenceThreshold */ + confidenceThreshold?: (number|null); + + /** SuggestionQueryConfig contextFilterSettings */ + contextFilterSettings?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings|null); + } + + /** Represents a SuggestionQueryConfig. */ + class SuggestionQueryConfig implements ISuggestionQueryConfig { + + /** + * Constructs a new SuggestionQueryConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig); + + /** SuggestionQueryConfig knowledgeBaseQuerySource. */ + public knowledgeBaseQuerySource?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource|null); + + /** SuggestionQueryConfig documentQuerySource. */ + public documentQuerySource?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource|null); + + /** SuggestionQueryConfig dialogflowQuerySource. */ + public dialogflowQuerySource?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource|null); + + /** SuggestionQueryConfig maxResults. */ + public maxResults: number; + + /** SuggestionQueryConfig confidenceThreshold. */ + public confidenceThreshold: number; + + /** SuggestionQueryConfig contextFilterSettings. */ + public contextFilterSettings?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings|null); + + /** SuggestionQueryConfig querySource. */ + public querySource?: ("knowledgeBaseQuerySource"|"documentQuerySource"|"dialogflowQuerySource"); + + /** + * Creates a new SuggestionQueryConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SuggestionQueryConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig; + + /** + * Encodes the specified SuggestionQueryConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.verify|verify} messages. + * @param message SuggestionQueryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SuggestionQueryConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.verify|verify} messages. + * @param message SuggestionQueryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SuggestionQueryConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SuggestionQueryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig; + + /** + * Decodes a SuggestionQueryConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SuggestionQueryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig; + + /** + * Verifies a SuggestionQueryConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SuggestionQueryConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SuggestionQueryConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig; + + /** + * Creates a plain object from a SuggestionQueryConfig message. Also converts values to other types if specified. + * @param message SuggestionQueryConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SuggestionQueryConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SuggestionQueryConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SuggestionQueryConfig { + + /** Properties of a KnowledgeBaseQuerySource. */ + interface IKnowledgeBaseQuerySource { + + /** KnowledgeBaseQuerySource knowledgeBases */ + knowledgeBases?: (string[]|null); + } + + /** Represents a KnowledgeBaseQuerySource. */ + class KnowledgeBaseQuerySource implements IKnowledgeBaseQuerySource { + + /** + * Constructs a new KnowledgeBaseQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource); + + /** KnowledgeBaseQuerySource knowledgeBases. */ + public knowledgeBases: string[]; + + /** + * Creates a new KnowledgeBaseQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns KnowledgeBaseQuerySource instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource; + + /** + * Encodes the specified KnowledgeBaseQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify|verify} messages. + * @param message KnowledgeBaseQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KnowledgeBaseQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify|verify} messages. + * @param message KnowledgeBaseQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KnowledgeBaseQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KnowledgeBaseQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource; + + /** + * Decodes a KnowledgeBaseQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KnowledgeBaseQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource; + + /** + * Verifies a KnowledgeBaseQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KnowledgeBaseQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KnowledgeBaseQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource; + + /** + * Creates a plain object from a KnowledgeBaseQuerySource message. Also converts values to other types if specified. + * @param message KnowledgeBaseQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KnowledgeBaseQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KnowledgeBaseQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DocumentQuerySource. */ + interface IDocumentQuerySource { + + /** DocumentQuerySource documents */ + documents?: (string[]|null); + } + + /** Represents a DocumentQuerySource. */ + class DocumentQuerySource implements IDocumentQuerySource { + + /** + * Constructs a new DocumentQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource); + + /** DocumentQuerySource documents. */ + public documents: string[]; + + /** + * Creates a new DocumentQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns DocumentQuerySource instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource; + + /** + * Encodes the specified DocumentQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify|verify} messages. + * @param message DocumentQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DocumentQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify|verify} messages. + * @param message DocumentQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DocumentQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DocumentQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource; + + /** + * Decodes a DocumentQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DocumentQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource; + + /** + * Verifies a DocumentQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DocumentQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DocumentQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource; + + /** + * Creates a plain object from a DocumentQuerySource message. Also converts values to other types if specified. + * @param message DocumentQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DocumentQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DocumentQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DialogflowQuerySource. */ + interface IDialogflowQuerySource { + + /** DialogflowQuerySource agent */ + agent?: (string|null); + } + + /** Represents a DialogflowQuerySource. */ + class DialogflowQuerySource implements IDialogflowQuerySource { + + /** + * Constructs a new DialogflowQuerySource. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource); + + /** DialogflowQuerySource agent. */ + public agent: string; + + /** + * Creates a new DialogflowQuerySource instance using the specified properties. + * @param [properties] Properties to set + * @returns DialogflowQuerySource instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource; + + /** + * Encodes the specified DialogflowQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify|verify} messages. + * @param message DialogflowQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DialogflowQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify|verify} messages. + * @param message DialogflowQuerySource message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DialogflowQuerySource message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DialogflowQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource; + + /** + * Decodes a DialogflowQuerySource message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DialogflowQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource; + + /** + * Verifies a DialogflowQuerySource message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DialogflowQuerySource message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DialogflowQuerySource + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource; + + /** + * Creates a plain object from a DialogflowQuerySource message. Also converts values to other types if specified. + * @param message DialogflowQuerySource + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DialogflowQuerySource to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DialogflowQuerySource + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ContextFilterSettings. */ + interface IContextFilterSettings { + + /** ContextFilterSettings dropHandoffMessages */ + dropHandoffMessages?: (boolean|null); + + /** ContextFilterSettings dropVirtualAgentMessages */ + dropVirtualAgentMessages?: (boolean|null); + + /** ContextFilterSettings dropIvrMessages */ + dropIvrMessages?: (boolean|null); + } + + /** Represents a ContextFilterSettings. */ + class ContextFilterSettings implements IContextFilterSettings { + + /** + * Constructs a new ContextFilterSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings); + + /** ContextFilterSettings dropHandoffMessages. */ + public dropHandoffMessages: boolean; + + /** ContextFilterSettings dropVirtualAgentMessages. */ + public dropVirtualAgentMessages: boolean; + + /** ContextFilterSettings dropIvrMessages. */ + public dropIvrMessages: boolean; + + /** + * Creates a new ContextFilterSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns ContextFilterSettings instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings; + + /** + * Encodes the specified ContextFilterSettings message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify|verify} messages. + * @param message ContextFilterSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ContextFilterSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify|verify} messages. + * @param message ContextFilterSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ContextFilterSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ContextFilterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings; + + /** + * Decodes a ContextFilterSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ContextFilterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings; + + /** + * Verifies a ContextFilterSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ContextFilterSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ContextFilterSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings; + + /** + * Creates a plain object from a ContextFilterSettings message. Also converts values to other types if specified. + * @param message ContextFilterSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ContextFilterSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ContextFilterSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ConversationModelConfig. */ + interface IConversationModelConfig { + + /** ConversationModelConfig model */ + model?: (string|null); + } + + /** Represents a ConversationModelConfig. */ + class ConversationModelConfig implements IConversationModelConfig { + + /** + * Constructs a new ConversationModelConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig); + + /** ConversationModelConfig model. */ + public model: string; + + /** + * Creates a new ConversationModelConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationModelConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig; + + /** + * Encodes the specified ConversationModelConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig.verify|verify} messages. + * @param message ConversationModelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationModelConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig.verify|verify} messages. + * @param message ConversationModelConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationModelConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationModelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig; + + /** + * Decodes a ConversationModelConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationModelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig; + + /** + * Verifies a ConversationModelConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationModelConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationModelConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig; + + /** + * Creates a plain object from a ConversationModelConfig message. Also converts values to other types if specified. + * @param message ConversationModelConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationModelConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationModelConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ConversationProcessConfig. */ + interface IConversationProcessConfig { + + /** ConversationProcessConfig recentSentencesCount */ + recentSentencesCount?: (number|null); + } + + /** Represents a ConversationProcessConfig. */ + class ConversationProcessConfig implements IConversationProcessConfig { + + /** + * Constructs a new ConversationProcessConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig); + + /** ConversationProcessConfig recentSentencesCount. */ + public recentSentencesCount: number; + + /** + * Creates a new ConversationProcessConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ConversationProcessConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig; + + /** + * Encodes the specified ConversationProcessConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig.verify|verify} messages. + * @param message ConversationProcessConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConversationProcessConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig.verify|verify} messages. + * @param message ConversationProcessConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConversationProcessConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConversationProcessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig; + + /** + * Decodes a ConversationProcessConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConversationProcessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig; + + /** + * Verifies a ConversationProcessConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConversationProcessConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConversationProcessConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig; + + /** + * Creates a plain object from a ConversationProcessConfig message. Also converts values to other types if specified. + * @param message ConversationProcessConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConversationProcessConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConversationProcessConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MessageAnalysisConfig. */ + interface IMessageAnalysisConfig { + + /** MessageAnalysisConfig enableEntityExtraction */ + enableEntityExtraction?: (boolean|null); + + /** MessageAnalysisConfig enableSentimentAnalysis */ + enableSentimentAnalysis?: (boolean|null); + } + + /** Represents a MessageAnalysisConfig. */ + class MessageAnalysisConfig implements IMessageAnalysisConfig { + + /** + * Constructs a new MessageAnalysisConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig); + + /** MessageAnalysisConfig enableEntityExtraction. */ + public enableEntityExtraction: boolean; + + /** MessageAnalysisConfig enableSentimentAnalysis. */ + public enableSentimentAnalysis: boolean; + + /** + * Creates a new MessageAnalysisConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageAnalysisConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig; + + /** + * Encodes the specified MessageAnalysisConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig.verify|verify} messages. + * @param message MessageAnalysisConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageAnalysisConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig.verify|verify} messages. + * @param message MessageAnalysisConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageAnalysisConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageAnalysisConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig; + + /** + * Decodes a MessageAnalysisConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageAnalysisConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig; + + /** + * Verifies a MessageAnalysisConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageAnalysisConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageAnalysisConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig; + + /** + * Creates a plain object from a MessageAnalysisConfig message. Also converts values to other types if specified. + * @param message MessageAnalysisConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageAnalysisConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageAnalysisConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a HumanAgentHandoffConfig. */ + interface IHumanAgentHandoffConfig { + + /** HumanAgentHandoffConfig livePersonConfig */ + livePersonConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig|null); + + /** HumanAgentHandoffConfig salesforceLiveAgentConfig */ + salesforceLiveAgentConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig|null); + } + + /** Represents a HumanAgentHandoffConfig. */ + class HumanAgentHandoffConfig implements IHumanAgentHandoffConfig { + + /** + * Constructs a new HumanAgentHandoffConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig); + + /** HumanAgentHandoffConfig livePersonConfig. */ + public livePersonConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig|null); + + /** HumanAgentHandoffConfig salesforceLiveAgentConfig. */ + public salesforceLiveAgentConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig|null); + + /** HumanAgentHandoffConfig agentService. */ + public agentService?: ("livePersonConfig"|"salesforceLiveAgentConfig"); + + /** + * Creates a new HumanAgentHandoffConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanAgentHandoffConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig; + + /** + * Encodes the specified HumanAgentHandoffConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.verify|verify} messages. + * @param message HumanAgentHandoffConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanAgentHandoffConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.verify|verify} messages. + * @param message HumanAgentHandoffConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanAgentHandoffConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanAgentHandoffConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig; + + /** + * Decodes a HumanAgentHandoffConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanAgentHandoffConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig; + + /** + * Verifies a HumanAgentHandoffConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanAgentHandoffConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanAgentHandoffConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig; + + /** + * Creates a plain object from a HumanAgentHandoffConfig message. Also converts values to other types if specified. + * @param message HumanAgentHandoffConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanAgentHandoffConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanAgentHandoffConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace HumanAgentHandoffConfig { + + /** Properties of a LivePersonConfig. */ + interface ILivePersonConfig { + + /** LivePersonConfig accountNumber */ + accountNumber?: (string|null); + } + + /** Represents a LivePersonConfig. */ + class LivePersonConfig implements ILivePersonConfig { + + /** + * Constructs a new LivePersonConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig); + + /** LivePersonConfig accountNumber. */ + public accountNumber: string; + + /** + * Creates a new LivePersonConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns LivePersonConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig; + + /** + * Encodes the specified LivePersonConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig.verify|verify} messages. + * @param message LivePersonConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LivePersonConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig.verify|verify} messages. + * @param message LivePersonConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LivePersonConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LivePersonConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig; + + /** + * Decodes a LivePersonConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LivePersonConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig; + + /** + * Verifies a LivePersonConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LivePersonConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LivePersonConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig; + + /** + * Creates a plain object from a LivePersonConfig message. Also converts values to other types if specified. + * @param message LivePersonConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LivePersonConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LivePersonConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SalesforceLiveAgentConfig. */ + interface ISalesforceLiveAgentConfig { + + /** SalesforceLiveAgentConfig organizationId */ + organizationId?: (string|null); + + /** SalesforceLiveAgentConfig deploymentId */ + deploymentId?: (string|null); + + /** SalesforceLiveAgentConfig buttonId */ + buttonId?: (string|null); + + /** SalesforceLiveAgentConfig endpointDomain */ + endpointDomain?: (string|null); + } + + /** Represents a SalesforceLiveAgentConfig. */ + class SalesforceLiveAgentConfig implements ISalesforceLiveAgentConfig { + + /** + * Constructs a new SalesforceLiveAgentConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig); + + /** SalesforceLiveAgentConfig organizationId. */ + public organizationId: string; + + /** SalesforceLiveAgentConfig deploymentId. */ + public deploymentId: string; + + /** SalesforceLiveAgentConfig buttonId. */ + public buttonId: string; + + /** SalesforceLiveAgentConfig endpointDomain. */ + public endpointDomain: string; + + /** + * Creates a new SalesforceLiveAgentConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SalesforceLiveAgentConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig; + + /** + * Encodes the specified SalesforceLiveAgentConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify|verify} messages. + * @param message SalesforceLiveAgentConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SalesforceLiveAgentConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify|verify} messages. + * @param message SalesforceLiveAgentConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SalesforceLiveAgentConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SalesforceLiveAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig; + + /** + * Decodes a SalesforceLiveAgentConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SalesforceLiveAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig; + + /** + * Verifies a SalesforceLiveAgentConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SalesforceLiveAgentConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SalesforceLiveAgentConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig; + + /** + * Creates a plain object from a SalesforceLiveAgentConfig message. Also converts values to other types if specified. + * @param message SalesforceLiveAgentConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SalesforceLiveAgentConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SalesforceLiveAgentConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a NotificationConfig. */ + interface INotificationConfig { + + /** NotificationConfig topic */ + topic?: (string|null); + + /** NotificationConfig messageFormat */ + messageFormat?: (google.cloud.dialogflow.v2beta1.NotificationConfig.MessageFormat|keyof typeof google.cloud.dialogflow.v2beta1.NotificationConfig.MessageFormat|null); + } + + /** Represents a NotificationConfig. */ + class NotificationConfig implements INotificationConfig { + + /** + * Constructs a new NotificationConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.INotificationConfig); + + /** NotificationConfig topic. */ + public topic: string; + + /** NotificationConfig messageFormat. */ + public messageFormat: (google.cloud.dialogflow.v2beta1.NotificationConfig.MessageFormat|keyof typeof google.cloud.dialogflow.v2beta1.NotificationConfig.MessageFormat); + + /** + * Creates a new NotificationConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns NotificationConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.INotificationConfig): google.cloud.dialogflow.v2beta1.NotificationConfig; + + /** + * Encodes the specified NotificationConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.NotificationConfig.verify|verify} messages. + * @param message NotificationConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.INotificationConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NotificationConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.NotificationConfig.verify|verify} messages. + * @param message NotificationConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.INotificationConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NotificationConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NotificationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.NotificationConfig; + + /** + * Decodes a NotificationConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NotificationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.NotificationConfig; + + /** + * Verifies a NotificationConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NotificationConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NotificationConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.NotificationConfig; + + /** + * Creates a plain object from a NotificationConfig message. Also converts values to other types if specified. + * @param message NotificationConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.NotificationConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NotificationConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NotificationConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace NotificationConfig { + + /** MessageFormat enum. */ + enum MessageFormat { + MESSAGE_FORMAT_UNSPECIFIED = 0, + PROTO = 1, + JSON = 2 + } + } + + /** Properties of a LoggingConfig. */ + interface ILoggingConfig { + + /** LoggingConfig enableStackdriverLogging */ + enableStackdriverLogging?: (boolean|null); + } + + /** Represents a LoggingConfig. */ + class LoggingConfig implements ILoggingConfig { + + /** + * Constructs a new LoggingConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ILoggingConfig); + + /** LoggingConfig enableStackdriverLogging. */ + public enableStackdriverLogging: boolean; + + /** + * Creates a new LoggingConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns LoggingConfig instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ILoggingConfig): google.cloud.dialogflow.v2beta1.LoggingConfig; + + /** + * Encodes the specified LoggingConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.LoggingConfig.verify|verify} messages. + * @param message LoggingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ILoggingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LoggingConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.LoggingConfig.verify|verify} messages. + * @param message LoggingConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ILoggingConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LoggingConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LoggingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.LoggingConfig; + + /** + * Decodes a LoggingConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LoggingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.LoggingConfig; + + /** + * Verifies a LoggingConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LoggingConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LoggingConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.LoggingConfig; + + /** + * Creates a plain object from a LoggingConfig message. Also converts values to other types if specified. + * @param message LoggingConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.LoggingConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LoggingConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LoggingConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationProfilesRequest. */ + interface IListConversationProfilesRequest { + + /** ListConversationProfilesRequest parent */ + parent?: (string|null); + + /** ListConversationProfilesRequest pageSize */ + pageSize?: (number|null); + + /** ListConversationProfilesRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListConversationProfilesRequest. */ + class ListConversationProfilesRequest implements IListConversationProfilesRequest { + + /** + * Constructs a new ListConversationProfilesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest); + + /** ListConversationProfilesRequest parent. */ + public parent: string; + + /** ListConversationProfilesRequest pageSize. */ + public pageSize: number; + + /** ListConversationProfilesRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListConversationProfilesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationProfilesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest): google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest; + + /** + * Encodes the specified ListConversationProfilesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest.verify|verify} messages. + * @param message ListConversationProfilesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationProfilesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest.verify|verify} messages. + * @param message ListConversationProfilesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationProfilesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationProfilesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest; + + /** + * Decodes a ListConversationProfilesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationProfilesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest; + + /** + * Verifies a ListConversationProfilesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationProfilesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationProfilesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest; + + /** + * Creates a plain object from a ListConversationProfilesRequest message. Also converts values to other types if specified. + * @param message ListConversationProfilesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationProfilesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationProfilesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListConversationProfilesResponse. */ + interface IListConversationProfilesResponse { + + /** ListConversationProfilesResponse conversationProfiles */ + conversationProfiles?: (google.cloud.dialogflow.v2beta1.IConversationProfile[]|null); + + /** ListConversationProfilesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListConversationProfilesResponse. */ + class ListConversationProfilesResponse implements IListConversationProfilesResponse { + + /** + * Constructs a new ListConversationProfilesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse); + + /** ListConversationProfilesResponse conversationProfiles. */ + public conversationProfiles: google.cloud.dialogflow.v2beta1.IConversationProfile[]; + + /** ListConversationProfilesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListConversationProfilesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListConversationProfilesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse): google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse; + + /** + * Encodes the specified ListConversationProfilesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse.verify|verify} messages. + * @param message ListConversationProfilesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListConversationProfilesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse.verify|verify} messages. + * @param message ListConversationProfilesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListConversationProfilesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListConversationProfilesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse; + + /** + * Decodes a ListConversationProfilesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListConversationProfilesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse; + + /** + * Verifies a ListConversationProfilesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListConversationProfilesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListConversationProfilesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse; + + /** + * Creates a plain object from a ListConversationProfilesResponse message. Also converts values to other types if specified. + * @param message ListConversationProfilesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListConversationProfilesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListConversationProfilesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetConversationProfileRequest. */ + interface IGetConversationProfileRequest { + + /** GetConversationProfileRequest name */ + name?: (string|null); + } + + /** Represents a GetConversationProfileRequest. */ + class GetConversationProfileRequest implements IGetConversationProfileRequest { + + /** + * Constructs a new GetConversationProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest); + + /** GetConversationProfileRequest name. */ + public name: string; + + /** + * Creates a new GetConversationProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetConversationProfileRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest): google.cloud.dialogflow.v2beta1.GetConversationProfileRequest; + + /** + * Encodes the specified GetConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetConversationProfileRequest.verify|verify} messages. + * @param message GetConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetConversationProfileRequest.verify|verify} messages. + * @param message GetConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetConversationProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetConversationProfileRequest; + + /** + * Decodes a GetConversationProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetConversationProfileRequest; + + /** + * Verifies a GetConversationProfileRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetConversationProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetConversationProfileRequest; + + /** + * Creates a plain object from a GetConversationProfileRequest message. Also converts values to other types if specified. + * @param message GetConversationProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetConversationProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetConversationProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetConversationProfileRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateConversationProfileRequest. */ + interface ICreateConversationProfileRequest { + + /** CreateConversationProfileRequest parent */ + parent?: (string|null); + + /** CreateConversationProfileRequest conversationProfile */ + conversationProfile?: (google.cloud.dialogflow.v2beta1.IConversationProfile|null); + } + + /** Represents a CreateConversationProfileRequest. */ + class CreateConversationProfileRequest implements ICreateConversationProfileRequest { + + /** + * Constructs a new CreateConversationProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest); + + /** CreateConversationProfileRequest parent. */ + public parent: string; + + /** CreateConversationProfileRequest conversationProfile. */ + public conversationProfile?: (google.cloud.dialogflow.v2beta1.IConversationProfile|null); + + /** + * Creates a new CreateConversationProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateConversationProfileRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest): google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest; + + /** + * Encodes the specified CreateConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest.verify|verify} messages. + * @param message CreateConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest.verify|verify} messages. + * @param message CreateConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateConversationProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest; + + /** + * Decodes a CreateConversationProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest; + + /** + * Verifies a CreateConversationProfileRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateConversationProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest; + + /** + * Creates a plain object from a CreateConversationProfileRequest message. Also converts values to other types if specified. + * @param message CreateConversationProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateConversationProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateConversationProfileRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateConversationProfileRequest. */ + interface IUpdateConversationProfileRequest { + + /** UpdateConversationProfileRequest conversationProfile */ + conversationProfile?: (google.cloud.dialogflow.v2beta1.IConversationProfile|null); + + /** UpdateConversationProfileRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateConversationProfileRequest. */ + class UpdateConversationProfileRequest implements IUpdateConversationProfileRequest { + + /** + * Constructs a new UpdateConversationProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest); + + /** UpdateConversationProfileRequest conversationProfile. */ + public conversationProfile?: (google.cloud.dialogflow.v2beta1.IConversationProfile|null); + + /** UpdateConversationProfileRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateConversationProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateConversationProfileRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest): google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest; + + /** + * Encodes the specified UpdateConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest.verify|verify} messages. + * @param message UpdateConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest.verify|verify} messages. + * @param message UpdateConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateConversationProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest; + + /** + * Decodes an UpdateConversationProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest; + + /** + * Verifies an UpdateConversationProfileRequest message. + * @param message Plain 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 UpdateConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateConversationProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest; + + /** + * Creates a plain object from an UpdateConversationProfileRequest message. Also converts values to other types if specified. + * @param message UpdateConversationProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateConversationProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateConversationProfileRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteConversationProfileRequest. */ + interface IDeleteConversationProfileRequest { + + /** DeleteConversationProfileRequest name */ + name?: (string|null); + } + + /** Represents a DeleteConversationProfileRequest. */ + class DeleteConversationProfileRequest implements IDeleteConversationProfileRequest { + + /** + * Constructs a new DeleteConversationProfileRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest); + + /** DeleteConversationProfileRequest name. */ + public name: string; + + /** + * Creates a new DeleteConversationProfileRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteConversationProfileRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest): google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest; + + /** + * Encodes the specified DeleteConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest.verify|verify} messages. + * @param message DeleteConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest.verify|verify} messages. + * @param message DeleteConversationProfileRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteConversationProfileRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest; + + /** + * Decodes a DeleteConversationProfileRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest; + + /** + * Verifies a DeleteConversationProfileRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteConversationProfileRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest; + + /** + * Creates a plain object from a DeleteConversationProfileRequest message. Also converts values to other types if specified. + * @param message DeleteConversationProfileRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteConversationProfileRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteConversationProfileRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SetSuggestionFeatureConfigRequest. */ + interface ISetSuggestionFeatureConfigRequest { + + /** SetSuggestionFeatureConfigRequest conversationProfile */ + conversationProfile?: (string|null); + + /** SetSuggestionFeatureConfigRequest participantRole */ + participantRole?: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role|null); + + /** SetSuggestionFeatureConfigRequest suggestionFeatureConfig */ + suggestionFeatureConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig|null); + } + + /** Represents a SetSuggestionFeatureConfigRequest. */ + class SetSuggestionFeatureConfigRequest implements ISetSuggestionFeatureConfigRequest { + + /** + * Constructs a new SetSuggestionFeatureConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest); + + /** SetSuggestionFeatureConfigRequest conversationProfile. */ + public conversationProfile: string; + + /** SetSuggestionFeatureConfigRequest participantRole. */ + public participantRole: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role); + + /** SetSuggestionFeatureConfigRequest suggestionFeatureConfig. */ + public suggestionFeatureConfig?: (google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig|null); + + /** + * Creates a new SetSuggestionFeatureConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SetSuggestionFeatureConfigRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest): google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest; + + /** + * Encodes the specified SetSuggestionFeatureConfigRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest.verify|verify} messages. + * @param message SetSuggestionFeatureConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetSuggestionFeatureConfigRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest.verify|verify} messages. + * @param message SetSuggestionFeatureConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetSuggestionFeatureConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest; + + /** + * Decodes a SetSuggestionFeatureConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest; + + /** + * Verifies a SetSuggestionFeatureConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetSuggestionFeatureConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetSuggestionFeatureConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest; + + /** + * Creates a plain object from a SetSuggestionFeatureConfigRequest message. Also converts values to other types if specified. + * @param message SetSuggestionFeatureConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetSuggestionFeatureConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetSuggestionFeatureConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ClearSuggestionFeatureConfigRequest. */ + interface IClearSuggestionFeatureConfigRequest { + + /** ClearSuggestionFeatureConfigRequest conversationProfile */ + conversationProfile?: (string|null); + + /** ClearSuggestionFeatureConfigRequest participantRole */ + participantRole?: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role|null); + + /** ClearSuggestionFeatureConfigRequest suggestionFeatureType */ + suggestionFeatureType?: (google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|null); + } + + /** Represents a ClearSuggestionFeatureConfigRequest. */ + class ClearSuggestionFeatureConfigRequest implements IClearSuggestionFeatureConfigRequest { + + /** + * Constructs a new ClearSuggestionFeatureConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest); + + /** ClearSuggestionFeatureConfigRequest conversationProfile. */ + public conversationProfile: string; + + /** ClearSuggestionFeatureConfigRequest participantRole. */ + public participantRole: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role); + + /** ClearSuggestionFeatureConfigRequest suggestionFeatureType. */ + public suggestionFeatureType: (google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2beta1.SuggestionFeature.Type); + + /** + * Creates a new ClearSuggestionFeatureConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ClearSuggestionFeatureConfigRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest): google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest; + + /** + * Encodes the specified ClearSuggestionFeatureConfigRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest.verify|verify} messages. + * @param message ClearSuggestionFeatureConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClearSuggestionFeatureConfigRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest.verify|verify} messages. + * @param message ClearSuggestionFeatureConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClearSuggestionFeatureConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClearSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest; + + /** + * Decodes a ClearSuggestionFeatureConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClearSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest; + + /** + * Verifies a ClearSuggestionFeatureConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClearSuggestionFeatureConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClearSuggestionFeatureConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest; + + /** + * Creates a plain object from a ClearSuggestionFeatureConfigRequest message. Also converts values to other types if specified. + * @param message ClearSuggestionFeatureConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClearSuggestionFeatureConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ClearSuggestionFeatureConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SetSuggestionFeatureConfigOperationMetadata. */ + interface ISetSuggestionFeatureConfigOperationMetadata { + + /** SetSuggestionFeatureConfigOperationMetadata conversationProfile */ + conversationProfile?: (string|null); + + /** SetSuggestionFeatureConfigOperationMetadata participantRole */ + participantRole?: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role|null); + + /** SetSuggestionFeatureConfigOperationMetadata suggestionFeatureType */ + suggestionFeatureType?: (google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|null); + + /** SetSuggestionFeatureConfigOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SetSuggestionFeatureConfigOperationMetadata. */ + class SetSuggestionFeatureConfigOperationMetadata implements ISetSuggestionFeatureConfigOperationMetadata { + + /** + * Constructs a new SetSuggestionFeatureConfigOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata); + + /** SetSuggestionFeatureConfigOperationMetadata conversationProfile. */ + public conversationProfile: string; + + /** SetSuggestionFeatureConfigOperationMetadata participantRole. */ + public participantRole: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role); + + /** SetSuggestionFeatureConfigOperationMetadata suggestionFeatureType. */ + public suggestionFeatureType: (google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2beta1.SuggestionFeature.Type); + + /** SetSuggestionFeatureConfigOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SetSuggestionFeatureConfigOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns SetSuggestionFeatureConfigOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata): google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata; + + /** + * Encodes the specified SetSuggestionFeatureConfigOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @param message SetSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SetSuggestionFeatureConfigOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @param message SetSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SetSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SetSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata; + + /** + * Decodes a SetSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SetSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata; + + /** + * Verifies a SetSuggestionFeatureConfigOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SetSuggestionFeatureConfigOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SetSuggestionFeatureConfigOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata; + + /** + * Creates a plain object from a SetSuggestionFeatureConfigOperationMetadata message. Also converts values to other types if specified. + * @param message SetSuggestionFeatureConfigOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SetSuggestionFeatureConfigOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SetSuggestionFeatureConfigOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ClearSuggestionFeatureConfigOperationMetadata. */ + interface IClearSuggestionFeatureConfigOperationMetadata { + + /** ClearSuggestionFeatureConfigOperationMetadata conversationProfile */ + conversationProfile?: (string|null); + + /** ClearSuggestionFeatureConfigOperationMetadata participantRole */ + participantRole?: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role|null); + + /** ClearSuggestionFeatureConfigOperationMetadata suggestionFeatureType */ + suggestionFeatureType?: (google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|null); + + /** ClearSuggestionFeatureConfigOperationMetadata createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a ClearSuggestionFeatureConfigOperationMetadata. */ + class ClearSuggestionFeatureConfigOperationMetadata implements IClearSuggestionFeatureConfigOperationMetadata { + + /** + * Constructs a new ClearSuggestionFeatureConfigOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata); + + /** ClearSuggestionFeatureConfigOperationMetadata conversationProfile. */ + public conversationProfile: string; + + /** ClearSuggestionFeatureConfigOperationMetadata participantRole. */ + public participantRole: (google.cloud.dialogflow.v2beta1.Participant.Role|keyof typeof google.cloud.dialogflow.v2beta1.Participant.Role); + + /** ClearSuggestionFeatureConfigOperationMetadata suggestionFeatureType. */ + public suggestionFeatureType: (google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|keyof typeof google.cloud.dialogflow.v2beta1.SuggestionFeature.Type); + + /** ClearSuggestionFeatureConfigOperationMetadata createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new ClearSuggestionFeatureConfigOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ClearSuggestionFeatureConfigOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata): google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata; + + /** + * Encodes the specified ClearSuggestionFeatureConfigOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @param message ClearSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClearSuggestionFeatureConfigOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @param message ClearSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClearSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClearSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata; + + /** + * Decodes a ClearSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClearSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata; + + /** + * Verifies a ClearSuggestionFeatureConfigOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClearSuggestionFeatureConfigOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClearSuggestionFeatureConfigOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata; + + /** + * Creates a plain object from a ClearSuggestionFeatureConfigOperationMetadata message. Also converts values to other types if specified. + * @param message ClearSuggestionFeatureConfigOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClearSuggestionFeatureConfigOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ClearSuggestionFeatureConfigOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Documents */ + class Documents extends $protobuf.rpc.Service { + + /** + * Constructs a new Documents 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 Documents 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): Documents; + + /** + * Calls ListDocuments. + * @param request ListDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListDocumentsResponse + */ + public listDocuments(request: google.cloud.dialogflow.v2beta1.IListDocumentsRequest, callback: google.cloud.dialogflow.v2beta1.Documents.ListDocumentsCallback): void; + + /** + * Calls ListDocuments. + * @param request ListDocumentsRequest message or plain object + * @returns Promise + */ + public listDocuments(request: google.cloud.dialogflow.v2beta1.IListDocumentsRequest): Promise; + + /** + * Calls GetDocument. + * @param request GetDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Document + */ + public getDocument(request: google.cloud.dialogflow.v2beta1.IGetDocumentRequest, callback: google.cloud.dialogflow.v2beta1.Documents.GetDocumentCallback): void; + + /** + * Calls GetDocument. + * @param request GetDocumentRequest message or plain object + * @returns Promise + */ + public getDocument(request: google.cloud.dialogflow.v2beta1.IGetDocumentRequest): Promise; + + /** + * Calls CreateDocument. + * @param request CreateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createDocument(request: google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, callback: google.cloud.dialogflow.v2beta1.Documents.CreateDocumentCallback): void; + + /** + * Calls CreateDocument. + * @param request CreateDocumentRequest message or plain object + * @returns Promise + */ + public createDocument(request: google.cloud.dialogflow.v2beta1.ICreateDocumentRequest): Promise; + + /** + * Calls ImportDocuments. + * @param request ImportDocumentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public importDocuments(request: google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, callback: google.cloud.dialogflow.v2beta1.Documents.ImportDocumentsCallback): void; + + /** + * Calls ImportDocuments. + * @param request ImportDocumentsRequest message or plain object + * @returns Promise + */ + public importDocuments(request: google.cloud.dialogflow.v2beta1.IImportDocumentsRequest): Promise; + + /** + * Calls DeleteDocument. + * @param request DeleteDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteDocument(request: google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, callback: google.cloud.dialogflow.v2beta1.Documents.DeleteDocumentCallback): void; + + /** + * Calls DeleteDocument. + * @param request DeleteDocumentRequest message or plain object + * @returns Promise + */ + public deleteDocument(request: google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest): Promise; + + /** + * Calls UpdateDocument. + * @param request UpdateDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateDocument(request: google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, callback: google.cloud.dialogflow.v2beta1.Documents.UpdateDocumentCallback): void; + + /** + * Calls UpdateDocument. + * @param request UpdateDocumentRequest message or plain object + * @returns Promise + */ + public updateDocument(request: google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest): Promise; + + /** + * Calls ReloadDocument. + * @param request ReloadDocumentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public reloadDocument(request: google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, callback: google.cloud.dialogflow.v2beta1.Documents.ReloadDocumentCallback): void; + + /** + * Calls ReloadDocument. + * @param request ReloadDocumentRequest message or plain object + * @returns Promise + */ + public reloadDocument(request: google.cloud.dialogflow.v2beta1.IReloadDocumentRequest): Promise; + } + + namespace Documents { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|listDocuments}. + * @param error Error, if any + * @param [response] ListDocumentsResponse + */ + type ListDocumentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListDocumentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|getDocument}. + * @param error Error, if any + * @param [response] Document + */ + type GetDocumentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Document) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|createDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|importDocuments}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportDocumentsCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|deleteDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|updateDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|reloadDocument}. + * @param error Error, if any + * @param [response] Operation + */ + type ReloadDocumentCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; + } + + /** Properties of a Document. */ + interface IDocument { + + /** Document name */ + name?: (string|null); + + /** Document displayName */ + displayName?: (string|null); + + /** Document mimeType */ + mimeType?: (string|null); + + /** Document knowledgeTypes */ + knowledgeTypes?: (google.cloud.dialogflow.v2beta1.Document.KnowledgeType[]|null); + + /** Document contentUri */ + contentUri?: (string|null); + + /** Document content */ + content?: (string|null); + + /** Document rawContent */ + rawContent?: (Uint8Array|string|null); + + /** Document enableAutoReload */ + enableAutoReload?: (boolean|null); + + /** Document latestReloadStatus */ + latestReloadStatus?: (google.cloud.dialogflow.v2beta1.Document.IReloadStatus|null); + + /** Document metadata */ + metadata?: ({ [k: string]: string }|null); + + /** Document state */ + state?: (google.cloud.dialogflow.v2beta1.Document.State|keyof typeof google.cloud.dialogflow.v2beta1.Document.State|null); + } + + /** Represents a Document. */ + class Document implements IDocument { + + /** + * Constructs a new Document. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDocument); + + /** Document name. */ + public name: string; + + /** Document displayName. */ + public displayName: string; + + /** Document mimeType. */ + public mimeType: string; + + /** Document knowledgeTypes. */ + public knowledgeTypes: google.cloud.dialogflow.v2beta1.Document.KnowledgeType[]; + + /** Document contentUri. */ + public contentUri?: (string|null); + + /** Document content. */ + public content?: (string|null); + + /** Document rawContent. */ + public rawContent?: (Uint8Array|string|null); + + /** Document enableAutoReload. */ + public enableAutoReload: boolean; + + /** Document latestReloadStatus. */ + public latestReloadStatus?: (google.cloud.dialogflow.v2beta1.Document.IReloadStatus|null); + + /** Document metadata. */ + public metadata: { [k: string]: string }; + + /** Document state. */ + public state: (google.cloud.dialogflow.v2beta1.Document.State|keyof typeof google.cloud.dialogflow.v2beta1.Document.State); + + /** Document source. */ + public source?: ("contentUri"|"content"|"rawContent"); + + /** + * Creates a new Document instance using the specified properties. + * @param [properties] Properties to set + * @returns Document instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDocument): google.cloud.dialogflow.v2beta1.Document; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Document.verify|verify} messages. + * @param message Document message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDocument, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Document message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Document; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Document; + + /** + * Verifies a Document message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Document + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Document; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @param message Document + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Document, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Document to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Document + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Document { + + /** KnowledgeType enum. */ + enum KnowledgeType { + KNOWLEDGE_TYPE_UNSPECIFIED = 0, + FAQ = 1, + EXTRACTIVE_QA = 2, + ARTICLE_SUGGESTION = 3, + AGENT_FACING_SMART_REPLY = 4, + SMART_REPLY = 4 + } + + /** Properties of a ReloadStatus. */ + interface IReloadStatus { + + /** ReloadStatus time */ + time?: (google.protobuf.ITimestamp|null); + + /** ReloadStatus status */ + status?: (google.rpc.IStatus|null); + } + + /** Represents a ReloadStatus. */ + class ReloadStatus implements IReloadStatus { + + /** + * Constructs a new ReloadStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Document.IReloadStatus); + + /** ReloadStatus time. */ + public time?: (google.protobuf.ITimestamp|null); + + /** ReloadStatus status. */ + public status?: (google.rpc.IStatus|null); + + /** + * Creates a new ReloadStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns ReloadStatus instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Document.IReloadStatus): google.cloud.dialogflow.v2beta1.Document.ReloadStatus; + + /** + * Encodes the specified ReloadStatus message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Document.ReloadStatus.verify|verify} messages. + * @param message ReloadStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Document.IReloadStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReloadStatus message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Document.ReloadStatus.verify|verify} messages. + * @param message ReloadStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Document.IReloadStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReloadStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReloadStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Document.ReloadStatus; + + /** + * Decodes a ReloadStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReloadStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Document.ReloadStatus; + + /** + * Verifies a ReloadStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReloadStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReloadStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Document.ReloadStatus; + + /** + * Creates a plain object from a ReloadStatus message. Also converts values to other types if specified. + * @param message ReloadStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Document.ReloadStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReloadStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReloadStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + CREATING = 1, + ACTIVE = 2, + UPDATING = 3, + RELOADING = 4, + DELETING = 5 + } + } + + /** Properties of a GetDocumentRequest. */ + interface IGetDocumentRequest { + + /** GetDocumentRequest name */ + name?: (string|null); + } + + /** Represents a GetDocumentRequest. */ + class GetDocumentRequest implements IGetDocumentRequest { + + /** + * Constructs a new GetDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetDocumentRequest); + + /** GetDocumentRequest name. */ + public name: string; + + /** + * Creates a new GetDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetDocumentRequest): google.cloud.dialogflow.v2beta1.GetDocumentRequest; + + /** + * Encodes the specified GetDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetDocumentRequest.verify|verify} messages. + * @param message GetDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetDocumentRequest.verify|verify} messages. + * @param message GetDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetDocumentRequest; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetDocumentRequest; + + /** + * Verifies a GetDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetDocumentRequest; + + /** + * Creates a plain object from a GetDocumentRequest message. Also converts values to other types if specified. + * @param message GetDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListDocumentsRequest. */ + interface IListDocumentsRequest { + + /** ListDocumentsRequest parent */ + parent?: (string|null); + + /** ListDocumentsRequest pageSize */ + pageSize?: (number|null); + + /** ListDocumentsRequest pageToken */ + pageToken?: (string|null); + + /** ListDocumentsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListDocumentsRequest. */ + class ListDocumentsRequest implements IListDocumentsRequest { + + /** + * Constructs a new ListDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListDocumentsRequest); + + /** ListDocumentsRequest parent. */ + public parent: string; + + /** ListDocumentsRequest pageSize. */ + public pageSize: number; + + /** ListDocumentsRequest pageToken. */ + public pageToken: string; + + /** ListDocumentsRequest filter. */ + public filter: string; + + /** + * Creates a new ListDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDocumentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListDocumentsRequest): google.cloud.dialogflow.v2beta1.ListDocumentsRequest; + + /** + * Encodes the specified ListDocumentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListDocumentsRequest.verify|verify} messages. + * @param message ListDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListDocumentsRequest.verify|verify} messages. + * @param message ListDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListDocumentsRequest; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListDocumentsRequest; + + /** + * Verifies a ListDocumentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListDocumentsRequest; + + /** + * Creates a plain object from a ListDocumentsRequest message. Also converts values to other types if specified. + * @param message ListDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListDocumentsResponse. */ + interface IListDocumentsResponse { + + /** ListDocumentsResponse documents */ + documents?: (google.cloud.dialogflow.v2beta1.IDocument[]|null); + + /** ListDocumentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListDocumentsResponse. */ + class ListDocumentsResponse implements IListDocumentsResponse { + + /** + * Constructs a new ListDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListDocumentsResponse); + + /** ListDocumentsResponse documents. */ + public documents: google.cloud.dialogflow.v2beta1.IDocument[]; + + /** ListDocumentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListDocumentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListDocumentsResponse): google.cloud.dialogflow.v2beta1.ListDocumentsResponse; + + /** + * Encodes the specified ListDocumentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListDocumentsResponse.verify|verify} messages. + * @param message ListDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListDocumentsResponse.verify|verify} messages. + * @param message ListDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListDocumentsResponse; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListDocumentsResponse; + + /** + * Verifies a ListDocumentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListDocumentsResponse; + + /** + * Creates a plain object from a ListDocumentsResponse message. Also converts values to other types if specified. + * @param message ListDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateDocumentRequest. */ + interface ICreateDocumentRequest { + + /** CreateDocumentRequest parent */ + parent?: (string|null); + + /** CreateDocumentRequest document */ + document?: (google.cloud.dialogflow.v2beta1.IDocument|null); + + /** CreateDocumentRequest importGcsCustomMetadata */ + importGcsCustomMetadata?: (boolean|null); + } + + /** Represents a CreateDocumentRequest. */ + class CreateDocumentRequest implements ICreateDocumentRequest { + + /** + * Constructs a new CreateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateDocumentRequest); + + /** CreateDocumentRequest parent. */ + public parent: string; + + /** CreateDocumentRequest document. */ + public document?: (google.cloud.dialogflow.v2beta1.IDocument|null); + + /** CreateDocumentRequest importGcsCustomMetadata. */ + public importGcsCustomMetadata: boolean; + + /** + * Creates a new CreateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateDocumentRequest): google.cloud.dialogflow.v2beta1.CreateDocumentRequest; + + /** + * Encodes the specified CreateDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateDocumentRequest.verify|verify} messages. + * @param message CreateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateDocumentRequest.verify|verify} messages. + * @param message CreateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateDocumentRequest; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateDocumentRequest; + + /** + * Verifies a CreateDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateDocumentRequest; + + /** + * Creates a plain object from a CreateDocumentRequest message. Also converts values to other types if specified. + * @param message CreateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportDocumentsRequest. */ + interface IImportDocumentsRequest { + + /** ImportDocumentsRequest parent */ + parent?: (string|null); + + /** ImportDocumentsRequest gcsSource */ + gcsSource?: (google.cloud.dialogflow.v2beta1.IGcsSources|null); + + /** ImportDocumentsRequest documentTemplate */ + documentTemplate?: (google.cloud.dialogflow.v2beta1.IImportDocumentTemplate|null); + + /** ImportDocumentsRequest importGcsCustomMetadata */ + importGcsCustomMetadata?: (boolean|null); + } + + /** Represents an ImportDocumentsRequest. */ + class ImportDocumentsRequest implements IImportDocumentsRequest { + + /** + * Constructs a new ImportDocumentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IImportDocumentsRequest); + + /** ImportDocumentsRequest parent. */ + public parent: string; + + /** ImportDocumentsRequest gcsSource. */ + public gcsSource?: (google.cloud.dialogflow.v2beta1.IGcsSources|null); + + /** ImportDocumentsRequest documentTemplate. */ + public documentTemplate?: (google.cloud.dialogflow.v2beta1.IImportDocumentTemplate|null); + + /** ImportDocumentsRequest importGcsCustomMetadata. */ + public importGcsCustomMetadata: boolean; + + /** ImportDocumentsRequest source. */ + public source?: "gcsSource"; + + /** + * Creates a new ImportDocumentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportDocumentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IImportDocumentsRequest): google.cloud.dialogflow.v2beta1.ImportDocumentsRequest; + + /** + * Encodes the specified ImportDocumentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentsRequest.verify|verify} messages. + * @param message ImportDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentsRequest.verify|verify} messages. + * @param message ImportDocumentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ImportDocumentsRequest; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ImportDocumentsRequest; + + /** + * Verifies an ImportDocumentsRequest message. + * @param message Plain 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 ImportDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportDocumentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ImportDocumentsRequest; + + /** + * Creates a plain object from an ImportDocumentsRequest message. Also converts values to other types if specified. + * @param message ImportDocumentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ImportDocumentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportDocumentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportDocumentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportDocumentTemplate. */ + interface IImportDocumentTemplate { + + /** ImportDocumentTemplate mimeType */ + mimeType?: (string|null); + + /** ImportDocumentTemplate knowledgeTypes */ + knowledgeTypes?: (google.cloud.dialogflow.v2beta1.Document.KnowledgeType[]|null); + + /** ImportDocumentTemplate metadata */ + metadata?: ({ [k: string]: string }|null); + } + + /** Represents an ImportDocumentTemplate. */ + class ImportDocumentTemplate implements IImportDocumentTemplate { + + /** + * Constructs a new ImportDocumentTemplate. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IImportDocumentTemplate); + + /** ImportDocumentTemplate mimeType. */ + public mimeType: string; + + /** ImportDocumentTemplate knowledgeTypes. */ + public knowledgeTypes: google.cloud.dialogflow.v2beta1.Document.KnowledgeType[]; + + /** ImportDocumentTemplate metadata. */ + public metadata: { [k: string]: string }; + + /** + * Creates a new ImportDocumentTemplate instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportDocumentTemplate instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IImportDocumentTemplate): google.cloud.dialogflow.v2beta1.ImportDocumentTemplate; + + /** + * Encodes the specified ImportDocumentTemplate message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.verify|verify} messages. + * @param message ImportDocumentTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IImportDocumentTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportDocumentTemplate message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.verify|verify} messages. + * @param message ImportDocumentTemplate message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IImportDocumentTemplate, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportDocumentTemplate message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportDocumentTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ImportDocumentTemplate; + + /** + * Decodes an ImportDocumentTemplate message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportDocumentTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ImportDocumentTemplate; + + /** + * Verifies an ImportDocumentTemplate message. + * @param message Plain 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 ImportDocumentTemplate message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportDocumentTemplate + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ImportDocumentTemplate; + + /** + * Creates a plain object from an ImportDocumentTemplate message. Also converts values to other types if specified. + * @param message ImportDocumentTemplate + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ImportDocumentTemplate, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportDocumentTemplate to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportDocumentTemplate + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportDocumentsResponse. */ + interface IImportDocumentsResponse { + + /** ImportDocumentsResponse warnings */ + warnings?: (google.rpc.IStatus[]|null); + } + + /** Represents an ImportDocumentsResponse. */ + class ImportDocumentsResponse implements IImportDocumentsResponse { + + /** + * Constructs a new ImportDocumentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IImportDocumentsResponse); + + /** ImportDocumentsResponse warnings. */ + public warnings: google.rpc.IStatus[]; + + /** + * Creates a new ImportDocumentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportDocumentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IImportDocumentsResponse): google.cloud.dialogflow.v2beta1.ImportDocumentsResponse; + + /** + * Encodes the specified ImportDocumentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentsResponse.verify|verify} messages. + * @param message ImportDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentsResponse.verify|verify} messages. + * @param message ImportDocumentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportDocumentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ImportDocumentsResponse; + + /** + * Decodes an ImportDocumentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ImportDocumentsResponse; + + /** + * Verifies an ImportDocumentsResponse message. + * @param message Plain 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 ImportDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportDocumentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ImportDocumentsResponse; + + /** + * Creates a plain object from an ImportDocumentsResponse message. Also converts values to other types if specified. + * @param message ImportDocumentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ImportDocumentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportDocumentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportDocumentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteDocumentRequest. */ + interface IDeleteDocumentRequest { + + /** DeleteDocumentRequest name */ + name?: (string|null); + } + + /** Represents a DeleteDocumentRequest. */ + class DeleteDocumentRequest implements IDeleteDocumentRequest { + + /** + * Constructs a new DeleteDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest); + + /** DeleteDocumentRequest name. */ + public name: string; + + /** + * Creates a new DeleteDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest): google.cloud.dialogflow.v2beta1.DeleteDocumentRequest; + + /** + * Encodes the specified DeleteDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteDocumentRequest.verify|verify} messages. + * @param message DeleteDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteDocumentRequest.verify|verify} messages. + * @param message DeleteDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteDocumentRequest; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteDocumentRequest; + + /** + * Verifies a DeleteDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteDocumentRequest; + + /** + * Creates a plain object from a DeleteDocumentRequest message. Also converts values to other types if specified. + * @param message DeleteDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateDocumentRequest. */ + interface IUpdateDocumentRequest { + + /** UpdateDocumentRequest document */ + document?: (google.cloud.dialogflow.v2beta1.IDocument|null); + + /** UpdateDocumentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateDocumentRequest. */ + class UpdateDocumentRequest implements IUpdateDocumentRequest { + + /** + * Constructs a new UpdateDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest); + + /** UpdateDocumentRequest document. */ + public document?: (google.cloud.dialogflow.v2beta1.IDocument|null); + + /** UpdateDocumentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest): google.cloud.dialogflow.v2beta1.UpdateDocumentRequest; + + /** + * Encodes the specified UpdateDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateDocumentRequest.verify|verify} messages. + * @param message UpdateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateDocumentRequest.verify|verify} messages. + * @param message UpdateDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateDocumentRequest; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateDocumentRequest; + + /** + * Verifies an UpdateDocumentRequest message. + * @param message Plain 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 UpdateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateDocumentRequest; + + /** + * Creates a plain object from an UpdateDocumentRequest message. Also converts values to other types if specified. + * @param message UpdateDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExportOperationMetadata. */ + interface IExportOperationMetadata { + + /** ExportOperationMetadata exportedGcsDestination */ + exportedGcsDestination?: (google.cloud.dialogflow.v2beta1.IGcsDestination|null); + } + + /** Represents an ExportOperationMetadata. */ + class ExportOperationMetadata implements IExportOperationMetadata { + + /** + * Constructs a new ExportOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IExportOperationMetadata); + + /** ExportOperationMetadata exportedGcsDestination. */ + public exportedGcsDestination?: (google.cloud.dialogflow.v2beta1.IGcsDestination|null); + + /** + * Creates a new ExportOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IExportOperationMetadata): google.cloud.dialogflow.v2beta1.ExportOperationMetadata; + + /** + * Encodes the specified ExportOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportOperationMetadata.verify|verify} messages. + * @param message ExportOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IExportOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportOperationMetadata.verify|verify} messages. + * @param message ExportOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IExportOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ExportOperationMetadata; + + /** + * Decodes an ExportOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ExportOperationMetadata; + + /** + * Verifies an ExportOperationMetadata message. + * @param message Plain 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 ExportOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ExportOperationMetadata; + + /** + * Creates a plain object from an ExportOperationMetadata message. Also converts values to other types if specified. + * @param message ExportOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ExportOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a KnowledgeOperationMetadata. */ + interface IKnowledgeOperationMetadata { + + /** KnowledgeOperationMetadata state */ + state?: (google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State|null); + + /** KnowledgeOperationMetadata knowledgeBase */ + knowledgeBase?: (string|null); + + /** KnowledgeOperationMetadata exportOperationMetadata */ + exportOperationMetadata?: (google.cloud.dialogflow.v2beta1.IExportOperationMetadata|null); + } + + /** Represents a KnowledgeOperationMetadata. */ + class KnowledgeOperationMetadata implements IKnowledgeOperationMetadata { + + /** + * Constructs a new KnowledgeOperationMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata); + + /** KnowledgeOperationMetadata state. */ + public state: (google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State|keyof typeof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State); + + /** KnowledgeOperationMetadata knowledgeBase. */ + public knowledgeBase: string; + + /** KnowledgeOperationMetadata exportOperationMetadata. */ + public exportOperationMetadata?: (google.cloud.dialogflow.v2beta1.IExportOperationMetadata|null); + + /** KnowledgeOperationMetadata operationMetadata. */ + public operationMetadata?: "exportOperationMetadata"; + + /** + * Creates a new KnowledgeOperationMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns KnowledgeOperationMetadata instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata): google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata; + + /** + * Encodes the specified KnowledgeOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.verify|verify} messages. + * @param message KnowledgeOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KnowledgeOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.verify|verify} messages. + * @param message KnowledgeOperationMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KnowledgeOperationMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KnowledgeOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata; + + /** + * Decodes a KnowledgeOperationMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KnowledgeOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata; + + /** + * Verifies a KnowledgeOperationMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KnowledgeOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KnowledgeOperationMetadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata; + + /** + * Creates a plain object from a KnowledgeOperationMetadata message. Also converts values to other types if specified. + * @param message KnowledgeOperationMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KnowledgeOperationMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KnowledgeOperationMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace KnowledgeOperationMetadata { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + PENDING = 1, + RUNNING = 2, + DONE = 3 + } + } + + /** Properties of a ReloadDocumentRequest. */ + interface IReloadDocumentRequest { + + /** ReloadDocumentRequest name */ + name?: (string|null); + + /** ReloadDocumentRequest gcsSource */ + gcsSource?: (google.cloud.dialogflow.v2beta1.IGcsSource|null); + + /** ReloadDocumentRequest importGcsCustomMetadata */ + importGcsCustomMetadata?: (boolean|null); + } + + /** Represents a ReloadDocumentRequest. */ + class ReloadDocumentRequest implements IReloadDocumentRequest { + + /** + * Constructs a new ReloadDocumentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IReloadDocumentRequest); + + /** ReloadDocumentRequest name. */ + public name: string; + + /** ReloadDocumentRequest gcsSource. */ + public gcsSource?: (google.cloud.dialogflow.v2beta1.IGcsSource|null); + + /** ReloadDocumentRequest importGcsCustomMetadata. */ + public importGcsCustomMetadata: boolean; + + /** ReloadDocumentRequest source. */ + public source?: "gcsSource"; + + /** + * Creates a new ReloadDocumentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ReloadDocumentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IReloadDocumentRequest): google.cloud.dialogflow.v2beta1.ReloadDocumentRequest; + + /** + * Encodes the specified ReloadDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ReloadDocumentRequest.verify|verify} messages. + * @param message ReloadDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReloadDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ReloadDocumentRequest.verify|verify} messages. + * @param message ReloadDocumentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReloadDocumentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReloadDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ReloadDocumentRequest; + + /** + * Decodes a ReloadDocumentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReloadDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ReloadDocumentRequest; + + /** + * Verifies a ReloadDocumentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReloadDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReloadDocumentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ReloadDocumentRequest; + + /** + * Creates a plain object from a ReloadDocumentRequest message. Also converts values to other types if specified. + * @param message ReloadDocumentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ReloadDocumentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReloadDocumentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReloadDocumentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GcsSources. */ + interface IGcsSources { + + /** GcsSources uris */ + uris?: (string[]|null); + } + + /** Represents a GcsSources. */ + class GcsSources implements IGcsSources { + + /** + * Constructs a new GcsSources. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGcsSources); + + /** GcsSources uris. */ + public uris: string[]; + + /** + * Creates a new GcsSources instance using the specified properties. + * @param [properties] Properties to set + * @returns GcsSources instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGcsSources): google.cloud.dialogflow.v2beta1.GcsSources; + + /** + * Encodes the specified GcsSources message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GcsSources.verify|verify} messages. + * @param message GcsSources message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGcsSources, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSources message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GcsSources.verify|verify} messages. + * @param message GcsSources message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGcsSources, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GcsSources message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GcsSources + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GcsSources; + + /** + * Decodes a GcsSources message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GcsSources + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GcsSources; + + /** + * Verifies a GcsSources message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GcsSources message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GcsSources + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GcsSources; + + /** + * Creates a plain object from a GcsSources message. Also converts values to other types if specified. + * @param message GcsSources + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GcsSources, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GcsSources to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GcsSources + * @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.dialogflow.v2beta1.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.dialogflow.v2beta1.IGcsSource): google.cloud.dialogflow.v2beta1.GcsSource; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.IGcsSource, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsSource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.IGcsDestination): google.cloud.dialogflow.v2beta1.GcsDestination; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.IGcsDestination, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GcsDestination message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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; + } + + /** Represents an Environments */ + class Environments extends $protobuf.rpc.Service { + + /** + * Constructs a new Environments 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 Environments 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): Environments; + + /** + * Calls ListEnvironments. + * @param request ListEnvironmentsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListEnvironmentsResponse + */ + public listEnvironments(request: google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, callback: google.cloud.dialogflow.v2beta1.Environments.ListEnvironmentsCallback): void; + + /** + * Calls ListEnvironments. + * @param request ListEnvironmentsRequest message or plain object + * @returns Promise + */ + public listEnvironments(request: google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest): Promise; + + /** + * Calls GetEnvironment. + * @param request GetEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Environment + */ + public getEnvironment(request: google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, callback: google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentCallback): void; + + /** + * Calls GetEnvironment. + * @param request GetEnvironmentRequest message or plain object + * @returns Promise + */ + public getEnvironment(request: google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest): Promise; + + /** + * Calls CreateEnvironment. + * @param request CreateEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Environment + */ + public createEnvironment(request: google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, callback: google.cloud.dialogflow.v2beta1.Environments.CreateEnvironmentCallback): void; + + /** + * Calls CreateEnvironment. + * @param request CreateEnvironmentRequest message or plain object + * @returns Promise + */ + public createEnvironment(request: google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest): Promise; + + /** + * Calls UpdateEnvironment. + * @param request UpdateEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Environment + */ + public updateEnvironment(request: google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, callback: google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironmentCallback): void; + + /** + * Calls UpdateEnvironment. + * @param request UpdateEnvironmentRequest message or plain object + * @returns Promise + */ + public updateEnvironment(request: google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest): Promise; + + /** + * Calls DeleteEnvironment. + * @param request DeleteEnvironmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteEnvironment(request: google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, callback: google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironmentCallback): void; + + /** + * Calls DeleteEnvironment. + * @param request DeleteEnvironmentRequest message or plain object + * @returns Promise + */ + public deleteEnvironment(request: google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest): Promise; + + /** + * Calls GetEnvironmentHistory. + * @param request GetEnvironmentHistoryRequest message or plain object + * @param callback Node-style callback called with the error, if any, and EnvironmentHistory + */ + public getEnvironmentHistory(request: google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, callback: google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistoryCallback): void; + + /** + * Calls GetEnvironmentHistory. + * @param request GetEnvironmentHistoryRequest message or plain object + * @returns Promise + */ + public getEnvironmentHistory(request: google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest): Promise; + } + + namespace Environments { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|listEnvironments}. + * @param error Error, if any + * @param [response] ListEnvironmentsResponse + */ + type ListEnvironmentsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|getEnvironment}. + * @param error Error, if any + * @param [response] Environment + */ + type GetEnvironmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Environment) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|createEnvironment}. + * @param error Error, if any + * @param [response] Environment + */ + type CreateEnvironmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Environment) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|updateEnvironment}. + * @param error Error, if any + * @param [response] Environment + */ + type UpdateEnvironmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Environment) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|deleteEnvironment}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteEnvironmentCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|getEnvironmentHistory}. + * @param error Error, if any + * @param [response] EnvironmentHistory + */ + type GetEnvironmentHistoryCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.EnvironmentHistory) => void; + } + + /** Properties of an Environment. */ + interface IEnvironment { + + /** Environment name */ + name?: (string|null); + + /** Environment description */ + description?: (string|null); + + /** Environment agentVersion */ + agentVersion?: (string|null); + + /** Environment state */ + state?: (google.cloud.dialogflow.v2beta1.Environment.State|keyof typeof google.cloud.dialogflow.v2beta1.Environment.State|null); + + /** Environment updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Environment textToSpeechSettings */ + textToSpeechSettings?: (google.cloud.dialogflow.v2beta1.ITextToSpeechSettings|null); + + /** Environment fulfillment */ + fulfillment?: (google.cloud.dialogflow.v2beta1.IFulfillment|null); + } + + /** Represents an Environment. */ + class Environment implements IEnvironment { + + /** + * Constructs a new Environment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IEnvironment); + + /** Environment name. */ + public name: string; + + /** Environment description. */ + public description: string; + + /** Environment agentVersion. */ + public agentVersion: string; + + /** Environment state. */ + public state: (google.cloud.dialogflow.v2beta1.Environment.State|keyof typeof google.cloud.dialogflow.v2beta1.Environment.State); + + /** Environment updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Environment textToSpeechSettings. */ + public textToSpeechSettings?: (google.cloud.dialogflow.v2beta1.ITextToSpeechSettings|null); + + /** Environment fulfillment. */ + public fulfillment?: (google.cloud.dialogflow.v2beta1.IFulfillment|null); + + /** + * Creates a new Environment instance using the specified properties. + * @param [properties] Properties to set + * @returns Environment instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IEnvironment): google.cloud.dialogflow.v2beta1.Environment; + + /** + * Encodes the specified Environment message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Environment.verify|verify} messages. + * @param message Environment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IEnvironment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Environment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Environment.verify|verify} messages. + * @param message Environment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IEnvironment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Environment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Environment; + + /** + * Decodes an Environment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Environment; + + /** + * Verifies an Environment message. + * @param message Plain 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 Environment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Environment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Environment; + + /** + * Creates a plain object from an Environment message. Also converts values to other types if specified. + * @param message Environment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Environment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Environment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Environment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Environment { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + STOPPED = 1, + LOADING = 2, + RUNNING = 3 + } + } + + /** Properties of a TextToSpeechSettings. */ + interface ITextToSpeechSettings { + + /** TextToSpeechSettings enableTextToSpeech */ + enableTextToSpeech?: (boolean|null); + + /** TextToSpeechSettings outputAudioEncoding */ + outputAudioEncoding?: (google.cloud.dialogflow.v2beta1.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.v2beta1.OutputAudioEncoding|null); + + /** TextToSpeechSettings sampleRateHertz */ + sampleRateHertz?: (number|null); + + /** TextToSpeechSettings synthesizeSpeechConfigs */ + synthesizeSpeechConfigs?: ({ [k: string]: google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig }|null); + } + + /** Represents a TextToSpeechSettings. */ + class TextToSpeechSettings implements ITextToSpeechSettings { + + /** + * Constructs a new TextToSpeechSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ITextToSpeechSettings); + + /** TextToSpeechSettings enableTextToSpeech. */ + public enableTextToSpeech: boolean; + + /** TextToSpeechSettings outputAudioEncoding. */ + public outputAudioEncoding: (google.cloud.dialogflow.v2beta1.OutputAudioEncoding|keyof typeof google.cloud.dialogflow.v2beta1.OutputAudioEncoding); + + /** TextToSpeechSettings sampleRateHertz. */ + public sampleRateHertz: number; + + /** TextToSpeechSettings synthesizeSpeechConfigs. */ + public synthesizeSpeechConfigs: { [k: string]: google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig }; + + /** + * Creates a new TextToSpeechSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns TextToSpeechSettings instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ITextToSpeechSettings): google.cloud.dialogflow.v2beta1.TextToSpeechSettings; + + /** + * Encodes the specified TextToSpeechSettings message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TextToSpeechSettings.verify|verify} messages. + * @param message TextToSpeechSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ITextToSpeechSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TextToSpeechSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TextToSpeechSettings.verify|verify} messages. + * @param message TextToSpeechSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ITextToSpeechSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TextToSpeechSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TextToSpeechSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.TextToSpeechSettings; + + /** + * Decodes a TextToSpeechSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TextToSpeechSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.TextToSpeechSettings; + + /** + * Verifies a TextToSpeechSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TextToSpeechSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TextToSpeechSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.TextToSpeechSettings; + + /** + * Creates a plain object from a TextToSpeechSettings message. Also converts values to other types if specified. + * @param message TextToSpeechSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.TextToSpeechSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TextToSpeechSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TextToSpeechSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEnvironmentsRequest. */ + interface IListEnvironmentsRequest { + + /** ListEnvironmentsRequest parent */ + parent?: (string|null); + + /** ListEnvironmentsRequest pageSize */ + pageSize?: (number|null); + + /** ListEnvironmentsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListEnvironmentsRequest. */ + class ListEnvironmentsRequest implements IListEnvironmentsRequest { + + /** + * Constructs a new ListEnvironmentsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest); + + /** ListEnvironmentsRequest parent. */ + public parent: string; + + /** ListEnvironmentsRequest pageSize. */ + public pageSize: number; + + /** ListEnvironmentsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListEnvironmentsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEnvironmentsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest): google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest; + + /** + * Encodes the specified ListEnvironmentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest.verify|verify} messages. + * @param message ListEnvironmentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEnvironmentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest.verify|verify} messages. + * @param message ListEnvironmentsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest; + + /** + * Verifies a ListEnvironmentsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEnvironmentsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEnvironmentsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest; + + /** + * Creates a plain object from a ListEnvironmentsRequest message. Also converts values to other types if specified. + * @param message ListEnvironmentsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEnvironmentsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEnvironmentsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListEnvironmentsResponse. */ + interface IListEnvironmentsResponse { + + /** ListEnvironmentsResponse environments */ + environments?: (google.cloud.dialogflow.v2beta1.IEnvironment[]|null); + + /** ListEnvironmentsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListEnvironmentsResponse. */ + class ListEnvironmentsResponse implements IListEnvironmentsResponse { + + /** + * Constructs a new ListEnvironmentsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse); + + /** ListEnvironmentsResponse environments. */ + public environments: google.cloud.dialogflow.v2beta1.IEnvironment[]; + + /** ListEnvironmentsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListEnvironmentsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListEnvironmentsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse): google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse; + + /** + * Encodes the specified ListEnvironmentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse.verify|verify} messages. + * @param message ListEnvironmentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListEnvironmentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse.verify|verify} messages. + * @param message ListEnvironmentsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse; + + /** + * Verifies a ListEnvironmentsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListEnvironmentsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListEnvironmentsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse; + + /** + * Creates a plain object from a ListEnvironmentsResponse message. Also converts values to other types if specified. + * @param message ListEnvironmentsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListEnvironmentsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListEnvironmentsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetEnvironmentRequest. */ + interface IGetEnvironmentRequest { + + /** GetEnvironmentRequest name */ + name?: (string|null); + } + + /** Represents a GetEnvironmentRequest. */ + class GetEnvironmentRequest implements IGetEnvironmentRequest { + + /** + * Constructs a new GetEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest); + + /** GetEnvironmentRequest name. */ + public name: string; + + /** + * Creates a new GetEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest): google.cloud.dialogflow.v2beta1.GetEnvironmentRequest; + + /** + * Encodes the specified GetEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEnvironmentRequest.verify|verify} messages. + * @param message GetEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEnvironmentRequest.verify|verify} messages. + * @param message GetEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetEnvironmentRequest; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetEnvironmentRequest; + + /** + * Verifies a GetEnvironmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetEnvironmentRequest; + + /** + * Creates a plain object from a GetEnvironmentRequest message. Also converts values to other types if specified. + * @param message GetEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetEnvironmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateEnvironmentRequest. */ + interface ICreateEnvironmentRequest { + + /** CreateEnvironmentRequest parent */ + parent?: (string|null); + + /** CreateEnvironmentRequest environment */ + environment?: (google.cloud.dialogflow.v2beta1.IEnvironment|null); + + /** CreateEnvironmentRequest environmentId */ + environmentId?: (string|null); + } + + /** Represents a CreateEnvironmentRequest. */ + class CreateEnvironmentRequest implements ICreateEnvironmentRequest { + + /** + * Constructs a new CreateEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest); + + /** CreateEnvironmentRequest parent. */ + public parent: string; + + /** CreateEnvironmentRequest environment. */ + public environment?: (google.cloud.dialogflow.v2beta1.IEnvironment|null); + + /** CreateEnvironmentRequest environmentId. */ + public environmentId: string; + + /** + * Creates a new CreateEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest): google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest; + + /** + * Encodes the specified CreateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest.verify|verify} messages. + * @param message CreateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest.verify|verify} messages. + * @param message CreateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest; + + /** + * Verifies a CreateEnvironmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest; + + /** + * Creates a plain object from a CreateEnvironmentRequest message. Also converts values to other types if specified. + * @param message CreateEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateEnvironmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateEnvironmentRequest. */ + interface IUpdateEnvironmentRequest { + + /** UpdateEnvironmentRequest environment */ + environment?: (google.cloud.dialogflow.v2beta1.IEnvironment|null); + + /** UpdateEnvironmentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateEnvironmentRequest allowLoadToDraftAndDiscardChanges */ + allowLoadToDraftAndDiscardChanges?: (boolean|null); + } + + /** Represents an UpdateEnvironmentRequest. */ + class UpdateEnvironmentRequest implements IUpdateEnvironmentRequest { + + /** + * Constructs a new UpdateEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest); + + /** UpdateEnvironmentRequest environment. */ + public environment?: (google.cloud.dialogflow.v2beta1.IEnvironment|null); + + /** UpdateEnvironmentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** UpdateEnvironmentRequest allowLoadToDraftAndDiscardChanges. */ + public allowLoadToDraftAndDiscardChanges: boolean; + + /** + * Creates a new UpdateEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest): google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest; + + /** + * Encodes the specified UpdateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest.verify|verify} messages. + * @param message UpdateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest.verify|verify} messages. + * @param message UpdateEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest; + + /** + * Verifies an UpdateEnvironmentRequest message. + * @param message Plain 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 UpdateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest; + + /** + * Creates a plain object from an UpdateEnvironmentRequest message. Also converts values to other types if specified. + * @param message UpdateEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateEnvironmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteEnvironmentRequest. */ + interface IDeleteEnvironmentRequest { + + /** DeleteEnvironmentRequest name */ + name?: (string|null); + } + + /** Represents a DeleteEnvironmentRequest. */ + class DeleteEnvironmentRequest implements IDeleteEnvironmentRequest { + + /** + * Constructs a new DeleteEnvironmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest); + + /** DeleteEnvironmentRequest name. */ + public name: string; + + /** + * Creates a new DeleteEnvironmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteEnvironmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest): google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest; + + /** + * Encodes the specified DeleteEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest.verify|verify} messages. + * @param message DeleteEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest.verify|verify} messages. + * @param message DeleteEnvironmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest; + + /** + * Verifies a DeleteEnvironmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteEnvironmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest; + + /** + * Creates a plain object from a DeleteEnvironmentRequest message. Also converts values to other types if specified. + * @param message DeleteEnvironmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteEnvironmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteEnvironmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetEnvironmentHistoryRequest. */ + interface IGetEnvironmentHistoryRequest { + + /** GetEnvironmentHistoryRequest parent */ + parent?: (string|null); + + /** GetEnvironmentHistoryRequest pageSize */ + pageSize?: (number|null); + + /** GetEnvironmentHistoryRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a GetEnvironmentHistoryRequest. */ + class GetEnvironmentHistoryRequest implements IGetEnvironmentHistoryRequest { + + /** + * Constructs a new GetEnvironmentHistoryRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest); + + /** GetEnvironmentHistoryRequest parent. */ + public parent: string; + + /** GetEnvironmentHistoryRequest pageSize. */ + public pageSize: number; + + /** GetEnvironmentHistoryRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new GetEnvironmentHistoryRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetEnvironmentHistoryRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest): google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest; + + /** + * Encodes the specified GetEnvironmentHistoryRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest.verify|verify} messages. + * @param message GetEnvironmentHistoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetEnvironmentHistoryRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest.verify|verify} messages. + * @param message GetEnvironmentHistoryRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetEnvironmentHistoryRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest; + + /** + * Decodes a GetEnvironmentHistoryRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest; + + /** + * Verifies a GetEnvironmentHistoryRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetEnvironmentHistoryRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetEnvironmentHistoryRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest; + + /** + * Creates a plain object from a GetEnvironmentHistoryRequest message. Also converts values to other types if specified. + * @param message GetEnvironmentHistoryRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetEnvironmentHistoryRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetEnvironmentHistoryRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnvironmentHistory. */ + interface IEnvironmentHistory { + + /** EnvironmentHistory parent */ + parent?: (string|null); + + /** EnvironmentHistory entries */ + entries?: (google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[]|null); + + /** EnvironmentHistory nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents an EnvironmentHistory. */ + class EnvironmentHistory implements IEnvironmentHistory { + + /** + * Constructs a new EnvironmentHistory. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IEnvironmentHistory); + + /** EnvironmentHistory parent. */ + public parent: string; + + /** EnvironmentHistory entries. */ + public entries: google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[]; + + /** EnvironmentHistory nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new EnvironmentHistory instance using the specified properties. + * @param [properties] Properties to set + * @returns EnvironmentHistory instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IEnvironmentHistory): google.cloud.dialogflow.v2beta1.EnvironmentHistory; + + /** + * Encodes the specified EnvironmentHistory message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.verify|verify} messages. + * @param message EnvironmentHistory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IEnvironmentHistory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnvironmentHistory message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.verify|verify} messages. + * @param message EnvironmentHistory message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IEnvironmentHistory, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnvironmentHistory message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnvironmentHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.EnvironmentHistory; + + /** + * Decodes an EnvironmentHistory message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnvironmentHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.EnvironmentHistory; + + /** + * Verifies an EnvironmentHistory message. + * @param message Plain 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 EnvironmentHistory message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnvironmentHistory + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.EnvironmentHistory; + + /** + * Creates a plain object from an EnvironmentHistory message. Also converts values to other types if specified. + * @param message EnvironmentHistory + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.EnvironmentHistory, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnvironmentHistory to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnvironmentHistory + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EnvironmentHistory { + + /** Properties of an Entry. */ + interface IEntry { + + /** Entry agentVersion */ + agentVersion?: (string|null); + + /** Entry description */ + description?: (string|null); + + /** Entry createTime */ + createTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an Entry. */ + class Entry implements IEntry { + + /** + * Constructs a new Entry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry); + + /** Entry agentVersion. */ + public agentVersion: string; + + /** Entry description. */ + public description: string; + + /** Entry createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Entry instance using the specified properties. + * @param [properties] Properties to set + * @returns Entry instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry): google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry; + + /** + * Encodes the specified Entry message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.verify|verify} messages. + * @param message Entry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Entry message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.verify|verify} messages. + * @param message Entry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Entry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry; + + /** + * Decodes an Entry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry; + + /** + * Verifies an Entry message. + * @param message Plain 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 Entry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Entry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry; + + /** + * Creates a plain object from an Entry message. Also converts values to other types if specified. + * @param message Entry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Entry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Entry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Represents a Fulfillments */ + class Fulfillments extends $protobuf.rpc.Service { + + /** + * Constructs a new Fulfillments 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 Fulfillments 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): Fulfillments; + + /** + * Calls GetFulfillment. + * @param request GetFulfillmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Fulfillment + */ + public getFulfillment(request: google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, callback: google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillmentCallback): void; + + /** + * Calls GetFulfillment. + * @param request GetFulfillmentRequest message or plain object + * @returns Promise + */ + public getFulfillment(request: google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest): Promise; + + /** + * Calls UpdateFulfillment. + * @param request UpdateFulfillmentRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Fulfillment + */ + public updateFulfillment(request: google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, callback: google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillmentCallback): void; + + /** + * Calls UpdateFulfillment. + * @param request UpdateFulfillmentRequest message or plain object + * @returns Promise + */ + public updateFulfillment(request: google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest): Promise; + } + + namespace Fulfillments { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Fulfillments|getFulfillment}. + * @param error Error, if any + * @param [response] Fulfillment + */ + type GetFulfillmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Fulfillment) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Fulfillments|updateFulfillment}. + * @param error Error, if any + * @param [response] Fulfillment + */ + type UpdateFulfillmentCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Fulfillment) => void; + } + + /** Properties of a Fulfillment. */ + interface IFulfillment { + + /** Fulfillment name */ + name?: (string|null); + + /** Fulfillment displayName */ + displayName?: (string|null); + + /** Fulfillment genericWebService */ + genericWebService?: (google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService|null); + + /** Fulfillment enabled */ + enabled?: (boolean|null); + + /** Fulfillment features */ + features?: (google.cloud.dialogflow.v2beta1.Fulfillment.IFeature[]|null); + } + + /** Represents a Fulfillment. */ + class Fulfillment implements IFulfillment { + + /** + * Constructs a new Fulfillment. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IFulfillment); + + /** Fulfillment name. */ + public name: string; + + /** Fulfillment displayName. */ + public displayName: string; + + /** Fulfillment genericWebService. */ + public genericWebService?: (google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService|null); + + /** Fulfillment enabled. */ + public enabled: boolean; + + /** Fulfillment features. */ + public features: google.cloud.dialogflow.v2beta1.Fulfillment.IFeature[]; + + /** Fulfillment fulfillment. */ + public fulfillment?: "genericWebService"; + + /** + * Creates a new Fulfillment instance using the specified properties. + * @param [properties] Properties to set + * @returns Fulfillment instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IFulfillment): google.cloud.dialogflow.v2beta1.Fulfillment; + + /** + * Encodes the specified Fulfillment message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.verify|verify} messages. + * @param message Fulfillment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IFulfillment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Fulfillment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.verify|verify} messages. + * @param message Fulfillment message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IFulfillment, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Fulfillment message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Fulfillment; + + /** + * Decodes a Fulfillment message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Fulfillment; + + /** + * Verifies a Fulfillment message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Fulfillment message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Fulfillment + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Fulfillment; + + /** + * Creates a plain object from a Fulfillment message. Also converts values to other types if specified. + * @param message Fulfillment + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Fulfillment, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Fulfillment to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Fulfillment + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Fulfillment { + + /** Properties of a GenericWebService. */ + interface IGenericWebService { + + /** GenericWebService uri */ + uri?: (string|null); + + /** GenericWebService username */ + username?: (string|null); + + /** GenericWebService password */ + password?: (string|null); + + /** GenericWebService requestHeaders */ + requestHeaders?: ({ [k: string]: string }|null); + + /** GenericWebService isCloudFunction */ + isCloudFunction?: (boolean|null); + } + + /** Represents a GenericWebService. */ + class GenericWebService implements IGenericWebService { + + /** + * Constructs a new GenericWebService. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService); + + /** GenericWebService uri. */ + public uri: string; + + /** GenericWebService username. */ + public username: string; + + /** GenericWebService password. */ + public password: string; + + /** GenericWebService requestHeaders. */ + public requestHeaders: { [k: string]: string }; + + /** GenericWebService isCloudFunction. */ + public isCloudFunction: boolean; + + /** + * Creates a new GenericWebService instance using the specified properties. + * @param [properties] Properties to set + * @returns GenericWebService instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService): google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService; + + /** + * Encodes the specified GenericWebService message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.verify|verify} messages. + * @param message GenericWebService message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenericWebService message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.verify|verify} messages. + * @param message GenericWebService message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenericWebService message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService; + + /** + * Decodes a GenericWebService message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService; + + /** + * Verifies a GenericWebService message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenericWebService message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenericWebService + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService; + + /** + * Creates a plain object from a GenericWebService message. Also converts values to other types if specified. + * @param message GenericWebService + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenericWebService to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenericWebService + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Feature. */ + interface IFeature { + + /** Feature type */ + type?: (google.cloud.dialogflow.v2beta1.Fulfillment.Feature.Type|keyof typeof google.cloud.dialogflow.v2beta1.Fulfillment.Feature.Type|null); + } + + /** Represents a Feature. */ + class Feature implements IFeature { + + /** + * Constructs a new Feature. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.Fulfillment.IFeature); + + /** Feature type. */ + public type: (google.cloud.dialogflow.v2beta1.Fulfillment.Feature.Type|keyof typeof google.cloud.dialogflow.v2beta1.Fulfillment.Feature.Type); + + /** + * Creates a new Feature instance using the specified properties. + * @param [properties] Properties to set + * @returns Feature instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.Fulfillment.IFeature): google.cloud.dialogflow.v2beta1.Fulfillment.Feature; + + /** + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.IFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.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, + SMALLTALK = 1 + } + } + } + + /** Properties of a GetFulfillmentRequest. */ + interface IGetFulfillmentRequest { + + /** GetFulfillmentRequest name */ + name?: (string|null); + } + + /** Represents a GetFulfillmentRequest. */ + class GetFulfillmentRequest implements IGetFulfillmentRequest { + + /** + * Constructs a new GetFulfillmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest); + + /** GetFulfillmentRequest name. */ + public name: string; + + /** + * Creates a new GetFulfillmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetFulfillmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest): google.cloud.dialogflow.v2beta1.GetFulfillmentRequest; + + /** + * Encodes the specified GetFulfillmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetFulfillmentRequest.verify|verify} messages. + * @param message GetFulfillmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetFulfillmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetFulfillmentRequest.verify|verify} messages. + * @param message GetFulfillmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetFulfillmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetFulfillmentRequest; + + /** + * Decodes a GetFulfillmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetFulfillmentRequest; + + /** + * Verifies a GetFulfillmentRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetFulfillmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetFulfillmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetFulfillmentRequest; + + /** + * Creates a plain object from a GetFulfillmentRequest message. Also converts values to other types if specified. + * @param message GetFulfillmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetFulfillmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetFulfillmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetFulfillmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateFulfillmentRequest. */ + interface IUpdateFulfillmentRequest { + + /** UpdateFulfillmentRequest fulfillment */ + fulfillment?: (google.cloud.dialogflow.v2beta1.IFulfillment|null); + + /** UpdateFulfillmentRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateFulfillmentRequest. */ + class UpdateFulfillmentRequest implements IUpdateFulfillmentRequest { + + /** + * Constructs a new UpdateFulfillmentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest); + + /** UpdateFulfillmentRequest fulfillment. */ + public fulfillment?: (google.cloud.dialogflow.v2beta1.IFulfillment|null); + + /** UpdateFulfillmentRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateFulfillmentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateFulfillmentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest): google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest; + + /** + * Encodes the specified UpdateFulfillmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest.verify|verify} messages. + * @param message UpdateFulfillmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateFulfillmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest.verify|verify} messages. + * @param message UpdateFulfillmentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateFulfillmentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest; + + /** + * Decodes an UpdateFulfillmentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest; + + /** + * Verifies an UpdateFulfillmentRequest message. + * @param message Plain 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 UpdateFulfillmentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateFulfillmentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest; + + /** + * Creates a plain object from an UpdateFulfillmentRequest message. Also converts values to other types if specified. + * @param message UpdateFulfillmentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateFulfillmentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateFulfillmentRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a HumanAgentAssistantEvent. */ + interface IHumanAgentAssistantEvent { + + /** HumanAgentAssistantEvent conversation */ + conversation?: (string|null); + + /** HumanAgentAssistantEvent participant */ + participant?: (string|null); + + /** HumanAgentAssistantEvent suggestionResults */ + suggestionResults?: (google.cloud.dialogflow.v2beta1.ISuggestionResult[]|null); + } + + /** Represents a HumanAgentAssistantEvent. */ + class HumanAgentAssistantEvent implements IHumanAgentAssistantEvent { + + /** + * Constructs a new HumanAgentAssistantEvent. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IHumanAgentAssistantEvent); + + /** HumanAgentAssistantEvent conversation. */ + public conversation: string; + + /** HumanAgentAssistantEvent participant. */ + public participant: string; + + /** HumanAgentAssistantEvent suggestionResults. */ + public suggestionResults: google.cloud.dialogflow.v2beta1.ISuggestionResult[]; + + /** + * Creates a new HumanAgentAssistantEvent instance using the specified properties. + * @param [properties] Properties to set + * @returns HumanAgentAssistantEvent instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IHumanAgentAssistantEvent): google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent; + + /** + * Encodes the specified HumanAgentAssistantEvent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent.verify|verify} messages. + * @param message HumanAgentAssistantEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IHumanAgentAssistantEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HumanAgentAssistantEvent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent.verify|verify} messages. + * @param message HumanAgentAssistantEvent message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IHumanAgentAssistantEvent, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HumanAgentAssistantEvent message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HumanAgentAssistantEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent; + + /** + * Decodes a HumanAgentAssistantEvent message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HumanAgentAssistantEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent; + + /** + * Verifies a HumanAgentAssistantEvent message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HumanAgentAssistantEvent message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HumanAgentAssistantEvent + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent; + + /** + * Creates a plain object from a HumanAgentAssistantEvent message. Also converts values to other types if specified. + * @param message HumanAgentAssistantEvent + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HumanAgentAssistantEvent to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HumanAgentAssistantEvent + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a KnowledgeBases */ + class KnowledgeBases extends $protobuf.rpc.Service { + + /** + * Constructs a new KnowledgeBases 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 KnowledgeBases 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): KnowledgeBases; + + /** + * Calls ListKnowledgeBases. + * @param request ListKnowledgeBasesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListKnowledgeBasesResponse + */ + public listKnowledgeBases(request: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, callback: google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBasesCallback): void; + + /** + * Calls ListKnowledgeBases. + * @param request ListKnowledgeBasesRequest message or plain object + * @returns Promise + */ + public listKnowledgeBases(request: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest): Promise; + + /** + * Calls GetKnowledgeBase. + * @param request GetKnowledgeBaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and KnowledgeBase + */ + public getKnowledgeBase(request: google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, callback: google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBaseCallback): void; + + /** + * Calls GetKnowledgeBase. + * @param request GetKnowledgeBaseRequest message or plain object + * @returns Promise + */ + public getKnowledgeBase(request: google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest): Promise; + + /** + * Calls CreateKnowledgeBase. + * @param request CreateKnowledgeBaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and KnowledgeBase + */ + public createKnowledgeBase(request: google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, callback: google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBaseCallback): void; + + /** + * Calls CreateKnowledgeBase. + * @param request CreateKnowledgeBaseRequest message or plain object + * @returns Promise + */ + public createKnowledgeBase(request: google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest): Promise; + + /** + * Calls DeleteKnowledgeBase. + * @param request DeleteKnowledgeBaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteKnowledgeBase(request: google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, callback: google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBaseCallback): void; + + /** + * Calls DeleteKnowledgeBase. + * @param request DeleteKnowledgeBaseRequest message or plain object + * @returns Promise + */ + public deleteKnowledgeBase(request: google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest): Promise; + + /** + * Calls UpdateKnowledgeBase. + * @param request UpdateKnowledgeBaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and KnowledgeBase + */ + public updateKnowledgeBase(request: google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, callback: google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBaseCallback): void; + + /** + * Calls UpdateKnowledgeBase. + * @param request UpdateKnowledgeBaseRequest message or plain object + * @returns Promise + */ + public updateKnowledgeBase(request: google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest): Promise; + } + + namespace KnowledgeBases { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|listKnowledgeBases}. + * @param error Error, if any + * @param [response] ListKnowledgeBasesResponse + */ + type ListKnowledgeBasesCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|getKnowledgeBase}. + * @param error Error, if any + * @param [response] KnowledgeBase + */ + type GetKnowledgeBaseCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.KnowledgeBase) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|createKnowledgeBase}. + * @param error Error, if any + * @param [response] KnowledgeBase + */ + type CreateKnowledgeBaseCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.KnowledgeBase) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|deleteKnowledgeBase}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteKnowledgeBaseCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|updateKnowledgeBase}. + * @param error Error, if any + * @param [response] KnowledgeBase + */ + type UpdateKnowledgeBaseCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.KnowledgeBase) => void; + } + + /** Properties of a KnowledgeBase. */ + interface IKnowledgeBase { + + /** KnowledgeBase name */ + name?: (string|null); + + /** KnowledgeBase displayName */ + displayName?: (string|null); + + /** KnowledgeBase languageCode */ + languageCode?: (string|null); + } + + /** Represents a KnowledgeBase. */ + class KnowledgeBase implements IKnowledgeBase { + + /** + * Constructs a new KnowledgeBase. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IKnowledgeBase); + + /** KnowledgeBase name. */ + public name: string; + + /** KnowledgeBase displayName. */ + public displayName: string; + + /** KnowledgeBase languageCode. */ + public languageCode: string; + + /** + * Creates a new KnowledgeBase instance using the specified properties. + * @param [properties] Properties to set + * @returns KnowledgeBase instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IKnowledgeBase): google.cloud.dialogflow.v2beta1.KnowledgeBase; + + /** + * Encodes the specified KnowledgeBase message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeBase.verify|verify} messages. + * @param message KnowledgeBase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IKnowledgeBase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified KnowledgeBase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeBase.verify|verify} messages. + * @param message KnowledgeBase message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IKnowledgeBase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a KnowledgeBase message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns KnowledgeBase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.KnowledgeBase; + + /** + * Decodes a KnowledgeBase message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns KnowledgeBase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.KnowledgeBase; + + /** + * Verifies a KnowledgeBase message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a KnowledgeBase message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns KnowledgeBase + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.KnowledgeBase; + + /** + * Creates a plain object from a KnowledgeBase message. Also converts values to other types if specified. + * @param message KnowledgeBase + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.KnowledgeBase, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this KnowledgeBase to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for KnowledgeBase + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListKnowledgeBasesRequest. */ + interface IListKnowledgeBasesRequest { + + /** ListKnowledgeBasesRequest parent */ + parent?: (string|null); + + /** ListKnowledgeBasesRequest pageSize */ + pageSize?: (number|null); + + /** ListKnowledgeBasesRequest pageToken */ + pageToken?: (string|null); + + /** ListKnowledgeBasesRequest filter */ + filter?: (string|null); + } + + /** Represents a ListKnowledgeBasesRequest. */ + class ListKnowledgeBasesRequest implements IListKnowledgeBasesRequest { + + /** + * Constructs a new ListKnowledgeBasesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest); + + /** ListKnowledgeBasesRequest parent. */ + public parent: string; + + /** ListKnowledgeBasesRequest pageSize. */ + public pageSize: number; + + /** ListKnowledgeBasesRequest pageToken. */ + public pageToken: string; + + /** ListKnowledgeBasesRequest filter. */ + public filter: string; + + /** + * Creates a new ListKnowledgeBasesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKnowledgeBasesRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest): google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest; + + /** + * Encodes the specified ListKnowledgeBasesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest.verify|verify} messages. + * @param message ListKnowledgeBasesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKnowledgeBasesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest.verify|verify} messages. + * @param message ListKnowledgeBasesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKnowledgeBasesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKnowledgeBasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest; + + /** + * Decodes a ListKnowledgeBasesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKnowledgeBasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest; + + /** + * Verifies a ListKnowledgeBasesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKnowledgeBasesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKnowledgeBasesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest; + + /** + * Creates a plain object from a ListKnowledgeBasesRequest message. Also converts values to other types if specified. + * @param message ListKnowledgeBasesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKnowledgeBasesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListKnowledgeBasesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListKnowledgeBasesResponse. */ + interface IListKnowledgeBasesResponse { + + /** ListKnowledgeBasesResponse knowledgeBases */ + knowledgeBases?: (google.cloud.dialogflow.v2beta1.IKnowledgeBase[]|null); + + /** ListKnowledgeBasesResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListKnowledgeBasesResponse. */ + class ListKnowledgeBasesResponse implements IListKnowledgeBasesResponse { + + /** + * Constructs a new ListKnowledgeBasesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse); + + /** ListKnowledgeBasesResponse knowledgeBases. */ + public knowledgeBases: google.cloud.dialogflow.v2beta1.IKnowledgeBase[]; + + /** ListKnowledgeBasesResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListKnowledgeBasesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListKnowledgeBasesResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse): google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse; + + /** + * Encodes the specified ListKnowledgeBasesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse.verify|verify} messages. + * @param message ListKnowledgeBasesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListKnowledgeBasesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse.verify|verify} messages. + * @param message ListKnowledgeBasesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListKnowledgeBasesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListKnowledgeBasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse; + + /** + * Decodes a ListKnowledgeBasesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListKnowledgeBasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse; + + /** + * Verifies a ListKnowledgeBasesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListKnowledgeBasesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListKnowledgeBasesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse; + + /** + * Creates a plain object from a ListKnowledgeBasesResponse message. Also converts values to other types if specified. + * @param message ListKnowledgeBasesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListKnowledgeBasesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListKnowledgeBasesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetKnowledgeBaseRequest. */ + interface IGetKnowledgeBaseRequest { + + /** GetKnowledgeBaseRequest name */ + name?: (string|null); + } + + /** Represents a GetKnowledgeBaseRequest. */ + class GetKnowledgeBaseRequest implements IGetKnowledgeBaseRequest { + + /** + * Constructs a new GetKnowledgeBaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest); + + /** GetKnowledgeBaseRequest name. */ + public name: string; + + /** + * Creates a new GetKnowledgeBaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetKnowledgeBaseRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest): google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest; + + /** + * Encodes the specified GetKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest.verify|verify} messages. + * @param message GetKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest.verify|verify} messages. + * @param message GetKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetKnowledgeBaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest; + + /** + * Decodes a GetKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest; + + /** + * Verifies a GetKnowledgeBaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetKnowledgeBaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest; + + /** + * Creates a plain object from a GetKnowledgeBaseRequest message. Also converts values to other types if specified. + * @param message GetKnowledgeBaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetKnowledgeBaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetKnowledgeBaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateKnowledgeBaseRequest. */ + interface ICreateKnowledgeBaseRequest { + + /** CreateKnowledgeBaseRequest parent */ + parent?: (string|null); + + /** CreateKnowledgeBaseRequest knowledgeBase */ + knowledgeBase?: (google.cloud.dialogflow.v2beta1.IKnowledgeBase|null); + } + + /** Represents a CreateKnowledgeBaseRequest. */ + class CreateKnowledgeBaseRequest implements ICreateKnowledgeBaseRequest { + + /** + * Constructs a new CreateKnowledgeBaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest); + + /** CreateKnowledgeBaseRequest parent. */ + public parent: string; + + /** CreateKnowledgeBaseRequest knowledgeBase. */ + public knowledgeBase?: (google.cloud.dialogflow.v2beta1.IKnowledgeBase|null); + + /** + * Creates a new CreateKnowledgeBaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateKnowledgeBaseRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest): google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest; + + /** + * Encodes the specified CreateKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest.verify|verify} messages. + * @param message CreateKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest.verify|verify} messages. + * @param message CreateKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateKnowledgeBaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest; + + /** + * Decodes a CreateKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest; + + /** + * Verifies a CreateKnowledgeBaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateKnowledgeBaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest; + + /** + * Creates a plain object from a CreateKnowledgeBaseRequest message. Also converts values to other types if specified. + * @param message CreateKnowledgeBaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateKnowledgeBaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateKnowledgeBaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteKnowledgeBaseRequest. */ + interface IDeleteKnowledgeBaseRequest { + + /** DeleteKnowledgeBaseRequest name */ + name?: (string|null); + + /** DeleteKnowledgeBaseRequest force */ + force?: (boolean|null); + } + + /** Represents a DeleteKnowledgeBaseRequest. */ + class DeleteKnowledgeBaseRequest implements IDeleteKnowledgeBaseRequest { + + /** + * Constructs a new DeleteKnowledgeBaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest); + + /** DeleteKnowledgeBaseRequest name. */ + public name: string; + + /** DeleteKnowledgeBaseRequest force. */ + public force: boolean; + + /** + * Creates a new DeleteKnowledgeBaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteKnowledgeBaseRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest): google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest; + + /** + * Encodes the specified DeleteKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest.verify|verify} messages. + * @param message DeleteKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest.verify|verify} messages. + * @param message DeleteKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteKnowledgeBaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest; + + /** + * Decodes a DeleteKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest; + + /** + * Verifies a DeleteKnowledgeBaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteKnowledgeBaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest; + + /** + * Creates a plain object from a DeleteKnowledgeBaseRequest message. Also converts values to other types if specified. + * @param message DeleteKnowledgeBaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteKnowledgeBaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteKnowledgeBaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateKnowledgeBaseRequest. */ + interface IUpdateKnowledgeBaseRequest { + + /** UpdateKnowledgeBaseRequest knowledgeBase */ + knowledgeBase?: (google.cloud.dialogflow.v2beta1.IKnowledgeBase|null); + + /** UpdateKnowledgeBaseRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateKnowledgeBaseRequest. */ + class UpdateKnowledgeBaseRequest implements IUpdateKnowledgeBaseRequest { + + /** + * Constructs a new UpdateKnowledgeBaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest); + + /** UpdateKnowledgeBaseRequest knowledgeBase. */ + public knowledgeBase?: (google.cloud.dialogflow.v2beta1.IKnowledgeBase|null); + + /** UpdateKnowledgeBaseRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateKnowledgeBaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateKnowledgeBaseRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest): google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest; + + /** + * Encodes the specified UpdateKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest.verify|verify} messages. + * @param message UpdateKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest.verify|verify} messages. + * @param message UpdateKnowledgeBaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateKnowledgeBaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest; + + /** + * Decodes an UpdateKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest; + + /** + * Verifies an UpdateKnowledgeBaseRequest message. + * @param message Plain 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 UpdateKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateKnowledgeBaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest; + + /** + * Creates a plain object from an UpdateKnowledgeBaseRequest message. Also converts values to other types if specified. + * @param message UpdateKnowledgeBaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateKnowledgeBaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateKnowledgeBaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a Versions */ + class Versions extends $protobuf.rpc.Service { + + /** + * Constructs a new Versions 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 Versions 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): Versions; + + /** + * Calls ListVersions. + * @param request ListVersionsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListVersionsResponse + */ + public listVersions(request: google.cloud.dialogflow.v2beta1.IListVersionsRequest, callback: google.cloud.dialogflow.v2beta1.Versions.ListVersionsCallback): void; + + /** + * Calls ListVersions. + * @param request ListVersionsRequest message or plain object + * @returns Promise + */ + public listVersions(request: google.cloud.dialogflow.v2beta1.IListVersionsRequest): Promise; + + /** + * Calls GetVersion. + * @param request GetVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Version + */ + public getVersion(request: google.cloud.dialogflow.v2beta1.IGetVersionRequest, callback: google.cloud.dialogflow.v2beta1.Versions.GetVersionCallback): void; + + /** + * Calls GetVersion. + * @param request GetVersionRequest message or plain object + * @returns Promise + */ + public getVersion(request: google.cloud.dialogflow.v2beta1.IGetVersionRequest): Promise; + + /** + * Calls CreateVersion. + * @param request CreateVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Version + */ + public createVersion(request: google.cloud.dialogflow.v2beta1.ICreateVersionRequest, callback: google.cloud.dialogflow.v2beta1.Versions.CreateVersionCallback): void; + + /** + * Calls CreateVersion. + * @param request CreateVersionRequest message or plain object + * @returns Promise + */ + public createVersion(request: google.cloud.dialogflow.v2beta1.ICreateVersionRequest): Promise; + + /** + * Calls UpdateVersion. + * @param request UpdateVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Version + */ + public updateVersion(request: google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, callback: google.cloud.dialogflow.v2beta1.Versions.UpdateVersionCallback): void; + + /** + * Calls UpdateVersion. + * @param request UpdateVersionRequest message or plain object + * @returns Promise + */ + public updateVersion(request: google.cloud.dialogflow.v2beta1.IUpdateVersionRequest): Promise; + + /** + * Calls DeleteVersion. + * @param request DeleteVersionRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public deleteVersion(request: google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, callback: google.cloud.dialogflow.v2beta1.Versions.DeleteVersionCallback): void; + + /** + * Calls DeleteVersion. + * @param request DeleteVersionRequest message or plain object + * @returns Promise + */ + public deleteVersion(request: google.cloud.dialogflow.v2beta1.IDeleteVersionRequest): Promise; + } + + namespace Versions { + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|listVersions}. + * @param error Error, if any + * @param [response] ListVersionsResponse + */ + type ListVersionsCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.ListVersionsResponse) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|getVersion}. + * @param error Error, if any + * @param [response] Version + */ + type GetVersionCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Version) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|createVersion}. + * @param error Error, if any + * @param [response] Version + */ + type CreateVersionCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Version) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|updateVersion}. + * @param error Error, if any + * @param [response] Version + */ + type UpdateVersionCallback = (error: (Error|null), response?: google.cloud.dialogflow.v2beta1.Version) => void; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|deleteVersion}. + * @param error Error, if any + * @param [response] Empty + */ + type DeleteVersionCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a Version. */ + interface IVersion { + + /** Version name */ + name?: (string|null); + + /** Version description */ + description?: (string|null); + + /** Version versionNumber */ + versionNumber?: (number|null); + + /** Version createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Version status */ + status?: (google.cloud.dialogflow.v2beta1.Version.VersionStatus|keyof typeof google.cloud.dialogflow.v2beta1.Version.VersionStatus|null); + } + + /** Represents a Version. */ + class Version implements IVersion { + + /** + * Constructs a new Version. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IVersion); + + /** Version name. */ + public name: string; + + /** Version description. */ + public description: string; + + /** Version versionNumber. */ + public versionNumber: number; + + /** Version createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Version status. */ + public status: (google.cloud.dialogflow.v2beta1.Version.VersionStatus|keyof typeof google.cloud.dialogflow.v2beta1.Version.VersionStatus); + + /** + * Creates a new Version instance using the specified properties. + * @param [properties] Properties to set + * @returns Version instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IVersion): google.cloud.dialogflow.v2beta1.Version; + + /** + * Encodes the specified Version message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Version.verify|verify} messages. + * @param message Version message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Version message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Version.verify|verify} messages. + * @param message Version message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Version message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.Version; + + /** + * Decodes a Version message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.Version; + + /** + * Verifies a Version message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Version message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Version + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.Version; + + /** + * Creates a plain object from a Version message. Also converts values to other types if specified. + * @param message Version + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.Version, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Version to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Version + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Version { + + /** VersionStatus enum. */ + enum VersionStatus { + VERSION_STATUS_UNSPECIFIED = 0, + IN_PROGRESS = 1, + READY = 2, + FAILED = 3 + } + } + + /** Properties of a ListVersionsRequest. */ + interface IListVersionsRequest { + + /** ListVersionsRequest parent */ + parent?: (string|null); + + /** ListVersionsRequest pageSize */ + pageSize?: (number|null); + + /** ListVersionsRequest pageToken */ + pageToken?: (string|null); + } + + /** Represents a ListVersionsRequest. */ + class ListVersionsRequest implements IListVersionsRequest { + + /** + * Constructs a new ListVersionsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListVersionsRequest); + + /** ListVersionsRequest parent. */ + public parent: string; + + /** ListVersionsRequest pageSize. */ + public pageSize: number; + + /** ListVersionsRequest pageToken. */ + public pageToken: string; + + /** + * Creates a new ListVersionsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListVersionsRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListVersionsRequest): google.cloud.dialogflow.v2beta1.ListVersionsRequest; + + /** + * Encodes the specified ListVersionsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListVersionsRequest.verify|verify} messages. + * @param message ListVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListVersionsRequest.verify|verify} messages. + * @param message ListVersionsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListVersionsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListVersionsRequest; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListVersionsRequest; + + /** + * Verifies a ListVersionsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListVersionsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListVersionsRequest; + + /** + * Creates a plain object from a ListVersionsRequest message. Also converts values to other types if specified. + * @param message ListVersionsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListVersionsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListVersionsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListVersionsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListVersionsResponse. */ + interface IListVersionsResponse { + + /** ListVersionsResponse versions */ + versions?: (google.cloud.dialogflow.v2beta1.IVersion[]|null); + + /** ListVersionsResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a ListVersionsResponse. */ + class ListVersionsResponse implements IListVersionsResponse { + + /** + * Constructs a new ListVersionsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IListVersionsResponse); + + /** ListVersionsResponse versions. */ + public versions: google.cloud.dialogflow.v2beta1.IVersion[]; + + /** ListVersionsResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new ListVersionsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListVersionsResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IListVersionsResponse): google.cloud.dialogflow.v2beta1.ListVersionsResponse; + + /** + * Encodes the specified ListVersionsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListVersionsResponse.verify|verify} messages. + * @param message ListVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IListVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListVersionsResponse.verify|verify} messages. + * @param message ListVersionsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IListVersionsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.ListVersionsResponse; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.ListVersionsResponse; + + /** + * Verifies a ListVersionsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListVersionsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.ListVersionsResponse; + + /** + * Creates a plain object from a ListVersionsResponse message. Also converts values to other types if specified. + * @param message ListVersionsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.ListVersionsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListVersionsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListVersionsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetVersionRequest. */ + interface IGetVersionRequest { + + /** GetVersionRequest name */ + name?: (string|null); + } + + /** Represents a GetVersionRequest. */ + class GetVersionRequest implements IGetVersionRequest { + + /** + * Constructs a new GetVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IGetVersionRequest); + + /** GetVersionRequest name. */ + public name: string; + + /** + * Creates a new GetVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IGetVersionRequest): google.cloud.dialogflow.v2beta1.GetVersionRequest; + + /** + * Encodes the specified GetVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetVersionRequest.verify|verify} messages. + * @param message GetVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IGetVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetVersionRequest.verify|verify} messages. + * @param message GetVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IGetVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.GetVersionRequest; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.GetVersionRequest; + + /** + * Verifies a GetVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.GetVersionRequest; + + /** + * Creates a plain object from a GetVersionRequest message. Also converts values to other types if specified. + * @param message GetVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.GetVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateVersionRequest. */ + interface ICreateVersionRequest { + + /** CreateVersionRequest parent */ + parent?: (string|null); + + /** CreateVersionRequest version */ + version?: (google.cloud.dialogflow.v2beta1.IVersion|null); + } + + /** Represents a CreateVersionRequest. */ + class CreateVersionRequest implements ICreateVersionRequest { + + /** + * Constructs a new CreateVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.ICreateVersionRequest); + + /** CreateVersionRequest parent. */ + public parent: string; + + /** CreateVersionRequest version. */ + public version?: (google.cloud.dialogflow.v2beta1.IVersion|null); + + /** + * Creates a new CreateVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.ICreateVersionRequest): google.cloud.dialogflow.v2beta1.CreateVersionRequest; + + /** + * Encodes the specified CreateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateVersionRequest.verify|verify} messages. + * @param message CreateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.ICreateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateVersionRequest.verify|verify} messages. + * @param message CreateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.ICreateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.CreateVersionRequest; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.CreateVersionRequest; + + /** + * Verifies a CreateVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.CreateVersionRequest; + + /** + * Creates a plain object from a CreateVersionRequest message. Also converts values to other types if specified. + * @param message CreateVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.CreateVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateVersionRequest. */ + interface IUpdateVersionRequest { + + /** UpdateVersionRequest version */ + version?: (google.cloud.dialogflow.v2beta1.IVersion|null); + + /** UpdateVersionRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateVersionRequest. */ + class UpdateVersionRequest implements IUpdateVersionRequest { + + /** + * Constructs a new UpdateVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IUpdateVersionRequest); + + /** UpdateVersionRequest version. */ + public version?: (google.cloud.dialogflow.v2beta1.IVersion|null); + + /** UpdateVersionRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IUpdateVersionRequest): google.cloud.dialogflow.v2beta1.UpdateVersionRequest; + + /** + * Encodes the specified UpdateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateVersionRequest.verify|verify} messages. + * @param message UpdateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateVersionRequest.verify|verify} messages. + * @param message UpdateVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.UpdateVersionRequest; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.UpdateVersionRequest; + + /** + * Verifies an UpdateVersionRequest message. + * @param message Plain 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 UpdateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.UpdateVersionRequest; + + /** + * Creates a plain object from an UpdateVersionRequest message. Also converts values to other types if specified. + * @param message UpdateVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.UpdateVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteVersionRequest. */ + interface IDeleteVersionRequest { + + /** DeleteVersionRequest name */ + name?: (string|null); + } + + /** Represents a DeleteVersionRequest. */ + class DeleteVersionRequest implements IDeleteVersionRequest { + + /** + * Constructs a new DeleteVersionRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IDeleteVersionRequest); + + /** DeleteVersionRequest name. */ + public name: string; + + /** + * Creates a new DeleteVersionRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteVersionRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IDeleteVersionRequest): google.cloud.dialogflow.v2beta1.DeleteVersionRequest; + + /** + * Encodes the specified DeleteVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteVersionRequest.verify|verify} messages. + * @param message DeleteVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteVersionRequest.verify|verify} messages. + * @param message DeleteVersionRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.DeleteVersionRequest; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.DeleteVersionRequest; + + /** + * Verifies a DeleteVersionRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteVersionRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteVersionRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.DeleteVersionRequest; + + /** + * Creates a plain object from a DeleteVersionRequest message. Also converts values to other types if specified. + * @param message DeleteVersionRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.DeleteVersionRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteVersionRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteVersionRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WebhookRequest. */ + interface IWebhookRequest { + + /** WebhookRequest session */ + session?: (string|null); + + /** WebhookRequest responseId */ + responseId?: (string|null); + + /** WebhookRequest queryResult */ + queryResult?: (google.cloud.dialogflow.v2beta1.IQueryResult|null); + + /** WebhookRequest alternativeQueryResults */ + alternativeQueryResults?: (google.cloud.dialogflow.v2beta1.IQueryResult[]|null); + + /** WebhookRequest originalDetectIntentRequest */ + originalDetectIntentRequest?: (google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest|null); + } + + /** Represents a WebhookRequest. */ + class WebhookRequest implements IWebhookRequest { + + /** + * Constructs a new WebhookRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IWebhookRequest); + + /** WebhookRequest session. */ + public session: string; + + /** WebhookRequest responseId. */ + public responseId: string; + + /** WebhookRequest queryResult. */ + public queryResult?: (google.cloud.dialogflow.v2beta1.IQueryResult|null); + + /** WebhookRequest alternativeQueryResults. */ + public alternativeQueryResults: google.cloud.dialogflow.v2beta1.IQueryResult[]; + + /** WebhookRequest originalDetectIntentRequest. */ + public originalDetectIntentRequest?: (google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest|null); + + /** + * Creates a new WebhookRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns WebhookRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IWebhookRequest): google.cloud.dialogflow.v2beta1.WebhookRequest; + + /** + * Encodes the specified WebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.WebhookRequest.verify|verify} messages. + * @param message WebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.WebhookRequest.verify|verify} messages. + * @param message WebhookRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IWebhookRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.WebhookRequest; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.WebhookRequest; + + /** + * Verifies a WebhookRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebhookRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebhookRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.WebhookRequest; + + /** + * Creates a plain object from a WebhookRequest message. Also converts values to other types if specified. + * @param message WebhookRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.WebhookRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebhookRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WebhookRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a WebhookResponse. */ + interface IWebhookResponse { + + /** WebhookResponse fulfillmentText */ + fulfillmentText?: (string|null); + + /** WebhookResponse fulfillmentMessages */ + fulfillmentMessages?: (google.cloud.dialogflow.v2beta1.Intent.IMessage[]|null); + + /** WebhookResponse source */ + source?: (string|null); + + /** WebhookResponse payload */ + payload?: (google.protobuf.IStruct|null); + + /** WebhookResponse outputContexts */ + outputContexts?: (google.cloud.dialogflow.v2beta1.IContext[]|null); + + /** WebhookResponse followupEventInput */ + followupEventInput?: (google.cloud.dialogflow.v2beta1.IEventInput|null); + + /** WebhookResponse liveAgentHandoff */ + liveAgentHandoff?: (boolean|null); + + /** WebhookResponse endInteraction */ + endInteraction?: (boolean|null); + + /** WebhookResponse sessionEntityTypes */ + sessionEntityTypes?: (google.cloud.dialogflow.v2beta1.ISessionEntityType[]|null); + } + + /** Represents a WebhookResponse. */ + class WebhookResponse implements IWebhookResponse { + + /** + * Constructs a new WebhookResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IWebhookResponse); + + /** WebhookResponse fulfillmentText. */ + public fulfillmentText: string; + + /** WebhookResponse fulfillmentMessages. */ + public fulfillmentMessages: google.cloud.dialogflow.v2beta1.Intent.IMessage[]; + + /** WebhookResponse source. */ + public source: string; + + /** WebhookResponse payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** WebhookResponse outputContexts. */ + public outputContexts: google.cloud.dialogflow.v2beta1.IContext[]; + + /** WebhookResponse followupEventInput. */ + public followupEventInput?: (google.cloud.dialogflow.v2beta1.IEventInput|null); + + /** WebhookResponse liveAgentHandoff. */ + public liveAgentHandoff: boolean; + + /** WebhookResponse endInteraction. */ + public endInteraction: boolean; + + /** WebhookResponse sessionEntityTypes. */ + public sessionEntityTypes: google.cloud.dialogflow.v2beta1.ISessionEntityType[]; + + /** + * Creates a new WebhookResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns WebhookResponse instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IWebhookResponse): google.cloud.dialogflow.v2beta1.WebhookResponse; + + /** + * Encodes the specified WebhookResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.WebhookResponse.verify|verify} messages. + * @param message WebhookResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IWebhookResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified WebhookResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.WebhookResponse.verify|verify} messages. + * @param message WebhookResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IWebhookResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.WebhookResponse; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.WebhookResponse; + + /** + * Verifies a WebhookResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a WebhookResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns WebhookResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.WebhookResponse; + + /** + * Creates a plain object from a WebhookResponse message. Also converts values to other types if specified. + * @param message WebhookResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.WebhookResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this WebhookResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for WebhookResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OriginalDetectIntentRequest. */ + interface IOriginalDetectIntentRequest { + + /** OriginalDetectIntentRequest source */ + source?: (string|null); + + /** OriginalDetectIntentRequest version */ + version?: (string|null); + + /** OriginalDetectIntentRequest payload */ + payload?: (google.protobuf.IStruct|null); + } + + /** Represents an OriginalDetectIntentRequest. */ + class OriginalDetectIntentRequest implements IOriginalDetectIntentRequest { + + /** + * Constructs a new OriginalDetectIntentRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest); + + /** OriginalDetectIntentRequest source. */ + public source: string; + + /** OriginalDetectIntentRequest version. */ + public version: string; + + /** OriginalDetectIntentRequest payload. */ + public payload?: (google.protobuf.IStruct|null); + + /** + * Creates a new OriginalDetectIntentRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns OriginalDetectIntentRequest instance + */ + public static create(properties?: google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest): google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest; + + /** + * Encodes the specified OriginalDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.verify|verify} messages. + * @param message OriginalDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OriginalDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.verify|verify} messages. + * @param message OriginalDetectIntentRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OriginalDetectIntentRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OriginalDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest; + + /** + * Decodes an OriginalDetectIntentRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OriginalDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest; + + /** + * Verifies an OriginalDetectIntentRequest message. + * @param message Plain 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 OriginalDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OriginalDetectIntentRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest; + + /** + * Creates a plain object from an OriginalDetectIntentRequest message. Also converts values to other types if specified. + * @param message OriginalDetectIntentRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OriginalDetectIntentRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OriginalDetectIntentRequest + * @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 Struct. */ + interface IStruct { + + /** Struct fields */ + fields?: ({ [k: string]: google.protobuf.IValue }|null); + } + + /** Represents a Struct. */ + class Struct implements IStruct { + + /** + * Constructs a new Struct. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IStruct); + + /** Struct fields. */ + public fields: { [k: string]: google.protobuf.IValue }; + + /** + * Creates a new Struct instance using the specified properties. + * @param [properties] Properties to set + * @returns Struct instance + */ + public static create(properties?: google.protobuf.IStruct): google.protobuf.Struct; + + /** + * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @param message Struct message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IStruct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @param message Struct message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IStruct, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Struct message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Struct + * @throws {Error} If the payload is not 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.Struct; + + /** + * Decodes a Struct message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Struct + * @throws {Error} If the payload 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.Struct; + + /** + * Verifies a Struct message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Struct message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Struct + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Struct; + + /** + * Creates a plain object from a Struct message. Also converts values to other types if specified. + * @param message Struct + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Struct, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Struct to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Struct + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Value. */ + interface IValue { + + /** Value nullValue */ + nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value numberValue */ + numberValue?: (number|null); + + /** Value stringValue */ + stringValue?: (string|null); + + /** Value boolValue */ + boolValue?: (boolean|null); + + /** Value structValue */ + structValue?: (google.protobuf.IStruct|null); + + /** Value listValue */ + listValue?: (google.protobuf.IListValue|null); + } + + /** Represents a Value. */ + class Value implements IValue { + + /** + * Constructs a new Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IValue); + + /** Value nullValue. */ + public nullValue?: (google.protobuf.NullValue|keyof typeof google.protobuf.NullValue|null); + + /** Value numberValue. */ + public numberValue?: (number|null); + + /** Value stringValue. */ + public stringValue?: (string|null); + + /** Value boolValue. */ + public boolValue?: (boolean|null); + + /** Value structValue. */ + public structValue?: (google.protobuf.IStruct|null); + + /** Value listValue. */ + public listValue?: (google.protobuf.IListValue|null); + + /** Value kind. */ + public kind?: ("nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"); + + /** + * Creates a new Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Value instance + */ + public static create(properties?: google.protobuf.IValue): google.protobuf.Value; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Value + * @throws {Error} If the payload is not 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.Value; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Value + * @throws {Error} If the payload 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.Value; + + /** + * Verifies a Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Value; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @param message Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** NullValue enum. */ + enum NullValue { + NULL_VALUE = 0 + } + + /** Properties of a ListValue. */ + interface IListValue { + + /** ListValue values */ + values?: (google.protobuf.IValue[]|null); + } + + /** Represents a ListValue. */ + class ListValue implements IListValue { + + /** + * Constructs a new ListValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IListValue); + + /** ListValue values. */ + public values: google.protobuf.IValue[]; + + /** + * Creates a new ListValue instance using the specified properties. + * @param [properties] Properties to set + * @returns ListValue instance + */ + public static create(properties?: google.protobuf.IListValue): google.protobuf.ListValue; + + /** + * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @param message ListValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IListValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @param message ListValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IListValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListValue + * @throws {Error} If the payload is not 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.ListValue; + + /** + * Decodes a ListValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListValue + * @throws {Error} If the payload 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.ListValue; + + /** + * Verifies a ListValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ListValue; + + /** + * Creates a plain object from a ListValue message. Also converts values to other types if specified. + * @param message ListValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ListValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListValue + * @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; + } + } + + /** 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 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/packages/google-cloud-dialogflow/protos/protos.js b/packages/google-cloud-dialogflow/protos/protos.js new file mode 100644 index 00000000000..3bfb1ff4e73 --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/protos.js @@ -0,0 +1,175232 @@ +// 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. + +/*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_dialogflow_protos || ($protobuf.roots._google_cloud_dialogflow_protos = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.cloud = (function() { + + /** + * Namespace cloud. + * @memberof google + * @namespace + */ + var cloud = {}; + + cloud.dialogflow = (function() { + + /** + * Namespace dialogflow. + * @memberof google.cloud + * @namespace + */ + var dialogflow = {}; + + dialogflow.v2 = (function() { + + /** + * Namespace v2. + * @memberof google.cloud.dialogflow + * @namespace + */ + var v2 = {}; + + v2.Agents = (function() { + + /** + * Constructs a new Agents service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an Agents + * @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 Agents(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Agents.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Agents; + + /** + * Creates new Agents service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Agents + * @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 {Agents} RPC service. Useful where requests and/or responses are streamed. + */ + Agents.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|getAgent}. + * @memberof google.cloud.dialogflow.v2.Agents + * @typedef GetAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Agent} [response] Agent + */ + + /** + * Calls GetAgent. + * @function getAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IGetAgentRequest} request GetAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Agents.GetAgentCallback} callback Node-style callback called with the error, if any, and Agent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.getAgent = function getAgent(request, callback) { + return this.rpcCall(getAgent, $root.google.cloud.dialogflow.v2.GetAgentRequest, $root.google.cloud.dialogflow.v2.Agent, request, callback); + }, "name", { value: "GetAgent" }); + + /** + * Calls GetAgent. + * @function getAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IGetAgentRequest} request GetAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|setAgent}. + * @memberof google.cloud.dialogflow.v2.Agents + * @typedef SetAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Agent} [response] Agent + */ + + /** + * Calls SetAgent. + * @function setAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.ISetAgentRequest} request SetAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Agents.SetAgentCallback} callback Node-style callback called with the error, if any, and Agent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.setAgent = function setAgent(request, callback) { + return this.rpcCall(setAgent, $root.google.cloud.dialogflow.v2.SetAgentRequest, $root.google.cloud.dialogflow.v2.Agent, request, callback); + }, "name", { value: "SetAgent" }); + + /** + * Calls SetAgent. + * @function setAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.ISetAgentRequest} request SetAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|deleteAgent}. + * @memberof google.cloud.dialogflow.v2.Agents + * @typedef DeleteAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteAgent. + * @function deleteAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteAgentRequest} request DeleteAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Agents.DeleteAgentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.deleteAgent = function deleteAgent(request, callback) { + return this.rpcCall(deleteAgent, $root.google.cloud.dialogflow.v2.DeleteAgentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteAgent" }); + + /** + * Calls DeleteAgent. + * @function deleteAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteAgentRequest} request DeleteAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|searchAgents}. + * @memberof google.cloud.dialogflow.v2.Agents + * @typedef SearchAgentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.SearchAgentsResponse} [response] SearchAgentsResponse + */ + + /** + * Calls SearchAgents. + * @function searchAgents + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.ISearchAgentsRequest} request SearchAgentsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Agents.SearchAgentsCallback} callback Node-style callback called with the error, if any, and SearchAgentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.searchAgents = function searchAgents(request, callback) { + return this.rpcCall(searchAgents, $root.google.cloud.dialogflow.v2.SearchAgentsRequest, $root.google.cloud.dialogflow.v2.SearchAgentsResponse, request, callback); + }, "name", { value: "SearchAgents" }); + + /** + * Calls SearchAgents. + * @function searchAgents + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.ISearchAgentsRequest} request SearchAgentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|trainAgent}. + * @memberof google.cloud.dialogflow.v2.Agents + * @typedef TrainAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls TrainAgent. + * @function trainAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.ITrainAgentRequest} request TrainAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Agents.TrainAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.trainAgent = function trainAgent(request, callback) { + return this.rpcCall(trainAgent, $root.google.cloud.dialogflow.v2.TrainAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "TrainAgent" }); + + /** + * Calls TrainAgent. + * @function trainAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.ITrainAgentRequest} request TrainAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|exportAgent}. + * @memberof google.cloud.dialogflow.v2.Agents + * @typedef ExportAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ExportAgent. + * @function exportAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IExportAgentRequest} request ExportAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Agents.ExportAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.exportAgent = function exportAgent(request, callback) { + return this.rpcCall(exportAgent, $root.google.cloud.dialogflow.v2.ExportAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ExportAgent" }); + + /** + * Calls ExportAgent. + * @function exportAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IExportAgentRequest} request ExportAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|importAgent}. + * @memberof google.cloud.dialogflow.v2.Agents + * @typedef ImportAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportAgent. + * @function importAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IImportAgentRequest} request ImportAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Agents.ImportAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.importAgent = function importAgent(request, callback) { + return this.rpcCall(importAgent, $root.google.cloud.dialogflow.v2.ImportAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportAgent" }); + + /** + * Calls ImportAgent. + * @function importAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IImportAgentRequest} request ImportAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|restoreAgent}. + * @memberof google.cloud.dialogflow.v2.Agents + * @typedef RestoreAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RestoreAgent. + * @function restoreAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IRestoreAgentRequest} request RestoreAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Agents.RestoreAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.restoreAgent = function restoreAgent(request, callback) { + return this.rpcCall(restoreAgent, $root.google.cloud.dialogflow.v2.RestoreAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RestoreAgent" }); + + /** + * Calls RestoreAgent. + * @function restoreAgent + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IRestoreAgentRequest} request RestoreAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Agents|getValidationResult}. + * @memberof google.cloud.dialogflow.v2.Agents + * @typedef GetValidationResultCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ValidationResult} [response] ValidationResult + */ + + /** + * Calls GetValidationResult. + * @function getValidationResult + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IGetValidationResultRequest} request GetValidationResultRequest message or plain object + * @param {google.cloud.dialogflow.v2.Agents.GetValidationResultCallback} callback Node-style callback called with the error, if any, and ValidationResult + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.getValidationResult = function getValidationResult(request, callback) { + return this.rpcCall(getValidationResult, $root.google.cloud.dialogflow.v2.GetValidationResultRequest, $root.google.cloud.dialogflow.v2.ValidationResult, request, callback); + }, "name", { value: "GetValidationResult" }); + + /** + * Calls GetValidationResult. + * @function getValidationResult + * @memberof google.cloud.dialogflow.v2.Agents + * @instance + * @param {google.cloud.dialogflow.v2.IGetValidationResultRequest} request GetValidationResultRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Agents; + })(); + + v2.Agent = (function() { + + /** + * Properties of an Agent. + * @memberof google.cloud.dialogflow.v2 + * @interface IAgent + * @property {string|null} [parent] Agent parent + * @property {string|null} [displayName] Agent displayName + * @property {string|null} [defaultLanguageCode] Agent defaultLanguageCode + * @property {Array.|null} [supportedLanguageCodes] Agent supportedLanguageCodes + * @property {string|null} [timeZone] Agent timeZone + * @property {string|null} [description] Agent description + * @property {string|null} [avatarUri] Agent avatarUri + * @property {boolean|null} [enableLogging] Agent enableLogging + * @property {google.cloud.dialogflow.v2.Agent.MatchMode|null} [matchMode] Agent matchMode + * @property {number|null} [classificationThreshold] Agent classificationThreshold + * @property {google.cloud.dialogflow.v2.Agent.ApiVersion|null} [apiVersion] Agent apiVersion + * @property {google.cloud.dialogflow.v2.Agent.Tier|null} [tier] Agent tier + */ + + /** + * Constructs a new Agent. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an Agent. + * @implements IAgent + * @constructor + * @param {google.cloud.dialogflow.v2.IAgent=} [properties] Properties to set + */ + function Agent(properties) { + this.supportedLanguageCodes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Agent parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.parent = ""; + + /** + * Agent displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.displayName = ""; + + /** + * Agent defaultLanguageCode. + * @member {string} defaultLanguageCode + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.defaultLanguageCode = ""; + + /** + * Agent supportedLanguageCodes. + * @member {Array.} supportedLanguageCodes + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.supportedLanguageCodes = $util.emptyArray; + + /** + * Agent timeZone. + * @member {string} timeZone + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.timeZone = ""; + + /** + * Agent description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.description = ""; + + /** + * Agent avatarUri. + * @member {string} avatarUri + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.avatarUri = ""; + + /** + * Agent enableLogging. + * @member {boolean} enableLogging + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.enableLogging = false; + + /** + * Agent matchMode. + * @member {google.cloud.dialogflow.v2.Agent.MatchMode} matchMode + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.matchMode = 0; + + /** + * Agent classificationThreshold. + * @member {number} classificationThreshold + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.classificationThreshold = 0; + + /** + * Agent apiVersion. + * @member {google.cloud.dialogflow.v2.Agent.ApiVersion} apiVersion + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.apiVersion = 0; + + /** + * Agent tier. + * @member {google.cloud.dialogflow.v2.Agent.Tier} tier + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + */ + Agent.prototype.tier = 0; + + /** + * Creates a new Agent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Agent + * @static + * @param {google.cloud.dialogflow.v2.IAgent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Agent} Agent instance + */ + Agent.create = function create(properties) { + return new Agent(properties); + }; + + /** + * Encodes the specified Agent message. Does not implicitly {@link google.cloud.dialogflow.v2.Agent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Agent + * @static + * @param {google.cloud.dialogflow.v2.IAgent} message Agent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Agent.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.defaultLanguageCode != null && Object.hasOwnProperty.call(message, "defaultLanguageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.defaultLanguageCode); + if (message.supportedLanguageCodes != null && message.supportedLanguageCodes.length) + for (var i = 0; i < message.supportedLanguageCodes.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.supportedLanguageCodes[i]); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.timeZone); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.description); + if (message.avatarUri != null && Object.hasOwnProperty.call(message, "avatarUri")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.avatarUri); + if (message.enableLogging != null && Object.hasOwnProperty.call(message, "enableLogging")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.enableLogging); + if (message.matchMode != null && Object.hasOwnProperty.call(message, "matchMode")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.matchMode); + if (message.classificationThreshold != null && Object.hasOwnProperty.call(message, "classificationThreshold")) + writer.uint32(/* id 10, wireType 5 =*/85).float(message.classificationThreshold); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.apiVersion); + if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.tier); + return writer; + }; + + /** + * Encodes the specified Agent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Agent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Agent + * @static + * @param {google.cloud.dialogflow.v2.IAgent} message Agent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Agent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Agent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Agent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Agent} Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Agent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Agent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.defaultLanguageCode = reader.string(); + break; + } + case 4: { + if (!(message.supportedLanguageCodes && message.supportedLanguageCodes.length)) + message.supportedLanguageCodes = []; + message.supportedLanguageCodes.push(reader.string()); + break; + } + case 5: { + message.timeZone = reader.string(); + break; + } + case 6: { + message.description = reader.string(); + break; + } + case 7: { + message.avatarUri = reader.string(); + break; + } + case 8: { + message.enableLogging = reader.bool(); + break; + } + case 9: { + message.matchMode = reader.int32(); + break; + } + case 10: { + message.classificationThreshold = reader.float(); + break; + } + case 14: { + message.apiVersion = reader.int32(); + break; + } + case 15: { + message.tier = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Agent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Agent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Agent} Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Agent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Agent message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Agent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Agent.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.defaultLanguageCode != null && message.hasOwnProperty("defaultLanguageCode")) + if (!$util.isString(message.defaultLanguageCode)) + return "defaultLanguageCode: string expected"; + if (message.supportedLanguageCodes != null && message.hasOwnProperty("supportedLanguageCodes")) { + if (!Array.isArray(message.supportedLanguageCodes)) + return "supportedLanguageCodes: array expected"; + for (var i = 0; i < message.supportedLanguageCodes.length; ++i) + if (!$util.isString(message.supportedLanguageCodes[i])) + return "supportedLanguageCodes: string[] expected"; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.avatarUri != null && message.hasOwnProperty("avatarUri")) + if (!$util.isString(message.avatarUri)) + return "avatarUri: string expected"; + if (message.enableLogging != null && message.hasOwnProperty("enableLogging")) + if (typeof message.enableLogging !== "boolean") + return "enableLogging: boolean expected"; + if (message.matchMode != null && message.hasOwnProperty("matchMode")) + switch (message.matchMode) { + default: + return "matchMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.classificationThreshold != null && message.hasOwnProperty("classificationThreshold")) + if (typeof message.classificationThreshold !== "number") + return "classificationThreshold: number expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + switch (message.apiVersion) { + default: + return "apiVersion: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.tier != null && message.hasOwnProperty("tier")) + switch (message.tier) { + default: + return "tier: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates an Agent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Agent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Agent} Agent + */ + Agent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Agent) + return object; + var message = new $root.google.cloud.dialogflow.v2.Agent(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.defaultLanguageCode != null) + message.defaultLanguageCode = String(object.defaultLanguageCode); + if (object.supportedLanguageCodes) { + if (!Array.isArray(object.supportedLanguageCodes)) + throw TypeError(".google.cloud.dialogflow.v2.Agent.supportedLanguageCodes: array expected"); + message.supportedLanguageCodes = []; + for (var i = 0; i < object.supportedLanguageCodes.length; ++i) + message.supportedLanguageCodes[i] = String(object.supportedLanguageCodes[i]); + } + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.description != null) + message.description = String(object.description); + if (object.avatarUri != null) + message.avatarUri = String(object.avatarUri); + if (object.enableLogging != null) + message.enableLogging = Boolean(object.enableLogging); + switch (object.matchMode) { + default: + if (typeof object.matchMode === "number") { + message.matchMode = object.matchMode; + break; + } + break; + case "MATCH_MODE_UNSPECIFIED": + case 0: + message.matchMode = 0; + break; + case "MATCH_MODE_HYBRID": + case 1: + message.matchMode = 1; + break; + case "MATCH_MODE_ML_ONLY": + case 2: + message.matchMode = 2; + break; + } + if (object.classificationThreshold != null) + message.classificationThreshold = Number(object.classificationThreshold); + switch (object.apiVersion) { + default: + if (typeof object.apiVersion === "number") { + message.apiVersion = object.apiVersion; + break; + } + break; + case "API_VERSION_UNSPECIFIED": + case 0: + message.apiVersion = 0; + break; + case "API_VERSION_V1": + case 1: + message.apiVersion = 1; + break; + case "API_VERSION_V2": + case 2: + message.apiVersion = 2; + break; + case "API_VERSION_V2_BETA_1": + case 3: + message.apiVersion = 3; + break; + } + switch (object.tier) { + default: + if (typeof object.tier === "number") { + message.tier = object.tier; + break; + } + break; + case "TIER_UNSPECIFIED": + case 0: + message.tier = 0; + break; + case "TIER_STANDARD": + case 1: + message.tier = 1; + break; + case "TIER_ENTERPRISE": + case 2: + message.tier = 2; + break; + case "TIER_ENTERPRISE_PLUS": + case 3: + message.tier = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from an Agent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Agent + * @static + * @param {google.cloud.dialogflow.v2.Agent} message Agent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Agent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.supportedLanguageCodes = []; + if (options.defaults) { + object.parent = ""; + object.displayName = ""; + object.defaultLanguageCode = ""; + object.timeZone = ""; + object.description = ""; + object.avatarUri = ""; + object.enableLogging = false; + object.matchMode = options.enums === String ? "MATCH_MODE_UNSPECIFIED" : 0; + object.classificationThreshold = 0; + object.apiVersion = options.enums === String ? "API_VERSION_UNSPECIFIED" : 0; + object.tier = options.enums === String ? "TIER_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.defaultLanguageCode != null && message.hasOwnProperty("defaultLanguageCode")) + object.defaultLanguageCode = message.defaultLanguageCode; + if (message.supportedLanguageCodes && message.supportedLanguageCodes.length) { + object.supportedLanguageCodes = []; + for (var j = 0; j < message.supportedLanguageCodes.length; ++j) + object.supportedLanguageCodes[j] = message.supportedLanguageCodes[j]; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.avatarUri != null && message.hasOwnProperty("avatarUri")) + object.avatarUri = message.avatarUri; + if (message.enableLogging != null && message.hasOwnProperty("enableLogging")) + object.enableLogging = message.enableLogging; + if (message.matchMode != null && message.hasOwnProperty("matchMode")) + object.matchMode = options.enums === String ? $root.google.cloud.dialogflow.v2.Agent.MatchMode[message.matchMode] === undefined ? message.matchMode : $root.google.cloud.dialogflow.v2.Agent.MatchMode[message.matchMode] : message.matchMode; + if (message.classificationThreshold != null && message.hasOwnProperty("classificationThreshold")) + object.classificationThreshold = options.json && !isFinite(message.classificationThreshold) ? String(message.classificationThreshold) : message.classificationThreshold; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = options.enums === String ? $root.google.cloud.dialogflow.v2.Agent.ApiVersion[message.apiVersion] === undefined ? message.apiVersion : $root.google.cloud.dialogflow.v2.Agent.ApiVersion[message.apiVersion] : message.apiVersion; + if (message.tier != null && message.hasOwnProperty("tier")) + object.tier = options.enums === String ? $root.google.cloud.dialogflow.v2.Agent.Tier[message.tier] === undefined ? message.tier : $root.google.cloud.dialogflow.v2.Agent.Tier[message.tier] : message.tier; + return object; + }; + + /** + * Converts this Agent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Agent + * @instance + * @returns {Object.} JSON object + */ + Agent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Agent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Agent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Agent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Agent"; + }; + + /** + * MatchMode enum. + * @name google.cloud.dialogflow.v2.Agent.MatchMode + * @enum {number} + * @property {number} MATCH_MODE_UNSPECIFIED=0 MATCH_MODE_UNSPECIFIED value + * @property {number} MATCH_MODE_HYBRID=1 MATCH_MODE_HYBRID value + * @property {number} MATCH_MODE_ML_ONLY=2 MATCH_MODE_ML_ONLY value + */ + Agent.MatchMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MATCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "MATCH_MODE_HYBRID"] = 1; + values[valuesById[2] = "MATCH_MODE_ML_ONLY"] = 2; + return values; + })(); + + /** + * ApiVersion enum. + * @name google.cloud.dialogflow.v2.Agent.ApiVersion + * @enum {number} + * @property {number} API_VERSION_UNSPECIFIED=0 API_VERSION_UNSPECIFIED value + * @property {number} API_VERSION_V1=1 API_VERSION_V1 value + * @property {number} API_VERSION_V2=2 API_VERSION_V2 value + * @property {number} API_VERSION_V2_BETA_1=3 API_VERSION_V2_BETA_1 value + */ + Agent.ApiVersion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "API_VERSION_UNSPECIFIED"] = 0; + values[valuesById[1] = "API_VERSION_V1"] = 1; + values[valuesById[2] = "API_VERSION_V2"] = 2; + values[valuesById[3] = "API_VERSION_V2_BETA_1"] = 3; + return values; + })(); + + /** + * Tier enum. + * @name google.cloud.dialogflow.v2.Agent.Tier + * @enum {number} + * @property {number} TIER_UNSPECIFIED=0 TIER_UNSPECIFIED value + * @property {number} TIER_STANDARD=1 TIER_STANDARD value + * @property {number} TIER_ENTERPRISE=2 TIER_ENTERPRISE value + * @property {number} TIER_ENTERPRISE_PLUS=3 TIER_ENTERPRISE_PLUS value + */ + Agent.Tier = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TIER_UNSPECIFIED"] = 0; + values[valuesById[1] = "TIER_STANDARD"] = 1; + values[valuesById[2] = "TIER_ENTERPRISE"] = 2; + values[valuesById[3] = "TIER_ENTERPRISE_PLUS"] = 3; + return values; + })(); + + return Agent; + })(); + + v2.GetAgentRequest = (function() { + + /** + * Properties of a GetAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetAgentRequest + * @property {string|null} [parent] GetAgentRequest parent + */ + + /** + * Constructs a new GetAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetAgentRequest. + * @implements IGetAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetAgentRequest=} [properties] Properties to set + */ + function GetAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @instance + */ + GetAgentRequest.prototype.parent = ""; + + /** + * Creates a new GetAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetAgentRequest} GetAgentRequest instance + */ + GetAgentRequest.create = function create(properties) { + return new GetAgentRequest(properties); + }; + + /** + * Encodes the specified GetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetAgentRequest} message GetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAgentRequest.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); + return writer; + }; + + /** + * Encodes the specified GetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetAgentRequest} message GetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetAgentRequest} GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetAgentRequest} GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetAgentRequest.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"; + return null; + }; + + /** + * Creates a GetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetAgentRequest} GetAgentRequest + */ + GetAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a GetAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.GetAgentRequest} message GetAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GetAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @instance + * @returns {Object.} JSON object + */ + GetAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetAgentRequest"; + }; + + return GetAgentRequest; + })(); + + v2.SetAgentRequest = (function() { + + /** + * Properties of a SetAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ISetAgentRequest + * @property {google.cloud.dialogflow.v2.IAgent|null} [agent] SetAgentRequest agent + * @property {google.protobuf.IFieldMask|null} [updateMask] SetAgentRequest updateMask + */ + + /** + * Constructs a new SetAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SetAgentRequest. + * @implements ISetAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ISetAgentRequest=} [properties] Properties to set + */ + function SetAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetAgentRequest agent. + * @member {google.cloud.dialogflow.v2.IAgent|null|undefined} agent + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @instance + */ + SetAgentRequest.prototype.agent = null; + + /** + * SetAgentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @instance + */ + SetAgentRequest.prototype.updateMask = null; + + /** + * Creates a new SetAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.ISetAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SetAgentRequest} SetAgentRequest instance + */ + SetAgentRequest.create = function create(properties) { + return new SetAgentRequest(properties); + }; + + /** + * Encodes the specified SetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SetAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.ISetAgentRequest} message SetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetAgentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agent != null && Object.hasOwnProperty.call(message, "agent")) + $root.google.cloud.dialogflow.v2.Agent.encode(message.agent, 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 SetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SetAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.ISetAgentRequest} message SetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SetAgentRequest} SetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SetAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agent = $root.google.cloud.dialogflow.v2.Agent.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 a SetAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SetAgentRequest} SetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetAgentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agent != null && message.hasOwnProperty("agent")) { + var error = $root.google.cloud.dialogflow.v2.Agent.verify(message.agent); + if (error) + return "agent." + 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 a SetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SetAgentRequest} SetAgentRequest + */ + SetAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SetAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.SetAgentRequest(); + if (object.agent != null) { + if (typeof object.agent !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SetAgentRequest.agent: object expected"); + message.agent = $root.google.cloud.dialogflow.v2.Agent.fromObject(object.agent); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SetAgentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from a SetAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.SetAgentRequest} message SetAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.agent = null; + object.updateMask = null; + } + if (message.agent != null && message.hasOwnProperty("agent")) + object.agent = $root.google.cloud.dialogflow.v2.Agent.toObject(message.agent, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this SetAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @instance + * @returns {Object.} JSON object + */ + SetAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SetAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SetAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SetAgentRequest"; + }; + + return SetAgentRequest; + })(); + + v2.DeleteAgentRequest = (function() { + + /** + * Properties of a DeleteAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteAgentRequest + * @property {string|null} [parent] DeleteAgentRequest parent + */ + + /** + * Constructs a new DeleteAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteAgentRequest. + * @implements IDeleteAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteAgentRequest=} [properties] Properties to set + */ + function DeleteAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @instance + */ + DeleteAgentRequest.prototype.parent = ""; + + /** + * Creates a new DeleteAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteAgentRequest} DeleteAgentRequest instance + */ + DeleteAgentRequest.create = function create(properties) { + return new DeleteAgentRequest(properties); + }; + + /** + * Encodes the specified DeleteAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteAgentRequest} message DeleteAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAgentRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteAgentRequest} message DeleteAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteAgentRequest} DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteAgentRequest} DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteAgentRequest.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"; + return null; + }; + + /** + * Creates a DeleteAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteAgentRequest} DeleteAgentRequest + */ + DeleteAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a DeleteAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteAgentRequest} message DeleteAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this DeleteAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteAgentRequest"; + }; + + return DeleteAgentRequest; + })(); + + v2.SearchAgentsRequest = (function() { + + /** + * Properties of a SearchAgentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ISearchAgentsRequest + * @property {string|null} [parent] SearchAgentsRequest parent + * @property {number|null} [pageSize] SearchAgentsRequest pageSize + * @property {string|null} [pageToken] SearchAgentsRequest pageToken + */ + + /** + * Constructs a new SearchAgentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SearchAgentsRequest. + * @implements ISearchAgentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ISearchAgentsRequest=} [properties] Properties to set + */ + function SearchAgentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchAgentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @instance + */ + SearchAgentsRequest.prototype.parent = ""; + + /** + * SearchAgentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @instance + */ + SearchAgentsRequest.prototype.pageSize = 0; + + /** + * SearchAgentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @instance + */ + SearchAgentsRequest.prototype.pageToken = ""; + + /** + * Creates a new SearchAgentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @static + * @param {google.cloud.dialogflow.v2.ISearchAgentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SearchAgentsRequest} SearchAgentsRequest instance + */ + SearchAgentsRequest.create = function create(properties) { + return new SearchAgentsRequest(properties); + }; + + /** + * Encodes the specified SearchAgentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SearchAgentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @static + * @param {google.cloud.dialogflow.v2.ISearchAgentsRequest} message SearchAgentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchAgentsRequest.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 SearchAgentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SearchAgentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @static + * @param {google.cloud.dialogflow.v2.ISearchAgentsRequest} message SearchAgentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchAgentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchAgentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SearchAgentsRequest} SearchAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchAgentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SearchAgentsRequest(); + 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 SearchAgentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SearchAgentsRequest} SearchAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchAgentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchAgentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchAgentsRequest.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 SearchAgentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SearchAgentsRequest} SearchAgentsRequest + */ + SearchAgentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SearchAgentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.SearchAgentsRequest(); + 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 SearchAgentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @static + * @param {google.cloud.dialogflow.v2.SearchAgentsRequest} message SearchAgentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchAgentsRequest.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 SearchAgentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @instance + * @returns {Object.} JSON object + */ + SearchAgentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchAgentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SearchAgentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchAgentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SearchAgentsRequest"; + }; + + return SearchAgentsRequest; + })(); + + v2.SearchAgentsResponse = (function() { + + /** + * Properties of a SearchAgentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface ISearchAgentsResponse + * @property {Array.|null} [agents] SearchAgentsResponse agents + * @property {string|null} [nextPageToken] SearchAgentsResponse nextPageToken + */ + + /** + * Constructs a new SearchAgentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SearchAgentsResponse. + * @implements ISearchAgentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.ISearchAgentsResponse=} [properties] Properties to set + */ + function SearchAgentsResponse(properties) { + this.agents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchAgentsResponse agents. + * @member {Array.} agents + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @instance + */ + SearchAgentsResponse.prototype.agents = $util.emptyArray; + + /** + * SearchAgentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @instance + */ + SearchAgentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new SearchAgentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @static + * @param {google.cloud.dialogflow.v2.ISearchAgentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SearchAgentsResponse} SearchAgentsResponse instance + */ + SearchAgentsResponse.create = function create(properties) { + return new SearchAgentsResponse(properties); + }; + + /** + * Encodes the specified SearchAgentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.SearchAgentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @static + * @param {google.cloud.dialogflow.v2.ISearchAgentsResponse} message SearchAgentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchAgentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agents != null && message.agents.length) + for (var i = 0; i < message.agents.length; ++i) + $root.google.cloud.dialogflow.v2.Agent.encode(message.agents[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 SearchAgentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SearchAgentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @static + * @param {google.cloud.dialogflow.v2.ISearchAgentsResponse} message SearchAgentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchAgentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchAgentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SearchAgentsResponse} SearchAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchAgentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SearchAgentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.agents && message.agents.length)) + message.agents = []; + message.agents.push($root.google.cloud.dialogflow.v2.Agent.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchAgentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SearchAgentsResponse} SearchAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchAgentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchAgentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchAgentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agents != null && message.hasOwnProperty("agents")) { + if (!Array.isArray(message.agents)) + return "agents: array expected"; + for (var i = 0; i < message.agents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Agent.verify(message.agents[i]); + if (error) + return "agents." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a SearchAgentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SearchAgentsResponse} SearchAgentsResponse + */ + SearchAgentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SearchAgentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.SearchAgentsResponse(); + if (object.agents) { + if (!Array.isArray(object.agents)) + throw TypeError(".google.cloud.dialogflow.v2.SearchAgentsResponse.agents: array expected"); + message.agents = []; + for (var i = 0; i < object.agents.length; ++i) { + if (typeof object.agents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SearchAgentsResponse.agents: object expected"); + message.agents[i] = $root.google.cloud.dialogflow.v2.Agent.fromObject(object.agents[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a SearchAgentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @static + * @param {google.cloud.dialogflow.v2.SearchAgentsResponse} message SearchAgentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchAgentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.agents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.agents && message.agents.length) { + object.agents = []; + for (var j = 0; j < message.agents.length; ++j) + object.agents[j] = $root.google.cloud.dialogflow.v2.Agent.toObject(message.agents[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this SearchAgentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @instance + * @returns {Object.} JSON object + */ + SearchAgentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchAgentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SearchAgentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchAgentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SearchAgentsResponse"; + }; + + return SearchAgentsResponse; + })(); + + v2.TrainAgentRequest = (function() { + + /** + * Properties of a TrainAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ITrainAgentRequest + * @property {string|null} [parent] TrainAgentRequest parent + */ + + /** + * Constructs a new TrainAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a TrainAgentRequest. + * @implements ITrainAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ITrainAgentRequest=} [properties] Properties to set + */ + function TrainAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TrainAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @instance + */ + TrainAgentRequest.prototype.parent = ""; + + /** + * Creates a new TrainAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.ITrainAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.TrainAgentRequest} TrainAgentRequest instance + */ + TrainAgentRequest.create = function create(properties) { + return new TrainAgentRequest(properties); + }; + + /** + * Encodes the specified TrainAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.TrainAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.ITrainAgentRequest} message TrainAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainAgentRequest.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); + return writer; + }; + + /** + * Encodes the specified TrainAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.TrainAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.ITrainAgentRequest} message TrainAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TrainAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.TrainAgentRequest} TrainAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.TrainAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TrainAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.TrainAgentRequest} TrainAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TrainAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TrainAgentRequest.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"; + return null; + }; + + /** + * Creates a TrainAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.TrainAgentRequest} TrainAgentRequest + */ + TrainAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.TrainAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.TrainAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a TrainAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.TrainAgentRequest} message TrainAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TrainAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this TrainAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @instance + * @returns {Object.} JSON object + */ + TrainAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TrainAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.TrainAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TrainAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.TrainAgentRequest"; + }; + + return TrainAgentRequest; + })(); + + v2.ExportAgentRequest = (function() { + + /** + * Properties of an ExportAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IExportAgentRequest + * @property {string|null} [parent] ExportAgentRequest parent + * @property {string|null} [agentUri] ExportAgentRequest agentUri + */ + + /** + * Constructs a new ExportAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ExportAgentRequest. + * @implements IExportAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IExportAgentRequest=} [properties] Properties to set + */ + function ExportAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @instance + */ + ExportAgentRequest.prototype.parent = ""; + + /** + * ExportAgentRequest agentUri. + * @member {string} agentUri + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @instance + */ + ExportAgentRequest.prototype.agentUri = ""; + + /** + * Creates a new ExportAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IExportAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ExportAgentRequest} ExportAgentRequest instance + */ + ExportAgentRequest.create = function create(properties) { + return new ExportAgentRequest(properties); + }; + + /** + * Encodes the specified ExportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IExportAgentRequest} message ExportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentRequest.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.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.agentUri); + return writer; + }; + + /** + * Encodes the specified ExportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IExportAgentRequest} message ExportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ExportAgentRequest} ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ExportAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.agentUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ExportAgentRequest} ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportAgentRequest.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.agentUri != null && message.hasOwnProperty("agentUri")) + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + return null; + }; + + /** + * Creates an ExportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ExportAgentRequest} ExportAgentRequest + */ + ExportAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ExportAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ExportAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + return message; + }; + + /** + * Creates a plain object from an ExportAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.ExportAgentRequest} message ExportAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.agentUri = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) + object.agentUri = message.agentUri; + return object; + }; + + /** + * Converts this ExportAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @instance + * @returns {Object.} JSON object + */ + ExportAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ExportAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ExportAgentRequest"; + }; + + return ExportAgentRequest; + })(); + + v2.ExportAgentResponse = (function() { + + /** + * Properties of an ExportAgentResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IExportAgentResponse + * @property {string|null} [agentUri] ExportAgentResponse agentUri + * @property {Uint8Array|null} [agentContent] ExportAgentResponse agentContent + */ + + /** + * Constructs a new ExportAgentResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ExportAgentResponse. + * @implements IExportAgentResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IExportAgentResponse=} [properties] Properties to set + */ + function ExportAgentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportAgentResponse agentUri. + * @member {string|null|undefined} agentUri + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @instance + */ + ExportAgentResponse.prototype.agentUri = null; + + /** + * ExportAgentResponse agentContent. + * @member {Uint8Array|null|undefined} agentContent + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @instance + */ + ExportAgentResponse.prototype.agentContent = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportAgentResponse agent. + * @member {"agentUri"|"agentContent"|undefined} agent + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @instance + */ + Object.defineProperty(ExportAgentResponse.prototype, "agent", { + get: $util.oneOfGetter($oneOfFields = ["agentUri", "agentContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportAgentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.v2.IExportAgentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ExportAgentResponse} ExportAgentResponse instance + */ + ExportAgentResponse.create = function create(properties) { + return new ExportAgentResponse(properties); + }; + + /** + * Encodes the specified ExportAgentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportAgentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.v2.IExportAgentResponse} message ExportAgentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.agentUri); + if (message.agentContent != null && Object.hasOwnProperty.call(message, "agentContent")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.agentContent); + return writer; + }; + + /** + * Encodes the specified ExportAgentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportAgentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.v2.IExportAgentResponse} message ExportAgentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ExportAgentResponse} ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ExportAgentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agentUri = reader.string(); + break; + } + case 2: { + message.agentContent = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ExportAgentResponse} ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportAgentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportAgentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + properties.agent = 1; + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + if (properties.agent === 1) + return "agent: multiple values"; + properties.agent = 1; + if (!(message.agentContent && typeof message.agentContent.length === "number" || $util.isString(message.agentContent))) + return "agentContent: buffer expected"; + } + return null; + }; + + /** + * Creates an ExportAgentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ExportAgentResponse} ExportAgentResponse + */ + ExportAgentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ExportAgentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ExportAgentResponse(); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + if (object.agentContent != null) + if (typeof object.agentContent === "string") + $util.base64.decode(object.agentContent, message.agentContent = $util.newBuffer($util.base64.length(object.agentContent)), 0); + else if (object.agentContent.length >= 0) + message.agentContent = object.agentContent; + return message; + }; + + /** + * Creates a plain object from an ExportAgentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.v2.ExportAgentResponse} message ExportAgentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportAgentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + object.agentUri = message.agentUri; + if (options.oneofs) + object.agent = "agentUri"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + object.agentContent = options.bytes === String ? $util.base64.encode(message.agentContent, 0, message.agentContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.agentContent) : message.agentContent; + if (options.oneofs) + object.agent = "agentContent"; + } + return object; + }; + + /** + * Converts this ExportAgentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @instance + * @returns {Object.} JSON object + */ + ExportAgentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportAgentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ExportAgentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportAgentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ExportAgentResponse"; + }; + + return ExportAgentResponse; + })(); + + v2.ImportAgentRequest = (function() { + + /** + * Properties of an ImportAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IImportAgentRequest + * @property {string|null} [parent] ImportAgentRequest parent + * @property {string|null} [agentUri] ImportAgentRequest agentUri + * @property {Uint8Array|null} [agentContent] ImportAgentRequest agentContent + */ + + /** + * Constructs a new ImportAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ImportAgentRequest. + * @implements IImportAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IImportAgentRequest=} [properties] Properties to set + */ + function ImportAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @instance + */ + ImportAgentRequest.prototype.parent = ""; + + /** + * ImportAgentRequest agentUri. + * @member {string|null|undefined} agentUri + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @instance + */ + ImportAgentRequest.prototype.agentUri = null; + + /** + * ImportAgentRequest agentContent. + * @member {Uint8Array|null|undefined} agentContent + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @instance + */ + ImportAgentRequest.prototype.agentContent = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportAgentRequest agent. + * @member {"agentUri"|"agentContent"|undefined} agent + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @instance + */ + Object.defineProperty(ImportAgentRequest.prototype, "agent", { + get: $util.oneOfGetter($oneOfFields = ["agentUri", "agentContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IImportAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ImportAgentRequest} ImportAgentRequest instance + */ + ImportAgentRequest.create = function create(properties) { + return new ImportAgentRequest(properties); + }; + + /** + * Encodes the specified ImportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IImportAgentRequest} message ImportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportAgentRequest.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.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.agentUri); + if (message.agentContent != null && Object.hasOwnProperty.call(message, "agentContent")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.agentContent); + return writer; + }; + + /** + * Encodes the specified ImportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IImportAgentRequest} message ImportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ImportAgentRequest} ImportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ImportAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.agentUri = reader.string(); + break; + } + case 3: { + message.agentContent = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ImportAgentRequest} ImportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportAgentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + properties.agent = 1; + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + if (properties.agent === 1) + return "agent: multiple values"; + properties.agent = 1; + if (!(message.agentContent && typeof message.agentContent.length === "number" || $util.isString(message.agentContent))) + return "agentContent: buffer expected"; + } + return null; + }; + + /** + * Creates an ImportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ImportAgentRequest} ImportAgentRequest + */ + ImportAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ImportAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ImportAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + if (object.agentContent != null) + if (typeof object.agentContent === "string") + $util.base64.decode(object.agentContent, message.agentContent = $util.newBuffer($util.base64.length(object.agentContent)), 0); + else if (object.agentContent.length >= 0) + message.agentContent = object.agentContent; + return message; + }; + + /** + * Creates a plain object from an ImportAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.ImportAgentRequest} message ImportAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + object.agentUri = message.agentUri; + if (options.oneofs) + object.agent = "agentUri"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + object.agentContent = options.bytes === String ? $util.base64.encode(message.agentContent, 0, message.agentContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.agentContent) : message.agentContent; + if (options.oneofs) + object.agent = "agentContent"; + } + return object; + }; + + /** + * Converts this ImportAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @instance + * @returns {Object.} JSON object + */ + ImportAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ImportAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ImportAgentRequest"; + }; + + return ImportAgentRequest; + })(); + + v2.RestoreAgentRequest = (function() { + + /** + * Properties of a RestoreAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IRestoreAgentRequest + * @property {string|null} [parent] RestoreAgentRequest parent + * @property {string|null} [agentUri] RestoreAgentRequest agentUri + * @property {Uint8Array|null} [agentContent] RestoreAgentRequest agentContent + */ + + /** + * Constructs a new RestoreAgentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a RestoreAgentRequest. + * @implements IRestoreAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IRestoreAgentRequest=} [properties] Properties to set + */ + function RestoreAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RestoreAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @instance + */ + RestoreAgentRequest.prototype.parent = ""; + + /** + * RestoreAgentRequest agentUri. + * @member {string|null|undefined} agentUri + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @instance + */ + RestoreAgentRequest.prototype.agentUri = null; + + /** + * RestoreAgentRequest agentContent. + * @member {Uint8Array|null|undefined} agentContent + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @instance + */ + RestoreAgentRequest.prototype.agentContent = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RestoreAgentRequest agent. + * @member {"agentUri"|"agentContent"|undefined} agent + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @instance + */ + Object.defineProperty(RestoreAgentRequest.prototype, "agent", { + get: $util.oneOfGetter($oneOfFields = ["agentUri", "agentContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RestoreAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IRestoreAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.RestoreAgentRequest} RestoreAgentRequest instance + */ + RestoreAgentRequest.create = function create(properties) { + return new RestoreAgentRequest(properties); + }; + + /** + * Encodes the specified RestoreAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.RestoreAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IRestoreAgentRequest} message RestoreAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreAgentRequest.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.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.agentUri); + if (message.agentContent != null && Object.hasOwnProperty.call(message, "agentContent")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.agentContent); + return writer; + }; + + /** + * Encodes the specified RestoreAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.RestoreAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.IRestoreAgentRequest} message RestoreAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.RestoreAgentRequest} RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.RestoreAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.agentUri = reader.string(); + break; + } + case 3: { + message.agentContent = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.RestoreAgentRequest} RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RestoreAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RestoreAgentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + properties.agent = 1; + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + if (properties.agent === 1) + return "agent: multiple values"; + properties.agent = 1; + if (!(message.agentContent && typeof message.agentContent.length === "number" || $util.isString(message.agentContent))) + return "agentContent: buffer expected"; + } + return null; + }; + + /** + * Creates a RestoreAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.RestoreAgentRequest} RestoreAgentRequest + */ + RestoreAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.RestoreAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.RestoreAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + if (object.agentContent != null) + if (typeof object.agentContent === "string") + $util.base64.decode(object.agentContent, message.agentContent = $util.newBuffer($util.base64.length(object.agentContent)), 0); + else if (object.agentContent.length >= 0) + message.agentContent = object.agentContent; + return message; + }; + + /** + * Creates a plain object from a RestoreAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.v2.RestoreAgentRequest} message RestoreAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RestoreAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + object.agentUri = message.agentUri; + if (options.oneofs) + object.agent = "agentUri"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + object.agentContent = options.bytes === String ? $util.base64.encode(message.agentContent, 0, message.agentContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.agentContent) : message.agentContent; + if (options.oneofs) + object.agent = "agentContent"; + } + return object; + }; + + /** + * Converts this RestoreAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @instance + * @returns {Object.} JSON object + */ + RestoreAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RestoreAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.RestoreAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RestoreAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.RestoreAgentRequest"; + }; + + return RestoreAgentRequest; + })(); + + v2.GetValidationResultRequest = (function() { + + /** + * Properties of a GetValidationResultRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetValidationResultRequest + * @property {string|null} [parent] GetValidationResultRequest parent + * @property {string|null} [languageCode] GetValidationResultRequest languageCode + */ + + /** + * Constructs a new GetValidationResultRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetValidationResultRequest. + * @implements IGetValidationResultRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetValidationResultRequest=} [properties] Properties to set + */ + function GetValidationResultRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetValidationResultRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @instance + */ + GetValidationResultRequest.prototype.parent = ""; + + /** + * GetValidationResultRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @instance + */ + GetValidationResultRequest.prototype.languageCode = ""; + + /** + * Creates a new GetValidationResultRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetValidationResultRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetValidationResultRequest} GetValidationResultRequest instance + */ + GetValidationResultRequest.create = function create(properties) { + return new GetValidationResultRequest(properties); + }; + + /** + * Encodes the specified GetValidationResultRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetValidationResultRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetValidationResultRequest} message GetValidationResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetValidationResultRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified GetValidationResultRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetValidationResultRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetValidationResultRequest} message GetValidationResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetValidationResultRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetValidationResultRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetValidationResultRequest} GetValidationResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetValidationResultRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetValidationResultRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetValidationResultRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetValidationResultRequest} GetValidationResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetValidationResultRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetValidationResultRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetValidationResultRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a GetValidationResultRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetValidationResultRequest} GetValidationResultRequest + */ + GetValidationResultRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetValidationResultRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetValidationResultRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a GetValidationResultRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @static + * @param {google.cloud.dialogflow.v2.GetValidationResultRequest} message GetValidationResultRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetValidationResultRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this GetValidationResultRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @instance + * @returns {Object.} JSON object + */ + GetValidationResultRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetValidationResultRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetValidationResultRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetValidationResultRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetValidationResultRequest"; + }; + + return GetValidationResultRequest; + })(); + + v2.ValidationError = (function() { + + /** + * Properties of a ValidationError. + * @memberof google.cloud.dialogflow.v2 + * @interface IValidationError + * @property {google.cloud.dialogflow.v2.ValidationError.Severity|null} [severity] ValidationError severity + * @property {Array.|null} [entries] ValidationError entries + * @property {string|null} [errorMessage] ValidationError errorMessage + */ + + /** + * Constructs a new ValidationError. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ValidationError. + * @implements IValidationError + * @constructor + * @param {google.cloud.dialogflow.v2.IValidationError=} [properties] Properties to set + */ + function ValidationError(properties) { + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidationError severity. + * @member {google.cloud.dialogflow.v2.ValidationError.Severity} severity + * @memberof google.cloud.dialogflow.v2.ValidationError + * @instance + */ + ValidationError.prototype.severity = 0; + + /** + * ValidationError entries. + * @member {Array.} entries + * @memberof google.cloud.dialogflow.v2.ValidationError + * @instance + */ + ValidationError.prototype.entries = $util.emptyArray; + + /** + * ValidationError errorMessage. + * @member {string} errorMessage + * @memberof google.cloud.dialogflow.v2.ValidationError + * @instance + */ + ValidationError.prototype.errorMessage = ""; + + /** + * Creates a new ValidationError instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ValidationError + * @static + * @param {google.cloud.dialogflow.v2.IValidationError=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ValidationError} ValidationError instance + */ + ValidationError.create = function create(properties) { + return new ValidationError(properties); + }; + + /** + * Encodes the specified ValidationError message. Does not implicitly {@link google.cloud.dialogflow.v2.ValidationError.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ValidationError + * @static + * @param {google.cloud.dialogflow.v2.IValidationError} message ValidationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidationError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.severity); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.entries[i]); + if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.errorMessage); + return writer; + }; + + /** + * Encodes the specified ValidationError message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ValidationError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ValidationError + * @static + * @param {google.cloud.dialogflow.v2.IValidationError} message ValidationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidationError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidationError message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ValidationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ValidationError} ValidationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidationError.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ValidationError(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.severity = reader.int32(); + break; + } + case 3: { + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push(reader.string()); + break; + } + case 4: { + message.errorMessage = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidationError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ValidationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ValidationError} ValidationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidationError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidationError message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ValidationError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidationError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.severity != null && message.hasOwnProperty("severity")) + switch (message.severity) { + default: + return "severity: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) + if (!$util.isString(message.entries[i])) + return "entries: string[] expected"; + } + if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + if (!$util.isString(message.errorMessage)) + return "errorMessage: string expected"; + return null; + }; + + /** + * Creates a ValidationError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ValidationError + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ValidationError} ValidationError + */ + ValidationError.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ValidationError) + return object; + var message = new $root.google.cloud.dialogflow.v2.ValidationError(); + switch (object.severity) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; + case "SEVERITY_UNSPECIFIED": + case 0: + message.severity = 0; + break; + case "INFO": + case 1: + message.severity = 1; + break; + case "WARNING": + case 2: + message.severity = 2; + break; + case "ERROR": + case 3: + message.severity = 3; + break; + case "CRITICAL": + case 4: + message.severity = 4; + break; + } + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".google.cloud.dialogflow.v2.ValidationError.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) + message.entries[i] = String(object.entries[i]); + } + if (object.errorMessage != null) + message.errorMessage = String(object.errorMessage); + return message; + }; + + /** + * Creates a plain object from a ValidationError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ValidationError + * @static + * @param {google.cloud.dialogflow.v2.ValidationError} message ValidationError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidationError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (options.defaults) { + object.severity = options.enums === String ? "SEVERITY_UNSPECIFIED" : 0; + object.errorMessage = ""; + } + if (message.severity != null && message.hasOwnProperty("severity")) + object.severity = options.enums === String ? $root.google.cloud.dialogflow.v2.ValidationError.Severity[message.severity] === undefined ? message.severity : $root.google.cloud.dialogflow.v2.ValidationError.Severity[message.severity] : message.severity; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = message.entries[j]; + } + if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + object.errorMessage = message.errorMessage; + return object; + }; + + /** + * Converts this ValidationError to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ValidationError + * @instance + * @returns {Object.} JSON object + */ + ValidationError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ValidationError + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ValidationError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ValidationError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ValidationError"; + }; + + /** + * Severity enum. + * @name google.cloud.dialogflow.v2.ValidationError.Severity + * @enum {number} + * @property {number} SEVERITY_UNSPECIFIED=0 SEVERITY_UNSPECIFIED value + * @property {number} INFO=1 INFO value + * @property {number} WARNING=2 WARNING value + * @property {number} ERROR=3 ERROR value + * @property {number} CRITICAL=4 CRITICAL value + */ + ValidationError.Severity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEVERITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "INFO"] = 1; + values[valuesById[2] = "WARNING"] = 2; + values[valuesById[3] = "ERROR"] = 3; + values[valuesById[4] = "CRITICAL"] = 4; + return values; + })(); + + return ValidationError; + })(); + + v2.ValidationResult = (function() { + + /** + * Properties of a ValidationResult. + * @memberof google.cloud.dialogflow.v2 + * @interface IValidationResult + * @property {Array.|null} [validationErrors] ValidationResult validationErrors + */ + + /** + * Constructs a new ValidationResult. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ValidationResult. + * @implements IValidationResult + * @constructor + * @param {google.cloud.dialogflow.v2.IValidationResult=} [properties] Properties to set + */ + function ValidationResult(properties) { + this.validationErrors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidationResult validationErrors. + * @member {Array.} validationErrors + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @instance + */ + ValidationResult.prototype.validationErrors = $util.emptyArray; + + /** + * Creates a new ValidationResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @static + * @param {google.cloud.dialogflow.v2.IValidationResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ValidationResult} ValidationResult instance + */ + ValidationResult.create = function create(properties) { + return new ValidationResult(properties); + }; + + /** + * Encodes the specified ValidationResult message. Does not implicitly {@link google.cloud.dialogflow.v2.ValidationResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @static + * @param {google.cloud.dialogflow.v2.IValidationResult} message ValidationResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidationResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validationErrors != null && message.validationErrors.length) + for (var i = 0; i < message.validationErrors.length; ++i) + $root.google.cloud.dialogflow.v2.ValidationError.encode(message.validationErrors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidationResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ValidationResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @static + * @param {google.cloud.dialogflow.v2.IValidationResult} message ValidationResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidationResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidationResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ValidationResult} ValidationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidationResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ValidationResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.validationErrors && message.validationErrors.length)) + message.validationErrors = []; + message.validationErrors.push($root.google.cloud.dialogflow.v2.ValidationError.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidationResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ValidationResult} ValidationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidationResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidationResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidationResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validationErrors != null && message.hasOwnProperty("validationErrors")) { + if (!Array.isArray(message.validationErrors)) + return "validationErrors: array expected"; + for (var i = 0; i < message.validationErrors.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.ValidationError.verify(message.validationErrors[i]); + if (error) + return "validationErrors." + error; + } + } + return null; + }; + + /** + * Creates a ValidationResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ValidationResult} ValidationResult + */ + ValidationResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ValidationResult) + return object; + var message = new $root.google.cloud.dialogflow.v2.ValidationResult(); + if (object.validationErrors) { + if (!Array.isArray(object.validationErrors)) + throw TypeError(".google.cloud.dialogflow.v2.ValidationResult.validationErrors: array expected"); + message.validationErrors = []; + for (var i = 0; i < object.validationErrors.length; ++i) { + if (typeof object.validationErrors[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ValidationResult.validationErrors: object expected"); + message.validationErrors[i] = $root.google.cloud.dialogflow.v2.ValidationError.fromObject(object.validationErrors[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ValidationResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @static + * @param {google.cloud.dialogflow.v2.ValidationResult} message ValidationResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidationResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.validationErrors = []; + if (message.validationErrors && message.validationErrors.length) { + object.validationErrors = []; + for (var j = 0; j < message.validationErrors.length; ++j) + object.validationErrors[j] = $root.google.cloud.dialogflow.v2.ValidationError.toObject(message.validationErrors[j], options); + } + return object; + }; + + /** + * Converts this ValidationResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @instance + * @returns {Object.} JSON object + */ + ValidationResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ValidationResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ValidationResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ValidationResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ValidationResult"; + }; + + return ValidationResult; + })(); + + v2.AnswerRecords = (function() { + + /** + * Constructs a new AnswerRecords service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AnswerRecords + * @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 AnswerRecords(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (AnswerRecords.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = AnswerRecords; + + /** + * Creates new AnswerRecords service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.AnswerRecords + * @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 {AnswerRecords} RPC service. Useful where requests and/or responses are streamed. + */ + AnswerRecords.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.AnswerRecords|listAnswerRecords}. + * @memberof google.cloud.dialogflow.v2.AnswerRecords + * @typedef ListAnswerRecordsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListAnswerRecordsResponse} [response] ListAnswerRecordsResponse + */ + + /** + * Calls ListAnswerRecords. + * @function listAnswerRecords + * @memberof google.cloud.dialogflow.v2.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsRequest} request ListAnswerRecordsRequest message or plain object + * @param {google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecordsCallback} callback Node-style callback called with the error, if any, and ListAnswerRecordsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AnswerRecords.prototype.listAnswerRecords = function listAnswerRecords(request, callback) { + return this.rpcCall(listAnswerRecords, $root.google.cloud.dialogflow.v2.ListAnswerRecordsRequest, $root.google.cloud.dialogflow.v2.ListAnswerRecordsResponse, request, callback); + }, "name", { value: "ListAnswerRecords" }); + + /** + * Calls ListAnswerRecords. + * @function listAnswerRecords + * @memberof google.cloud.dialogflow.v2.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsRequest} request ListAnswerRecordsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.AnswerRecords|updateAnswerRecord}. + * @memberof google.cloud.dialogflow.v2.AnswerRecords + * @typedef UpdateAnswerRecordCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.AnswerRecord} [response] AnswerRecord + */ + + /** + * Calls UpdateAnswerRecord. + * @function updateAnswerRecord + * @memberof google.cloud.dialogflow.v2.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest} request UpdateAnswerRecordRequest message or plain object + * @param {google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecordCallback} callback Node-style callback called with the error, if any, and AnswerRecord + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AnswerRecords.prototype.updateAnswerRecord = function updateAnswerRecord(request, callback) { + return this.rpcCall(updateAnswerRecord, $root.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest, $root.google.cloud.dialogflow.v2.AnswerRecord, request, callback); + }, "name", { value: "UpdateAnswerRecord" }); + + /** + * Calls UpdateAnswerRecord. + * @function updateAnswerRecord + * @memberof google.cloud.dialogflow.v2.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest} request UpdateAnswerRecordRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return AnswerRecords; + })(); + + v2.AnswerRecord = (function() { + + /** + * Properties of an AnswerRecord. + * @memberof google.cloud.dialogflow.v2 + * @interface IAnswerRecord + * @property {string|null} [name] AnswerRecord name + * @property {google.cloud.dialogflow.v2.IAnswerFeedback|null} [answerFeedback] AnswerRecord answerFeedback + * @property {google.cloud.dialogflow.v2.IAgentAssistantRecord|null} [agentAssistantRecord] AnswerRecord agentAssistantRecord + */ + + /** + * Constructs a new AnswerRecord. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AnswerRecord. + * @implements IAnswerRecord + * @constructor + * @param {google.cloud.dialogflow.v2.IAnswerRecord=} [properties] Properties to set + */ + function AnswerRecord(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnswerRecord name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @instance + */ + AnswerRecord.prototype.name = ""; + + /** + * AnswerRecord answerFeedback. + * @member {google.cloud.dialogflow.v2.IAnswerFeedback|null|undefined} answerFeedback + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @instance + */ + AnswerRecord.prototype.answerFeedback = null; + + /** + * AnswerRecord agentAssistantRecord. + * @member {google.cloud.dialogflow.v2.IAgentAssistantRecord|null|undefined} agentAssistantRecord + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @instance + */ + AnswerRecord.prototype.agentAssistantRecord = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AnswerRecord record. + * @member {"agentAssistantRecord"|undefined} record + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @instance + */ + Object.defineProperty(AnswerRecord.prototype, "record", { + get: $util.oneOfGetter($oneOfFields = ["agentAssistantRecord"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AnswerRecord instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @static + * @param {google.cloud.dialogflow.v2.IAnswerRecord=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AnswerRecord} AnswerRecord instance + */ + AnswerRecord.create = function create(properties) { + return new AnswerRecord(properties); + }; + + /** + * Encodes the specified AnswerRecord message. Does not implicitly {@link google.cloud.dialogflow.v2.AnswerRecord.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @static + * @param {google.cloud.dialogflow.v2.IAnswerRecord} message AnswerRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnswerRecord.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.answerFeedback != null && Object.hasOwnProperty.call(message, "answerFeedback")) + $root.google.cloud.dialogflow.v2.AnswerFeedback.encode(message.answerFeedback, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.agentAssistantRecord != null && Object.hasOwnProperty.call(message, "agentAssistantRecord")) + $root.google.cloud.dialogflow.v2.AgentAssistantRecord.encode(message.agentAssistantRecord, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AnswerRecord message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnswerRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @static + * @param {google.cloud.dialogflow.v2.IAnswerRecord} message AnswerRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnswerRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnswerRecord message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AnswerRecord} AnswerRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnswerRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AnswerRecord(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.answerFeedback = $root.google.cloud.dialogflow.v2.AnswerFeedback.decode(reader, reader.uint32()); + break; + } + case 4: { + message.agentAssistantRecord = $root.google.cloud.dialogflow.v2.AgentAssistantRecord.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnswerRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AnswerRecord} AnswerRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnswerRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnswerRecord message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnswerRecord.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.answerFeedback != null && message.hasOwnProperty("answerFeedback")) { + var error = $root.google.cloud.dialogflow.v2.AnswerFeedback.verify(message.answerFeedback); + if (error) + return "answerFeedback." + error; + } + if (message.agentAssistantRecord != null && message.hasOwnProperty("agentAssistantRecord")) { + properties.record = 1; + { + var error = $root.google.cloud.dialogflow.v2.AgentAssistantRecord.verify(message.agentAssistantRecord); + if (error) + return "agentAssistantRecord." + error; + } + } + return null; + }; + + /** + * Creates an AnswerRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AnswerRecord} AnswerRecord + */ + AnswerRecord.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AnswerRecord) + return object; + var message = new $root.google.cloud.dialogflow.v2.AnswerRecord(); + if (object.name != null) + message.name = String(object.name); + if (object.answerFeedback != null) { + if (typeof object.answerFeedback !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnswerRecord.answerFeedback: object expected"); + message.answerFeedback = $root.google.cloud.dialogflow.v2.AnswerFeedback.fromObject(object.answerFeedback); + } + if (object.agentAssistantRecord != null) { + if (typeof object.agentAssistantRecord !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnswerRecord.agentAssistantRecord: object expected"); + message.agentAssistantRecord = $root.google.cloud.dialogflow.v2.AgentAssistantRecord.fromObject(object.agentAssistantRecord); + } + return message; + }; + + /** + * Creates a plain object from an AnswerRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @static + * @param {google.cloud.dialogflow.v2.AnswerRecord} message AnswerRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnswerRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.answerFeedback = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.answerFeedback != null && message.hasOwnProperty("answerFeedback")) + object.answerFeedback = $root.google.cloud.dialogflow.v2.AnswerFeedback.toObject(message.answerFeedback, options); + if (message.agentAssistantRecord != null && message.hasOwnProperty("agentAssistantRecord")) { + object.agentAssistantRecord = $root.google.cloud.dialogflow.v2.AgentAssistantRecord.toObject(message.agentAssistantRecord, options); + if (options.oneofs) + object.record = "agentAssistantRecord"; + } + return object; + }; + + /** + * Converts this AnswerRecord to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @instance + * @returns {Object.} JSON object + */ + AnswerRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnswerRecord + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AnswerRecord + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnswerRecord.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AnswerRecord"; + }; + + return AnswerRecord; + })(); + + v2.ListAnswerRecordsRequest = (function() { + + /** + * Properties of a ListAnswerRecordsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListAnswerRecordsRequest + * @property {string|null} [parent] ListAnswerRecordsRequest parent + * @property {string|null} [filter] ListAnswerRecordsRequest filter + * @property {number|null} [pageSize] ListAnswerRecordsRequest pageSize + * @property {string|null} [pageToken] ListAnswerRecordsRequest pageToken + */ + + /** + * Constructs a new ListAnswerRecordsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListAnswerRecordsRequest. + * @implements IListAnswerRecordsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsRequest=} [properties] Properties to set + */ + function ListAnswerRecordsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListAnswerRecordsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @instance + */ + ListAnswerRecordsRequest.prototype.parent = ""; + + /** + * ListAnswerRecordsRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @instance + */ + ListAnswerRecordsRequest.prototype.filter = ""; + + /** + * ListAnswerRecordsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @instance + */ + ListAnswerRecordsRequest.prototype.pageSize = 0; + + /** + * ListAnswerRecordsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @instance + */ + ListAnswerRecordsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListAnswerRecordsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListAnswerRecordsRequest} ListAnswerRecordsRequest instance + */ + ListAnswerRecordsRequest.create = function create(properties) { + return new ListAnswerRecordsRequest(properties); + }; + + /** + * Encodes the specified ListAnswerRecordsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListAnswerRecordsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsRequest} message ListAnswerRecordsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAnswerRecordsRequest.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.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListAnswerRecordsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListAnswerRecordsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsRequest} message ListAnswerRecordsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAnswerRecordsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAnswerRecordsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListAnswerRecordsRequest} ListAnswerRecordsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAnswerRecordsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListAnswerRecordsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAnswerRecordsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListAnswerRecordsRequest} ListAnswerRecordsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAnswerRecordsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAnswerRecordsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAnswerRecordsRequest.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.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 ListAnswerRecordsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListAnswerRecordsRequest} ListAnswerRecordsRequest + */ + ListAnswerRecordsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListAnswerRecordsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListAnswerRecordsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + 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 ListAnswerRecordsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListAnswerRecordsRequest} message ListAnswerRecordsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAnswerRecordsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + 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; + return object; + }; + + /** + * Converts this ListAnswerRecordsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @instance + * @returns {Object.} JSON object + */ + ListAnswerRecordsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListAnswerRecordsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListAnswerRecordsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListAnswerRecordsRequest"; + }; + + return ListAnswerRecordsRequest; + })(); + + v2.ListAnswerRecordsResponse = (function() { + + /** + * Properties of a ListAnswerRecordsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListAnswerRecordsResponse + * @property {Array.|null} [answerRecords] ListAnswerRecordsResponse answerRecords + * @property {string|null} [nextPageToken] ListAnswerRecordsResponse nextPageToken + */ + + /** + * Constructs a new ListAnswerRecordsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListAnswerRecordsResponse. + * @implements IListAnswerRecordsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsResponse=} [properties] Properties to set + */ + function ListAnswerRecordsResponse(properties) { + this.answerRecords = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListAnswerRecordsResponse answerRecords. + * @member {Array.} answerRecords + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @instance + */ + ListAnswerRecordsResponse.prototype.answerRecords = $util.emptyArray; + + /** + * ListAnswerRecordsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @instance + */ + ListAnswerRecordsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListAnswerRecordsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListAnswerRecordsResponse} ListAnswerRecordsResponse instance + */ + ListAnswerRecordsResponse.create = function create(properties) { + return new ListAnswerRecordsResponse(properties); + }; + + /** + * Encodes the specified ListAnswerRecordsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsResponse} message ListAnswerRecordsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAnswerRecordsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answerRecords != null && message.answerRecords.length) + for (var i = 0; i < message.answerRecords.length; ++i) + $root.google.cloud.dialogflow.v2.AnswerRecord.encode(message.answerRecords[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 ListAnswerRecordsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListAnswerRecordsResponse} message ListAnswerRecordsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAnswerRecordsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAnswerRecordsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListAnswerRecordsResponse} ListAnswerRecordsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAnswerRecordsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListAnswerRecordsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.answerRecords && message.answerRecords.length)) + message.answerRecords = []; + message.answerRecords.push($root.google.cloud.dialogflow.v2.AnswerRecord.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAnswerRecordsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListAnswerRecordsResponse} ListAnswerRecordsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAnswerRecordsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAnswerRecordsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAnswerRecordsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answerRecords != null && message.hasOwnProperty("answerRecords")) { + if (!Array.isArray(message.answerRecords)) + return "answerRecords: array expected"; + for (var i = 0; i < message.answerRecords.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.AnswerRecord.verify(message.answerRecords[i]); + if (error) + return "answerRecords." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListAnswerRecordsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListAnswerRecordsResponse} ListAnswerRecordsResponse + */ + ListAnswerRecordsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListAnswerRecordsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListAnswerRecordsResponse(); + if (object.answerRecords) { + if (!Array.isArray(object.answerRecords)) + throw TypeError(".google.cloud.dialogflow.v2.ListAnswerRecordsResponse.answerRecords: array expected"); + message.answerRecords = []; + for (var i = 0; i < object.answerRecords.length; ++i) { + if (typeof object.answerRecords[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListAnswerRecordsResponse.answerRecords: object expected"); + message.answerRecords[i] = $root.google.cloud.dialogflow.v2.AnswerRecord.fromObject(object.answerRecords[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListAnswerRecordsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListAnswerRecordsResponse} message ListAnswerRecordsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAnswerRecordsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.answerRecords = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.answerRecords && message.answerRecords.length) { + object.answerRecords = []; + for (var j = 0; j < message.answerRecords.length; ++j) + object.answerRecords[j] = $root.google.cloud.dialogflow.v2.AnswerRecord.toObject(message.answerRecords[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListAnswerRecordsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @instance + * @returns {Object.} JSON object + */ + ListAnswerRecordsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListAnswerRecordsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListAnswerRecordsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListAnswerRecordsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListAnswerRecordsResponse"; + }; + + return ListAnswerRecordsResponse; + })(); + + v2.UpdateAnswerRecordRequest = (function() { + + /** + * Properties of an UpdateAnswerRecordRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateAnswerRecordRequest + * @property {google.cloud.dialogflow.v2.IAnswerRecord|null} [answerRecord] UpdateAnswerRecordRequest answerRecord + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateAnswerRecordRequest updateMask + */ + + /** + * Constructs a new UpdateAnswerRecordRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateAnswerRecordRequest. + * @implements IUpdateAnswerRecordRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest=} [properties] Properties to set + */ + function UpdateAnswerRecordRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateAnswerRecordRequest answerRecord. + * @member {google.cloud.dialogflow.v2.IAnswerRecord|null|undefined} answerRecord + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @instance + */ + UpdateAnswerRecordRequest.prototype.answerRecord = null; + + /** + * UpdateAnswerRecordRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @instance + */ + UpdateAnswerRecordRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateAnswerRecordRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateAnswerRecordRequest} UpdateAnswerRecordRequest instance + */ + UpdateAnswerRecordRequest.create = function create(properties) { + return new UpdateAnswerRecordRequest(properties); + }; + + /** + * Encodes the specified UpdateAnswerRecordRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateAnswerRecordRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest} message UpdateAnswerRecordRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAnswerRecordRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + $root.google.cloud.dialogflow.v2.AnswerRecord.encode(message.answerRecord, 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 UpdateAnswerRecordRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateAnswerRecordRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest} message UpdateAnswerRecordRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAnswerRecordRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateAnswerRecordRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateAnswerRecordRequest} UpdateAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAnswerRecordRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.answerRecord = $root.google.cloud.dialogflow.v2.AnswerRecord.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 UpdateAnswerRecordRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateAnswerRecordRequest} UpdateAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAnswerRecordRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateAnswerRecordRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateAnswerRecordRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) { + var error = $root.google.cloud.dialogflow.v2.AnswerRecord.verify(message.answerRecord); + if (error) + return "answerRecord." + 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 UpdateAnswerRecordRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateAnswerRecordRequest} UpdateAnswerRecordRequest + */ + UpdateAnswerRecordRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest(); + if (object.answerRecord != null) { + if (typeof object.answerRecord !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateAnswerRecordRequest.answerRecord: object expected"); + message.answerRecord = $root.google.cloud.dialogflow.v2.AnswerRecord.fromObject(object.answerRecord); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateAnswerRecordRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateAnswerRecordRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateAnswerRecordRequest} message UpdateAnswerRecordRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateAnswerRecordRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.answerRecord = null; + object.updateMask = null; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = $root.google.cloud.dialogflow.v2.AnswerRecord.toObject(message.answerRecord, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateAnswerRecordRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateAnswerRecordRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateAnswerRecordRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateAnswerRecordRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateAnswerRecordRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateAnswerRecordRequest"; + }; + + return UpdateAnswerRecordRequest; + })(); + + v2.AnswerFeedback = (function() { + + /** + * Properties of an AnswerFeedback. + * @memberof google.cloud.dialogflow.v2 + * @interface IAnswerFeedback + * @property {google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel|null} [correctnessLevel] AnswerFeedback correctnessLevel + * @property {google.cloud.dialogflow.v2.IAgentAssistantFeedback|null} [agentAssistantDetailFeedback] AnswerFeedback agentAssistantDetailFeedback + * @property {boolean|null} [clicked] AnswerFeedback clicked + * @property {google.protobuf.ITimestamp|null} [clickTime] AnswerFeedback clickTime + * @property {boolean|null} [displayed] AnswerFeedback displayed + * @property {google.protobuf.ITimestamp|null} [displayTime] AnswerFeedback displayTime + */ + + /** + * Constructs a new AnswerFeedback. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AnswerFeedback. + * @implements IAnswerFeedback + * @constructor + * @param {google.cloud.dialogflow.v2.IAnswerFeedback=} [properties] Properties to set + */ + function AnswerFeedback(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnswerFeedback correctnessLevel. + * @member {google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel} correctnessLevel + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.correctnessLevel = 0; + + /** + * AnswerFeedback agentAssistantDetailFeedback. + * @member {google.cloud.dialogflow.v2.IAgentAssistantFeedback|null|undefined} agentAssistantDetailFeedback + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.agentAssistantDetailFeedback = null; + + /** + * AnswerFeedback clicked. + * @member {boolean} clicked + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.clicked = false; + + /** + * AnswerFeedback clickTime. + * @member {google.protobuf.ITimestamp|null|undefined} clickTime + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.clickTime = null; + + /** + * AnswerFeedback displayed. + * @member {boolean} displayed + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.displayed = false; + + /** + * AnswerFeedback displayTime. + * @member {google.protobuf.ITimestamp|null|undefined} displayTime + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.displayTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AnswerFeedback detailFeedback. + * @member {"agentAssistantDetailFeedback"|undefined} detailFeedback + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @instance + */ + Object.defineProperty(AnswerFeedback.prototype, "detailFeedback", { + get: $util.oneOfGetter($oneOfFields = ["agentAssistantDetailFeedback"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AnswerFeedback instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @static + * @param {google.cloud.dialogflow.v2.IAnswerFeedback=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AnswerFeedback} AnswerFeedback instance + */ + AnswerFeedback.create = function create(properties) { + return new AnswerFeedback(properties); + }; + + /** + * Encodes the specified AnswerFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2.AnswerFeedback.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @static + * @param {google.cloud.dialogflow.v2.IAnswerFeedback} message AnswerFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnswerFeedback.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.correctnessLevel != null && Object.hasOwnProperty.call(message, "correctnessLevel")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.correctnessLevel); + if (message.agentAssistantDetailFeedback != null && Object.hasOwnProperty.call(message, "agentAssistantDetailFeedback")) + $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.encode(message.agentAssistantDetailFeedback, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.clicked != null && Object.hasOwnProperty.call(message, "clicked")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.clicked); + if (message.displayed != null && Object.hasOwnProperty.call(message, "displayed")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.displayed); + if (message.clickTime != null && Object.hasOwnProperty.call(message, "clickTime")) + $root.google.protobuf.Timestamp.encode(message.clickTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.displayTime != null && Object.hasOwnProperty.call(message, "displayTime")) + $root.google.protobuf.Timestamp.encode(message.displayTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AnswerFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnswerFeedback.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @static + * @param {google.cloud.dialogflow.v2.IAnswerFeedback} message AnswerFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnswerFeedback.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnswerFeedback message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AnswerFeedback} AnswerFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnswerFeedback.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AnswerFeedback(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.correctnessLevel = reader.int32(); + break; + } + case 2: { + message.agentAssistantDetailFeedback = $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.decode(reader, reader.uint32()); + break; + } + case 3: { + message.clicked = reader.bool(); + break; + } + case 5: { + message.clickTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.displayed = reader.bool(); + break; + } + case 6: { + message.displayTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnswerFeedback message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AnswerFeedback} AnswerFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnswerFeedback.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnswerFeedback message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnswerFeedback.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.correctnessLevel != null && message.hasOwnProperty("correctnessLevel")) + switch (message.correctnessLevel) { + default: + return "correctnessLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.agentAssistantDetailFeedback != null && message.hasOwnProperty("agentAssistantDetailFeedback")) { + properties.detailFeedback = 1; + { + var error = $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.verify(message.agentAssistantDetailFeedback); + if (error) + return "agentAssistantDetailFeedback." + error; + } + } + if (message.clicked != null && message.hasOwnProperty("clicked")) + if (typeof message.clicked !== "boolean") + return "clicked: boolean expected"; + if (message.clickTime != null && message.hasOwnProperty("clickTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.clickTime); + if (error) + return "clickTime." + error; + } + if (message.displayed != null && message.hasOwnProperty("displayed")) + if (typeof message.displayed !== "boolean") + return "displayed: boolean expected"; + if (message.displayTime != null && message.hasOwnProperty("displayTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.displayTime); + if (error) + return "displayTime." + error; + } + return null; + }; + + /** + * Creates an AnswerFeedback message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AnswerFeedback} AnswerFeedback + */ + AnswerFeedback.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AnswerFeedback) + return object; + var message = new $root.google.cloud.dialogflow.v2.AnswerFeedback(); + switch (object.correctnessLevel) { + default: + if (typeof object.correctnessLevel === "number") { + message.correctnessLevel = object.correctnessLevel; + break; + } + break; + case "CORRECTNESS_LEVEL_UNSPECIFIED": + case 0: + message.correctnessLevel = 0; + break; + case "NOT_CORRECT": + case 1: + message.correctnessLevel = 1; + break; + case "PARTIALLY_CORRECT": + case 2: + message.correctnessLevel = 2; + break; + case "FULLY_CORRECT": + case 3: + message.correctnessLevel = 3; + break; + } + if (object.agentAssistantDetailFeedback != null) { + if (typeof object.agentAssistantDetailFeedback !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnswerFeedback.agentAssistantDetailFeedback: object expected"); + message.agentAssistantDetailFeedback = $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.fromObject(object.agentAssistantDetailFeedback); + } + if (object.clicked != null) + message.clicked = Boolean(object.clicked); + if (object.clickTime != null) { + if (typeof object.clickTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnswerFeedback.clickTime: object expected"); + message.clickTime = $root.google.protobuf.Timestamp.fromObject(object.clickTime); + } + if (object.displayed != null) + message.displayed = Boolean(object.displayed); + if (object.displayTime != null) { + if (typeof object.displayTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnswerFeedback.displayTime: object expected"); + message.displayTime = $root.google.protobuf.Timestamp.fromObject(object.displayTime); + } + return message; + }; + + /** + * Creates a plain object from an AnswerFeedback message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @static + * @param {google.cloud.dialogflow.v2.AnswerFeedback} message AnswerFeedback + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnswerFeedback.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.correctnessLevel = options.enums === String ? "CORRECTNESS_LEVEL_UNSPECIFIED" : 0; + object.clicked = false; + object.displayed = false; + object.clickTime = null; + object.displayTime = null; + } + if (message.correctnessLevel != null && message.hasOwnProperty("correctnessLevel")) + object.correctnessLevel = options.enums === String ? $root.google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel[message.correctnessLevel] === undefined ? message.correctnessLevel : $root.google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel[message.correctnessLevel] : message.correctnessLevel; + if (message.agentAssistantDetailFeedback != null && message.hasOwnProperty("agentAssistantDetailFeedback")) { + object.agentAssistantDetailFeedback = $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.toObject(message.agentAssistantDetailFeedback, options); + if (options.oneofs) + object.detailFeedback = "agentAssistantDetailFeedback"; + } + if (message.clicked != null && message.hasOwnProperty("clicked")) + object.clicked = message.clicked; + if (message.displayed != null && message.hasOwnProperty("displayed")) + object.displayed = message.displayed; + if (message.clickTime != null && message.hasOwnProperty("clickTime")) + object.clickTime = $root.google.protobuf.Timestamp.toObject(message.clickTime, options); + if (message.displayTime != null && message.hasOwnProperty("displayTime")) + object.displayTime = $root.google.protobuf.Timestamp.toObject(message.displayTime, options); + return object; + }; + + /** + * Converts this AnswerFeedback to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @instance + * @returns {Object.} JSON object + */ + AnswerFeedback.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnswerFeedback + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AnswerFeedback + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnswerFeedback.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AnswerFeedback"; + }; + + /** + * CorrectnessLevel enum. + * @name google.cloud.dialogflow.v2.AnswerFeedback.CorrectnessLevel + * @enum {number} + * @property {number} CORRECTNESS_LEVEL_UNSPECIFIED=0 CORRECTNESS_LEVEL_UNSPECIFIED value + * @property {number} NOT_CORRECT=1 NOT_CORRECT value + * @property {number} PARTIALLY_CORRECT=2 PARTIALLY_CORRECT value + * @property {number} FULLY_CORRECT=3 FULLY_CORRECT value + */ + AnswerFeedback.CorrectnessLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CORRECTNESS_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "NOT_CORRECT"] = 1; + values[valuesById[2] = "PARTIALLY_CORRECT"] = 2; + values[valuesById[3] = "FULLY_CORRECT"] = 3; + return values; + })(); + + return AnswerFeedback; + })(); + + v2.AgentAssistantFeedback = (function() { + + /** + * Properties of an AgentAssistantFeedback. + * @memberof google.cloud.dialogflow.v2 + * @interface IAgentAssistantFeedback + * @property {google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance|null} [answerRelevance] AgentAssistantFeedback answerRelevance + * @property {google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness|null} [documentCorrectness] AgentAssistantFeedback documentCorrectness + * @property {google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency|null} [documentEfficiency] AgentAssistantFeedback documentEfficiency + */ + + /** + * Constructs a new AgentAssistantFeedback. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AgentAssistantFeedback. + * @implements IAgentAssistantFeedback + * @constructor + * @param {google.cloud.dialogflow.v2.IAgentAssistantFeedback=} [properties] Properties to set + */ + function AgentAssistantFeedback(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AgentAssistantFeedback answerRelevance. + * @member {google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance} answerRelevance + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @instance + */ + AgentAssistantFeedback.prototype.answerRelevance = 0; + + /** + * AgentAssistantFeedback documentCorrectness. + * @member {google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness} documentCorrectness + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @instance + */ + AgentAssistantFeedback.prototype.documentCorrectness = 0; + + /** + * AgentAssistantFeedback documentEfficiency. + * @member {google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency} documentEfficiency + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @instance + */ + AgentAssistantFeedback.prototype.documentEfficiency = 0; + + /** + * Creates a new AgentAssistantFeedback instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @static + * @param {google.cloud.dialogflow.v2.IAgentAssistantFeedback=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AgentAssistantFeedback} AgentAssistantFeedback instance + */ + AgentAssistantFeedback.create = function create(properties) { + return new AgentAssistantFeedback(properties); + }; + + /** + * Encodes the specified AgentAssistantFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2.AgentAssistantFeedback.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @static + * @param {google.cloud.dialogflow.v2.IAgentAssistantFeedback} message AgentAssistantFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAssistantFeedback.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answerRelevance != null && Object.hasOwnProperty.call(message, "answerRelevance")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.answerRelevance); + if (message.documentCorrectness != null && Object.hasOwnProperty.call(message, "documentCorrectness")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.documentCorrectness); + if (message.documentEfficiency != null && Object.hasOwnProperty.call(message, "documentEfficiency")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.documentEfficiency); + return writer; + }; + + /** + * Encodes the specified AgentAssistantFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AgentAssistantFeedback.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @static + * @param {google.cloud.dialogflow.v2.IAgentAssistantFeedback} message AgentAssistantFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAssistantFeedback.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AgentAssistantFeedback message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AgentAssistantFeedback} AgentAssistantFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAssistantFeedback.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AgentAssistantFeedback(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.answerRelevance = reader.int32(); + break; + } + case 2: { + message.documentCorrectness = reader.int32(); + break; + } + case 3: { + message.documentEfficiency = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AgentAssistantFeedback message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AgentAssistantFeedback} AgentAssistantFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAssistantFeedback.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AgentAssistantFeedback message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AgentAssistantFeedback.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answerRelevance != null && message.hasOwnProperty("answerRelevance")) + switch (message.answerRelevance) { + default: + return "answerRelevance: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.documentCorrectness != null && message.hasOwnProperty("documentCorrectness")) + switch (message.documentCorrectness) { + default: + return "documentCorrectness: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.documentEfficiency != null && message.hasOwnProperty("documentEfficiency")) + switch (message.documentEfficiency) { + default: + return "documentEfficiency: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an AgentAssistantFeedback message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AgentAssistantFeedback} AgentAssistantFeedback + */ + AgentAssistantFeedback.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AgentAssistantFeedback) + return object; + var message = new $root.google.cloud.dialogflow.v2.AgentAssistantFeedback(); + switch (object.answerRelevance) { + default: + if (typeof object.answerRelevance === "number") { + message.answerRelevance = object.answerRelevance; + break; + } + break; + case "ANSWER_RELEVANCE_UNSPECIFIED": + case 0: + message.answerRelevance = 0; + break; + case "IRRELEVANT": + case 1: + message.answerRelevance = 1; + break; + case "RELEVANT": + case 2: + message.answerRelevance = 2; + break; + } + switch (object.documentCorrectness) { + default: + if (typeof object.documentCorrectness === "number") { + message.documentCorrectness = object.documentCorrectness; + break; + } + break; + case "DOCUMENT_CORRECTNESS_UNSPECIFIED": + case 0: + message.documentCorrectness = 0; + break; + case "INCORRECT": + case 1: + message.documentCorrectness = 1; + break; + case "CORRECT": + case 2: + message.documentCorrectness = 2; + break; + } + switch (object.documentEfficiency) { + default: + if (typeof object.documentEfficiency === "number") { + message.documentEfficiency = object.documentEfficiency; + break; + } + break; + case "DOCUMENT_EFFICIENCY_UNSPECIFIED": + case 0: + message.documentEfficiency = 0; + break; + case "INEFFICIENT": + case 1: + message.documentEfficiency = 1; + break; + case "EFFICIENT": + case 2: + message.documentEfficiency = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an AgentAssistantFeedback message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @static + * @param {google.cloud.dialogflow.v2.AgentAssistantFeedback} message AgentAssistantFeedback + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AgentAssistantFeedback.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.answerRelevance = options.enums === String ? "ANSWER_RELEVANCE_UNSPECIFIED" : 0; + object.documentCorrectness = options.enums === String ? "DOCUMENT_CORRECTNESS_UNSPECIFIED" : 0; + object.documentEfficiency = options.enums === String ? "DOCUMENT_EFFICIENCY_UNSPECIFIED" : 0; + } + if (message.answerRelevance != null && message.hasOwnProperty("answerRelevance")) + object.answerRelevance = options.enums === String ? $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance[message.answerRelevance] === undefined ? message.answerRelevance : $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance[message.answerRelevance] : message.answerRelevance; + if (message.documentCorrectness != null && message.hasOwnProperty("documentCorrectness")) + object.documentCorrectness = options.enums === String ? $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness[message.documentCorrectness] === undefined ? message.documentCorrectness : $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness[message.documentCorrectness] : message.documentCorrectness; + if (message.documentEfficiency != null && message.hasOwnProperty("documentEfficiency")) + object.documentEfficiency = options.enums === String ? $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency[message.documentEfficiency] === undefined ? message.documentEfficiency : $root.google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency[message.documentEfficiency] : message.documentEfficiency; + return object; + }; + + /** + * Converts this AgentAssistantFeedback to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @instance + * @returns {Object.} JSON object + */ + AgentAssistantFeedback.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AgentAssistantFeedback + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AgentAssistantFeedback + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AgentAssistantFeedback.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AgentAssistantFeedback"; + }; + + /** + * AnswerRelevance enum. + * @name google.cloud.dialogflow.v2.AgentAssistantFeedback.AnswerRelevance + * @enum {number} + * @property {number} ANSWER_RELEVANCE_UNSPECIFIED=0 ANSWER_RELEVANCE_UNSPECIFIED value + * @property {number} IRRELEVANT=1 IRRELEVANT value + * @property {number} RELEVANT=2 RELEVANT value + */ + AgentAssistantFeedback.AnswerRelevance = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ANSWER_RELEVANCE_UNSPECIFIED"] = 0; + values[valuesById[1] = "IRRELEVANT"] = 1; + values[valuesById[2] = "RELEVANT"] = 2; + return values; + })(); + + /** + * DocumentCorrectness enum. + * @name google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentCorrectness + * @enum {number} + * @property {number} DOCUMENT_CORRECTNESS_UNSPECIFIED=0 DOCUMENT_CORRECTNESS_UNSPECIFIED value + * @property {number} INCORRECT=1 INCORRECT value + * @property {number} CORRECT=2 CORRECT value + */ + AgentAssistantFeedback.DocumentCorrectness = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DOCUMENT_CORRECTNESS_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCORRECT"] = 1; + values[valuesById[2] = "CORRECT"] = 2; + return values; + })(); + + /** + * DocumentEfficiency enum. + * @name google.cloud.dialogflow.v2.AgentAssistantFeedback.DocumentEfficiency + * @enum {number} + * @property {number} DOCUMENT_EFFICIENCY_UNSPECIFIED=0 DOCUMENT_EFFICIENCY_UNSPECIFIED value + * @property {number} INEFFICIENT=1 INEFFICIENT value + * @property {number} EFFICIENT=2 EFFICIENT value + */ + AgentAssistantFeedback.DocumentEfficiency = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DOCUMENT_EFFICIENCY_UNSPECIFIED"] = 0; + values[valuesById[1] = "INEFFICIENT"] = 1; + values[valuesById[2] = "EFFICIENT"] = 2; + return values; + })(); + + return AgentAssistantFeedback; + })(); + + v2.AgentAssistantRecord = (function() { + + /** + * Properties of an AgentAssistantRecord. + * @memberof google.cloud.dialogflow.v2 + * @interface IAgentAssistantRecord + * @property {google.cloud.dialogflow.v2.IArticleAnswer|null} [articleSuggestionAnswer] AgentAssistantRecord articleSuggestionAnswer + * @property {google.cloud.dialogflow.v2.IFaqAnswer|null} [faqAnswer] AgentAssistantRecord faqAnswer + */ + + /** + * Constructs a new AgentAssistantRecord. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AgentAssistantRecord. + * @implements IAgentAssistantRecord + * @constructor + * @param {google.cloud.dialogflow.v2.IAgentAssistantRecord=} [properties] Properties to set + */ + function AgentAssistantRecord(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AgentAssistantRecord articleSuggestionAnswer. + * @member {google.cloud.dialogflow.v2.IArticleAnswer|null|undefined} articleSuggestionAnswer + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @instance + */ + AgentAssistantRecord.prototype.articleSuggestionAnswer = null; + + /** + * AgentAssistantRecord faqAnswer. + * @member {google.cloud.dialogflow.v2.IFaqAnswer|null|undefined} faqAnswer + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @instance + */ + AgentAssistantRecord.prototype.faqAnswer = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AgentAssistantRecord answer. + * @member {"articleSuggestionAnswer"|"faqAnswer"|undefined} answer + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @instance + */ + Object.defineProperty(AgentAssistantRecord.prototype, "answer", { + get: $util.oneOfGetter($oneOfFields = ["articleSuggestionAnswer", "faqAnswer"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AgentAssistantRecord instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @static + * @param {google.cloud.dialogflow.v2.IAgentAssistantRecord=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AgentAssistantRecord} AgentAssistantRecord instance + */ + AgentAssistantRecord.create = function create(properties) { + return new AgentAssistantRecord(properties); + }; + + /** + * Encodes the specified AgentAssistantRecord message. Does not implicitly {@link google.cloud.dialogflow.v2.AgentAssistantRecord.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @static + * @param {google.cloud.dialogflow.v2.IAgentAssistantRecord} message AgentAssistantRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAssistantRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.articleSuggestionAnswer != null && Object.hasOwnProperty.call(message, "articleSuggestionAnswer")) + $root.google.cloud.dialogflow.v2.ArticleAnswer.encode(message.articleSuggestionAnswer, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.faqAnswer != null && Object.hasOwnProperty.call(message, "faqAnswer")) + $root.google.cloud.dialogflow.v2.FaqAnswer.encode(message.faqAnswer, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AgentAssistantRecord message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AgentAssistantRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @static + * @param {google.cloud.dialogflow.v2.IAgentAssistantRecord} message AgentAssistantRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAssistantRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AgentAssistantRecord message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AgentAssistantRecord} AgentAssistantRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAssistantRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AgentAssistantRecord(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.articleSuggestionAnswer = $root.google.cloud.dialogflow.v2.ArticleAnswer.decode(reader, reader.uint32()); + break; + } + case 6: { + message.faqAnswer = $root.google.cloud.dialogflow.v2.FaqAnswer.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AgentAssistantRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AgentAssistantRecord} AgentAssistantRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAssistantRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AgentAssistantRecord message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AgentAssistantRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.articleSuggestionAnswer != null && message.hasOwnProperty("articleSuggestionAnswer")) { + properties.answer = 1; + { + var error = $root.google.cloud.dialogflow.v2.ArticleAnswer.verify(message.articleSuggestionAnswer); + if (error) + return "articleSuggestionAnswer." + error; + } + } + if (message.faqAnswer != null && message.hasOwnProperty("faqAnswer")) { + if (properties.answer === 1) + return "answer: multiple values"; + properties.answer = 1; + { + var error = $root.google.cloud.dialogflow.v2.FaqAnswer.verify(message.faqAnswer); + if (error) + return "faqAnswer." + error; + } + } + return null; + }; + + /** + * Creates an AgentAssistantRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AgentAssistantRecord} AgentAssistantRecord + */ + AgentAssistantRecord.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AgentAssistantRecord) + return object; + var message = new $root.google.cloud.dialogflow.v2.AgentAssistantRecord(); + if (object.articleSuggestionAnswer != null) { + if (typeof object.articleSuggestionAnswer !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AgentAssistantRecord.articleSuggestionAnswer: object expected"); + message.articleSuggestionAnswer = $root.google.cloud.dialogflow.v2.ArticleAnswer.fromObject(object.articleSuggestionAnswer); + } + if (object.faqAnswer != null) { + if (typeof object.faqAnswer !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AgentAssistantRecord.faqAnswer: object expected"); + message.faqAnswer = $root.google.cloud.dialogflow.v2.FaqAnswer.fromObject(object.faqAnswer); + } + return message; + }; + + /** + * Creates a plain object from an AgentAssistantRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @static + * @param {google.cloud.dialogflow.v2.AgentAssistantRecord} message AgentAssistantRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AgentAssistantRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.articleSuggestionAnswer != null && message.hasOwnProperty("articleSuggestionAnswer")) { + object.articleSuggestionAnswer = $root.google.cloud.dialogflow.v2.ArticleAnswer.toObject(message.articleSuggestionAnswer, options); + if (options.oneofs) + object.answer = "articleSuggestionAnswer"; + } + if (message.faqAnswer != null && message.hasOwnProperty("faqAnswer")) { + object.faqAnswer = $root.google.cloud.dialogflow.v2.FaqAnswer.toObject(message.faqAnswer, options); + if (options.oneofs) + object.answer = "faqAnswer"; + } + return object; + }; + + /** + * Converts this AgentAssistantRecord to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @instance + * @returns {Object.} JSON object + */ + AgentAssistantRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AgentAssistantRecord + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AgentAssistantRecord + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AgentAssistantRecord.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AgentAssistantRecord"; + }; + + return AgentAssistantRecord; + })(); + + v2.Participants = (function() { + + /** + * Constructs a new Participants service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Participants + * @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 Participants(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Participants.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Participants; + + /** + * Creates new Participants service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Participants + * @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 {Participants} RPC service. Useful where requests and/or responses are streamed. + */ + Participants.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|createParticipant}. + * @memberof google.cloud.dialogflow.v2.Participants + * @typedef CreateParticipantCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Participant} [response] Participant + */ + + /** + * Calls CreateParticipant. + * @function createParticipant + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.ICreateParticipantRequest} request CreateParticipantRequest message or plain object + * @param {google.cloud.dialogflow.v2.Participants.CreateParticipantCallback} callback Node-style callback called with the error, if any, and Participant + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.createParticipant = function createParticipant(request, callback) { + return this.rpcCall(createParticipant, $root.google.cloud.dialogflow.v2.CreateParticipantRequest, $root.google.cloud.dialogflow.v2.Participant, request, callback); + }, "name", { value: "CreateParticipant" }); + + /** + * Calls CreateParticipant. + * @function createParticipant + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.ICreateParticipantRequest} request CreateParticipantRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|getParticipant}. + * @memberof google.cloud.dialogflow.v2.Participants + * @typedef GetParticipantCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Participant} [response] Participant + */ + + /** + * Calls GetParticipant. + * @function getParticipant + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IGetParticipantRequest} request GetParticipantRequest message or plain object + * @param {google.cloud.dialogflow.v2.Participants.GetParticipantCallback} callback Node-style callback called with the error, if any, and Participant + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.getParticipant = function getParticipant(request, callback) { + return this.rpcCall(getParticipant, $root.google.cloud.dialogflow.v2.GetParticipantRequest, $root.google.cloud.dialogflow.v2.Participant, request, callback); + }, "name", { value: "GetParticipant" }); + + /** + * Calls GetParticipant. + * @function getParticipant + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IGetParticipantRequest} request GetParticipantRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|listParticipants}. + * @memberof google.cloud.dialogflow.v2.Participants + * @typedef ListParticipantsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListParticipantsResponse} [response] ListParticipantsResponse + */ + + /** + * Calls ListParticipants. + * @function listParticipants + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IListParticipantsRequest} request ListParticipantsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Participants.ListParticipantsCallback} callback Node-style callback called with the error, if any, and ListParticipantsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.listParticipants = function listParticipants(request, callback) { + return this.rpcCall(listParticipants, $root.google.cloud.dialogflow.v2.ListParticipantsRequest, $root.google.cloud.dialogflow.v2.ListParticipantsResponse, request, callback); + }, "name", { value: "ListParticipants" }); + + /** + * Calls ListParticipants. + * @function listParticipants + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IListParticipantsRequest} request ListParticipantsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|updateParticipant}. + * @memberof google.cloud.dialogflow.v2.Participants + * @typedef UpdateParticipantCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Participant} [response] Participant + */ + + /** + * Calls UpdateParticipant. + * @function updateParticipant + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateParticipantRequest} request UpdateParticipantRequest message or plain object + * @param {google.cloud.dialogflow.v2.Participants.UpdateParticipantCallback} callback Node-style callback called with the error, if any, and Participant + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.updateParticipant = function updateParticipant(request, callback) { + return this.rpcCall(updateParticipant, $root.google.cloud.dialogflow.v2.UpdateParticipantRequest, $root.google.cloud.dialogflow.v2.Participant, request, callback); + }, "name", { value: "UpdateParticipant" }); + + /** + * Calls UpdateParticipant. + * @function updateParticipant + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateParticipantRequest} request UpdateParticipantRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|analyzeContent}. + * @memberof google.cloud.dialogflow.v2.Participants + * @typedef AnalyzeContentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.AnalyzeContentResponse} [response] AnalyzeContentResponse + */ + + /** + * Calls AnalyzeContent. + * @function analyzeContent + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IAnalyzeContentRequest} request AnalyzeContentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Participants.AnalyzeContentCallback} callback Node-style callback called with the error, if any, and AnalyzeContentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.analyzeContent = function analyzeContent(request, callback) { + return this.rpcCall(analyzeContent, $root.google.cloud.dialogflow.v2.AnalyzeContentRequest, $root.google.cloud.dialogflow.v2.AnalyzeContentResponse, request, callback); + }, "name", { value: "AnalyzeContent" }); + + /** + * Calls AnalyzeContent. + * @function analyzeContent + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IAnalyzeContentRequest} request AnalyzeContentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|streamingAnalyzeContent}. + * @memberof google.cloud.dialogflow.v2.Participants + * @typedef StreamingAnalyzeContentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse} [response] StreamingAnalyzeContentResponse + */ + + /** + * Calls StreamingAnalyzeContent. + * @function streamingAnalyzeContent + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest} request StreamingAnalyzeContentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContentCallback} callback Node-style callback called with the error, if any, and StreamingAnalyzeContentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.streamingAnalyzeContent = function streamingAnalyzeContent(request, callback) { + return this.rpcCall(streamingAnalyzeContent, $root.google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest, $root.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse, request, callback); + }, "name", { value: "StreamingAnalyzeContent" }); + + /** + * Calls StreamingAnalyzeContent. + * @function streamingAnalyzeContent + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest} request StreamingAnalyzeContentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|suggestArticles}. + * @memberof google.cloud.dialogflow.v2.Participants + * @typedef SuggestArticlesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.SuggestArticlesResponse} [response] SuggestArticlesResponse + */ + + /** + * Calls SuggestArticles. + * @function suggestArticles + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.ISuggestArticlesRequest} request SuggestArticlesRequest message or plain object + * @param {google.cloud.dialogflow.v2.Participants.SuggestArticlesCallback} callback Node-style callback called with the error, if any, and SuggestArticlesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.suggestArticles = function suggestArticles(request, callback) { + return this.rpcCall(suggestArticles, $root.google.cloud.dialogflow.v2.SuggestArticlesRequest, $root.google.cloud.dialogflow.v2.SuggestArticlesResponse, request, callback); + }, "name", { value: "SuggestArticles" }); + + /** + * Calls SuggestArticles. + * @function suggestArticles + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.ISuggestArticlesRequest} request SuggestArticlesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|suggestFaqAnswers}. + * @memberof google.cloud.dialogflow.v2.Participants + * @typedef SuggestFaqAnswersCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.SuggestFaqAnswersResponse} [response] SuggestFaqAnswersResponse + */ + + /** + * Calls SuggestFaqAnswers. + * @function suggestFaqAnswers + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest} request SuggestFaqAnswersRequest message or plain object + * @param {google.cloud.dialogflow.v2.Participants.SuggestFaqAnswersCallback} callback Node-style callback called with the error, if any, and SuggestFaqAnswersResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.suggestFaqAnswers = function suggestFaqAnswers(request, callback) { + return this.rpcCall(suggestFaqAnswers, $root.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest, $root.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse, request, callback); + }, "name", { value: "SuggestFaqAnswers" }); + + /** + * Calls SuggestFaqAnswers. + * @function suggestFaqAnswers + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest} request SuggestFaqAnswersRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Participants|suggestSmartReplies}. + * @memberof google.cloud.dialogflow.v2.Participants + * @typedef SuggestSmartRepliesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.SuggestSmartRepliesResponse} [response] SuggestSmartRepliesResponse + */ + + /** + * Calls SuggestSmartReplies. + * @function suggestSmartReplies + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest} request SuggestSmartRepliesRequest message or plain object + * @param {google.cloud.dialogflow.v2.Participants.SuggestSmartRepliesCallback} callback Node-style callback called with the error, if any, and SuggestSmartRepliesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.suggestSmartReplies = function suggestSmartReplies(request, callback) { + return this.rpcCall(suggestSmartReplies, $root.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest, $root.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse, request, callback); + }, "name", { value: "SuggestSmartReplies" }); + + /** + * Calls SuggestSmartReplies. + * @function suggestSmartReplies + * @memberof google.cloud.dialogflow.v2.Participants + * @instance + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest} request SuggestSmartRepliesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Participants; + })(); + + v2.Participant = (function() { + + /** + * Properties of a Participant. + * @memberof google.cloud.dialogflow.v2 + * @interface IParticipant + * @property {string|null} [name] Participant name + * @property {google.cloud.dialogflow.v2.Participant.Role|null} [role] Participant role + * @property {string|null} [sipRecordingMediaLabel] Participant sipRecordingMediaLabel + * @property {string|null} [obfuscatedExternalUserId] Participant obfuscatedExternalUserId + * @property {Object.|null} [documentsMetadataFilters] Participant documentsMetadataFilters + */ + + /** + * Constructs a new Participant. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Participant. + * @implements IParticipant + * @constructor + * @param {google.cloud.dialogflow.v2.IParticipant=} [properties] Properties to set + */ + function Participant(properties) { + this.documentsMetadataFilters = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Participant name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Participant + * @instance + */ + Participant.prototype.name = ""; + + /** + * Participant role. + * @member {google.cloud.dialogflow.v2.Participant.Role} role + * @memberof google.cloud.dialogflow.v2.Participant + * @instance + */ + Participant.prototype.role = 0; + + /** + * Participant sipRecordingMediaLabel. + * @member {string} sipRecordingMediaLabel + * @memberof google.cloud.dialogflow.v2.Participant + * @instance + */ + Participant.prototype.sipRecordingMediaLabel = ""; + + /** + * Participant obfuscatedExternalUserId. + * @member {string} obfuscatedExternalUserId + * @memberof google.cloud.dialogflow.v2.Participant + * @instance + */ + Participant.prototype.obfuscatedExternalUserId = ""; + + /** + * Participant documentsMetadataFilters. + * @member {Object.} documentsMetadataFilters + * @memberof google.cloud.dialogflow.v2.Participant + * @instance + */ + Participant.prototype.documentsMetadataFilters = $util.emptyObject; + + /** + * Creates a new Participant instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Participant + * @static + * @param {google.cloud.dialogflow.v2.IParticipant=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Participant} Participant instance + */ + Participant.create = function create(properties) { + return new Participant(properties); + }; + + /** + * Encodes the specified Participant message. Does not implicitly {@link google.cloud.dialogflow.v2.Participant.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Participant + * @static + * @param {google.cloud.dialogflow.v2.IParticipant} message Participant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Participant.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.role != null && Object.hasOwnProperty.call(message, "role")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.role); + if (message.sipRecordingMediaLabel != null && Object.hasOwnProperty.call(message, "sipRecordingMediaLabel")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.sipRecordingMediaLabel); + if (message.obfuscatedExternalUserId != null && Object.hasOwnProperty.call(message, "obfuscatedExternalUserId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.obfuscatedExternalUserId); + if (message.documentsMetadataFilters != null && Object.hasOwnProperty.call(message, "documentsMetadataFilters")) + for (var keys = Object.keys(message.documentsMetadataFilters), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.documentsMetadataFilters[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified Participant message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Participant.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Participant + * @static + * @param {google.cloud.dialogflow.v2.IParticipant} message Participant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Participant.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Participant message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Participant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Participant} Participant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Participant.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Participant(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.role = reader.int32(); + break; + } + case 6: { + message.sipRecordingMediaLabel = reader.string(); + break; + } + case 7: { + message.obfuscatedExternalUserId = reader.string(); + break; + } + case 8: { + if (message.documentsMetadataFilters === $util.emptyObject) + message.documentsMetadataFilters = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.documentsMetadataFilters[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Participant message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Participant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Participant} Participant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Participant.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Participant message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Participant + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Participant.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.role != null && message.hasOwnProperty("role")) + switch (message.role) { + default: + return "role: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.sipRecordingMediaLabel != null && message.hasOwnProperty("sipRecordingMediaLabel")) + if (!$util.isString(message.sipRecordingMediaLabel)) + return "sipRecordingMediaLabel: string expected"; + if (message.obfuscatedExternalUserId != null && message.hasOwnProperty("obfuscatedExternalUserId")) + if (!$util.isString(message.obfuscatedExternalUserId)) + return "obfuscatedExternalUserId: string expected"; + if (message.documentsMetadataFilters != null && message.hasOwnProperty("documentsMetadataFilters")) { + if (!$util.isObject(message.documentsMetadataFilters)) + return "documentsMetadataFilters: object expected"; + var key = Object.keys(message.documentsMetadataFilters); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.documentsMetadataFilters[key[i]])) + return "documentsMetadataFilters: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a Participant message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Participant + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Participant} Participant + */ + Participant.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Participant) + return object; + var message = new $root.google.cloud.dialogflow.v2.Participant(); + if (object.name != null) + message.name = String(object.name); + switch (object.role) { + default: + if (typeof object.role === "number") { + message.role = object.role; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.role = 0; + break; + case "HUMAN_AGENT": + case 1: + message.role = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.role = 2; + break; + case "END_USER": + case 3: + message.role = 3; + break; + } + if (object.sipRecordingMediaLabel != null) + message.sipRecordingMediaLabel = String(object.sipRecordingMediaLabel); + if (object.obfuscatedExternalUserId != null) + message.obfuscatedExternalUserId = String(object.obfuscatedExternalUserId); + if (object.documentsMetadataFilters) { + if (typeof object.documentsMetadataFilters !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Participant.documentsMetadataFilters: object expected"); + message.documentsMetadataFilters = {}; + for (var keys = Object.keys(object.documentsMetadataFilters), i = 0; i < keys.length; ++i) + message.documentsMetadataFilters[keys[i]] = String(object.documentsMetadataFilters[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a Participant message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Participant + * @static + * @param {google.cloud.dialogflow.v2.Participant} message Participant + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Participant.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.documentsMetadataFilters = {}; + if (options.defaults) { + object.name = ""; + object.role = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.sipRecordingMediaLabel = ""; + object.obfuscatedExternalUserId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.role != null && message.hasOwnProperty("role")) + object.role = options.enums === String ? $root.google.cloud.dialogflow.v2.Participant.Role[message.role] === undefined ? message.role : $root.google.cloud.dialogflow.v2.Participant.Role[message.role] : message.role; + if (message.sipRecordingMediaLabel != null && message.hasOwnProperty("sipRecordingMediaLabel")) + object.sipRecordingMediaLabel = message.sipRecordingMediaLabel; + if (message.obfuscatedExternalUserId != null && message.hasOwnProperty("obfuscatedExternalUserId")) + object.obfuscatedExternalUserId = message.obfuscatedExternalUserId; + var keys2; + if (message.documentsMetadataFilters && (keys2 = Object.keys(message.documentsMetadataFilters)).length) { + object.documentsMetadataFilters = {}; + for (var j = 0; j < keys2.length; ++j) + object.documentsMetadataFilters[keys2[j]] = message.documentsMetadataFilters[keys2[j]]; + } + return object; + }; + + /** + * Converts this Participant to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Participant + * @instance + * @returns {Object.} JSON object + */ + Participant.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Participant + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Participant + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Participant.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Participant"; + }; + + /** + * Role enum. + * @name google.cloud.dialogflow.v2.Participant.Role + * @enum {number} + * @property {number} ROLE_UNSPECIFIED=0 ROLE_UNSPECIFIED value + * @property {number} HUMAN_AGENT=1 HUMAN_AGENT value + * @property {number} AUTOMATED_AGENT=2 AUTOMATED_AGENT value + * @property {number} END_USER=3 END_USER value + */ + Participant.Role = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ROLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "HUMAN_AGENT"] = 1; + values[valuesById[2] = "AUTOMATED_AGENT"] = 2; + values[valuesById[3] = "END_USER"] = 3; + return values; + })(); + + return Participant; + })(); + + v2.Message = (function() { + + /** + * Properties of a Message. + * @memberof google.cloud.dialogflow.v2 + * @interface IMessage + * @property {string|null} [name] Message name + * @property {string|null} [content] Message content + * @property {string|null} [languageCode] Message languageCode + * @property {string|null} [participant] Message participant + * @property {google.cloud.dialogflow.v2.Participant.Role|null} [participantRole] Message participantRole + * @property {google.protobuf.ITimestamp|null} [createTime] Message createTime + * @property {google.protobuf.ITimestamp|null} [sendTime] Message sendTime + * @property {google.cloud.dialogflow.v2.IMessageAnnotation|null} [messageAnnotation] Message messageAnnotation + * @property {google.cloud.dialogflow.v2.ISentimentAnalysisResult|null} [sentimentAnalysis] Message sentimentAnalysis + */ + + /** + * Constructs a new Message. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Message. + * @implements IMessage + * @constructor + * @param {google.cloud.dialogflow.v2.IMessage=} [properties] Properties to set + */ + function Message(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Message name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Message + * @instance + */ + Message.prototype.name = ""; + + /** + * Message content. + * @member {string} content + * @memberof google.cloud.dialogflow.v2.Message + * @instance + */ + Message.prototype.content = ""; + + /** + * Message languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.Message + * @instance + */ + Message.prototype.languageCode = ""; + + /** + * Message participant. + * @member {string} participant + * @memberof google.cloud.dialogflow.v2.Message + * @instance + */ + Message.prototype.participant = ""; + + /** + * Message participantRole. + * @member {google.cloud.dialogflow.v2.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2.Message + * @instance + */ + Message.prototype.participantRole = 0; + + /** + * Message createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.Message + * @instance + */ + Message.prototype.createTime = null; + + /** + * Message sendTime. + * @member {google.protobuf.ITimestamp|null|undefined} sendTime + * @memberof google.cloud.dialogflow.v2.Message + * @instance + */ + Message.prototype.sendTime = null; + + /** + * Message messageAnnotation. + * @member {google.cloud.dialogflow.v2.IMessageAnnotation|null|undefined} messageAnnotation + * @memberof google.cloud.dialogflow.v2.Message + * @instance + */ + Message.prototype.messageAnnotation = null; + + /** + * Message sentimentAnalysis. + * @member {google.cloud.dialogflow.v2.ISentimentAnalysisResult|null|undefined} sentimentAnalysis + * @memberof google.cloud.dialogflow.v2.Message + * @instance + */ + Message.prototype.sentimentAnalysis = null; + + /** + * Creates a new Message instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Message + * @static + * @param {google.cloud.dialogflow.v2.IMessage=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Message} Message instance + */ + Message.create = function create(properties) { + return new Message(properties); + }; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.dialogflow.v2.Message.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Message + * @static + * @param {google.cloud.dialogflow.v2.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.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.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.content); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.participant); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.participantRole); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.messageAnnotation != null && Object.hasOwnProperty.call(message, "messageAnnotation")) + $root.google.cloud.dialogflow.v2.MessageAnnotation.encode(message.messageAnnotation, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.sentimentAnalysis != null && Object.hasOwnProperty.call(message, "sentimentAnalysis")) + $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.encode(message.sentimentAnalysis, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sendTime != null && Object.hasOwnProperty.call(message, "sendTime")) + $root.google.protobuf.Timestamp.encode(message.sendTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Message.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Message + * @static + * @param {google.cloud.dialogflow.v2.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Message message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Message(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.content = reader.string(); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 4: { + message.participant = reader.string(); + break; + } + case 5: { + message.participantRole = reader.int32(); + break; + } + case 6: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sendTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.messageAnnotation = $root.google.cloud.dialogflow.v2.MessageAnnotation.decode(reader, reader.uint32()); + break; + } + case 8: { + message.sentimentAnalysis = $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Message message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Message + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Message.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.content != null && message.hasOwnProperty("content")) + if (!$util.isString(message.content)) + return "content: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.sendTime != null && message.hasOwnProperty("sendTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.sendTime); + if (error) + return "sendTime." + error; + } + if (message.messageAnnotation != null && message.hasOwnProperty("messageAnnotation")) { + var error = $root.google.cloud.dialogflow.v2.MessageAnnotation.verify(message.messageAnnotation); + if (error) + return "messageAnnotation." + error; + } + if (message.sentimentAnalysis != null && message.hasOwnProperty("sentimentAnalysis")) { + var error = $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.verify(message.sentimentAnalysis); + if (error) + return "sentimentAnalysis." + error; + } + return null; + }; + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Message + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Message} Message + */ + Message.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Message) + return object; + var message = new $root.google.cloud.dialogflow.v2.Message(); + if (object.name != null) + message.name = String(object.name); + if (object.content != null) + message.content = String(object.content); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.participant != null) + message.participant = String(object.participant); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Message.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.sendTime != null) { + if (typeof object.sendTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Message.sendTime: object expected"); + message.sendTime = $root.google.protobuf.Timestamp.fromObject(object.sendTime); + } + if (object.messageAnnotation != null) { + if (typeof object.messageAnnotation !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Message.messageAnnotation: object expected"); + message.messageAnnotation = $root.google.cloud.dialogflow.v2.MessageAnnotation.fromObject(object.messageAnnotation); + } + if (object.sentimentAnalysis != null) { + if (typeof object.sentimentAnalysis !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Message.sentimentAnalysis: object expected"); + message.sentimentAnalysis = $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.fromObject(object.sentimentAnalysis); + } + return message; + }; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Message + * @static + * @param {google.cloud.dialogflow.v2.Message} message Message + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Message.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.content = ""; + object.languageCode = ""; + object.participant = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.createTime = null; + object.messageAnnotation = null; + object.sentimentAnalysis = null; + object.sendTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.content != null && message.hasOwnProperty("content")) + object.content = message.content; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] : message.participantRole; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.messageAnnotation != null && message.hasOwnProperty("messageAnnotation")) + object.messageAnnotation = $root.google.cloud.dialogflow.v2.MessageAnnotation.toObject(message.messageAnnotation, options); + if (message.sentimentAnalysis != null && message.hasOwnProperty("sentimentAnalysis")) + object.sentimentAnalysis = $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.toObject(message.sentimentAnalysis, options); + if (message.sendTime != null && message.hasOwnProperty("sendTime")) + object.sendTime = $root.google.protobuf.Timestamp.toObject(message.sendTime, options); + return object; + }; + + /** + * Converts this Message to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Message + * @instance + * @returns {Object.} JSON object + */ + Message.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Message + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Message + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Message"; + }; + + return Message; + })(); + + v2.CreateParticipantRequest = (function() { + + /** + * Properties of a CreateParticipantRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateParticipantRequest + * @property {string|null} [parent] CreateParticipantRequest parent + * @property {google.cloud.dialogflow.v2.IParticipant|null} [participant] CreateParticipantRequest participant + */ + + /** + * Constructs a new CreateParticipantRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateParticipantRequest. + * @implements ICreateParticipantRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateParticipantRequest=} [properties] Properties to set + */ + function CreateParticipantRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateParticipantRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @instance + */ + CreateParticipantRequest.prototype.parent = ""; + + /** + * CreateParticipantRequest participant. + * @member {google.cloud.dialogflow.v2.IParticipant|null|undefined} participant + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @instance + */ + CreateParticipantRequest.prototype.participant = null; + + /** + * Creates a new CreateParticipantRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateParticipantRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateParticipantRequest} CreateParticipantRequest instance + */ + CreateParticipantRequest.create = function create(properties) { + return new CreateParticipantRequest(properties); + }; + + /** + * Encodes the specified CreateParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateParticipantRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateParticipantRequest} message CreateParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateParticipantRequest.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.participant != null && Object.hasOwnProperty.call(message, "participant")) + $root.google.cloud.dialogflow.v2.Participant.encode(message.participant, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateParticipantRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateParticipantRequest} message CreateParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateParticipantRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateParticipantRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateParticipantRequest} CreateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateParticipantRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateParticipantRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.participant = $root.google.cloud.dialogflow.v2.Participant.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateParticipantRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateParticipantRequest} CreateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateParticipantRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateParticipantRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateParticipantRequest.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.participant != null && message.hasOwnProperty("participant")) { + var error = $root.google.cloud.dialogflow.v2.Participant.verify(message.participant); + if (error) + return "participant." + error; + } + return null; + }; + + /** + * Creates a CreateParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateParticipantRequest} CreateParticipantRequest + */ + CreateParticipantRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateParticipantRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateParticipantRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.participant != null) { + if (typeof object.participant !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateParticipantRequest.participant: object expected"); + message.participant = $root.google.cloud.dialogflow.v2.Participant.fromObject(object.participant); + } + return message; + }; + + /** + * Creates a plain object from a CreateParticipantRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateParticipantRequest} message CreateParticipantRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateParticipantRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.participant = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = $root.google.cloud.dialogflow.v2.Participant.toObject(message.participant, options); + return object; + }; + + /** + * Converts this CreateParticipantRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @instance + * @returns {Object.} JSON object + */ + CreateParticipantRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateParticipantRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateParticipantRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateParticipantRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateParticipantRequest"; + }; + + return CreateParticipantRequest; + })(); + + v2.GetParticipantRequest = (function() { + + /** + * Properties of a GetParticipantRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetParticipantRequest + * @property {string|null} [name] GetParticipantRequest name + */ + + /** + * Constructs a new GetParticipantRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetParticipantRequest. + * @implements IGetParticipantRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetParticipantRequest=} [properties] Properties to set + */ + function GetParticipantRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetParticipantRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @instance + */ + GetParticipantRequest.prototype.name = ""; + + /** + * Creates a new GetParticipantRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetParticipantRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetParticipantRequest} GetParticipantRequest instance + */ + GetParticipantRequest.create = function create(properties) { + return new GetParticipantRequest(properties); + }; + + /** + * Encodes the specified GetParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetParticipantRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetParticipantRequest} message GetParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetParticipantRequest.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 GetParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetParticipantRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetParticipantRequest} message GetParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetParticipantRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetParticipantRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetParticipantRequest} GetParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetParticipantRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetParticipantRequest(); + 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 GetParticipantRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetParticipantRequest} GetParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetParticipantRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetParticipantRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetParticipantRequest.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 GetParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetParticipantRequest} GetParticipantRequest + */ + GetParticipantRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetParticipantRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetParticipantRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetParticipantRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.GetParticipantRequest} message GetParticipantRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetParticipantRequest.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 GetParticipantRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @instance + * @returns {Object.} JSON object + */ + GetParticipantRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetParticipantRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetParticipantRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetParticipantRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetParticipantRequest"; + }; + + return GetParticipantRequest; + })(); + + v2.ListParticipantsRequest = (function() { + + /** + * Properties of a ListParticipantsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListParticipantsRequest + * @property {string|null} [parent] ListParticipantsRequest parent + * @property {number|null} [pageSize] ListParticipantsRequest pageSize + * @property {string|null} [pageToken] ListParticipantsRequest pageToken + */ + + /** + * Constructs a new ListParticipantsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListParticipantsRequest. + * @implements IListParticipantsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListParticipantsRequest=} [properties] Properties to set + */ + function ListParticipantsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListParticipantsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @instance + */ + ListParticipantsRequest.prototype.parent = ""; + + /** + * ListParticipantsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @instance + */ + ListParticipantsRequest.prototype.pageSize = 0; + + /** + * ListParticipantsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @instance + */ + ListParticipantsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListParticipantsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListParticipantsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListParticipantsRequest} ListParticipantsRequest instance + */ + ListParticipantsRequest.create = function create(properties) { + return new ListParticipantsRequest(properties); + }; + + /** + * Encodes the specified ListParticipantsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListParticipantsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListParticipantsRequest} message ListParticipantsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListParticipantsRequest.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 ListParticipantsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListParticipantsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListParticipantsRequest} message ListParticipantsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListParticipantsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListParticipantsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListParticipantsRequest} ListParticipantsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListParticipantsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListParticipantsRequest(); + 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 ListParticipantsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListParticipantsRequest} ListParticipantsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListParticipantsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListParticipantsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListParticipantsRequest.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 ListParticipantsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListParticipantsRequest} ListParticipantsRequest + */ + ListParticipantsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListParticipantsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListParticipantsRequest(); + 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 ListParticipantsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListParticipantsRequest} message ListParticipantsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListParticipantsRequest.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 ListParticipantsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @instance + * @returns {Object.} JSON object + */ + ListParticipantsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListParticipantsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListParticipantsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListParticipantsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListParticipantsRequest"; + }; + + return ListParticipantsRequest; + })(); + + v2.ListParticipantsResponse = (function() { + + /** + * Properties of a ListParticipantsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListParticipantsResponse + * @property {Array.|null} [participants] ListParticipantsResponse participants + * @property {string|null} [nextPageToken] ListParticipantsResponse nextPageToken + */ + + /** + * Constructs a new ListParticipantsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListParticipantsResponse. + * @implements IListParticipantsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListParticipantsResponse=} [properties] Properties to set + */ + function ListParticipantsResponse(properties) { + this.participants = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListParticipantsResponse participants. + * @member {Array.} participants + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @instance + */ + ListParticipantsResponse.prototype.participants = $util.emptyArray; + + /** + * ListParticipantsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @instance + */ + ListParticipantsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListParticipantsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListParticipantsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListParticipantsResponse} ListParticipantsResponse instance + */ + ListParticipantsResponse.create = function create(properties) { + return new ListParticipantsResponse(properties); + }; + + /** + * Encodes the specified ListParticipantsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListParticipantsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListParticipantsResponse} message ListParticipantsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListParticipantsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.participants != null && message.participants.length) + for (var i = 0; i < message.participants.length; ++i) + $root.google.cloud.dialogflow.v2.Participant.encode(message.participants[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 ListParticipantsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListParticipantsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListParticipantsResponse} message ListParticipantsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListParticipantsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListParticipantsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListParticipantsResponse} ListParticipantsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListParticipantsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListParticipantsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.participants && message.participants.length)) + message.participants = []; + message.participants.push($root.google.cloud.dialogflow.v2.Participant.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListParticipantsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListParticipantsResponse} ListParticipantsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListParticipantsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListParticipantsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListParticipantsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.participants != null && message.hasOwnProperty("participants")) { + if (!Array.isArray(message.participants)) + return "participants: array expected"; + for (var i = 0; i < message.participants.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Participant.verify(message.participants[i]); + if (error) + return "participants." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListParticipantsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListParticipantsResponse} ListParticipantsResponse + */ + ListParticipantsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListParticipantsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListParticipantsResponse(); + if (object.participants) { + if (!Array.isArray(object.participants)) + throw TypeError(".google.cloud.dialogflow.v2.ListParticipantsResponse.participants: array expected"); + message.participants = []; + for (var i = 0; i < object.participants.length; ++i) { + if (typeof object.participants[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListParticipantsResponse.participants: object expected"); + message.participants[i] = $root.google.cloud.dialogflow.v2.Participant.fromObject(object.participants[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListParticipantsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListParticipantsResponse} message ListParticipantsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListParticipantsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.participants = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.participants && message.participants.length) { + object.participants = []; + for (var j = 0; j < message.participants.length; ++j) + object.participants[j] = $root.google.cloud.dialogflow.v2.Participant.toObject(message.participants[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListParticipantsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @instance + * @returns {Object.} JSON object + */ + ListParticipantsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListParticipantsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListParticipantsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListParticipantsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListParticipantsResponse"; + }; + + return ListParticipantsResponse; + })(); + + v2.UpdateParticipantRequest = (function() { + + /** + * Properties of an UpdateParticipantRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateParticipantRequest + * @property {google.cloud.dialogflow.v2.IParticipant|null} [participant] UpdateParticipantRequest participant + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateParticipantRequest updateMask + */ + + /** + * Constructs a new UpdateParticipantRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateParticipantRequest. + * @implements IUpdateParticipantRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateParticipantRequest=} [properties] Properties to set + */ + function UpdateParticipantRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateParticipantRequest participant. + * @member {google.cloud.dialogflow.v2.IParticipant|null|undefined} participant + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @instance + */ + UpdateParticipantRequest.prototype.participant = null; + + /** + * UpdateParticipantRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @instance + */ + UpdateParticipantRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateParticipantRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateParticipantRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateParticipantRequest} UpdateParticipantRequest instance + */ + UpdateParticipantRequest.create = function create(properties) { + return new UpdateParticipantRequest(properties); + }; + + /** + * Encodes the specified UpdateParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateParticipantRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateParticipantRequest} message UpdateParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateParticipantRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + $root.google.cloud.dialogflow.v2.Participant.encode(message.participant, 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 UpdateParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateParticipantRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateParticipantRequest} message UpdateParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateParticipantRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateParticipantRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateParticipantRequest} UpdateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateParticipantRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateParticipantRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.participant = $root.google.cloud.dialogflow.v2.Participant.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 UpdateParticipantRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateParticipantRequest} UpdateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateParticipantRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateParticipantRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateParticipantRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.participant != null && message.hasOwnProperty("participant")) { + var error = $root.google.cloud.dialogflow.v2.Participant.verify(message.participant); + if (error) + return "participant." + 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 UpdateParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateParticipantRequest} UpdateParticipantRequest + */ + UpdateParticipantRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateParticipantRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateParticipantRequest(); + if (object.participant != null) { + if (typeof object.participant !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateParticipantRequest.participant: object expected"); + message.participant = $root.google.cloud.dialogflow.v2.Participant.fromObject(object.participant); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateParticipantRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateParticipantRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateParticipantRequest} message UpdateParticipantRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateParticipantRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.participant = null; + object.updateMask = null; + } + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = $root.google.cloud.dialogflow.v2.Participant.toObject(message.participant, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateParticipantRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateParticipantRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateParticipantRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateParticipantRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateParticipantRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateParticipantRequest"; + }; + + return UpdateParticipantRequest; + })(); + + v2.AnalyzeContentRequest = (function() { + + /** + * Properties of an AnalyzeContentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IAnalyzeContentRequest + * @property {string|null} [participant] AnalyzeContentRequest participant + * @property {google.cloud.dialogflow.v2.ITextInput|null} [textInput] AnalyzeContentRequest textInput + * @property {google.cloud.dialogflow.v2.IEventInput|null} [eventInput] AnalyzeContentRequest eventInput + * @property {google.cloud.dialogflow.v2.IOutputAudioConfig|null} [replyAudioConfig] AnalyzeContentRequest replyAudioConfig + * @property {google.cloud.dialogflow.v2.IQueryParameters|null} [queryParams] AnalyzeContentRequest queryParams + * @property {google.cloud.dialogflow.v2.IAssistQueryParameters|null} [assistQueryParams] AnalyzeContentRequest assistQueryParams + * @property {google.protobuf.IStruct|null} [cxParameters] AnalyzeContentRequest cxParameters + * @property {string|null} [requestId] AnalyzeContentRequest requestId + */ + + /** + * Constructs a new AnalyzeContentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AnalyzeContentRequest. + * @implements IAnalyzeContentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IAnalyzeContentRequest=} [properties] Properties to set + */ + function AnalyzeContentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnalyzeContentRequest participant. + * @member {string} participant + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.participant = ""; + + /** + * AnalyzeContentRequest textInput. + * @member {google.cloud.dialogflow.v2.ITextInput|null|undefined} textInput + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.textInput = null; + + /** + * AnalyzeContentRequest eventInput. + * @member {google.cloud.dialogflow.v2.IEventInput|null|undefined} eventInput + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.eventInput = null; + + /** + * AnalyzeContentRequest replyAudioConfig. + * @member {google.cloud.dialogflow.v2.IOutputAudioConfig|null|undefined} replyAudioConfig + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.replyAudioConfig = null; + + /** + * AnalyzeContentRequest queryParams. + * @member {google.cloud.dialogflow.v2.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.queryParams = null; + + /** + * AnalyzeContentRequest assistQueryParams. + * @member {google.cloud.dialogflow.v2.IAssistQueryParameters|null|undefined} assistQueryParams + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.assistQueryParams = null; + + /** + * AnalyzeContentRequest cxParameters. + * @member {google.protobuf.IStruct|null|undefined} cxParameters + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.cxParameters = null; + + /** + * AnalyzeContentRequest requestId. + * @member {string} requestId + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.requestId = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AnalyzeContentRequest input. + * @member {"textInput"|"eventInput"|undefined} input + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + */ + Object.defineProperty(AnalyzeContentRequest.prototype, "input", { + get: $util.oneOfGetter($oneOfFields = ["textInput", "eventInput"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AnalyzeContentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2.IAnalyzeContentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AnalyzeContentRequest} AnalyzeContentRequest instance + */ + AnalyzeContentRequest.create = function create(properties) { + return new AnalyzeContentRequest(properties); + }; + + /** + * Encodes the specified AnalyzeContentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.AnalyzeContentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2.IAnalyzeContentRequest} message AnalyzeContentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyzeContentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.participant); + if (message.replyAudioConfig != null && Object.hasOwnProperty.call(message, "replyAudioConfig")) + $root.google.cloud.dialogflow.v2.OutputAudioConfig.encode(message.replyAudioConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.textInput != null && Object.hasOwnProperty.call(message, "textInput")) + $root.google.cloud.dialogflow.v2.TextInput.encode(message.textInput, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.eventInput != null && Object.hasOwnProperty.call(message, "eventInput")) + $root.google.cloud.dialogflow.v2.EventInput.encode(message.eventInput, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.v2.QueryParameters.encode(message.queryParams, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.requestId); + if (message.assistQueryParams != null && Object.hasOwnProperty.call(message, "assistQueryParams")) + $root.google.cloud.dialogflow.v2.AssistQueryParameters.encode(message.assistQueryParams, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.cxParameters != null && Object.hasOwnProperty.call(message, "cxParameters")) + $root.google.protobuf.Struct.encode(message.cxParameters, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AnalyzeContentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnalyzeContentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2.IAnalyzeContentRequest} message AnalyzeContentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyzeContentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnalyzeContentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AnalyzeContentRequest} AnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyzeContentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AnalyzeContentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.participant = reader.string(); + break; + } + case 6: { + message.textInput = $root.google.cloud.dialogflow.v2.TextInput.decode(reader, reader.uint32()); + break; + } + case 8: { + message.eventInput = $root.google.cloud.dialogflow.v2.EventInput.decode(reader, reader.uint32()); + break; + } + case 5: { + message.replyAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 9: { + message.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.decode(reader, reader.uint32()); + break; + } + case 14: { + message.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.decode(reader, reader.uint32()); + break; + } + case 18: { + message.cxParameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 11: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnalyzeContentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AnalyzeContentRequest} AnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyzeContentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnalyzeContentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnalyzeContentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.textInput != null && message.hasOwnProperty("textInput")) { + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2.TextInput.verify(message.textInput); + if (error) + return "textInput." + error; + } + } + if (message.eventInput != null && message.hasOwnProperty("eventInput")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2.EventInput.verify(message.eventInput); + if (error) + return "eventInput." + error; + } + } + if (message.replyAudioConfig != null && message.hasOwnProperty("replyAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2.OutputAudioConfig.verify(message.replyAudioConfig); + if (error) + return "replyAudioConfig." + error; + } + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.v2.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) { + var error = $root.google.cloud.dialogflow.v2.AssistQueryParameters.verify(message.assistQueryParams); + if (error) + return "assistQueryParams." + error; + } + if (message.cxParameters != null && message.hasOwnProperty("cxParameters")) { + var error = $root.google.protobuf.Struct.verify(message.cxParameters); + if (error) + return "cxParameters." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates an AnalyzeContentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AnalyzeContentRequest} AnalyzeContentRequest + */ + AnalyzeContentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AnalyzeContentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.AnalyzeContentRequest(); + if (object.participant != null) + message.participant = String(object.participant); + if (object.textInput != null) { + if (typeof object.textInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentRequest.textInput: object expected"); + message.textInput = $root.google.cloud.dialogflow.v2.TextInput.fromObject(object.textInput); + } + if (object.eventInput != null) { + if (typeof object.eventInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentRequest.eventInput: object expected"); + message.eventInput = $root.google.cloud.dialogflow.v2.EventInput.fromObject(object.eventInput); + } + if (object.replyAudioConfig != null) { + if (typeof object.replyAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentRequest.replyAudioConfig: object expected"); + message.replyAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.fromObject(object.replyAudioConfig); + } + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.fromObject(object.queryParams); + } + if (object.assistQueryParams != null) { + if (typeof object.assistQueryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentRequest.assistQueryParams: object expected"); + message.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.fromObject(object.assistQueryParams); + } + if (object.cxParameters != null) { + if (typeof object.cxParameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentRequest.cxParameters: object expected"); + message.cxParameters = $root.google.protobuf.Struct.fromObject(object.cxParameters); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from an AnalyzeContentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2.AnalyzeContentRequest} message AnalyzeContentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnalyzeContentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.participant = ""; + object.replyAudioConfig = null; + object.queryParams = null; + object.requestId = ""; + object.assistQueryParams = null; + object.cxParameters = null; + } + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.replyAudioConfig != null && message.hasOwnProperty("replyAudioConfig")) + object.replyAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.toObject(message.replyAudioConfig, options); + if (message.textInput != null && message.hasOwnProperty("textInput")) { + object.textInput = $root.google.cloud.dialogflow.v2.TextInput.toObject(message.textInput, options); + if (options.oneofs) + object.input = "textInput"; + } + if (message.eventInput != null && message.hasOwnProperty("eventInput")) { + object.eventInput = $root.google.cloud.dialogflow.v2.EventInput.toObject(message.eventInput, options); + if (options.oneofs) + object.input = "eventInput"; + } + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.toObject(message.queryParams, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) + object.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.toObject(message.assistQueryParams, options); + if (message.cxParameters != null && message.hasOwnProperty("cxParameters")) + object.cxParameters = $root.google.protobuf.Struct.toObject(message.cxParameters, options); + return object; + }; + + /** + * Converts this AnalyzeContentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @instance + * @returns {Object.} JSON object + */ + AnalyzeContentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnalyzeContentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AnalyzeContentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnalyzeContentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AnalyzeContentRequest"; + }; + + return AnalyzeContentRequest; + })(); + + v2.DtmfParameters = (function() { + + /** + * Properties of a DtmfParameters. + * @memberof google.cloud.dialogflow.v2 + * @interface IDtmfParameters + * @property {boolean|null} [acceptsDtmfInput] DtmfParameters acceptsDtmfInput + */ + + /** + * Constructs a new DtmfParameters. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DtmfParameters. + * @implements IDtmfParameters + * @constructor + * @param {google.cloud.dialogflow.v2.IDtmfParameters=} [properties] Properties to set + */ + function DtmfParameters(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DtmfParameters acceptsDtmfInput. + * @member {boolean} acceptsDtmfInput + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @instance + */ + DtmfParameters.prototype.acceptsDtmfInput = false; + + /** + * Creates a new DtmfParameters instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @static + * @param {google.cloud.dialogflow.v2.IDtmfParameters=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DtmfParameters} DtmfParameters instance + */ + DtmfParameters.create = function create(properties) { + return new DtmfParameters(properties); + }; + + /** + * Encodes the specified DtmfParameters message. Does not implicitly {@link google.cloud.dialogflow.v2.DtmfParameters.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @static + * @param {google.cloud.dialogflow.v2.IDtmfParameters} message DtmfParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DtmfParameters.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.acceptsDtmfInput != null && Object.hasOwnProperty.call(message, "acceptsDtmfInput")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.acceptsDtmfInput); + return writer; + }; + + /** + * Encodes the specified DtmfParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DtmfParameters.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @static + * @param {google.cloud.dialogflow.v2.IDtmfParameters} message DtmfParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DtmfParameters.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DtmfParameters message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DtmfParameters} DtmfParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DtmfParameters.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DtmfParameters(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.acceptsDtmfInput = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DtmfParameters message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DtmfParameters} DtmfParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DtmfParameters.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DtmfParameters message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DtmfParameters.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.acceptsDtmfInput != null && message.hasOwnProperty("acceptsDtmfInput")) + if (typeof message.acceptsDtmfInput !== "boolean") + return "acceptsDtmfInput: boolean expected"; + return null; + }; + + /** + * Creates a DtmfParameters message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DtmfParameters} DtmfParameters + */ + DtmfParameters.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DtmfParameters) + return object; + var message = new $root.google.cloud.dialogflow.v2.DtmfParameters(); + if (object.acceptsDtmfInput != null) + message.acceptsDtmfInput = Boolean(object.acceptsDtmfInput); + return message; + }; + + /** + * Creates a plain object from a DtmfParameters message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @static + * @param {google.cloud.dialogflow.v2.DtmfParameters} message DtmfParameters + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DtmfParameters.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.acceptsDtmfInput = false; + if (message.acceptsDtmfInput != null && message.hasOwnProperty("acceptsDtmfInput")) + object.acceptsDtmfInput = message.acceptsDtmfInput; + return object; + }; + + /** + * Converts this DtmfParameters to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @instance + * @returns {Object.} JSON object + */ + DtmfParameters.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DtmfParameters + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DtmfParameters + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DtmfParameters.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DtmfParameters"; + }; + + return DtmfParameters; + })(); + + v2.AnalyzeContentResponse = (function() { + + /** + * Properties of an AnalyzeContentResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IAnalyzeContentResponse + * @property {string|null} [replyText] AnalyzeContentResponse replyText + * @property {google.cloud.dialogflow.v2.IOutputAudio|null} [replyAudio] AnalyzeContentResponse replyAudio + * @property {google.cloud.dialogflow.v2.IAutomatedAgentReply|null} [automatedAgentReply] AnalyzeContentResponse automatedAgentReply + * @property {google.cloud.dialogflow.v2.IMessage|null} [message] AnalyzeContentResponse message + * @property {Array.|null} [humanAgentSuggestionResults] AnalyzeContentResponse humanAgentSuggestionResults + * @property {Array.|null} [endUserSuggestionResults] AnalyzeContentResponse endUserSuggestionResults + * @property {google.cloud.dialogflow.v2.IDtmfParameters|null} [dtmfParameters] AnalyzeContentResponse dtmfParameters + */ + + /** + * Constructs a new AnalyzeContentResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AnalyzeContentResponse. + * @implements IAnalyzeContentResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IAnalyzeContentResponse=} [properties] Properties to set + */ + function AnalyzeContentResponse(properties) { + this.humanAgentSuggestionResults = []; + this.endUserSuggestionResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnalyzeContentResponse replyText. + * @member {string} replyText + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.replyText = ""; + + /** + * AnalyzeContentResponse replyAudio. + * @member {google.cloud.dialogflow.v2.IOutputAudio|null|undefined} replyAudio + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.replyAudio = null; + + /** + * AnalyzeContentResponse automatedAgentReply. + * @member {google.cloud.dialogflow.v2.IAutomatedAgentReply|null|undefined} automatedAgentReply + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.automatedAgentReply = null; + + /** + * AnalyzeContentResponse message. + * @member {google.cloud.dialogflow.v2.IMessage|null|undefined} message + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.message = null; + + /** + * AnalyzeContentResponse humanAgentSuggestionResults. + * @member {Array.} humanAgentSuggestionResults + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.humanAgentSuggestionResults = $util.emptyArray; + + /** + * AnalyzeContentResponse endUserSuggestionResults. + * @member {Array.} endUserSuggestionResults + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.endUserSuggestionResults = $util.emptyArray; + + /** + * AnalyzeContentResponse dtmfParameters. + * @member {google.cloud.dialogflow.v2.IDtmfParameters|null|undefined} dtmfParameters + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.dtmfParameters = null; + + /** + * Creates a new AnalyzeContentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2.IAnalyzeContentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AnalyzeContentResponse} AnalyzeContentResponse instance + */ + AnalyzeContentResponse.create = function create(properties) { + return new AnalyzeContentResponse(properties); + }; + + /** + * Encodes the specified AnalyzeContentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.AnalyzeContentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2.IAnalyzeContentResponse} message AnalyzeContentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyzeContentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.replyText != null && Object.hasOwnProperty.call(message, "replyText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.replyText); + if (message.replyAudio != null && Object.hasOwnProperty.call(message, "replyAudio")) + $root.google.cloud.dialogflow.v2.OutputAudio.encode(message.replyAudio, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.automatedAgentReply != null && Object.hasOwnProperty.call(message, "automatedAgentReply")) + $root.google.cloud.dialogflow.v2.AutomatedAgentReply.encode(message.automatedAgentReply, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.google.cloud.dialogflow.v2.Message.encode(message.message, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.humanAgentSuggestionResults != null && message.humanAgentSuggestionResults.length) + for (var i = 0; i < message.humanAgentSuggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2.SuggestionResult.encode(message.humanAgentSuggestionResults[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.endUserSuggestionResults != null && message.endUserSuggestionResults.length) + for (var i = 0; i < message.endUserSuggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2.SuggestionResult.encode(message.endUserSuggestionResults[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.dtmfParameters != null && Object.hasOwnProperty.call(message, "dtmfParameters")) + $root.google.cloud.dialogflow.v2.DtmfParameters.encode(message.dtmfParameters, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AnalyzeContentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnalyzeContentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2.IAnalyzeContentResponse} message AnalyzeContentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyzeContentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnalyzeContentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AnalyzeContentResponse} AnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyzeContentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AnalyzeContentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.replyText = reader.string(); + break; + } + case 2: { + message.replyAudio = $root.google.cloud.dialogflow.v2.OutputAudio.decode(reader, reader.uint32()); + break; + } + case 3: { + message.automatedAgentReply = $root.google.cloud.dialogflow.v2.AutomatedAgentReply.decode(reader, reader.uint32()); + break; + } + case 5: { + message.message = $root.google.cloud.dialogflow.v2.Message.decode(reader, reader.uint32()); + break; + } + case 6: { + if (!(message.humanAgentSuggestionResults && message.humanAgentSuggestionResults.length)) + message.humanAgentSuggestionResults = []; + message.humanAgentSuggestionResults.push($root.google.cloud.dialogflow.v2.SuggestionResult.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.endUserSuggestionResults && message.endUserSuggestionResults.length)) + message.endUserSuggestionResults = []; + message.endUserSuggestionResults.push($root.google.cloud.dialogflow.v2.SuggestionResult.decode(reader, reader.uint32())); + break; + } + case 9: { + message.dtmfParameters = $root.google.cloud.dialogflow.v2.DtmfParameters.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnalyzeContentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AnalyzeContentResponse} AnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyzeContentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnalyzeContentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnalyzeContentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.replyText != null && message.hasOwnProperty("replyText")) + if (!$util.isString(message.replyText)) + return "replyText: string expected"; + if (message.replyAudio != null && message.hasOwnProperty("replyAudio")) { + var error = $root.google.cloud.dialogflow.v2.OutputAudio.verify(message.replyAudio); + if (error) + return "replyAudio." + error; + } + if (message.automatedAgentReply != null && message.hasOwnProperty("automatedAgentReply")) { + var error = $root.google.cloud.dialogflow.v2.AutomatedAgentReply.verify(message.automatedAgentReply); + if (error) + return "automatedAgentReply." + error; + } + if (message.message != null && message.hasOwnProperty("message")) { + var error = $root.google.cloud.dialogflow.v2.Message.verify(message.message); + if (error) + return "message." + error; + } + if (message.humanAgentSuggestionResults != null && message.hasOwnProperty("humanAgentSuggestionResults")) { + if (!Array.isArray(message.humanAgentSuggestionResults)) + return "humanAgentSuggestionResults: array expected"; + for (var i = 0; i < message.humanAgentSuggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SuggestionResult.verify(message.humanAgentSuggestionResults[i]); + if (error) + return "humanAgentSuggestionResults." + error; + } + } + if (message.endUserSuggestionResults != null && message.hasOwnProperty("endUserSuggestionResults")) { + if (!Array.isArray(message.endUserSuggestionResults)) + return "endUserSuggestionResults: array expected"; + for (var i = 0; i < message.endUserSuggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SuggestionResult.verify(message.endUserSuggestionResults[i]); + if (error) + return "endUserSuggestionResults." + error; + } + } + if (message.dtmfParameters != null && message.hasOwnProperty("dtmfParameters")) { + var error = $root.google.cloud.dialogflow.v2.DtmfParameters.verify(message.dtmfParameters); + if (error) + return "dtmfParameters." + error; + } + return null; + }; + + /** + * Creates an AnalyzeContentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AnalyzeContentResponse} AnalyzeContentResponse + */ + AnalyzeContentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AnalyzeContentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.AnalyzeContentResponse(); + if (object.replyText != null) + message.replyText = String(object.replyText); + if (object.replyAudio != null) { + if (typeof object.replyAudio !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentResponse.replyAudio: object expected"); + message.replyAudio = $root.google.cloud.dialogflow.v2.OutputAudio.fromObject(object.replyAudio); + } + if (object.automatedAgentReply != null) { + if (typeof object.automatedAgentReply !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentResponse.automatedAgentReply: object expected"); + message.automatedAgentReply = $root.google.cloud.dialogflow.v2.AutomatedAgentReply.fromObject(object.automatedAgentReply); + } + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentResponse.message: object expected"); + message.message = $root.google.cloud.dialogflow.v2.Message.fromObject(object.message); + } + if (object.humanAgentSuggestionResults) { + if (!Array.isArray(object.humanAgentSuggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentResponse.humanAgentSuggestionResults: array expected"); + message.humanAgentSuggestionResults = []; + for (var i = 0; i < object.humanAgentSuggestionResults.length; ++i) { + if (typeof object.humanAgentSuggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentResponse.humanAgentSuggestionResults: object expected"); + message.humanAgentSuggestionResults[i] = $root.google.cloud.dialogflow.v2.SuggestionResult.fromObject(object.humanAgentSuggestionResults[i]); + } + } + if (object.endUserSuggestionResults) { + if (!Array.isArray(object.endUserSuggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentResponse.endUserSuggestionResults: array expected"); + message.endUserSuggestionResults = []; + for (var i = 0; i < object.endUserSuggestionResults.length; ++i) { + if (typeof object.endUserSuggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentResponse.endUserSuggestionResults: object expected"); + message.endUserSuggestionResults[i] = $root.google.cloud.dialogflow.v2.SuggestionResult.fromObject(object.endUserSuggestionResults[i]); + } + } + if (object.dtmfParameters != null) { + if (typeof object.dtmfParameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnalyzeContentResponse.dtmfParameters: object expected"); + message.dtmfParameters = $root.google.cloud.dialogflow.v2.DtmfParameters.fromObject(object.dtmfParameters); + } + return message; + }; + + /** + * Creates a plain object from an AnalyzeContentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2.AnalyzeContentResponse} message AnalyzeContentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnalyzeContentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.humanAgentSuggestionResults = []; + object.endUserSuggestionResults = []; + } + if (options.defaults) { + object.replyText = ""; + object.replyAudio = null; + object.automatedAgentReply = null; + object.message = null; + object.dtmfParameters = null; + } + if (message.replyText != null && message.hasOwnProperty("replyText")) + object.replyText = message.replyText; + if (message.replyAudio != null && message.hasOwnProperty("replyAudio")) + object.replyAudio = $root.google.cloud.dialogflow.v2.OutputAudio.toObject(message.replyAudio, options); + if (message.automatedAgentReply != null && message.hasOwnProperty("automatedAgentReply")) + object.automatedAgentReply = $root.google.cloud.dialogflow.v2.AutomatedAgentReply.toObject(message.automatedAgentReply, options); + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.google.cloud.dialogflow.v2.Message.toObject(message.message, options); + if (message.humanAgentSuggestionResults && message.humanAgentSuggestionResults.length) { + object.humanAgentSuggestionResults = []; + for (var j = 0; j < message.humanAgentSuggestionResults.length; ++j) + object.humanAgentSuggestionResults[j] = $root.google.cloud.dialogflow.v2.SuggestionResult.toObject(message.humanAgentSuggestionResults[j], options); + } + if (message.endUserSuggestionResults && message.endUserSuggestionResults.length) { + object.endUserSuggestionResults = []; + for (var j = 0; j < message.endUserSuggestionResults.length; ++j) + object.endUserSuggestionResults[j] = $root.google.cloud.dialogflow.v2.SuggestionResult.toObject(message.endUserSuggestionResults[j], options); + } + if (message.dtmfParameters != null && message.hasOwnProperty("dtmfParameters")) + object.dtmfParameters = $root.google.cloud.dialogflow.v2.DtmfParameters.toObject(message.dtmfParameters, options); + return object; + }; + + /** + * Converts this AnalyzeContentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @instance + * @returns {Object.} JSON object + */ + AnalyzeContentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnalyzeContentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AnalyzeContentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnalyzeContentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AnalyzeContentResponse"; + }; + + return AnalyzeContentResponse; + })(); + + v2.StreamingAnalyzeContentRequest = (function() { + + /** + * Properties of a StreamingAnalyzeContentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IStreamingAnalyzeContentRequest + * @property {string|null} [participant] StreamingAnalyzeContentRequest participant + * @property {google.cloud.dialogflow.v2.IInputAudioConfig|null} [audioConfig] StreamingAnalyzeContentRequest audioConfig + * @property {google.cloud.dialogflow.v2.IInputTextConfig|null} [textConfig] StreamingAnalyzeContentRequest textConfig + * @property {google.cloud.dialogflow.v2.IOutputAudioConfig|null} [replyAudioConfig] StreamingAnalyzeContentRequest replyAudioConfig + * @property {Uint8Array|null} [inputAudio] StreamingAnalyzeContentRequest inputAudio + * @property {string|null} [inputText] StreamingAnalyzeContentRequest inputText + * @property {google.cloud.dialogflow.v2.ITelephonyDtmfEvents|null} [inputDtmf] StreamingAnalyzeContentRequest inputDtmf + * @property {google.cloud.dialogflow.v2.IQueryParameters|null} [queryParams] StreamingAnalyzeContentRequest queryParams + * @property {google.cloud.dialogflow.v2.IAssistQueryParameters|null} [assistQueryParams] StreamingAnalyzeContentRequest assistQueryParams + * @property {google.protobuf.IStruct|null} [cxParameters] StreamingAnalyzeContentRequest cxParameters + * @property {boolean|null} [enablePartialAutomatedAgentReply] StreamingAnalyzeContentRequest enablePartialAutomatedAgentReply + */ + + /** + * Constructs a new StreamingAnalyzeContentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a StreamingAnalyzeContentRequest. + * @implements IStreamingAnalyzeContentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest=} [properties] Properties to set + */ + function StreamingAnalyzeContentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingAnalyzeContentRequest participant. + * @member {string} participant + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.participant = ""; + + /** + * StreamingAnalyzeContentRequest audioConfig. + * @member {google.cloud.dialogflow.v2.IInputAudioConfig|null|undefined} audioConfig + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.audioConfig = null; + + /** + * StreamingAnalyzeContentRequest textConfig. + * @member {google.cloud.dialogflow.v2.IInputTextConfig|null|undefined} textConfig + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.textConfig = null; + + /** + * StreamingAnalyzeContentRequest replyAudioConfig. + * @member {google.cloud.dialogflow.v2.IOutputAudioConfig|null|undefined} replyAudioConfig + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.replyAudioConfig = null; + + /** + * StreamingAnalyzeContentRequest inputAudio. + * @member {Uint8Array|null|undefined} inputAudio + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.inputAudio = null; + + /** + * StreamingAnalyzeContentRequest inputText. + * @member {string|null|undefined} inputText + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.inputText = null; + + /** + * StreamingAnalyzeContentRequest inputDtmf. + * @member {google.cloud.dialogflow.v2.ITelephonyDtmfEvents|null|undefined} inputDtmf + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.inputDtmf = null; + + /** + * StreamingAnalyzeContentRequest queryParams. + * @member {google.cloud.dialogflow.v2.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.queryParams = null; + + /** + * StreamingAnalyzeContentRequest assistQueryParams. + * @member {google.cloud.dialogflow.v2.IAssistQueryParameters|null|undefined} assistQueryParams + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.assistQueryParams = null; + + /** + * StreamingAnalyzeContentRequest cxParameters. + * @member {google.protobuf.IStruct|null|undefined} cxParameters + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.cxParameters = null; + + /** + * StreamingAnalyzeContentRequest enablePartialAutomatedAgentReply. + * @member {boolean} enablePartialAutomatedAgentReply + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.enablePartialAutomatedAgentReply = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * StreamingAnalyzeContentRequest config. + * @member {"audioConfig"|"textConfig"|undefined} config + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + Object.defineProperty(StreamingAnalyzeContentRequest.prototype, "config", { + get: $util.oneOfGetter($oneOfFields = ["audioConfig", "textConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * StreamingAnalyzeContentRequest input. + * @member {"inputAudio"|"inputText"|"inputDtmf"|undefined} input + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + */ + Object.defineProperty(StreamingAnalyzeContentRequest.prototype, "input", { + get: $util.oneOfGetter($oneOfFields = ["inputAudio", "inputText", "inputDtmf"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new StreamingAnalyzeContentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest} StreamingAnalyzeContentRequest instance + */ + StreamingAnalyzeContentRequest.create = function create(properties) { + return new StreamingAnalyzeContentRequest(properties); + }; + + /** + * Encodes the specified StreamingAnalyzeContentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest} message StreamingAnalyzeContentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingAnalyzeContentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.participant); + if (message.audioConfig != null && Object.hasOwnProperty.call(message, "audioConfig")) + $root.google.cloud.dialogflow.v2.InputAudioConfig.encode(message.audioConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.textConfig != null && Object.hasOwnProperty.call(message, "textConfig")) + $root.google.cloud.dialogflow.v2.InputTextConfig.encode(message.textConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.replyAudioConfig != null && Object.hasOwnProperty.call(message, "replyAudioConfig")) + $root.google.cloud.dialogflow.v2.OutputAudioConfig.encode(message.replyAudioConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.inputAudio != null && Object.hasOwnProperty.call(message, "inputAudio")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.inputAudio); + if (message.inputText != null && Object.hasOwnProperty.call(message, "inputText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.inputText); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.v2.QueryParameters.encode(message.queryParams, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.assistQueryParams != null && Object.hasOwnProperty.call(message, "assistQueryParams")) + $root.google.cloud.dialogflow.v2.AssistQueryParameters.encode(message.assistQueryParams, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.inputDtmf != null && Object.hasOwnProperty.call(message, "inputDtmf")) + $root.google.cloud.dialogflow.v2.TelephonyDtmfEvents.encode(message.inputDtmf, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.enablePartialAutomatedAgentReply != null && Object.hasOwnProperty.call(message, "enablePartialAutomatedAgentReply")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.enablePartialAutomatedAgentReply); + if (message.cxParameters != null && Object.hasOwnProperty.call(message, "cxParameters")) + $root.google.protobuf.Struct.encode(message.cxParameters, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingAnalyzeContentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentRequest} message StreamingAnalyzeContentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingAnalyzeContentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingAnalyzeContentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest} StreamingAnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingAnalyzeContentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.participant = reader.string(); + break; + } + case 2: { + message.audioConfig = $root.google.cloud.dialogflow.v2.InputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.textConfig = $root.google.cloud.dialogflow.v2.InputTextConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.replyAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.inputAudio = reader.bytes(); + break; + } + case 6: { + message.inputText = reader.string(); + break; + } + case 9: { + message.inputDtmf = $root.google.cloud.dialogflow.v2.TelephonyDtmfEvents.decode(reader, reader.uint32()); + break; + } + case 7: { + message.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.decode(reader, reader.uint32()); + break; + } + case 8: { + message.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.decode(reader, reader.uint32()); + break; + } + case 13: { + message.cxParameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 12: { + message.enablePartialAutomatedAgentReply = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingAnalyzeContentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest} StreamingAnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingAnalyzeContentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingAnalyzeContentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingAnalyzeContentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { + properties.config = 1; + { + var error = $root.google.cloud.dialogflow.v2.InputAudioConfig.verify(message.audioConfig); + if (error) + return "audioConfig." + error; + } + } + if (message.textConfig != null && message.hasOwnProperty("textConfig")) { + if (properties.config === 1) + return "config: multiple values"; + properties.config = 1; + { + var error = $root.google.cloud.dialogflow.v2.InputTextConfig.verify(message.textConfig); + if (error) + return "textConfig." + error; + } + } + if (message.replyAudioConfig != null && message.hasOwnProperty("replyAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2.OutputAudioConfig.verify(message.replyAudioConfig); + if (error) + return "replyAudioConfig." + error; + } + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) { + properties.input = 1; + if (!(message.inputAudio && typeof message.inputAudio.length === "number" || $util.isString(message.inputAudio))) + return "inputAudio: buffer expected"; + } + if (message.inputText != null && message.hasOwnProperty("inputText")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + if (!$util.isString(message.inputText)) + return "inputText: string expected"; + } + if (message.inputDtmf != null && message.hasOwnProperty("inputDtmf")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2.TelephonyDtmfEvents.verify(message.inputDtmf); + if (error) + return "inputDtmf." + error; + } + } + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.v2.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) { + var error = $root.google.cloud.dialogflow.v2.AssistQueryParameters.verify(message.assistQueryParams); + if (error) + return "assistQueryParams." + error; + } + if (message.cxParameters != null && message.hasOwnProperty("cxParameters")) { + var error = $root.google.protobuf.Struct.verify(message.cxParameters); + if (error) + return "cxParameters." + error; + } + if (message.enablePartialAutomatedAgentReply != null && message.hasOwnProperty("enablePartialAutomatedAgentReply")) + if (typeof message.enablePartialAutomatedAgentReply !== "boolean") + return "enablePartialAutomatedAgentReply: boolean expected"; + return null; + }; + + /** + * Creates a StreamingAnalyzeContentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest} StreamingAnalyzeContentRequest + */ + StreamingAnalyzeContentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest(); + if (object.participant != null) + message.participant = String(object.participant); + if (object.audioConfig != null) { + if (typeof object.audioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.audioConfig: object expected"); + message.audioConfig = $root.google.cloud.dialogflow.v2.InputAudioConfig.fromObject(object.audioConfig); + } + if (object.textConfig != null) { + if (typeof object.textConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.textConfig: object expected"); + message.textConfig = $root.google.cloud.dialogflow.v2.InputTextConfig.fromObject(object.textConfig); + } + if (object.replyAudioConfig != null) { + if (typeof object.replyAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.replyAudioConfig: object expected"); + message.replyAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.fromObject(object.replyAudioConfig); + } + if (object.inputAudio != null) + if (typeof object.inputAudio === "string") + $util.base64.decode(object.inputAudio, message.inputAudio = $util.newBuffer($util.base64.length(object.inputAudio)), 0); + else if (object.inputAudio.length >= 0) + message.inputAudio = object.inputAudio; + if (object.inputText != null) + message.inputText = String(object.inputText); + if (object.inputDtmf != null) { + if (typeof object.inputDtmf !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.inputDtmf: object expected"); + message.inputDtmf = $root.google.cloud.dialogflow.v2.TelephonyDtmfEvents.fromObject(object.inputDtmf); + } + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.fromObject(object.queryParams); + } + if (object.assistQueryParams != null) { + if (typeof object.assistQueryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.assistQueryParams: object expected"); + message.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.fromObject(object.assistQueryParams); + } + if (object.cxParameters != null) { + if (typeof object.cxParameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest.cxParameters: object expected"); + message.cxParameters = $root.google.protobuf.Struct.fromObject(object.cxParameters); + } + if (object.enablePartialAutomatedAgentReply != null) + message.enablePartialAutomatedAgentReply = Boolean(object.enablePartialAutomatedAgentReply); + return message; + }; + + /** + * Creates a plain object from a StreamingAnalyzeContentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest} message StreamingAnalyzeContentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingAnalyzeContentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.participant = ""; + object.replyAudioConfig = null; + object.queryParams = null; + object.assistQueryParams = null; + object.enablePartialAutomatedAgentReply = false; + object.cxParameters = null; + } + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { + object.audioConfig = $root.google.cloud.dialogflow.v2.InputAudioConfig.toObject(message.audioConfig, options); + if (options.oneofs) + object.config = "audioConfig"; + } + if (message.textConfig != null && message.hasOwnProperty("textConfig")) { + object.textConfig = $root.google.cloud.dialogflow.v2.InputTextConfig.toObject(message.textConfig, options); + if (options.oneofs) + object.config = "textConfig"; + } + if (message.replyAudioConfig != null && message.hasOwnProperty("replyAudioConfig")) + object.replyAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.toObject(message.replyAudioConfig, options); + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) { + object.inputAudio = options.bytes === String ? $util.base64.encode(message.inputAudio, 0, message.inputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.inputAudio) : message.inputAudio; + if (options.oneofs) + object.input = "inputAudio"; + } + if (message.inputText != null && message.hasOwnProperty("inputText")) { + object.inputText = message.inputText; + if (options.oneofs) + object.input = "inputText"; + } + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.toObject(message.queryParams, options); + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) + object.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.toObject(message.assistQueryParams, options); + if (message.inputDtmf != null && message.hasOwnProperty("inputDtmf")) { + object.inputDtmf = $root.google.cloud.dialogflow.v2.TelephonyDtmfEvents.toObject(message.inputDtmf, options); + if (options.oneofs) + object.input = "inputDtmf"; + } + if (message.enablePartialAutomatedAgentReply != null && message.hasOwnProperty("enablePartialAutomatedAgentReply")) + object.enablePartialAutomatedAgentReply = message.enablePartialAutomatedAgentReply; + if (message.cxParameters != null && message.hasOwnProperty("cxParameters")) + object.cxParameters = $root.google.protobuf.Struct.toObject(message.cxParameters, options); + return object; + }; + + /** + * Converts this StreamingAnalyzeContentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @instance + * @returns {Object.} JSON object + */ + StreamingAnalyzeContentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingAnalyzeContentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingAnalyzeContentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest"; + }; + + return StreamingAnalyzeContentRequest; + })(); + + v2.StreamingAnalyzeContentResponse = (function() { + + /** + * Properties of a StreamingAnalyzeContentResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IStreamingAnalyzeContentResponse + * @property {google.cloud.dialogflow.v2.IStreamingRecognitionResult|null} [recognitionResult] StreamingAnalyzeContentResponse recognitionResult + * @property {string|null} [replyText] StreamingAnalyzeContentResponse replyText + * @property {google.cloud.dialogflow.v2.IOutputAudio|null} [replyAudio] StreamingAnalyzeContentResponse replyAudio + * @property {google.cloud.dialogflow.v2.IAutomatedAgentReply|null} [automatedAgentReply] StreamingAnalyzeContentResponse automatedAgentReply + * @property {google.cloud.dialogflow.v2.IMessage|null} [message] StreamingAnalyzeContentResponse message + * @property {Array.|null} [humanAgentSuggestionResults] StreamingAnalyzeContentResponse humanAgentSuggestionResults + * @property {Array.|null} [endUserSuggestionResults] StreamingAnalyzeContentResponse endUserSuggestionResults + * @property {google.cloud.dialogflow.v2.IDtmfParameters|null} [dtmfParameters] StreamingAnalyzeContentResponse dtmfParameters + */ + + /** + * Constructs a new StreamingAnalyzeContentResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a StreamingAnalyzeContentResponse. + * @implements IStreamingAnalyzeContentResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentResponse=} [properties] Properties to set + */ + function StreamingAnalyzeContentResponse(properties) { + this.humanAgentSuggestionResults = []; + this.endUserSuggestionResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingAnalyzeContentResponse recognitionResult. + * @member {google.cloud.dialogflow.v2.IStreamingRecognitionResult|null|undefined} recognitionResult + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.recognitionResult = null; + + /** + * StreamingAnalyzeContentResponse replyText. + * @member {string} replyText + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.replyText = ""; + + /** + * StreamingAnalyzeContentResponse replyAudio. + * @member {google.cloud.dialogflow.v2.IOutputAudio|null|undefined} replyAudio + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.replyAudio = null; + + /** + * StreamingAnalyzeContentResponse automatedAgentReply. + * @member {google.cloud.dialogflow.v2.IAutomatedAgentReply|null|undefined} automatedAgentReply + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.automatedAgentReply = null; + + /** + * StreamingAnalyzeContentResponse message. + * @member {google.cloud.dialogflow.v2.IMessage|null|undefined} message + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.message = null; + + /** + * StreamingAnalyzeContentResponse humanAgentSuggestionResults. + * @member {Array.} humanAgentSuggestionResults + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.humanAgentSuggestionResults = $util.emptyArray; + + /** + * StreamingAnalyzeContentResponse endUserSuggestionResults. + * @member {Array.} endUserSuggestionResults + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.endUserSuggestionResults = $util.emptyArray; + + /** + * StreamingAnalyzeContentResponse dtmfParameters. + * @member {google.cloud.dialogflow.v2.IDtmfParameters|null|undefined} dtmfParameters + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.dtmfParameters = null; + + /** + * Creates a new StreamingAnalyzeContentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse} StreamingAnalyzeContentResponse instance + */ + StreamingAnalyzeContentResponse.create = function create(properties) { + return new StreamingAnalyzeContentResponse(properties); + }; + + /** + * Encodes the specified StreamingAnalyzeContentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentResponse} message StreamingAnalyzeContentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingAnalyzeContentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recognitionResult != null && Object.hasOwnProperty.call(message, "recognitionResult")) + $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.encode(message.recognitionResult, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.replyText != null && Object.hasOwnProperty.call(message, "replyText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.replyText); + if (message.replyAudio != null && Object.hasOwnProperty.call(message, "replyAudio")) + $root.google.cloud.dialogflow.v2.OutputAudio.encode(message.replyAudio, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.automatedAgentReply != null && Object.hasOwnProperty.call(message, "automatedAgentReply")) + $root.google.cloud.dialogflow.v2.AutomatedAgentReply.encode(message.automatedAgentReply, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.google.cloud.dialogflow.v2.Message.encode(message.message, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.humanAgentSuggestionResults != null && message.humanAgentSuggestionResults.length) + for (var i = 0; i < message.humanAgentSuggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2.SuggestionResult.encode(message.humanAgentSuggestionResults[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.endUserSuggestionResults != null && message.endUserSuggestionResults.length) + for (var i = 0; i < message.endUserSuggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2.SuggestionResult.encode(message.endUserSuggestionResults[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.dtmfParameters != null && Object.hasOwnProperty.call(message, "dtmfParameters")) + $root.google.cloud.dialogflow.v2.DtmfParameters.encode(message.dtmfParameters, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingAnalyzeContentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2.IStreamingAnalyzeContentResponse} message StreamingAnalyzeContentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingAnalyzeContentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingAnalyzeContentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse} StreamingAnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingAnalyzeContentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.recognitionResult = $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.decode(reader, reader.uint32()); + break; + } + case 2: { + message.replyText = reader.string(); + break; + } + case 3: { + message.replyAudio = $root.google.cloud.dialogflow.v2.OutputAudio.decode(reader, reader.uint32()); + break; + } + case 4: { + message.automatedAgentReply = $root.google.cloud.dialogflow.v2.AutomatedAgentReply.decode(reader, reader.uint32()); + break; + } + case 6: { + message.message = $root.google.cloud.dialogflow.v2.Message.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.humanAgentSuggestionResults && message.humanAgentSuggestionResults.length)) + message.humanAgentSuggestionResults = []; + message.humanAgentSuggestionResults.push($root.google.cloud.dialogflow.v2.SuggestionResult.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.endUserSuggestionResults && message.endUserSuggestionResults.length)) + message.endUserSuggestionResults = []; + message.endUserSuggestionResults.push($root.google.cloud.dialogflow.v2.SuggestionResult.decode(reader, reader.uint32())); + break; + } + case 10: { + message.dtmfParameters = $root.google.cloud.dialogflow.v2.DtmfParameters.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingAnalyzeContentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse} StreamingAnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingAnalyzeContentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingAnalyzeContentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingAnalyzeContentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) { + var error = $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.verify(message.recognitionResult); + if (error) + return "recognitionResult." + error; + } + if (message.replyText != null && message.hasOwnProperty("replyText")) + if (!$util.isString(message.replyText)) + return "replyText: string expected"; + if (message.replyAudio != null && message.hasOwnProperty("replyAudio")) { + var error = $root.google.cloud.dialogflow.v2.OutputAudio.verify(message.replyAudio); + if (error) + return "replyAudio." + error; + } + if (message.automatedAgentReply != null && message.hasOwnProperty("automatedAgentReply")) { + var error = $root.google.cloud.dialogflow.v2.AutomatedAgentReply.verify(message.automatedAgentReply); + if (error) + return "automatedAgentReply." + error; + } + if (message.message != null && message.hasOwnProperty("message")) { + var error = $root.google.cloud.dialogflow.v2.Message.verify(message.message); + if (error) + return "message." + error; + } + if (message.humanAgentSuggestionResults != null && message.hasOwnProperty("humanAgentSuggestionResults")) { + if (!Array.isArray(message.humanAgentSuggestionResults)) + return "humanAgentSuggestionResults: array expected"; + for (var i = 0; i < message.humanAgentSuggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SuggestionResult.verify(message.humanAgentSuggestionResults[i]); + if (error) + return "humanAgentSuggestionResults." + error; + } + } + if (message.endUserSuggestionResults != null && message.hasOwnProperty("endUserSuggestionResults")) { + if (!Array.isArray(message.endUserSuggestionResults)) + return "endUserSuggestionResults: array expected"; + for (var i = 0; i < message.endUserSuggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SuggestionResult.verify(message.endUserSuggestionResults[i]); + if (error) + return "endUserSuggestionResults." + error; + } + } + if (message.dtmfParameters != null && message.hasOwnProperty("dtmfParameters")) { + var error = $root.google.cloud.dialogflow.v2.DtmfParameters.verify(message.dtmfParameters); + if (error) + return "dtmfParameters." + error; + } + return null; + }; + + /** + * Creates a StreamingAnalyzeContentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse} StreamingAnalyzeContentResponse + */ + StreamingAnalyzeContentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse(); + if (object.recognitionResult != null) { + if (typeof object.recognitionResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.recognitionResult: object expected"); + message.recognitionResult = $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.fromObject(object.recognitionResult); + } + if (object.replyText != null) + message.replyText = String(object.replyText); + if (object.replyAudio != null) { + if (typeof object.replyAudio !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.replyAudio: object expected"); + message.replyAudio = $root.google.cloud.dialogflow.v2.OutputAudio.fromObject(object.replyAudio); + } + if (object.automatedAgentReply != null) { + if (typeof object.automatedAgentReply !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.automatedAgentReply: object expected"); + message.automatedAgentReply = $root.google.cloud.dialogflow.v2.AutomatedAgentReply.fromObject(object.automatedAgentReply); + } + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.message: object expected"); + message.message = $root.google.cloud.dialogflow.v2.Message.fromObject(object.message); + } + if (object.humanAgentSuggestionResults) { + if (!Array.isArray(object.humanAgentSuggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.humanAgentSuggestionResults: array expected"); + message.humanAgentSuggestionResults = []; + for (var i = 0; i < object.humanAgentSuggestionResults.length; ++i) { + if (typeof object.humanAgentSuggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.humanAgentSuggestionResults: object expected"); + message.humanAgentSuggestionResults[i] = $root.google.cloud.dialogflow.v2.SuggestionResult.fromObject(object.humanAgentSuggestionResults[i]); + } + } + if (object.endUserSuggestionResults) { + if (!Array.isArray(object.endUserSuggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.endUserSuggestionResults: array expected"); + message.endUserSuggestionResults = []; + for (var i = 0; i < object.endUserSuggestionResults.length; ++i) { + if (typeof object.endUserSuggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.endUserSuggestionResults: object expected"); + message.endUserSuggestionResults[i] = $root.google.cloud.dialogflow.v2.SuggestionResult.fromObject(object.endUserSuggestionResults[i]); + } + } + if (object.dtmfParameters != null) { + if (typeof object.dtmfParameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse.dtmfParameters: object expected"); + message.dtmfParameters = $root.google.cloud.dialogflow.v2.DtmfParameters.fromObject(object.dtmfParameters); + } + return message; + }; + + /** + * Creates a plain object from a StreamingAnalyzeContentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse} message StreamingAnalyzeContentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingAnalyzeContentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.humanAgentSuggestionResults = []; + object.endUserSuggestionResults = []; + } + if (options.defaults) { + object.recognitionResult = null; + object.replyText = ""; + object.replyAudio = null; + object.automatedAgentReply = null; + object.message = null; + object.dtmfParameters = null; + } + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) + object.recognitionResult = $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.toObject(message.recognitionResult, options); + if (message.replyText != null && message.hasOwnProperty("replyText")) + object.replyText = message.replyText; + if (message.replyAudio != null && message.hasOwnProperty("replyAudio")) + object.replyAudio = $root.google.cloud.dialogflow.v2.OutputAudio.toObject(message.replyAudio, options); + if (message.automatedAgentReply != null && message.hasOwnProperty("automatedAgentReply")) + object.automatedAgentReply = $root.google.cloud.dialogflow.v2.AutomatedAgentReply.toObject(message.automatedAgentReply, options); + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.google.cloud.dialogflow.v2.Message.toObject(message.message, options); + if (message.humanAgentSuggestionResults && message.humanAgentSuggestionResults.length) { + object.humanAgentSuggestionResults = []; + for (var j = 0; j < message.humanAgentSuggestionResults.length; ++j) + object.humanAgentSuggestionResults[j] = $root.google.cloud.dialogflow.v2.SuggestionResult.toObject(message.humanAgentSuggestionResults[j], options); + } + if (message.endUserSuggestionResults && message.endUserSuggestionResults.length) { + object.endUserSuggestionResults = []; + for (var j = 0; j < message.endUserSuggestionResults.length; ++j) + object.endUserSuggestionResults[j] = $root.google.cloud.dialogflow.v2.SuggestionResult.toObject(message.endUserSuggestionResults[j], options); + } + if (message.dtmfParameters != null && message.hasOwnProperty("dtmfParameters")) + object.dtmfParameters = $root.google.cloud.dialogflow.v2.DtmfParameters.toObject(message.dtmfParameters, options); + return object; + }; + + /** + * Converts this StreamingAnalyzeContentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @instance + * @returns {Object.} JSON object + */ + StreamingAnalyzeContentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingAnalyzeContentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingAnalyzeContentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse"; + }; + + return StreamingAnalyzeContentResponse; + })(); + + v2.SuggestArticlesRequest = (function() { + + /** + * Properties of a SuggestArticlesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ISuggestArticlesRequest + * @property {string|null} [parent] SuggestArticlesRequest parent + * @property {string|null} [latestMessage] SuggestArticlesRequest latestMessage + * @property {number|null} [contextSize] SuggestArticlesRequest contextSize + * @property {google.cloud.dialogflow.v2.IAssistQueryParameters|null} [assistQueryParams] SuggestArticlesRequest assistQueryParams + */ + + /** + * Constructs a new SuggestArticlesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SuggestArticlesRequest. + * @implements ISuggestArticlesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ISuggestArticlesRequest=} [properties] Properties to set + */ + function SuggestArticlesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestArticlesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @instance + */ + SuggestArticlesRequest.prototype.parent = ""; + + /** + * SuggestArticlesRequest latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @instance + */ + SuggestArticlesRequest.prototype.latestMessage = ""; + + /** + * SuggestArticlesRequest contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @instance + */ + SuggestArticlesRequest.prototype.contextSize = 0; + + /** + * SuggestArticlesRequest assistQueryParams. + * @member {google.cloud.dialogflow.v2.IAssistQueryParameters|null|undefined} assistQueryParams + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @instance + */ + SuggestArticlesRequest.prototype.assistQueryParams = null; + + /** + * Creates a new SuggestArticlesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @static + * @param {google.cloud.dialogflow.v2.ISuggestArticlesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SuggestArticlesRequest} SuggestArticlesRequest instance + */ + SuggestArticlesRequest.create = function create(properties) { + return new SuggestArticlesRequest(properties); + }; + + /** + * Encodes the specified SuggestArticlesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestArticlesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @static + * @param {google.cloud.dialogflow.v2.ISuggestArticlesRequest} message SuggestArticlesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestArticlesRequest.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.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + if (message.assistQueryParams != null && Object.hasOwnProperty.call(message, "assistQueryParams")) + $root.google.cloud.dialogflow.v2.AssistQueryParameters.encode(message.assistQueryParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestArticlesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestArticlesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @static + * @param {google.cloud.dialogflow.v2.ISuggestArticlesRequest} message SuggestArticlesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestArticlesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestArticlesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SuggestArticlesRequest} SuggestArticlesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestArticlesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SuggestArticlesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + case 4: { + message.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestArticlesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SuggestArticlesRequest} SuggestArticlesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestArticlesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestArticlesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestArticlesRequest.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.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) { + var error = $root.google.cloud.dialogflow.v2.AssistQueryParameters.verify(message.assistQueryParams); + if (error) + return "assistQueryParams." + error; + } + return null; + }; + + /** + * Creates a SuggestArticlesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SuggestArticlesRequest} SuggestArticlesRequest + */ + SuggestArticlesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SuggestArticlesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.SuggestArticlesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + if (object.assistQueryParams != null) { + if (typeof object.assistQueryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestArticlesRequest.assistQueryParams: object expected"); + message.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.fromObject(object.assistQueryParams); + } + return message; + }; + + /** + * Creates a plain object from a SuggestArticlesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @static + * @param {google.cloud.dialogflow.v2.SuggestArticlesRequest} message SuggestArticlesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestArticlesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.latestMessage = ""; + object.contextSize = 0; + object.assistQueryParams = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) + object.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.toObject(message.assistQueryParams, options); + return object; + }; + + /** + * Converts this SuggestArticlesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @instance + * @returns {Object.} JSON object + */ + SuggestArticlesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestArticlesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SuggestArticlesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestArticlesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SuggestArticlesRequest"; + }; + + return SuggestArticlesRequest; + })(); + + v2.SuggestArticlesResponse = (function() { + + /** + * Properties of a SuggestArticlesResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface ISuggestArticlesResponse + * @property {Array.|null} [articleAnswers] SuggestArticlesResponse articleAnswers + * @property {string|null} [latestMessage] SuggestArticlesResponse latestMessage + * @property {number|null} [contextSize] SuggestArticlesResponse contextSize + */ + + /** + * Constructs a new SuggestArticlesResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SuggestArticlesResponse. + * @implements ISuggestArticlesResponse + * @constructor + * @param {google.cloud.dialogflow.v2.ISuggestArticlesResponse=} [properties] Properties to set + */ + function SuggestArticlesResponse(properties) { + this.articleAnswers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestArticlesResponse articleAnswers. + * @member {Array.} articleAnswers + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @instance + */ + SuggestArticlesResponse.prototype.articleAnswers = $util.emptyArray; + + /** + * SuggestArticlesResponse latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @instance + */ + SuggestArticlesResponse.prototype.latestMessage = ""; + + /** + * SuggestArticlesResponse contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @instance + */ + SuggestArticlesResponse.prototype.contextSize = 0; + + /** + * Creates a new SuggestArticlesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @static + * @param {google.cloud.dialogflow.v2.ISuggestArticlesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SuggestArticlesResponse} SuggestArticlesResponse instance + */ + SuggestArticlesResponse.create = function create(properties) { + return new SuggestArticlesResponse(properties); + }; + + /** + * Encodes the specified SuggestArticlesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestArticlesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @static + * @param {google.cloud.dialogflow.v2.ISuggestArticlesResponse} message SuggestArticlesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestArticlesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.articleAnswers != null && message.articleAnswers.length) + for (var i = 0; i < message.articleAnswers.length; ++i) + $root.google.cloud.dialogflow.v2.ArticleAnswer.encode(message.articleAnswers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified SuggestArticlesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestArticlesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @static + * @param {google.cloud.dialogflow.v2.ISuggestArticlesResponse} message SuggestArticlesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestArticlesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestArticlesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SuggestArticlesResponse} SuggestArticlesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestArticlesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SuggestArticlesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.articleAnswers && message.articleAnswers.length)) + message.articleAnswers = []; + message.articleAnswers.push($root.google.cloud.dialogflow.v2.ArticleAnswer.decode(reader, reader.uint32())); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestArticlesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SuggestArticlesResponse} SuggestArticlesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestArticlesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestArticlesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestArticlesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.articleAnswers != null && message.hasOwnProperty("articleAnswers")) { + if (!Array.isArray(message.articleAnswers)) + return "articleAnswers: array expected"; + for (var i = 0; i < message.articleAnswers.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.ArticleAnswer.verify(message.articleAnswers[i]); + if (error) + return "articleAnswers." + error; + } + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestArticlesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SuggestArticlesResponse} SuggestArticlesResponse + */ + SuggestArticlesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SuggestArticlesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.SuggestArticlesResponse(); + if (object.articleAnswers) { + if (!Array.isArray(object.articleAnswers)) + throw TypeError(".google.cloud.dialogflow.v2.SuggestArticlesResponse.articleAnswers: array expected"); + message.articleAnswers = []; + for (var i = 0; i < object.articleAnswers.length; ++i) { + if (typeof object.articleAnswers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestArticlesResponse.articleAnswers: object expected"); + message.articleAnswers[i] = $root.google.cloud.dialogflow.v2.ArticleAnswer.fromObject(object.articleAnswers[i]); + } + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestArticlesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @static + * @param {google.cloud.dialogflow.v2.SuggestArticlesResponse} message SuggestArticlesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestArticlesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.articleAnswers = []; + if (options.defaults) { + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.articleAnswers && message.articleAnswers.length) { + object.articleAnswers = []; + for (var j = 0; j < message.articleAnswers.length; ++j) + object.articleAnswers[j] = $root.google.cloud.dialogflow.v2.ArticleAnswer.toObject(message.articleAnswers[j], options); + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this SuggestArticlesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @instance + * @returns {Object.} JSON object + */ + SuggestArticlesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestArticlesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SuggestArticlesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestArticlesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SuggestArticlesResponse"; + }; + + return SuggestArticlesResponse; + })(); + + v2.SuggestFaqAnswersRequest = (function() { + + /** + * Properties of a SuggestFaqAnswersRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ISuggestFaqAnswersRequest + * @property {string|null} [parent] SuggestFaqAnswersRequest parent + * @property {string|null} [latestMessage] SuggestFaqAnswersRequest latestMessage + * @property {number|null} [contextSize] SuggestFaqAnswersRequest contextSize + * @property {google.cloud.dialogflow.v2.IAssistQueryParameters|null} [assistQueryParams] SuggestFaqAnswersRequest assistQueryParams + */ + + /** + * Constructs a new SuggestFaqAnswersRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SuggestFaqAnswersRequest. + * @implements ISuggestFaqAnswersRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest=} [properties] Properties to set + */ + function SuggestFaqAnswersRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestFaqAnswersRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @instance + */ + SuggestFaqAnswersRequest.prototype.parent = ""; + + /** + * SuggestFaqAnswersRequest latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @instance + */ + SuggestFaqAnswersRequest.prototype.latestMessage = ""; + + /** + * SuggestFaqAnswersRequest contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @instance + */ + SuggestFaqAnswersRequest.prototype.contextSize = 0; + + /** + * SuggestFaqAnswersRequest assistQueryParams. + * @member {google.cloud.dialogflow.v2.IAssistQueryParameters|null|undefined} assistQueryParams + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @instance + */ + SuggestFaqAnswersRequest.prototype.assistQueryParams = null; + + /** + * Creates a new SuggestFaqAnswersRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @static + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SuggestFaqAnswersRequest} SuggestFaqAnswersRequest instance + */ + SuggestFaqAnswersRequest.create = function create(properties) { + return new SuggestFaqAnswersRequest(properties); + }; + + /** + * Encodes the specified SuggestFaqAnswersRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @static + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest} message SuggestFaqAnswersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestFaqAnswersRequest.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.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + if (message.assistQueryParams != null && Object.hasOwnProperty.call(message, "assistQueryParams")) + $root.google.cloud.dialogflow.v2.AssistQueryParameters.encode(message.assistQueryParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestFaqAnswersRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @static + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest} message SuggestFaqAnswersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestFaqAnswersRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestFaqAnswersRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SuggestFaqAnswersRequest} SuggestFaqAnswersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestFaqAnswersRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + case 4: { + message.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestFaqAnswersRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SuggestFaqAnswersRequest} SuggestFaqAnswersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestFaqAnswersRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestFaqAnswersRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestFaqAnswersRequest.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.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) { + var error = $root.google.cloud.dialogflow.v2.AssistQueryParameters.verify(message.assistQueryParams); + if (error) + return "assistQueryParams." + error; + } + return null; + }; + + /** + * Creates a SuggestFaqAnswersRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SuggestFaqAnswersRequest} SuggestFaqAnswersRequest + */ + SuggestFaqAnswersRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + if (object.assistQueryParams != null) { + if (typeof object.assistQueryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestFaqAnswersRequest.assistQueryParams: object expected"); + message.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.fromObject(object.assistQueryParams); + } + return message; + }; + + /** + * Creates a plain object from a SuggestFaqAnswersRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @static + * @param {google.cloud.dialogflow.v2.SuggestFaqAnswersRequest} message SuggestFaqAnswersRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestFaqAnswersRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.latestMessage = ""; + object.contextSize = 0; + object.assistQueryParams = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) + object.assistQueryParams = $root.google.cloud.dialogflow.v2.AssistQueryParameters.toObject(message.assistQueryParams, options); + return object; + }; + + /** + * Converts this SuggestFaqAnswersRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @instance + * @returns {Object.} JSON object + */ + SuggestFaqAnswersRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestFaqAnswersRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestFaqAnswersRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SuggestFaqAnswersRequest"; + }; + + return SuggestFaqAnswersRequest; + })(); + + v2.SuggestFaqAnswersResponse = (function() { + + /** + * Properties of a SuggestFaqAnswersResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface ISuggestFaqAnswersResponse + * @property {Array.|null} [faqAnswers] SuggestFaqAnswersResponse faqAnswers + * @property {string|null} [latestMessage] SuggestFaqAnswersResponse latestMessage + * @property {number|null} [contextSize] SuggestFaqAnswersResponse contextSize + */ + + /** + * Constructs a new SuggestFaqAnswersResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SuggestFaqAnswersResponse. + * @implements ISuggestFaqAnswersResponse + * @constructor + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse=} [properties] Properties to set + */ + function SuggestFaqAnswersResponse(properties) { + this.faqAnswers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestFaqAnswersResponse faqAnswers. + * @member {Array.} faqAnswers + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @instance + */ + SuggestFaqAnswersResponse.prototype.faqAnswers = $util.emptyArray; + + /** + * SuggestFaqAnswersResponse latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @instance + */ + SuggestFaqAnswersResponse.prototype.latestMessage = ""; + + /** + * SuggestFaqAnswersResponse contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @instance + */ + SuggestFaqAnswersResponse.prototype.contextSize = 0; + + /** + * Creates a new SuggestFaqAnswersResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @static + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SuggestFaqAnswersResponse} SuggestFaqAnswersResponse instance + */ + SuggestFaqAnswersResponse.create = function create(properties) { + return new SuggestFaqAnswersResponse(properties); + }; + + /** + * Encodes the specified SuggestFaqAnswersResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @static + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse} message SuggestFaqAnswersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestFaqAnswersResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.faqAnswers != null && message.faqAnswers.length) + for (var i = 0; i < message.faqAnswers.length; ++i) + $root.google.cloud.dialogflow.v2.FaqAnswer.encode(message.faqAnswers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified SuggestFaqAnswersResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @static + * @param {google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse} message SuggestFaqAnswersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestFaqAnswersResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestFaqAnswersResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SuggestFaqAnswersResponse} SuggestFaqAnswersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestFaqAnswersResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.faqAnswers && message.faqAnswers.length)) + message.faqAnswers = []; + message.faqAnswers.push($root.google.cloud.dialogflow.v2.FaqAnswer.decode(reader, reader.uint32())); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestFaqAnswersResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SuggestFaqAnswersResponse} SuggestFaqAnswersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestFaqAnswersResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestFaqAnswersResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestFaqAnswersResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.faqAnswers != null && message.hasOwnProperty("faqAnswers")) { + if (!Array.isArray(message.faqAnswers)) + return "faqAnswers: array expected"; + for (var i = 0; i < message.faqAnswers.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.FaqAnswer.verify(message.faqAnswers[i]); + if (error) + return "faqAnswers." + error; + } + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestFaqAnswersResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SuggestFaqAnswersResponse} SuggestFaqAnswersResponse + */ + SuggestFaqAnswersResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse(); + if (object.faqAnswers) { + if (!Array.isArray(object.faqAnswers)) + throw TypeError(".google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.faqAnswers: array expected"); + message.faqAnswers = []; + for (var i = 0; i < object.faqAnswers.length; ++i) { + if (typeof object.faqAnswers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.faqAnswers: object expected"); + message.faqAnswers[i] = $root.google.cloud.dialogflow.v2.FaqAnswer.fromObject(object.faqAnswers[i]); + } + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestFaqAnswersResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @static + * @param {google.cloud.dialogflow.v2.SuggestFaqAnswersResponse} message SuggestFaqAnswersResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestFaqAnswersResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.faqAnswers = []; + if (options.defaults) { + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.faqAnswers && message.faqAnswers.length) { + object.faqAnswers = []; + for (var j = 0; j < message.faqAnswers.length; ++j) + object.faqAnswers[j] = $root.google.cloud.dialogflow.v2.FaqAnswer.toObject(message.faqAnswers[j], options); + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this SuggestFaqAnswersResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @instance + * @returns {Object.} JSON object + */ + SuggestFaqAnswersResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestFaqAnswersResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SuggestFaqAnswersResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestFaqAnswersResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SuggestFaqAnswersResponse"; + }; + + return SuggestFaqAnswersResponse; + })(); + + v2.SuggestSmartRepliesRequest = (function() { + + /** + * Properties of a SuggestSmartRepliesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ISuggestSmartRepliesRequest + * @property {string|null} [parent] SuggestSmartRepliesRequest parent + * @property {google.cloud.dialogflow.v2.ITextInput|null} [currentTextInput] SuggestSmartRepliesRequest currentTextInput + * @property {string|null} [latestMessage] SuggestSmartRepliesRequest latestMessage + * @property {number|null} [contextSize] SuggestSmartRepliesRequest contextSize + */ + + /** + * Constructs a new SuggestSmartRepliesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SuggestSmartRepliesRequest. + * @implements ISuggestSmartRepliesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest=} [properties] Properties to set + */ + function SuggestSmartRepliesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestSmartRepliesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @instance + */ + SuggestSmartRepliesRequest.prototype.parent = ""; + + /** + * SuggestSmartRepliesRequest currentTextInput. + * @member {google.cloud.dialogflow.v2.ITextInput|null|undefined} currentTextInput + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @instance + */ + SuggestSmartRepliesRequest.prototype.currentTextInput = null; + + /** + * SuggestSmartRepliesRequest latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @instance + */ + SuggestSmartRepliesRequest.prototype.latestMessage = ""; + + /** + * SuggestSmartRepliesRequest contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @instance + */ + SuggestSmartRepliesRequest.prototype.contextSize = 0; + + /** + * Creates a new SuggestSmartRepliesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @static + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SuggestSmartRepliesRequest} SuggestSmartRepliesRequest instance + */ + SuggestSmartRepliesRequest.create = function create(properties) { + return new SuggestSmartRepliesRequest(properties); + }; + + /** + * Encodes the specified SuggestSmartRepliesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @static + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest} message SuggestSmartRepliesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestSmartRepliesRequest.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.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + if (message.currentTextInput != null && Object.hasOwnProperty.call(message, "currentTextInput")) + $root.google.cloud.dialogflow.v2.TextInput.encode(message.currentTextInput, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestSmartRepliesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @static + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest} message SuggestSmartRepliesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestSmartRepliesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestSmartRepliesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SuggestSmartRepliesRequest} SuggestSmartRepliesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestSmartRepliesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 4: { + message.currentTextInput = $root.google.cloud.dialogflow.v2.TextInput.decode(reader, reader.uint32()); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestSmartRepliesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SuggestSmartRepliesRequest} SuggestSmartRepliesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestSmartRepliesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestSmartRepliesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestSmartRepliesRequest.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.currentTextInput != null && message.hasOwnProperty("currentTextInput")) { + var error = $root.google.cloud.dialogflow.v2.TextInput.verify(message.currentTextInput); + if (error) + return "currentTextInput." + error; + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestSmartRepliesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SuggestSmartRepliesRequest} SuggestSmartRepliesRequest + */ + SuggestSmartRepliesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.currentTextInput != null) { + if (typeof object.currentTextInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestSmartRepliesRequest.currentTextInput: object expected"); + message.currentTextInput = $root.google.cloud.dialogflow.v2.TextInput.fromObject(object.currentTextInput); + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestSmartRepliesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @static + * @param {google.cloud.dialogflow.v2.SuggestSmartRepliesRequest} message SuggestSmartRepliesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestSmartRepliesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.latestMessage = ""; + object.contextSize = 0; + object.currentTextInput = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + if (message.currentTextInput != null && message.hasOwnProperty("currentTextInput")) + object.currentTextInput = $root.google.cloud.dialogflow.v2.TextInput.toObject(message.currentTextInput, options); + return object; + }; + + /** + * Converts this SuggestSmartRepliesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @instance + * @returns {Object.} JSON object + */ + SuggestSmartRepliesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestSmartRepliesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestSmartRepliesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SuggestSmartRepliesRequest"; + }; + + return SuggestSmartRepliesRequest; + })(); + + v2.SuggestSmartRepliesResponse = (function() { + + /** + * Properties of a SuggestSmartRepliesResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface ISuggestSmartRepliesResponse + * @property {Array.|null} [smartReplyAnswers] SuggestSmartRepliesResponse smartReplyAnswers + * @property {string|null} [latestMessage] SuggestSmartRepliesResponse latestMessage + * @property {number|null} [contextSize] SuggestSmartRepliesResponse contextSize + */ + + /** + * Constructs a new SuggestSmartRepliesResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SuggestSmartRepliesResponse. + * @implements ISuggestSmartRepliesResponse + * @constructor + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse=} [properties] Properties to set + */ + function SuggestSmartRepliesResponse(properties) { + this.smartReplyAnswers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestSmartRepliesResponse smartReplyAnswers. + * @member {Array.} smartReplyAnswers + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @instance + */ + SuggestSmartRepliesResponse.prototype.smartReplyAnswers = $util.emptyArray; + + /** + * SuggestSmartRepliesResponse latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @instance + */ + SuggestSmartRepliesResponse.prototype.latestMessage = ""; + + /** + * SuggestSmartRepliesResponse contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @instance + */ + SuggestSmartRepliesResponse.prototype.contextSize = 0; + + /** + * Creates a new SuggestSmartRepliesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @static + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SuggestSmartRepliesResponse} SuggestSmartRepliesResponse instance + */ + SuggestSmartRepliesResponse.create = function create(properties) { + return new SuggestSmartRepliesResponse(properties); + }; + + /** + * Encodes the specified SuggestSmartRepliesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @static + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse} message SuggestSmartRepliesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestSmartRepliesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.smartReplyAnswers != null && message.smartReplyAnswers.length) + for (var i = 0; i < message.smartReplyAnswers.length; ++i) + $root.google.cloud.dialogflow.v2.SmartReplyAnswer.encode(message.smartReplyAnswers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified SuggestSmartRepliesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @static + * @param {google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse} message SuggestSmartRepliesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestSmartRepliesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestSmartRepliesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SuggestSmartRepliesResponse} SuggestSmartRepliesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestSmartRepliesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.smartReplyAnswers && message.smartReplyAnswers.length)) + message.smartReplyAnswers = []; + message.smartReplyAnswers.push($root.google.cloud.dialogflow.v2.SmartReplyAnswer.decode(reader, reader.uint32())); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestSmartRepliesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SuggestSmartRepliesResponse} SuggestSmartRepliesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestSmartRepliesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestSmartRepliesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestSmartRepliesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.smartReplyAnswers != null && message.hasOwnProperty("smartReplyAnswers")) { + if (!Array.isArray(message.smartReplyAnswers)) + return "smartReplyAnswers: array expected"; + for (var i = 0; i < message.smartReplyAnswers.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SmartReplyAnswer.verify(message.smartReplyAnswers[i]); + if (error) + return "smartReplyAnswers." + error; + } + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestSmartRepliesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SuggestSmartRepliesResponse} SuggestSmartRepliesResponse + */ + SuggestSmartRepliesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse(); + if (object.smartReplyAnswers) { + if (!Array.isArray(object.smartReplyAnswers)) + throw TypeError(".google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.smartReplyAnswers: array expected"); + message.smartReplyAnswers = []; + for (var i = 0; i < object.smartReplyAnswers.length; ++i) { + if (typeof object.smartReplyAnswers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.smartReplyAnswers: object expected"); + message.smartReplyAnswers[i] = $root.google.cloud.dialogflow.v2.SmartReplyAnswer.fromObject(object.smartReplyAnswers[i]); + } + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestSmartRepliesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @static + * @param {google.cloud.dialogflow.v2.SuggestSmartRepliesResponse} message SuggestSmartRepliesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestSmartRepliesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.smartReplyAnswers = []; + if (options.defaults) { + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.smartReplyAnswers && message.smartReplyAnswers.length) { + object.smartReplyAnswers = []; + for (var j = 0; j < message.smartReplyAnswers.length; ++j) + object.smartReplyAnswers[j] = $root.google.cloud.dialogflow.v2.SmartReplyAnswer.toObject(message.smartReplyAnswers[j], options); + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this SuggestSmartRepliesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @instance + * @returns {Object.} JSON object + */ + SuggestSmartRepliesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestSmartRepliesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SuggestSmartRepliesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestSmartRepliesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SuggestSmartRepliesResponse"; + }; + + return SuggestSmartRepliesResponse; + })(); + + v2.OutputAudio = (function() { + + /** + * Properties of an OutputAudio. + * @memberof google.cloud.dialogflow.v2 + * @interface IOutputAudio + * @property {google.cloud.dialogflow.v2.IOutputAudioConfig|null} [config] OutputAudio config + * @property {Uint8Array|null} [audio] OutputAudio audio + */ + + /** + * Constructs a new OutputAudio. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an OutputAudio. + * @implements IOutputAudio + * @constructor + * @param {google.cloud.dialogflow.v2.IOutputAudio=} [properties] Properties to set + */ + function OutputAudio(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputAudio config. + * @member {google.cloud.dialogflow.v2.IOutputAudioConfig|null|undefined} config + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @instance + */ + OutputAudio.prototype.config = null; + + /** + * OutputAudio audio. + * @member {Uint8Array} audio + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @instance + */ + OutputAudio.prototype.audio = $util.newBuffer([]); + + /** + * Creates a new OutputAudio instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @static + * @param {google.cloud.dialogflow.v2.IOutputAudio=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.OutputAudio} OutputAudio instance + */ + OutputAudio.create = function create(properties) { + return new OutputAudio(properties); + }; + + /** + * Encodes the specified OutputAudio message. Does not implicitly {@link google.cloud.dialogflow.v2.OutputAudio.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @static + * @param {google.cloud.dialogflow.v2.IOutputAudio} message OutputAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudio.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.config != null && Object.hasOwnProperty.call(message, "config")) + $root.google.cloud.dialogflow.v2.OutputAudioConfig.encode(message.config, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.audio != null && Object.hasOwnProperty.call(message, "audio")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.audio); + return writer; + }; + + /** + * Encodes the specified OutputAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.OutputAudio.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @static + * @param {google.cloud.dialogflow.v2.IOutputAudio} message OutputAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudio.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputAudio message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.OutputAudio} OutputAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudio.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.OutputAudio(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.config = $root.google.cloud.dialogflow.v2.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.audio = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputAudio message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.OutputAudio} OutputAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudio.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputAudio message. + * @function verify + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputAudio.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.config != null && message.hasOwnProperty("config")) { + var error = $root.google.cloud.dialogflow.v2.OutputAudioConfig.verify(message.config); + if (error) + return "config." + error; + } + if (message.audio != null && message.hasOwnProperty("audio")) + if (!(message.audio && typeof message.audio.length === "number" || $util.isString(message.audio))) + return "audio: buffer expected"; + return null; + }; + + /** + * Creates an OutputAudio message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.OutputAudio} OutputAudio + */ + OutputAudio.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.OutputAudio) + return object; + var message = new $root.google.cloud.dialogflow.v2.OutputAudio(); + if (object.config != null) { + if (typeof object.config !== "object") + throw TypeError(".google.cloud.dialogflow.v2.OutputAudio.config: object expected"); + message.config = $root.google.cloud.dialogflow.v2.OutputAudioConfig.fromObject(object.config); + } + if (object.audio != null) + if (typeof object.audio === "string") + $util.base64.decode(object.audio, message.audio = $util.newBuffer($util.base64.length(object.audio)), 0); + else if (object.audio.length >= 0) + message.audio = object.audio; + return message; + }; + + /** + * Creates a plain object from an OutputAudio message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @static + * @param {google.cloud.dialogflow.v2.OutputAudio} message OutputAudio + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputAudio.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.config = null; + if (options.bytes === String) + object.audio = ""; + else { + object.audio = []; + if (options.bytes !== Array) + object.audio = $util.newBuffer(object.audio); + } + } + if (message.config != null && message.hasOwnProperty("config")) + object.config = $root.google.cloud.dialogflow.v2.OutputAudioConfig.toObject(message.config, options); + if (message.audio != null && message.hasOwnProperty("audio")) + object.audio = options.bytes === String ? $util.base64.encode(message.audio, 0, message.audio.length) : options.bytes === Array ? Array.prototype.slice.call(message.audio) : message.audio; + return object; + }; + + /** + * Converts this OutputAudio to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @instance + * @returns {Object.} JSON object + */ + OutputAudio.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OutputAudio + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.OutputAudio + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputAudio.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.OutputAudio"; + }; + + return OutputAudio; + })(); + + v2.AutomatedAgentReply = (function() { + + /** + * Properties of an AutomatedAgentReply. + * @memberof google.cloud.dialogflow.v2 + * @interface IAutomatedAgentReply + * @property {google.cloud.dialogflow.v2.IDetectIntentResponse|null} [detectIntentResponse] AutomatedAgentReply detectIntentResponse + * @property {google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType|null} [automatedAgentReplyType] AutomatedAgentReply automatedAgentReplyType + * @property {boolean|null} [allowCancellation] AutomatedAgentReply allowCancellation + */ + + /** + * Constructs a new AutomatedAgentReply. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AutomatedAgentReply. + * @implements IAutomatedAgentReply + * @constructor + * @param {google.cloud.dialogflow.v2.IAutomatedAgentReply=} [properties] Properties to set + */ + function AutomatedAgentReply(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AutomatedAgentReply detectIntentResponse. + * @member {google.cloud.dialogflow.v2.IDetectIntentResponse|null|undefined} detectIntentResponse + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.detectIntentResponse = null; + + /** + * AutomatedAgentReply automatedAgentReplyType. + * @member {google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType} automatedAgentReplyType + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.automatedAgentReplyType = 0; + + /** + * AutomatedAgentReply allowCancellation. + * @member {boolean} allowCancellation + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.allowCancellation = false; + + /** + * Creates a new AutomatedAgentReply instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @static + * @param {google.cloud.dialogflow.v2.IAutomatedAgentReply=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AutomatedAgentReply} AutomatedAgentReply instance + */ + AutomatedAgentReply.create = function create(properties) { + return new AutomatedAgentReply(properties); + }; + + /** + * Encodes the specified AutomatedAgentReply message. Does not implicitly {@link google.cloud.dialogflow.v2.AutomatedAgentReply.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @static + * @param {google.cloud.dialogflow.v2.IAutomatedAgentReply} message AutomatedAgentReply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutomatedAgentReply.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.detectIntentResponse != null && Object.hasOwnProperty.call(message, "detectIntentResponse")) + $root.google.cloud.dialogflow.v2.DetectIntentResponse.encode(message.detectIntentResponse, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.automatedAgentReplyType != null && Object.hasOwnProperty.call(message, "automatedAgentReplyType")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.automatedAgentReplyType); + if (message.allowCancellation != null && Object.hasOwnProperty.call(message, "allowCancellation")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.allowCancellation); + return writer; + }; + + /** + * Encodes the specified AutomatedAgentReply message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AutomatedAgentReply.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @static + * @param {google.cloud.dialogflow.v2.IAutomatedAgentReply} message AutomatedAgentReply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutomatedAgentReply.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AutomatedAgentReply message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AutomatedAgentReply} AutomatedAgentReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutomatedAgentReply.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AutomatedAgentReply(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.detectIntentResponse = $root.google.cloud.dialogflow.v2.DetectIntentResponse.decode(reader, reader.uint32()); + break; + } + case 7: { + message.automatedAgentReplyType = reader.int32(); + break; + } + case 8: { + message.allowCancellation = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AutomatedAgentReply message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AutomatedAgentReply} AutomatedAgentReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutomatedAgentReply.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AutomatedAgentReply message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AutomatedAgentReply.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.detectIntentResponse != null && message.hasOwnProperty("detectIntentResponse")) { + var error = $root.google.cloud.dialogflow.v2.DetectIntentResponse.verify(message.detectIntentResponse); + if (error) + return "detectIntentResponse." + error; + } + if (message.automatedAgentReplyType != null && message.hasOwnProperty("automatedAgentReplyType")) + switch (message.automatedAgentReplyType) { + default: + return "automatedAgentReplyType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.allowCancellation != null && message.hasOwnProperty("allowCancellation")) + if (typeof message.allowCancellation !== "boolean") + return "allowCancellation: boolean expected"; + return null; + }; + + /** + * Creates an AutomatedAgentReply message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AutomatedAgentReply} AutomatedAgentReply + */ + AutomatedAgentReply.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AutomatedAgentReply) + return object; + var message = new $root.google.cloud.dialogflow.v2.AutomatedAgentReply(); + if (object.detectIntentResponse != null) { + if (typeof object.detectIntentResponse !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AutomatedAgentReply.detectIntentResponse: object expected"); + message.detectIntentResponse = $root.google.cloud.dialogflow.v2.DetectIntentResponse.fromObject(object.detectIntentResponse); + } + switch (object.automatedAgentReplyType) { + default: + if (typeof object.automatedAgentReplyType === "number") { + message.automatedAgentReplyType = object.automatedAgentReplyType; + break; + } + break; + case "AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED": + case 0: + message.automatedAgentReplyType = 0; + break; + case "PARTIAL": + case 1: + message.automatedAgentReplyType = 1; + break; + case "FINAL": + case 2: + message.automatedAgentReplyType = 2; + break; + } + if (object.allowCancellation != null) + message.allowCancellation = Boolean(object.allowCancellation); + return message; + }; + + /** + * Creates a plain object from an AutomatedAgentReply message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @static + * @param {google.cloud.dialogflow.v2.AutomatedAgentReply} message AutomatedAgentReply + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AutomatedAgentReply.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.detectIntentResponse = null; + object.automatedAgentReplyType = options.enums === String ? "AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED" : 0; + object.allowCancellation = false; + } + if (message.detectIntentResponse != null && message.hasOwnProperty("detectIntentResponse")) + object.detectIntentResponse = $root.google.cloud.dialogflow.v2.DetectIntentResponse.toObject(message.detectIntentResponse, options); + if (message.automatedAgentReplyType != null && message.hasOwnProperty("automatedAgentReplyType")) + object.automatedAgentReplyType = options.enums === String ? $root.google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType[message.automatedAgentReplyType] === undefined ? message.automatedAgentReplyType : $root.google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType[message.automatedAgentReplyType] : message.automatedAgentReplyType; + if (message.allowCancellation != null && message.hasOwnProperty("allowCancellation")) + object.allowCancellation = message.allowCancellation; + return object; + }; + + /** + * Converts this AutomatedAgentReply to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @instance + * @returns {Object.} JSON object + */ + AutomatedAgentReply.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AutomatedAgentReply + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AutomatedAgentReply + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AutomatedAgentReply.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AutomatedAgentReply"; + }; + + /** + * AutomatedAgentReplyType enum. + * @name google.cloud.dialogflow.v2.AutomatedAgentReply.AutomatedAgentReplyType + * @enum {number} + * @property {number} AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED=0 AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED value + * @property {number} PARTIAL=1 PARTIAL value + * @property {number} FINAL=2 FINAL value + */ + AutomatedAgentReply.AutomatedAgentReplyType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PARTIAL"] = 1; + values[valuesById[2] = "FINAL"] = 2; + return values; + })(); + + return AutomatedAgentReply; + })(); + + v2.ArticleAnswer = (function() { + + /** + * Properties of an ArticleAnswer. + * @memberof google.cloud.dialogflow.v2 + * @interface IArticleAnswer + * @property {string|null} [title] ArticleAnswer title + * @property {string|null} [uri] ArticleAnswer uri + * @property {Array.|null} [snippets] ArticleAnswer snippets + * @property {number|null} [confidence] ArticleAnswer confidence + * @property {Object.|null} [metadata] ArticleAnswer metadata + * @property {string|null} [answerRecord] ArticleAnswer answerRecord + */ + + /** + * Constructs a new ArticleAnswer. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ArticleAnswer. + * @implements IArticleAnswer + * @constructor + * @param {google.cloud.dialogflow.v2.IArticleAnswer=} [properties] Properties to set + */ + function ArticleAnswer(properties) { + this.snippets = []; + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ArticleAnswer title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.title = ""; + + /** + * ArticleAnswer uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.uri = ""; + + /** + * ArticleAnswer snippets. + * @member {Array.} snippets + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.snippets = $util.emptyArray; + + /** + * ArticleAnswer confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.confidence = 0; + + /** + * ArticleAnswer metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.metadata = $util.emptyObject; + + /** + * ArticleAnswer answerRecord. + * @member {string} answerRecord + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.answerRecord = ""; + + /** + * Creates a new ArticleAnswer instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @static + * @param {google.cloud.dialogflow.v2.IArticleAnswer=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ArticleAnswer} ArticleAnswer instance + */ + ArticleAnswer.create = function create(properties) { + return new ArticleAnswer(properties); + }; + + /** + * Encodes the specified ArticleAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2.ArticleAnswer.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @static + * @param {google.cloud.dialogflow.v2.IArticleAnswer} message ArticleAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArticleAnswer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); + if (message.snippets != null && message.snippets.length) + for (var i = 0; i < message.snippets.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.snippets[i]); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.answerRecord); + return writer; + }; + + /** + * Encodes the specified ArticleAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ArticleAnswer.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @static + * @param {google.cloud.dialogflow.v2.IArticleAnswer} message ArticleAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArticleAnswer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ArticleAnswer message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ArticleAnswer} ArticleAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArticleAnswer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ArticleAnswer(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.uri = reader.string(); + break; + } + case 3: { + if (!(message.snippets && message.snippets.length)) + message.snippets = []; + message.snippets.push(reader.string()); + break; + } + case 4: { + message.confidence = reader.float(); + break; + } + case 5: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 6: { + message.answerRecord = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ArticleAnswer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ArticleAnswer} ArticleAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArticleAnswer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ArticleAnswer message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ArticleAnswer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.snippets != null && message.hasOwnProperty("snippets")) { + if (!Array.isArray(message.snippets)) + return "snippets: array expected"; + for (var i = 0; i < message.snippets.length; ++i) + if (!$util.isString(message.snippets[i])) + return "snippets: string[] expected"; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + if (!$util.isString(message.answerRecord)) + return "answerRecord: string expected"; + return null; + }; + + /** + * Creates an ArticleAnswer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ArticleAnswer} ArticleAnswer + */ + ArticleAnswer.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ArticleAnswer) + return object; + var message = new $root.google.cloud.dialogflow.v2.ArticleAnswer(); + if (object.title != null) + message.title = String(object.title); + if (object.uri != null) + message.uri = String(object.uri); + if (object.snippets) { + if (!Array.isArray(object.snippets)) + throw TypeError(".google.cloud.dialogflow.v2.ArticleAnswer.snippets: array expected"); + message.snippets = []; + for (var i = 0; i < object.snippets.length; ++i) + message.snippets[i] = String(object.snippets[i]); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ArticleAnswer.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + if (object.answerRecord != null) + message.answerRecord = String(object.answerRecord); + return message; + }; + + /** + * Creates a plain object from an ArticleAnswer message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @static + * @param {google.cloud.dialogflow.v2.ArticleAnswer} message ArticleAnswer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ArticleAnswer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.snippets = []; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) { + object.title = ""; + object.uri = ""; + object.confidence = 0; + object.answerRecord = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.snippets && message.snippets.length) { + object.snippets = []; + for (var j = 0; j < message.snippets.length; ++j) + object.snippets[j] = message.snippets[j]; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = message.answerRecord; + return object; + }; + + /** + * Converts this ArticleAnswer to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @instance + * @returns {Object.} JSON object + */ + ArticleAnswer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ArticleAnswer + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ArticleAnswer + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ArticleAnswer.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ArticleAnswer"; + }; + + return ArticleAnswer; + })(); + + v2.FaqAnswer = (function() { + + /** + * Properties of a FaqAnswer. + * @memberof google.cloud.dialogflow.v2 + * @interface IFaqAnswer + * @property {string|null} [answer] FaqAnswer answer + * @property {number|null} [confidence] FaqAnswer confidence + * @property {string|null} [question] FaqAnswer question + * @property {string|null} [source] FaqAnswer source + * @property {Object.|null} [metadata] FaqAnswer metadata + * @property {string|null} [answerRecord] FaqAnswer answerRecord + */ + + /** + * Constructs a new FaqAnswer. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a FaqAnswer. + * @implements IFaqAnswer + * @constructor + * @param {google.cloud.dialogflow.v2.IFaqAnswer=} [properties] Properties to set + */ + function FaqAnswer(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FaqAnswer answer. + * @member {string} answer + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @instance + */ + FaqAnswer.prototype.answer = ""; + + /** + * FaqAnswer confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @instance + */ + FaqAnswer.prototype.confidence = 0; + + /** + * FaqAnswer question. + * @member {string} question + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @instance + */ + FaqAnswer.prototype.question = ""; + + /** + * FaqAnswer source. + * @member {string} source + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @instance + */ + FaqAnswer.prototype.source = ""; + + /** + * FaqAnswer metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @instance + */ + FaqAnswer.prototype.metadata = $util.emptyObject; + + /** + * FaqAnswer answerRecord. + * @member {string} answerRecord + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @instance + */ + FaqAnswer.prototype.answerRecord = ""; + + /** + * Creates a new FaqAnswer instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2.IFaqAnswer=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.FaqAnswer} FaqAnswer instance + */ + FaqAnswer.create = function create(properties) { + return new FaqAnswer(properties); + }; + + /** + * Encodes the specified FaqAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2.FaqAnswer.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2.IFaqAnswer} message FaqAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaqAnswer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answer != null && Object.hasOwnProperty.call(message, "answer")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.answer); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.question != null && Object.hasOwnProperty.call(message, "question")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.question); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.source); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.answerRecord); + return writer; + }; + + /** + * Encodes the specified FaqAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.FaqAnswer.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2.IFaqAnswer} message FaqAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaqAnswer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.FaqAnswer} FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaqAnswer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.FaqAnswer(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.answer = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + case 3: { + message.question = reader.string(); + break; + } + case 4: { + message.source = reader.string(); + break; + } + case 5: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 6: { + message.answerRecord = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.FaqAnswer} FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaqAnswer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FaqAnswer message. + * @function verify + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FaqAnswer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answer != null && message.hasOwnProperty("answer")) + if (!$util.isString(message.answer)) + return "answer: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.question != null && message.hasOwnProperty("question")) + if (!$util.isString(message.question)) + return "question: string expected"; + if (message.source != null && message.hasOwnProperty("source")) + if (!$util.isString(message.source)) + return "source: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + if (!$util.isString(message.answerRecord)) + return "answerRecord: string expected"; + return null; + }; + + /** + * Creates a FaqAnswer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.FaqAnswer} FaqAnswer + */ + FaqAnswer.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.FaqAnswer) + return object; + var message = new $root.google.cloud.dialogflow.v2.FaqAnswer(); + if (object.answer != null) + message.answer = String(object.answer); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.question != null) + message.question = String(object.question); + if (object.source != null) + message.source = String(object.source); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2.FaqAnswer.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + if (object.answerRecord != null) + message.answerRecord = String(object.answerRecord); + return message; + }; + + /** + * Creates a plain object from a FaqAnswer message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2.FaqAnswer} message FaqAnswer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FaqAnswer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) { + object.answer = ""; + object.confidence = 0; + object.question = ""; + object.source = ""; + object.answerRecord = ""; + } + if (message.answer != null && message.hasOwnProperty("answer")) + object.answer = message.answer; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.question != null && message.hasOwnProperty("question")) + object.question = message.question; + if (message.source != null && message.hasOwnProperty("source")) + object.source = message.source; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = message.answerRecord; + return object; + }; + + /** + * Converts this FaqAnswer to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @instance + * @returns {Object.} JSON object + */ + FaqAnswer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FaqAnswer + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.FaqAnswer + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FaqAnswer.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.FaqAnswer"; + }; + + return FaqAnswer; + })(); + + v2.SmartReplyAnswer = (function() { + + /** + * Properties of a SmartReplyAnswer. + * @memberof google.cloud.dialogflow.v2 + * @interface ISmartReplyAnswer + * @property {string|null} [reply] SmartReplyAnswer reply + * @property {number|null} [confidence] SmartReplyAnswer confidence + * @property {string|null} [answerRecord] SmartReplyAnswer answerRecord + */ + + /** + * Constructs a new SmartReplyAnswer. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SmartReplyAnswer. + * @implements ISmartReplyAnswer + * @constructor + * @param {google.cloud.dialogflow.v2.ISmartReplyAnswer=} [properties] Properties to set + */ + function SmartReplyAnswer(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SmartReplyAnswer reply. + * @member {string} reply + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @instance + */ + SmartReplyAnswer.prototype.reply = ""; + + /** + * SmartReplyAnswer confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @instance + */ + SmartReplyAnswer.prototype.confidence = 0; + + /** + * SmartReplyAnswer answerRecord. + * @member {string} answerRecord + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @instance + */ + SmartReplyAnswer.prototype.answerRecord = ""; + + /** + * Creates a new SmartReplyAnswer instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @static + * @param {google.cloud.dialogflow.v2.ISmartReplyAnswer=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SmartReplyAnswer} SmartReplyAnswer instance + */ + SmartReplyAnswer.create = function create(properties) { + return new SmartReplyAnswer(properties); + }; + + /** + * Encodes the specified SmartReplyAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyAnswer.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @static + * @param {google.cloud.dialogflow.v2.ISmartReplyAnswer} message SmartReplyAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyAnswer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.reply != null && Object.hasOwnProperty.call(message, "reply")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.reply); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.answerRecord); + return writer; + }; + + /** + * Encodes the specified SmartReplyAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyAnswer.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @static + * @param {google.cloud.dialogflow.v2.ISmartReplyAnswer} message SmartReplyAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyAnswer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SmartReplyAnswer message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SmartReplyAnswer} SmartReplyAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyAnswer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SmartReplyAnswer(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.reply = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + case 3: { + message.answerRecord = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SmartReplyAnswer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SmartReplyAnswer} SmartReplyAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyAnswer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SmartReplyAnswer message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SmartReplyAnswer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.reply != null && message.hasOwnProperty("reply")) + if (!$util.isString(message.reply)) + return "reply: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + if (!$util.isString(message.answerRecord)) + return "answerRecord: string expected"; + return null; + }; + + /** + * Creates a SmartReplyAnswer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SmartReplyAnswer} SmartReplyAnswer + */ + SmartReplyAnswer.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SmartReplyAnswer) + return object; + var message = new $root.google.cloud.dialogflow.v2.SmartReplyAnswer(); + if (object.reply != null) + message.reply = String(object.reply); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.answerRecord != null) + message.answerRecord = String(object.answerRecord); + return message; + }; + + /** + * Creates a plain object from a SmartReplyAnswer message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @static + * @param {google.cloud.dialogflow.v2.SmartReplyAnswer} message SmartReplyAnswer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SmartReplyAnswer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.reply = ""; + object.confidence = 0; + object.answerRecord = ""; + } + if (message.reply != null && message.hasOwnProperty("reply")) + object.reply = message.reply; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = message.answerRecord; + return object; + }; + + /** + * Converts this SmartReplyAnswer to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @instance + * @returns {Object.} JSON object + */ + SmartReplyAnswer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SmartReplyAnswer + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SmartReplyAnswer + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SmartReplyAnswer.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SmartReplyAnswer"; + }; + + return SmartReplyAnswer; + })(); + + v2.SuggestionResult = (function() { + + /** + * Properties of a SuggestionResult. + * @memberof google.cloud.dialogflow.v2 + * @interface ISuggestionResult + * @property {google.rpc.IStatus|null} [error] SuggestionResult error + * @property {google.cloud.dialogflow.v2.ISuggestArticlesResponse|null} [suggestArticlesResponse] SuggestionResult suggestArticlesResponse + * @property {google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse|null} [suggestFaqAnswersResponse] SuggestionResult suggestFaqAnswersResponse + * @property {google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse|null} [suggestSmartRepliesResponse] SuggestionResult suggestSmartRepliesResponse + */ + + /** + * Constructs a new SuggestionResult. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SuggestionResult. + * @implements ISuggestionResult + * @constructor + * @param {google.cloud.dialogflow.v2.ISuggestionResult=} [properties] Properties to set + */ + function SuggestionResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionResult error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @instance + */ + SuggestionResult.prototype.error = null; + + /** + * SuggestionResult suggestArticlesResponse. + * @member {google.cloud.dialogflow.v2.ISuggestArticlesResponse|null|undefined} suggestArticlesResponse + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @instance + */ + SuggestionResult.prototype.suggestArticlesResponse = null; + + /** + * SuggestionResult suggestFaqAnswersResponse. + * @member {google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse|null|undefined} suggestFaqAnswersResponse + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @instance + */ + SuggestionResult.prototype.suggestFaqAnswersResponse = null; + + /** + * SuggestionResult suggestSmartRepliesResponse. + * @member {google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse|null|undefined} suggestSmartRepliesResponse + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @instance + */ + SuggestionResult.prototype.suggestSmartRepliesResponse = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SuggestionResult suggestionResponse. + * @member {"error"|"suggestArticlesResponse"|"suggestFaqAnswersResponse"|"suggestSmartRepliesResponse"|undefined} suggestionResponse + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @instance + */ + Object.defineProperty(SuggestionResult.prototype, "suggestionResponse", { + get: $util.oneOfGetter($oneOfFields = ["error", "suggestArticlesResponse", "suggestFaqAnswersResponse", "suggestSmartRepliesResponse"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SuggestionResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @static + * @param {google.cloud.dialogflow.v2.ISuggestionResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SuggestionResult} SuggestionResult instance + */ + SuggestionResult.create = function create(properties) { + return new SuggestionResult(properties); + }; + + /** + * Encodes the specified SuggestionResult message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @static + * @param {google.cloud.dialogflow.v2.ISuggestionResult} message SuggestionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.suggestArticlesResponse != null && Object.hasOwnProperty.call(message, "suggestArticlesResponse")) + $root.google.cloud.dialogflow.v2.SuggestArticlesResponse.encode(message.suggestArticlesResponse, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.suggestFaqAnswersResponse != null && Object.hasOwnProperty.call(message, "suggestFaqAnswersResponse")) + $root.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.encode(message.suggestFaqAnswersResponse, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.suggestSmartRepliesResponse != null && Object.hasOwnProperty.call(message, "suggestSmartRepliesResponse")) + $root.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.encode(message.suggestSmartRepliesResponse, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @static + * @param {google.cloud.dialogflow.v2.ISuggestionResult} message SuggestionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SuggestionResult} SuggestionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SuggestionResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 2: { + message.suggestArticlesResponse = $root.google.cloud.dialogflow.v2.SuggestArticlesResponse.decode(reader, reader.uint32()); + break; + } + case 3: { + message.suggestFaqAnswersResponse = $root.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.decode(reader, reader.uint32()); + break; + } + case 4: { + message.suggestSmartRepliesResponse = $root.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SuggestionResult} SuggestionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.error != null && message.hasOwnProperty("error")) { + properties.suggestionResponse = 1; + { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.suggestArticlesResponse != null && message.hasOwnProperty("suggestArticlesResponse")) { + if (properties.suggestionResponse === 1) + return "suggestionResponse: multiple values"; + properties.suggestionResponse = 1; + { + var error = $root.google.cloud.dialogflow.v2.SuggestArticlesResponse.verify(message.suggestArticlesResponse); + if (error) + return "suggestArticlesResponse." + error; + } + } + if (message.suggestFaqAnswersResponse != null && message.hasOwnProperty("suggestFaqAnswersResponse")) { + if (properties.suggestionResponse === 1) + return "suggestionResponse: multiple values"; + properties.suggestionResponse = 1; + { + var error = $root.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.verify(message.suggestFaqAnswersResponse); + if (error) + return "suggestFaqAnswersResponse." + error; + } + } + if (message.suggestSmartRepliesResponse != null && message.hasOwnProperty("suggestSmartRepliesResponse")) { + if (properties.suggestionResponse === 1) + return "suggestionResponse: multiple values"; + properties.suggestionResponse = 1; + { + var error = $root.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.verify(message.suggestSmartRepliesResponse); + if (error) + return "suggestSmartRepliesResponse." + error; + } + } + return null; + }; + + /** + * Creates a SuggestionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SuggestionResult} SuggestionResult + */ + SuggestionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SuggestionResult) + return object; + var message = new $root.google.cloud.dialogflow.v2.SuggestionResult(); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestionResult.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.suggestArticlesResponse != null) { + if (typeof object.suggestArticlesResponse !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestionResult.suggestArticlesResponse: object expected"); + message.suggestArticlesResponse = $root.google.cloud.dialogflow.v2.SuggestArticlesResponse.fromObject(object.suggestArticlesResponse); + } + if (object.suggestFaqAnswersResponse != null) { + if (typeof object.suggestFaqAnswersResponse !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestionResult.suggestFaqAnswersResponse: object expected"); + message.suggestFaqAnswersResponse = $root.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.fromObject(object.suggestFaqAnswersResponse); + } + if (object.suggestSmartRepliesResponse != null) { + if (typeof object.suggestSmartRepliesResponse !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SuggestionResult.suggestSmartRepliesResponse: object expected"); + message.suggestSmartRepliesResponse = $root.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.fromObject(object.suggestSmartRepliesResponse); + } + return message; + }; + + /** + * Creates a plain object from a SuggestionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @static + * @param {google.cloud.dialogflow.v2.SuggestionResult} message SuggestionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (options.oneofs) + object.suggestionResponse = "error"; + } + if (message.suggestArticlesResponse != null && message.hasOwnProperty("suggestArticlesResponse")) { + object.suggestArticlesResponse = $root.google.cloud.dialogflow.v2.SuggestArticlesResponse.toObject(message.suggestArticlesResponse, options); + if (options.oneofs) + object.suggestionResponse = "suggestArticlesResponse"; + } + if (message.suggestFaqAnswersResponse != null && message.hasOwnProperty("suggestFaqAnswersResponse")) { + object.suggestFaqAnswersResponse = $root.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse.toObject(message.suggestFaqAnswersResponse, options); + if (options.oneofs) + object.suggestionResponse = "suggestFaqAnswersResponse"; + } + if (message.suggestSmartRepliesResponse != null && message.hasOwnProperty("suggestSmartRepliesResponse")) { + object.suggestSmartRepliesResponse = $root.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse.toObject(message.suggestSmartRepliesResponse, options); + if (options.oneofs) + object.suggestionResponse = "suggestSmartRepliesResponse"; + } + return object; + }; + + /** + * Converts this SuggestionResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @instance + * @returns {Object.} JSON object + */ + SuggestionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SuggestionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SuggestionResult"; + }; + + return SuggestionResult; + })(); + + v2.InputTextConfig = (function() { + + /** + * Properties of an InputTextConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface IInputTextConfig + * @property {string|null} [languageCode] InputTextConfig languageCode + */ + + /** + * Constructs a new InputTextConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an InputTextConfig. + * @implements IInputTextConfig + * @constructor + * @param {google.cloud.dialogflow.v2.IInputTextConfig=} [properties] Properties to set + */ + function InputTextConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InputTextConfig languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @instance + */ + InputTextConfig.prototype.languageCode = ""; + + /** + * Creates a new InputTextConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @static + * @param {google.cloud.dialogflow.v2.IInputTextConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.InputTextConfig} InputTextConfig instance + */ + InputTextConfig.create = function create(properties) { + return new InputTextConfig(properties); + }; + + /** + * Encodes the specified InputTextConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.InputTextConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @static + * @param {google.cloud.dialogflow.v2.IInputTextConfig} message InputTextConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputTextConfig.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); + return writer; + }; + + /** + * Encodes the specified InputTextConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.InputTextConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @static + * @param {google.cloud.dialogflow.v2.IInputTextConfig} message InputTextConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputTextConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InputTextConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.InputTextConfig} InputTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputTextConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.InputTextConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InputTextConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.InputTextConfig} InputTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputTextConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InputTextConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InputTextConfig.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"; + return null; + }; + + /** + * Creates an InputTextConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.InputTextConfig} InputTextConfig + */ + InputTextConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.InputTextConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.InputTextConfig(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from an InputTextConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @static + * @param {google.cloud.dialogflow.v2.InputTextConfig} message InputTextConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InputTextConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.languageCode = ""; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this InputTextConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @instance + * @returns {Object.} JSON object + */ + InputTextConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InputTextConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.InputTextConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputTextConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.InputTextConfig"; + }; + + return InputTextConfig; + })(); + + v2.AnnotatedMessagePart = (function() { + + /** + * Properties of an AnnotatedMessagePart. + * @memberof google.cloud.dialogflow.v2 + * @interface IAnnotatedMessagePart + * @property {string|null} [text] AnnotatedMessagePart text + * @property {string|null} [entityType] AnnotatedMessagePart entityType + * @property {google.protobuf.IValue|null} [formattedValue] AnnotatedMessagePart formattedValue + */ + + /** + * Constructs a new AnnotatedMessagePart. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AnnotatedMessagePart. + * @implements IAnnotatedMessagePart + * @constructor + * @param {google.cloud.dialogflow.v2.IAnnotatedMessagePart=} [properties] Properties to set + */ + function AnnotatedMessagePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnnotatedMessagePart text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @instance + */ + AnnotatedMessagePart.prototype.text = ""; + + /** + * AnnotatedMessagePart entityType. + * @member {string} entityType + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @instance + */ + AnnotatedMessagePart.prototype.entityType = ""; + + /** + * AnnotatedMessagePart formattedValue. + * @member {google.protobuf.IValue|null|undefined} formattedValue + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @instance + */ + AnnotatedMessagePart.prototype.formattedValue = null; + + /** + * Creates a new AnnotatedMessagePart instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @static + * @param {google.cloud.dialogflow.v2.IAnnotatedMessagePart=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AnnotatedMessagePart} AnnotatedMessagePart instance + */ + AnnotatedMessagePart.create = function create(properties) { + return new AnnotatedMessagePart(properties); + }; + + /** + * Encodes the specified AnnotatedMessagePart message. Does not implicitly {@link google.cloud.dialogflow.v2.AnnotatedMessagePart.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @static + * @param {google.cloud.dialogflow.v2.IAnnotatedMessagePart} message AnnotatedMessagePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotatedMessagePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityType); + if (message.formattedValue != null && Object.hasOwnProperty.call(message, "formattedValue")) + $root.google.protobuf.Value.encode(message.formattedValue, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AnnotatedMessagePart message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AnnotatedMessagePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @static + * @param {google.cloud.dialogflow.v2.IAnnotatedMessagePart} message AnnotatedMessagePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotatedMessagePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnnotatedMessagePart message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AnnotatedMessagePart} AnnotatedMessagePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotatedMessagePart.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AnnotatedMessagePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.entityType = reader.string(); + break; + } + case 3: { + message.formattedValue = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnnotatedMessagePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AnnotatedMessagePart} AnnotatedMessagePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotatedMessagePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnnotatedMessagePart message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnnotatedMessagePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) + if (!$util.isString(message.entityType)) + return "entityType: string expected"; + if (message.formattedValue != null && message.hasOwnProperty("formattedValue")) { + var error = $root.google.protobuf.Value.verify(message.formattedValue); + if (error) + return "formattedValue." + error; + } + return null; + }; + + /** + * Creates an AnnotatedMessagePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AnnotatedMessagePart} AnnotatedMessagePart + */ + AnnotatedMessagePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AnnotatedMessagePart) + return object; + var message = new $root.google.cloud.dialogflow.v2.AnnotatedMessagePart(); + if (object.text != null) + message.text = String(object.text); + if (object.entityType != null) + message.entityType = String(object.entityType); + if (object.formattedValue != null) { + if (typeof object.formattedValue !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AnnotatedMessagePart.formattedValue: object expected"); + message.formattedValue = $root.google.protobuf.Value.fromObject(object.formattedValue); + } + return message; + }; + + /** + * Creates a plain object from an AnnotatedMessagePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @static + * @param {google.cloud.dialogflow.v2.AnnotatedMessagePart} message AnnotatedMessagePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnnotatedMessagePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.entityType = ""; + object.formattedValue = null; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = message.entityType; + if (message.formattedValue != null && message.hasOwnProperty("formattedValue")) + object.formattedValue = $root.google.protobuf.Value.toObject(message.formattedValue, options); + return object; + }; + + /** + * Converts this AnnotatedMessagePart to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @instance + * @returns {Object.} JSON object + */ + AnnotatedMessagePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnnotatedMessagePart + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AnnotatedMessagePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnnotatedMessagePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AnnotatedMessagePart"; + }; + + return AnnotatedMessagePart; + })(); + + v2.MessageAnnotation = (function() { + + /** + * Properties of a MessageAnnotation. + * @memberof google.cloud.dialogflow.v2 + * @interface IMessageAnnotation + * @property {Array.|null} [parts] MessageAnnotation parts + * @property {boolean|null} [containEntities] MessageAnnotation containEntities + */ + + /** + * Constructs a new MessageAnnotation. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a MessageAnnotation. + * @implements IMessageAnnotation + * @constructor + * @param {google.cloud.dialogflow.v2.IMessageAnnotation=} [properties] Properties to set + */ + function MessageAnnotation(properties) { + this.parts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageAnnotation parts. + * @member {Array.} parts + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @instance + */ + MessageAnnotation.prototype.parts = $util.emptyArray; + + /** + * MessageAnnotation containEntities. + * @member {boolean} containEntities + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @instance + */ + MessageAnnotation.prototype.containEntities = false; + + /** + * Creates a new MessageAnnotation instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @static + * @param {google.cloud.dialogflow.v2.IMessageAnnotation=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.MessageAnnotation} MessageAnnotation instance + */ + MessageAnnotation.create = function create(properties) { + return new MessageAnnotation(properties); + }; + + /** + * Encodes the specified MessageAnnotation message. Does not implicitly {@link google.cloud.dialogflow.v2.MessageAnnotation.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @static + * @param {google.cloud.dialogflow.v2.IMessageAnnotation} message MessageAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageAnnotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parts != null && message.parts.length) + for (var i = 0; i < message.parts.length; ++i) + $root.google.cloud.dialogflow.v2.AnnotatedMessagePart.encode(message.parts[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.containEntities != null && Object.hasOwnProperty.call(message, "containEntities")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.containEntities); + return writer; + }; + + /** + * Encodes the specified MessageAnnotation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.MessageAnnotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @static + * @param {google.cloud.dialogflow.v2.IMessageAnnotation} message MessageAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageAnnotation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.MessageAnnotation} MessageAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageAnnotation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.MessageAnnotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.parts && message.parts.length)) + message.parts = []; + message.parts.push($root.google.cloud.dialogflow.v2.AnnotatedMessagePart.decode(reader, reader.uint32())); + break; + } + case 2: { + message.containEntities = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageAnnotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.MessageAnnotation} MessageAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageAnnotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageAnnotation message. + * @function verify + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageAnnotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parts != null && message.hasOwnProperty("parts")) { + if (!Array.isArray(message.parts)) + return "parts: array expected"; + for (var i = 0; i < message.parts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.AnnotatedMessagePart.verify(message.parts[i]); + if (error) + return "parts." + error; + } + } + if (message.containEntities != null && message.hasOwnProperty("containEntities")) + if (typeof message.containEntities !== "boolean") + return "containEntities: boolean expected"; + return null; + }; + + /** + * Creates a MessageAnnotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.MessageAnnotation} MessageAnnotation + */ + MessageAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.MessageAnnotation) + return object; + var message = new $root.google.cloud.dialogflow.v2.MessageAnnotation(); + if (object.parts) { + if (!Array.isArray(object.parts)) + throw TypeError(".google.cloud.dialogflow.v2.MessageAnnotation.parts: array expected"); + message.parts = []; + for (var i = 0; i < object.parts.length; ++i) { + if (typeof object.parts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.MessageAnnotation.parts: object expected"); + message.parts[i] = $root.google.cloud.dialogflow.v2.AnnotatedMessagePart.fromObject(object.parts[i]); + } + } + if (object.containEntities != null) + message.containEntities = Boolean(object.containEntities); + return message; + }; + + /** + * Creates a plain object from a MessageAnnotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @static + * @param {google.cloud.dialogflow.v2.MessageAnnotation} message MessageAnnotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageAnnotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parts = []; + if (options.defaults) + object.containEntities = false; + if (message.parts && message.parts.length) { + object.parts = []; + for (var j = 0; j < message.parts.length; ++j) + object.parts[j] = $root.google.cloud.dialogflow.v2.AnnotatedMessagePart.toObject(message.parts[j], options); + } + if (message.containEntities != null && message.hasOwnProperty("containEntities")) + object.containEntities = message.containEntities; + return object; + }; + + /** + * Converts this MessageAnnotation to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @instance + * @returns {Object.} JSON object + */ + MessageAnnotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageAnnotation + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.MessageAnnotation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.MessageAnnotation"; + }; + + return MessageAnnotation; + })(); + + v2.AssistQueryParameters = (function() { + + /** + * Properties of an AssistQueryParameters. + * @memberof google.cloud.dialogflow.v2 + * @interface IAssistQueryParameters + * @property {Object.|null} [documentsMetadataFilters] AssistQueryParameters documentsMetadataFilters + */ + + /** + * Constructs a new AssistQueryParameters. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AssistQueryParameters. + * @implements IAssistQueryParameters + * @constructor + * @param {google.cloud.dialogflow.v2.IAssistQueryParameters=} [properties] Properties to set + */ + function AssistQueryParameters(properties) { + this.documentsMetadataFilters = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AssistQueryParameters documentsMetadataFilters. + * @member {Object.} documentsMetadataFilters + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @instance + */ + AssistQueryParameters.prototype.documentsMetadataFilters = $util.emptyObject; + + /** + * Creates a new AssistQueryParameters instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @static + * @param {google.cloud.dialogflow.v2.IAssistQueryParameters=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AssistQueryParameters} AssistQueryParameters instance + */ + AssistQueryParameters.create = function create(properties) { + return new AssistQueryParameters(properties); + }; + + /** + * Encodes the specified AssistQueryParameters message. Does not implicitly {@link google.cloud.dialogflow.v2.AssistQueryParameters.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @static + * @param {google.cloud.dialogflow.v2.IAssistQueryParameters} message AssistQueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AssistQueryParameters.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentsMetadataFilters != null && Object.hasOwnProperty.call(message, "documentsMetadataFilters")) + for (var keys = Object.keys(message.documentsMetadataFilters), i = 0; i < keys.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.documentsMetadataFilters[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified AssistQueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AssistQueryParameters.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @static + * @param {google.cloud.dialogflow.v2.IAssistQueryParameters} message AssistQueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AssistQueryParameters.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AssistQueryParameters message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AssistQueryParameters} AssistQueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AssistQueryParameters.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AssistQueryParameters(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (message.documentsMetadataFilters === $util.emptyObject) + message.documentsMetadataFilters = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.documentsMetadataFilters[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AssistQueryParameters message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AssistQueryParameters} AssistQueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AssistQueryParameters.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AssistQueryParameters message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AssistQueryParameters.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documentsMetadataFilters != null && message.hasOwnProperty("documentsMetadataFilters")) { + if (!$util.isObject(message.documentsMetadataFilters)) + return "documentsMetadataFilters: object expected"; + var key = Object.keys(message.documentsMetadataFilters); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.documentsMetadataFilters[key[i]])) + return "documentsMetadataFilters: string{k:string} expected"; + } + return null; + }; + + /** + * Creates an AssistQueryParameters message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AssistQueryParameters} AssistQueryParameters + */ + AssistQueryParameters.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AssistQueryParameters) + return object; + var message = new $root.google.cloud.dialogflow.v2.AssistQueryParameters(); + if (object.documentsMetadataFilters) { + if (typeof object.documentsMetadataFilters !== "object") + throw TypeError(".google.cloud.dialogflow.v2.AssistQueryParameters.documentsMetadataFilters: object expected"); + message.documentsMetadataFilters = {}; + for (var keys = Object.keys(object.documentsMetadataFilters), i = 0; i < keys.length; ++i) + message.documentsMetadataFilters[keys[i]] = String(object.documentsMetadataFilters[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from an AssistQueryParameters message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @static + * @param {google.cloud.dialogflow.v2.AssistQueryParameters} message AssistQueryParameters + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AssistQueryParameters.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.documentsMetadataFilters = {}; + var keys2; + if (message.documentsMetadataFilters && (keys2 = Object.keys(message.documentsMetadataFilters)).length) { + object.documentsMetadataFilters = {}; + for (var j = 0; j < keys2.length; ++j) + object.documentsMetadataFilters[keys2[j]] = message.documentsMetadataFilters[keys2[j]]; + } + return object; + }; + + /** + * Converts this AssistQueryParameters to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @instance + * @returns {Object.} JSON object + */ + AssistQueryParameters.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AssistQueryParameters + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AssistQueryParameters + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AssistQueryParameters.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AssistQueryParameters"; + }; + + return AssistQueryParameters; + })(); + + /** + * AudioEncoding enum. + * @name google.cloud.dialogflow.v2.AudioEncoding + * @enum {number} + * @property {number} AUDIO_ENCODING_UNSPECIFIED=0 AUDIO_ENCODING_UNSPECIFIED value + * @property {number} AUDIO_ENCODING_LINEAR_16=1 AUDIO_ENCODING_LINEAR_16 value + * @property {number} AUDIO_ENCODING_FLAC=2 AUDIO_ENCODING_FLAC value + * @property {number} AUDIO_ENCODING_MULAW=3 AUDIO_ENCODING_MULAW value + * @property {number} AUDIO_ENCODING_AMR=4 AUDIO_ENCODING_AMR value + * @property {number} AUDIO_ENCODING_AMR_WB=5 AUDIO_ENCODING_AMR_WB value + * @property {number} AUDIO_ENCODING_OGG_OPUS=6 AUDIO_ENCODING_OGG_OPUS value + * @property {number} AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE=7 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE value + */ + v2.AudioEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUDIO_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUDIO_ENCODING_LINEAR_16"] = 1; + values[valuesById[2] = "AUDIO_ENCODING_FLAC"] = 2; + values[valuesById[3] = "AUDIO_ENCODING_MULAW"] = 3; + values[valuesById[4] = "AUDIO_ENCODING_AMR"] = 4; + values[valuesById[5] = "AUDIO_ENCODING_AMR_WB"] = 5; + values[valuesById[6] = "AUDIO_ENCODING_OGG_OPUS"] = 6; + values[valuesById[7] = "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE"] = 7; + return values; + })(); + + v2.SpeechContext = (function() { + + /** + * Properties of a SpeechContext. + * @memberof google.cloud.dialogflow.v2 + * @interface ISpeechContext + * @property {Array.|null} [phrases] SpeechContext phrases + * @property {number|null} [boost] SpeechContext boost + */ + + /** + * Constructs a new SpeechContext. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SpeechContext. + * @implements ISpeechContext + * @constructor + * @param {google.cloud.dialogflow.v2.ISpeechContext=} [properties] Properties to set + */ + function SpeechContext(properties) { + this.phrases = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpeechContext phrases. + * @member {Array.} phrases + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @instance + */ + SpeechContext.prototype.phrases = $util.emptyArray; + + /** + * SpeechContext boost. + * @member {number} boost + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @instance + */ + SpeechContext.prototype.boost = 0; + + /** + * Creates a new SpeechContext instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @static + * @param {google.cloud.dialogflow.v2.ISpeechContext=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SpeechContext} SpeechContext instance + */ + SpeechContext.create = function create(properties) { + return new SpeechContext(properties); + }; + + /** + * Encodes the specified SpeechContext message. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @static + * @param {google.cloud.dialogflow.v2.ISpeechContext} message SpeechContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phrases != null && message.phrases.length) + for (var i = 0; i < message.phrases.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.phrases[i]); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; + + /** + * Encodes the specified SpeechContext message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @static + * @param {google.cloud.dialogflow.v2.ISpeechContext} message SpeechContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpeechContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SpeechContext} SpeechContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechContext.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SpeechContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.phrases && message.phrases.length)) + message.phrases = []; + message.phrases.push(reader.string()); + break; + } + case 2: { + message.boost = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpeechContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SpeechContext} SpeechContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpeechContext message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpeechContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.phrases != null && message.hasOwnProperty("phrases")) { + if (!Array.isArray(message.phrases)) + return "phrases: array expected"; + for (var i = 0; i < message.phrases.length; ++i) + if (!$util.isString(message.phrases[i])) + return "phrases: string[] expected"; + } + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a SpeechContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SpeechContext} SpeechContext + */ + SpeechContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SpeechContext) + return object; + var message = new $root.google.cloud.dialogflow.v2.SpeechContext(); + if (object.phrases) { + if (!Array.isArray(object.phrases)) + throw TypeError(".google.cloud.dialogflow.v2.SpeechContext.phrases: array expected"); + message.phrases = []; + for (var i = 0; i < object.phrases.length; ++i) + message.phrases[i] = String(object.phrases[i]); + } + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a SpeechContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @static + * @param {google.cloud.dialogflow.v2.SpeechContext} message SpeechContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpeechContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.phrases = []; + if (options.defaults) + object.boost = 0; + if (message.phrases && message.phrases.length) { + object.phrases = []; + for (var j = 0; j < message.phrases.length; ++j) + object.phrases[j] = message.phrases[j]; + } + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this SpeechContext to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @instance + * @returns {Object.} JSON object + */ + SpeechContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SpeechContext + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SpeechContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpeechContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SpeechContext"; + }; + + return SpeechContext; + })(); + + /** + * SpeechModelVariant enum. + * @name google.cloud.dialogflow.v2.SpeechModelVariant + * @enum {number} + * @property {number} SPEECH_MODEL_VARIANT_UNSPECIFIED=0 SPEECH_MODEL_VARIANT_UNSPECIFIED value + * @property {number} USE_BEST_AVAILABLE=1 USE_BEST_AVAILABLE value + * @property {number} USE_STANDARD=2 USE_STANDARD value + * @property {number} USE_ENHANCED=3 USE_ENHANCED value + */ + v2.SpeechModelVariant = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SPEECH_MODEL_VARIANT_UNSPECIFIED"] = 0; + values[valuesById[1] = "USE_BEST_AVAILABLE"] = 1; + values[valuesById[2] = "USE_STANDARD"] = 2; + values[valuesById[3] = "USE_ENHANCED"] = 3; + return values; + })(); + + v2.SpeechWordInfo = (function() { + + /** + * Properties of a SpeechWordInfo. + * @memberof google.cloud.dialogflow.v2 + * @interface ISpeechWordInfo + * @property {string|null} [word] SpeechWordInfo word + * @property {google.protobuf.IDuration|null} [startOffset] SpeechWordInfo startOffset + * @property {google.protobuf.IDuration|null} [endOffset] SpeechWordInfo endOffset + * @property {number|null} [confidence] SpeechWordInfo confidence + */ + + /** + * Constructs a new SpeechWordInfo. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SpeechWordInfo. + * @implements ISpeechWordInfo + * @constructor + * @param {google.cloud.dialogflow.v2.ISpeechWordInfo=} [properties] Properties to set + */ + function SpeechWordInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpeechWordInfo word. + * @member {string} word + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.word = ""; + + /** + * SpeechWordInfo startOffset. + * @member {google.protobuf.IDuration|null|undefined} startOffset + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.startOffset = null; + + /** + * SpeechWordInfo endOffset. + * @member {google.protobuf.IDuration|null|undefined} endOffset + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.endOffset = null; + + /** + * SpeechWordInfo confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.confidence = 0; + + /** + * Creates a new SpeechWordInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.v2.ISpeechWordInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SpeechWordInfo} SpeechWordInfo instance + */ + SpeechWordInfo.create = function create(properties) { + return new SpeechWordInfo(properties); + }; + + /** + * Encodes the specified SpeechWordInfo message. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechWordInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.v2.ISpeechWordInfo} message SpeechWordInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechWordInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startOffset != null && Object.hasOwnProperty.call(message, "startOffset")) + $root.google.protobuf.Duration.encode(message.startOffset, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endOffset != null && Object.hasOwnProperty.call(message, "endOffset")) + $root.google.protobuf.Duration.encode(message.endOffset, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.word != null && Object.hasOwnProperty.call(message, "word")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.word); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified SpeechWordInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechWordInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.v2.ISpeechWordInfo} message SpeechWordInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechWordInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SpeechWordInfo} SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechWordInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SpeechWordInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.word = reader.string(); + break; + } + case 1: { + message.startOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 4: { + message.confidence = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SpeechWordInfo} SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechWordInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpeechWordInfo message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpeechWordInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.word != null && message.hasOwnProperty("word")) + if (!$util.isString(message.word)) + return "word: string expected"; + if (message.startOffset != null && message.hasOwnProperty("startOffset")) { + var error = $root.google.protobuf.Duration.verify(message.startOffset); + if (error) + return "startOffset." + error; + } + if (message.endOffset != null && message.hasOwnProperty("endOffset")) { + var error = $root.google.protobuf.Duration.verify(message.endOffset); + if (error) + return "endOffset." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a SpeechWordInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SpeechWordInfo} SpeechWordInfo + */ + SpeechWordInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SpeechWordInfo) + return object; + var message = new $root.google.cloud.dialogflow.v2.SpeechWordInfo(); + if (object.word != null) + message.word = String(object.word); + if (object.startOffset != null) { + if (typeof object.startOffset !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SpeechWordInfo.startOffset: object expected"); + message.startOffset = $root.google.protobuf.Duration.fromObject(object.startOffset); + } + if (object.endOffset != null) { + if (typeof object.endOffset !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SpeechWordInfo.endOffset: object expected"); + message.endOffset = $root.google.protobuf.Duration.fromObject(object.endOffset); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a SpeechWordInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.v2.SpeechWordInfo} message SpeechWordInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpeechWordInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startOffset = null; + object.endOffset = null; + object.word = ""; + object.confidence = 0; + } + if (message.startOffset != null && message.hasOwnProperty("startOffset")) + object.startOffset = $root.google.protobuf.Duration.toObject(message.startOffset, options); + if (message.endOffset != null && message.hasOwnProperty("endOffset")) + object.endOffset = $root.google.protobuf.Duration.toObject(message.endOffset, options); + if (message.word != null && message.hasOwnProperty("word")) + object.word = message.word; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this SpeechWordInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @instance + * @returns {Object.} JSON object + */ + SpeechWordInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SpeechWordInfo + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SpeechWordInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpeechWordInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SpeechWordInfo"; + }; + + return SpeechWordInfo; + })(); + + v2.InputAudioConfig = (function() { + + /** + * Properties of an InputAudioConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface IInputAudioConfig + * @property {google.cloud.dialogflow.v2.AudioEncoding|null} [audioEncoding] InputAudioConfig audioEncoding + * @property {number|null} [sampleRateHertz] InputAudioConfig sampleRateHertz + * @property {string|null} [languageCode] InputAudioConfig languageCode + * @property {boolean|null} [enableWordInfo] InputAudioConfig enableWordInfo + * @property {Array.|null} [phraseHints] InputAudioConfig phraseHints + * @property {Array.|null} [speechContexts] InputAudioConfig speechContexts + * @property {string|null} [model] InputAudioConfig model + * @property {google.cloud.dialogflow.v2.SpeechModelVariant|null} [modelVariant] InputAudioConfig modelVariant + * @property {boolean|null} [singleUtterance] InputAudioConfig singleUtterance + * @property {boolean|null} [disableNoSpeechRecognizedEvent] InputAudioConfig disableNoSpeechRecognizedEvent + */ + + /** + * Constructs a new InputAudioConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an InputAudioConfig. + * @implements IInputAudioConfig + * @constructor + * @param {google.cloud.dialogflow.v2.IInputAudioConfig=} [properties] Properties to set + */ + function InputAudioConfig(properties) { + this.phraseHints = []; + this.speechContexts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InputAudioConfig audioEncoding. + * @member {google.cloud.dialogflow.v2.AudioEncoding} audioEncoding + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.audioEncoding = 0; + + /** + * InputAudioConfig sampleRateHertz. + * @member {number} sampleRateHertz + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.sampleRateHertz = 0; + + /** + * InputAudioConfig languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.languageCode = ""; + + /** + * InputAudioConfig enableWordInfo. + * @member {boolean} enableWordInfo + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.enableWordInfo = false; + + /** + * InputAudioConfig phraseHints. + * @member {Array.} phraseHints + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.phraseHints = $util.emptyArray; + + /** + * InputAudioConfig speechContexts. + * @member {Array.} speechContexts + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.speechContexts = $util.emptyArray; + + /** + * InputAudioConfig model. + * @member {string} model + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.model = ""; + + /** + * InputAudioConfig modelVariant. + * @member {google.cloud.dialogflow.v2.SpeechModelVariant} modelVariant + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.modelVariant = 0; + + /** + * InputAudioConfig singleUtterance. + * @member {boolean} singleUtterance + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.singleUtterance = false; + + /** + * InputAudioConfig disableNoSpeechRecognizedEvent. + * @member {boolean} disableNoSpeechRecognizedEvent + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.disableNoSpeechRecognizedEvent = false; + + /** + * Creates a new InputAudioConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2.IInputAudioConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.InputAudioConfig} InputAudioConfig instance + */ + InputAudioConfig.create = function create(properties) { + return new InputAudioConfig(properties); + }; + + /** + * Encodes the specified InputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.InputAudioConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2.IInputAudioConfig} message InputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputAudioConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioEncoding != null && Object.hasOwnProperty.call(message, "audioEncoding")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.audioEncoding); + if (message.sampleRateHertz != null && Object.hasOwnProperty.call(message, "sampleRateHertz")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sampleRateHertz); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.phraseHints != null && message.phraseHints.length) + for (var i = 0; i < message.phraseHints.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.phraseHints[i]); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.model); + if (message.singleUtterance != null && Object.hasOwnProperty.call(message, "singleUtterance")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.singleUtterance); + if (message.modelVariant != null && Object.hasOwnProperty.call(message, "modelVariant")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.modelVariant); + if (message.speechContexts != null && message.speechContexts.length) + for (var i = 0; i < message.speechContexts.length; ++i) + $root.google.cloud.dialogflow.v2.SpeechContext.encode(message.speechContexts[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.enableWordInfo != null && Object.hasOwnProperty.call(message, "enableWordInfo")) + writer.uint32(/* id 13, wireType 0 =*/104).bool(message.enableWordInfo); + if (message.disableNoSpeechRecognizedEvent != null && Object.hasOwnProperty.call(message, "disableNoSpeechRecognizedEvent")) + writer.uint32(/* id 14, wireType 0 =*/112).bool(message.disableNoSpeechRecognizedEvent); + return writer; + }; + + /** + * Encodes the specified InputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.InputAudioConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2.IInputAudioConfig} message InputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputAudioConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.InputAudioConfig} InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputAudioConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.InputAudioConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.audioEncoding = reader.int32(); + break; + } + case 2: { + message.sampleRateHertz = reader.int32(); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 13: { + message.enableWordInfo = reader.bool(); + break; + } + case 4: { + if (!(message.phraseHints && message.phraseHints.length)) + message.phraseHints = []; + message.phraseHints.push(reader.string()); + break; + } + case 11: { + if (!(message.speechContexts && message.speechContexts.length)) + message.speechContexts = []; + message.speechContexts.push($root.google.cloud.dialogflow.v2.SpeechContext.decode(reader, reader.uint32())); + break; + } + case 7: { + message.model = reader.string(); + break; + } + case 10: { + message.modelVariant = reader.int32(); + break; + } + case 8: { + message.singleUtterance = reader.bool(); + break; + } + case 14: { + message.disableNoSpeechRecognizedEvent = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.InputAudioConfig} InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputAudioConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InputAudioConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InputAudioConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + switch (message.audioEncoding) { + default: + return "audioEncoding: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + if (!$util.isInteger(message.sampleRateHertz)) + return "sampleRateHertz: integer expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.enableWordInfo != null && message.hasOwnProperty("enableWordInfo")) + if (typeof message.enableWordInfo !== "boolean") + return "enableWordInfo: boolean expected"; + if (message.phraseHints != null && message.hasOwnProperty("phraseHints")) { + if (!Array.isArray(message.phraseHints)) + return "phraseHints: array expected"; + for (var i = 0; i < message.phraseHints.length; ++i) + if (!$util.isString(message.phraseHints[i])) + return "phraseHints: string[] expected"; + } + if (message.speechContexts != null && message.hasOwnProperty("speechContexts")) { + if (!Array.isArray(message.speechContexts)) + return "speechContexts: array expected"; + for (var i = 0; i < message.speechContexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SpeechContext.verify(message.speechContexts[i]); + if (error) + return "speechContexts." + error; + } + } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.modelVariant != null && message.hasOwnProperty("modelVariant")) + switch (message.modelVariant) { + default: + return "modelVariant: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + if (typeof message.singleUtterance !== "boolean") + return "singleUtterance: boolean expected"; + if (message.disableNoSpeechRecognizedEvent != null && message.hasOwnProperty("disableNoSpeechRecognizedEvent")) + if (typeof message.disableNoSpeechRecognizedEvent !== "boolean") + return "disableNoSpeechRecognizedEvent: boolean expected"; + return null; + }; + + /** + * Creates an InputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.InputAudioConfig} InputAudioConfig + */ + InputAudioConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.InputAudioConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.InputAudioConfig(); + switch (object.audioEncoding) { + default: + if (typeof object.audioEncoding === "number") { + message.audioEncoding = object.audioEncoding; + break; + } + break; + case "AUDIO_ENCODING_UNSPECIFIED": + case 0: + message.audioEncoding = 0; + break; + case "AUDIO_ENCODING_LINEAR_16": + case 1: + message.audioEncoding = 1; + break; + case "AUDIO_ENCODING_FLAC": + case 2: + message.audioEncoding = 2; + break; + case "AUDIO_ENCODING_MULAW": + case 3: + message.audioEncoding = 3; + break; + case "AUDIO_ENCODING_AMR": + case 4: + message.audioEncoding = 4; + break; + case "AUDIO_ENCODING_AMR_WB": + case 5: + message.audioEncoding = 5; + break; + case "AUDIO_ENCODING_OGG_OPUS": + case 6: + message.audioEncoding = 6; + break; + case "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": + case 7: + message.audioEncoding = 7; + break; + } + if (object.sampleRateHertz != null) + message.sampleRateHertz = object.sampleRateHertz | 0; + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.enableWordInfo != null) + message.enableWordInfo = Boolean(object.enableWordInfo); + if (object.phraseHints) { + if (!Array.isArray(object.phraseHints)) + throw TypeError(".google.cloud.dialogflow.v2.InputAudioConfig.phraseHints: array expected"); + message.phraseHints = []; + for (var i = 0; i < object.phraseHints.length; ++i) + message.phraseHints[i] = String(object.phraseHints[i]); + } + if (object.speechContexts) { + if (!Array.isArray(object.speechContexts)) + throw TypeError(".google.cloud.dialogflow.v2.InputAudioConfig.speechContexts: array expected"); + message.speechContexts = []; + for (var i = 0; i < object.speechContexts.length; ++i) { + if (typeof object.speechContexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.InputAudioConfig.speechContexts: object expected"); + message.speechContexts[i] = $root.google.cloud.dialogflow.v2.SpeechContext.fromObject(object.speechContexts[i]); + } + } + if (object.model != null) + message.model = String(object.model); + switch (object.modelVariant) { + default: + if (typeof object.modelVariant === "number") { + message.modelVariant = object.modelVariant; + break; + } + break; + case "SPEECH_MODEL_VARIANT_UNSPECIFIED": + case 0: + message.modelVariant = 0; + break; + case "USE_BEST_AVAILABLE": + case 1: + message.modelVariant = 1; + break; + case "USE_STANDARD": + case 2: + message.modelVariant = 2; + break; + case "USE_ENHANCED": + case 3: + message.modelVariant = 3; + break; + } + if (object.singleUtterance != null) + message.singleUtterance = Boolean(object.singleUtterance); + if (object.disableNoSpeechRecognizedEvent != null) + message.disableNoSpeechRecognizedEvent = Boolean(object.disableNoSpeechRecognizedEvent); + return message; + }; + + /** + * Creates a plain object from an InputAudioConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2.InputAudioConfig} message InputAudioConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InputAudioConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.phraseHints = []; + object.speechContexts = []; + } + if (options.defaults) { + object.audioEncoding = options.enums === String ? "AUDIO_ENCODING_UNSPECIFIED" : 0; + object.sampleRateHertz = 0; + object.languageCode = ""; + object.model = ""; + object.singleUtterance = false; + object.modelVariant = options.enums === String ? "SPEECH_MODEL_VARIANT_UNSPECIFIED" : 0; + object.enableWordInfo = false; + object.disableNoSpeechRecognizedEvent = false; + } + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + object.audioEncoding = options.enums === String ? $root.google.cloud.dialogflow.v2.AudioEncoding[message.audioEncoding] === undefined ? message.audioEncoding : $root.google.cloud.dialogflow.v2.AudioEncoding[message.audioEncoding] : message.audioEncoding; + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + object.sampleRateHertz = message.sampleRateHertz; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.phraseHints && message.phraseHints.length) { + object.phraseHints = []; + for (var j = 0; j < message.phraseHints.length; ++j) + object.phraseHints[j] = message.phraseHints[j]; + } + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + object.singleUtterance = message.singleUtterance; + if (message.modelVariant != null && message.hasOwnProperty("modelVariant")) + object.modelVariant = options.enums === String ? $root.google.cloud.dialogflow.v2.SpeechModelVariant[message.modelVariant] === undefined ? message.modelVariant : $root.google.cloud.dialogflow.v2.SpeechModelVariant[message.modelVariant] : message.modelVariant; + if (message.speechContexts && message.speechContexts.length) { + object.speechContexts = []; + for (var j = 0; j < message.speechContexts.length; ++j) + object.speechContexts[j] = $root.google.cloud.dialogflow.v2.SpeechContext.toObject(message.speechContexts[j], options); + } + if (message.enableWordInfo != null && message.hasOwnProperty("enableWordInfo")) + object.enableWordInfo = message.enableWordInfo; + if (message.disableNoSpeechRecognizedEvent != null && message.hasOwnProperty("disableNoSpeechRecognizedEvent")) + object.disableNoSpeechRecognizedEvent = message.disableNoSpeechRecognizedEvent; + return object; + }; + + /** + * Converts this InputAudioConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @instance + * @returns {Object.} JSON object + */ + InputAudioConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InputAudioConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.InputAudioConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputAudioConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.InputAudioConfig"; + }; + + return InputAudioConfig; + })(); + + /** + * SsmlVoiceGender enum. + * @name google.cloud.dialogflow.v2.SsmlVoiceGender + * @enum {number} + * @property {number} SSML_VOICE_GENDER_UNSPECIFIED=0 SSML_VOICE_GENDER_UNSPECIFIED value + * @property {number} SSML_VOICE_GENDER_MALE=1 SSML_VOICE_GENDER_MALE value + * @property {number} SSML_VOICE_GENDER_FEMALE=2 SSML_VOICE_GENDER_FEMALE value + * @property {number} SSML_VOICE_GENDER_NEUTRAL=3 SSML_VOICE_GENDER_NEUTRAL value + */ + v2.SsmlVoiceGender = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SSML_VOICE_GENDER_UNSPECIFIED"] = 0; + values[valuesById[1] = "SSML_VOICE_GENDER_MALE"] = 1; + values[valuesById[2] = "SSML_VOICE_GENDER_FEMALE"] = 2; + values[valuesById[3] = "SSML_VOICE_GENDER_NEUTRAL"] = 3; + return values; + })(); + + v2.VoiceSelectionParams = (function() { + + /** + * Properties of a VoiceSelectionParams. + * @memberof google.cloud.dialogflow.v2 + * @interface IVoiceSelectionParams + * @property {string|null} [name] VoiceSelectionParams name + * @property {google.cloud.dialogflow.v2.SsmlVoiceGender|null} [ssmlGender] VoiceSelectionParams ssmlGender + */ + + /** + * Constructs a new VoiceSelectionParams. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a VoiceSelectionParams. + * @implements IVoiceSelectionParams + * @constructor + * @param {google.cloud.dialogflow.v2.IVoiceSelectionParams=} [properties] Properties to set + */ + function VoiceSelectionParams(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VoiceSelectionParams name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @instance + */ + VoiceSelectionParams.prototype.name = ""; + + /** + * VoiceSelectionParams ssmlGender. + * @member {google.cloud.dialogflow.v2.SsmlVoiceGender} ssmlGender + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @instance + */ + VoiceSelectionParams.prototype.ssmlGender = 0; + + /** + * Creates a new VoiceSelectionParams instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.v2.IVoiceSelectionParams=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.VoiceSelectionParams} VoiceSelectionParams instance + */ + VoiceSelectionParams.create = function create(properties) { + return new VoiceSelectionParams(properties); + }; + + /** + * Encodes the specified VoiceSelectionParams message. Does not implicitly {@link google.cloud.dialogflow.v2.VoiceSelectionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.v2.IVoiceSelectionParams} message VoiceSelectionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoiceSelectionParams.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.ssmlGender != null && Object.hasOwnProperty.call(message, "ssmlGender")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.ssmlGender); + return writer; + }; + + /** + * Encodes the specified VoiceSelectionParams message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.VoiceSelectionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.v2.IVoiceSelectionParams} message VoiceSelectionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoiceSelectionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.VoiceSelectionParams} VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoiceSelectionParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.VoiceSelectionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.ssmlGender = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.VoiceSelectionParams} VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoiceSelectionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VoiceSelectionParams message. + * @function verify + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VoiceSelectionParams.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.ssmlGender != null && message.hasOwnProperty("ssmlGender")) + switch (message.ssmlGender) { + default: + return "ssmlGender: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a VoiceSelectionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.VoiceSelectionParams} VoiceSelectionParams + */ + VoiceSelectionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.VoiceSelectionParams) + return object; + var message = new $root.google.cloud.dialogflow.v2.VoiceSelectionParams(); + if (object.name != null) + message.name = String(object.name); + switch (object.ssmlGender) { + default: + if (typeof object.ssmlGender === "number") { + message.ssmlGender = object.ssmlGender; + break; + } + break; + case "SSML_VOICE_GENDER_UNSPECIFIED": + case 0: + message.ssmlGender = 0; + break; + case "SSML_VOICE_GENDER_MALE": + case 1: + message.ssmlGender = 1; + break; + case "SSML_VOICE_GENDER_FEMALE": + case 2: + message.ssmlGender = 2; + break; + case "SSML_VOICE_GENDER_NEUTRAL": + case 3: + message.ssmlGender = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a VoiceSelectionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.v2.VoiceSelectionParams} message VoiceSelectionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VoiceSelectionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.ssmlGender = options.enums === String ? "SSML_VOICE_GENDER_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.ssmlGender != null && message.hasOwnProperty("ssmlGender")) + object.ssmlGender = options.enums === String ? $root.google.cloud.dialogflow.v2.SsmlVoiceGender[message.ssmlGender] === undefined ? message.ssmlGender : $root.google.cloud.dialogflow.v2.SsmlVoiceGender[message.ssmlGender] : message.ssmlGender; + return object; + }; + + /** + * Converts this VoiceSelectionParams to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @instance + * @returns {Object.} JSON object + */ + VoiceSelectionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VoiceSelectionParams + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.VoiceSelectionParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VoiceSelectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.VoiceSelectionParams"; + }; + + return VoiceSelectionParams; + })(); + + v2.SynthesizeSpeechConfig = (function() { + + /** + * Properties of a SynthesizeSpeechConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface ISynthesizeSpeechConfig + * @property {number|null} [speakingRate] SynthesizeSpeechConfig speakingRate + * @property {number|null} [pitch] SynthesizeSpeechConfig pitch + * @property {number|null} [volumeGainDb] SynthesizeSpeechConfig volumeGainDb + * @property {Array.|null} [effectsProfileId] SynthesizeSpeechConfig effectsProfileId + * @property {google.cloud.dialogflow.v2.IVoiceSelectionParams|null} [voice] SynthesizeSpeechConfig voice + */ + + /** + * Constructs a new SynthesizeSpeechConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SynthesizeSpeechConfig. + * @implements ISynthesizeSpeechConfig + * @constructor + * @param {google.cloud.dialogflow.v2.ISynthesizeSpeechConfig=} [properties] Properties to set + */ + function SynthesizeSpeechConfig(properties) { + this.effectsProfileId = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SynthesizeSpeechConfig speakingRate. + * @member {number} speakingRate + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.speakingRate = 0; + + /** + * SynthesizeSpeechConfig pitch. + * @member {number} pitch + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.pitch = 0; + + /** + * SynthesizeSpeechConfig volumeGainDb. + * @member {number} volumeGainDb + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.volumeGainDb = 0; + + /** + * SynthesizeSpeechConfig effectsProfileId. + * @member {Array.} effectsProfileId + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.effectsProfileId = $util.emptyArray; + + /** + * SynthesizeSpeechConfig voice. + * @member {google.cloud.dialogflow.v2.IVoiceSelectionParams|null|undefined} voice + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.voice = null; + + /** + * Creates a new SynthesizeSpeechConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.v2.ISynthesizeSpeechConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SynthesizeSpeechConfig} SynthesizeSpeechConfig instance + */ + SynthesizeSpeechConfig.create = function create(properties) { + return new SynthesizeSpeechConfig(properties); + }; + + /** + * Encodes the specified SynthesizeSpeechConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.SynthesizeSpeechConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.v2.ISynthesizeSpeechConfig} message SynthesizeSpeechConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SynthesizeSpeechConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.speakingRate != null && Object.hasOwnProperty.call(message, "speakingRate")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.speakingRate); + if (message.pitch != null && Object.hasOwnProperty.call(message, "pitch")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.pitch); + if (message.volumeGainDb != null && Object.hasOwnProperty.call(message, "volumeGainDb")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.volumeGainDb); + if (message.voice != null && Object.hasOwnProperty.call(message, "voice")) + $root.google.cloud.dialogflow.v2.VoiceSelectionParams.encode(message.voice, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.effectsProfileId != null && message.effectsProfileId.length) + for (var i = 0; i < message.effectsProfileId.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.effectsProfileId[i]); + return writer; + }; + + /** + * Encodes the specified SynthesizeSpeechConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SynthesizeSpeechConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.v2.ISynthesizeSpeechConfig} message SynthesizeSpeechConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SynthesizeSpeechConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SynthesizeSpeechConfig} SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SynthesizeSpeechConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.speakingRate = reader.double(); + break; + } + case 2: { + message.pitch = reader.double(); + break; + } + case 3: { + message.volumeGainDb = reader.double(); + break; + } + case 5: { + if (!(message.effectsProfileId && message.effectsProfileId.length)) + message.effectsProfileId = []; + message.effectsProfileId.push(reader.string()); + break; + } + case 4: { + message.voice = $root.google.cloud.dialogflow.v2.VoiceSelectionParams.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SynthesizeSpeechConfig} SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SynthesizeSpeechConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SynthesizeSpeechConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SynthesizeSpeechConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.speakingRate != null && message.hasOwnProperty("speakingRate")) + if (typeof message.speakingRate !== "number") + return "speakingRate: number expected"; + if (message.pitch != null && message.hasOwnProperty("pitch")) + if (typeof message.pitch !== "number") + return "pitch: number expected"; + if (message.volumeGainDb != null && message.hasOwnProperty("volumeGainDb")) + if (typeof message.volumeGainDb !== "number") + return "volumeGainDb: number expected"; + if (message.effectsProfileId != null && message.hasOwnProperty("effectsProfileId")) { + if (!Array.isArray(message.effectsProfileId)) + return "effectsProfileId: array expected"; + for (var i = 0; i < message.effectsProfileId.length; ++i) + if (!$util.isString(message.effectsProfileId[i])) + return "effectsProfileId: string[] expected"; + } + if (message.voice != null && message.hasOwnProperty("voice")) { + var error = $root.google.cloud.dialogflow.v2.VoiceSelectionParams.verify(message.voice); + if (error) + return "voice." + error; + } + return null; + }; + + /** + * Creates a SynthesizeSpeechConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SynthesizeSpeechConfig} SynthesizeSpeechConfig + */ + SynthesizeSpeechConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig(); + if (object.speakingRate != null) + message.speakingRate = Number(object.speakingRate); + if (object.pitch != null) + message.pitch = Number(object.pitch); + if (object.volumeGainDb != null) + message.volumeGainDb = Number(object.volumeGainDb); + if (object.effectsProfileId) { + if (!Array.isArray(object.effectsProfileId)) + throw TypeError(".google.cloud.dialogflow.v2.SynthesizeSpeechConfig.effectsProfileId: array expected"); + message.effectsProfileId = []; + for (var i = 0; i < object.effectsProfileId.length; ++i) + message.effectsProfileId[i] = String(object.effectsProfileId[i]); + } + if (object.voice != null) { + if (typeof object.voice !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SynthesizeSpeechConfig.voice: object expected"); + message.voice = $root.google.cloud.dialogflow.v2.VoiceSelectionParams.fromObject(object.voice); + } + return message; + }; + + /** + * Creates a plain object from a SynthesizeSpeechConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.v2.SynthesizeSpeechConfig} message SynthesizeSpeechConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SynthesizeSpeechConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.effectsProfileId = []; + if (options.defaults) { + object.speakingRate = 0; + object.pitch = 0; + object.volumeGainDb = 0; + object.voice = null; + } + if (message.speakingRate != null && message.hasOwnProperty("speakingRate")) + object.speakingRate = options.json && !isFinite(message.speakingRate) ? String(message.speakingRate) : message.speakingRate; + if (message.pitch != null && message.hasOwnProperty("pitch")) + object.pitch = options.json && !isFinite(message.pitch) ? String(message.pitch) : message.pitch; + if (message.volumeGainDb != null && message.hasOwnProperty("volumeGainDb")) + object.volumeGainDb = options.json && !isFinite(message.volumeGainDb) ? String(message.volumeGainDb) : message.volumeGainDb; + if (message.voice != null && message.hasOwnProperty("voice")) + object.voice = $root.google.cloud.dialogflow.v2.VoiceSelectionParams.toObject(message.voice, options); + if (message.effectsProfileId && message.effectsProfileId.length) { + object.effectsProfileId = []; + for (var j = 0; j < message.effectsProfileId.length; ++j) + object.effectsProfileId[j] = message.effectsProfileId[j]; + } + return object; + }; + + /** + * Converts this SynthesizeSpeechConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @instance + * @returns {Object.} JSON object + */ + SynthesizeSpeechConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SynthesizeSpeechConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SynthesizeSpeechConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SynthesizeSpeechConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SynthesizeSpeechConfig"; + }; + + return SynthesizeSpeechConfig; + })(); + + /** + * OutputAudioEncoding enum. + * @name google.cloud.dialogflow.v2.OutputAudioEncoding + * @enum {number} + * @property {number} OUTPUT_AUDIO_ENCODING_UNSPECIFIED=0 OUTPUT_AUDIO_ENCODING_UNSPECIFIED value + * @property {number} OUTPUT_AUDIO_ENCODING_LINEAR_16=1 OUTPUT_AUDIO_ENCODING_LINEAR_16 value + * @property {number} OUTPUT_AUDIO_ENCODING_MP3=2 OUTPUT_AUDIO_ENCODING_MP3 value + * @property {number} OUTPUT_AUDIO_ENCODING_MP3_64_KBPS=4 OUTPUT_AUDIO_ENCODING_MP3_64_KBPS value + * @property {number} OUTPUT_AUDIO_ENCODING_OGG_OPUS=3 OUTPUT_AUDIO_ENCODING_OGG_OPUS value + * @property {number} OUTPUT_AUDIO_ENCODING_MULAW=5 OUTPUT_AUDIO_ENCODING_MULAW value + */ + v2.OutputAudioEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OUTPUT_AUDIO_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "OUTPUT_AUDIO_ENCODING_LINEAR_16"] = 1; + values[valuesById[2] = "OUTPUT_AUDIO_ENCODING_MP3"] = 2; + values[valuesById[4] = "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS"] = 4; + values[valuesById[3] = "OUTPUT_AUDIO_ENCODING_OGG_OPUS"] = 3; + values[valuesById[5] = "OUTPUT_AUDIO_ENCODING_MULAW"] = 5; + return values; + })(); + + v2.OutputAudioConfig = (function() { + + /** + * Properties of an OutputAudioConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface IOutputAudioConfig + * @property {google.cloud.dialogflow.v2.OutputAudioEncoding|null} [audioEncoding] OutputAudioConfig audioEncoding + * @property {number|null} [sampleRateHertz] OutputAudioConfig sampleRateHertz + * @property {google.cloud.dialogflow.v2.ISynthesizeSpeechConfig|null} [synthesizeSpeechConfig] OutputAudioConfig synthesizeSpeechConfig + */ + + /** + * Constructs a new OutputAudioConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an OutputAudioConfig. + * @implements IOutputAudioConfig + * @constructor + * @param {google.cloud.dialogflow.v2.IOutputAudioConfig=} [properties] Properties to set + */ + function OutputAudioConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputAudioConfig audioEncoding. + * @member {google.cloud.dialogflow.v2.OutputAudioEncoding} audioEncoding + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @instance + */ + OutputAudioConfig.prototype.audioEncoding = 0; + + /** + * OutputAudioConfig sampleRateHertz. + * @member {number} sampleRateHertz + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @instance + */ + OutputAudioConfig.prototype.sampleRateHertz = 0; + + /** + * OutputAudioConfig synthesizeSpeechConfig. + * @member {google.cloud.dialogflow.v2.ISynthesizeSpeechConfig|null|undefined} synthesizeSpeechConfig + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @instance + */ + OutputAudioConfig.prototype.synthesizeSpeechConfig = null; + + /** + * Creates a new OutputAudioConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2.IOutputAudioConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.OutputAudioConfig} OutputAudioConfig instance + */ + OutputAudioConfig.create = function create(properties) { + return new OutputAudioConfig(properties); + }; + + /** + * Encodes the specified OutputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.OutputAudioConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2.IOutputAudioConfig} message OutputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudioConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioEncoding != null && Object.hasOwnProperty.call(message, "audioEncoding")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.audioEncoding); + if (message.sampleRateHertz != null && Object.hasOwnProperty.call(message, "sampleRateHertz")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sampleRateHertz); + if (message.synthesizeSpeechConfig != null && Object.hasOwnProperty.call(message, "synthesizeSpeechConfig")) + $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.encode(message.synthesizeSpeechConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OutputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.OutputAudioConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2.IOutputAudioConfig} message OutputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudioConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.OutputAudioConfig} OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudioConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.OutputAudioConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.audioEncoding = reader.int32(); + break; + } + case 2: { + message.sampleRateHertz = reader.int32(); + break; + } + case 3: { + message.synthesizeSpeechConfig = $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.OutputAudioConfig} OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudioConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputAudioConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputAudioConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + switch (message.audioEncoding) { + default: + return "audioEncoding: enum value expected"; + case 0: + case 1: + case 2: + case 4: + case 3: + case 5: + break; + } + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + if (!$util.isInteger(message.sampleRateHertz)) + return "sampleRateHertz: integer expected"; + if (message.synthesizeSpeechConfig != null && message.hasOwnProperty("synthesizeSpeechConfig")) { + var error = $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.verify(message.synthesizeSpeechConfig); + if (error) + return "synthesizeSpeechConfig." + error; + } + return null; + }; + + /** + * Creates an OutputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.OutputAudioConfig} OutputAudioConfig + */ + OutputAudioConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.OutputAudioConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.OutputAudioConfig(); + switch (object.audioEncoding) { + default: + if (typeof object.audioEncoding === "number") { + message.audioEncoding = object.audioEncoding; + break; + } + break; + case "OUTPUT_AUDIO_ENCODING_UNSPECIFIED": + case 0: + message.audioEncoding = 0; + break; + case "OUTPUT_AUDIO_ENCODING_LINEAR_16": + case 1: + message.audioEncoding = 1; + break; + case "OUTPUT_AUDIO_ENCODING_MP3": + case 2: + message.audioEncoding = 2; + break; + case "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS": + case 4: + message.audioEncoding = 4; + break; + case "OUTPUT_AUDIO_ENCODING_OGG_OPUS": + case 3: + message.audioEncoding = 3; + break; + case "OUTPUT_AUDIO_ENCODING_MULAW": + case 5: + message.audioEncoding = 5; + break; + } + if (object.sampleRateHertz != null) + message.sampleRateHertz = object.sampleRateHertz | 0; + if (object.synthesizeSpeechConfig != null) { + if (typeof object.synthesizeSpeechConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.OutputAudioConfig.synthesizeSpeechConfig: object expected"); + message.synthesizeSpeechConfig = $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.fromObject(object.synthesizeSpeechConfig); + } + return message; + }; + + /** + * Creates a plain object from an OutputAudioConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2.OutputAudioConfig} message OutputAudioConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputAudioConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.audioEncoding = options.enums === String ? "OUTPUT_AUDIO_ENCODING_UNSPECIFIED" : 0; + object.sampleRateHertz = 0; + object.synthesizeSpeechConfig = null; + } + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + object.audioEncoding = options.enums === String ? $root.google.cloud.dialogflow.v2.OutputAudioEncoding[message.audioEncoding] === undefined ? message.audioEncoding : $root.google.cloud.dialogflow.v2.OutputAudioEncoding[message.audioEncoding] : message.audioEncoding; + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + object.sampleRateHertz = message.sampleRateHertz; + if (message.synthesizeSpeechConfig != null && message.hasOwnProperty("synthesizeSpeechConfig")) + object.synthesizeSpeechConfig = $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.toObject(message.synthesizeSpeechConfig, options); + return object; + }; + + /** + * Converts this OutputAudioConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @instance + * @returns {Object.} JSON object + */ + OutputAudioConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OutputAudioConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.OutputAudioConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputAudioConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.OutputAudioConfig"; + }; + + return OutputAudioConfig; + })(); + + /** + * TelephonyDtmf enum. + * @name google.cloud.dialogflow.v2.TelephonyDtmf + * @enum {number} + * @property {number} TELEPHONY_DTMF_UNSPECIFIED=0 TELEPHONY_DTMF_UNSPECIFIED value + * @property {number} DTMF_ONE=1 DTMF_ONE value + * @property {number} DTMF_TWO=2 DTMF_TWO value + * @property {number} DTMF_THREE=3 DTMF_THREE value + * @property {number} DTMF_FOUR=4 DTMF_FOUR value + * @property {number} DTMF_FIVE=5 DTMF_FIVE value + * @property {number} DTMF_SIX=6 DTMF_SIX value + * @property {number} DTMF_SEVEN=7 DTMF_SEVEN value + * @property {number} DTMF_EIGHT=8 DTMF_EIGHT value + * @property {number} DTMF_NINE=9 DTMF_NINE value + * @property {number} DTMF_ZERO=10 DTMF_ZERO value + * @property {number} DTMF_A=11 DTMF_A value + * @property {number} DTMF_B=12 DTMF_B value + * @property {number} DTMF_C=13 DTMF_C value + * @property {number} DTMF_D=14 DTMF_D value + * @property {number} DTMF_STAR=15 DTMF_STAR value + * @property {number} DTMF_POUND=16 DTMF_POUND value + */ + v2.TelephonyDtmf = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TELEPHONY_DTMF_UNSPECIFIED"] = 0; + values[valuesById[1] = "DTMF_ONE"] = 1; + values[valuesById[2] = "DTMF_TWO"] = 2; + values[valuesById[3] = "DTMF_THREE"] = 3; + values[valuesById[4] = "DTMF_FOUR"] = 4; + values[valuesById[5] = "DTMF_FIVE"] = 5; + values[valuesById[6] = "DTMF_SIX"] = 6; + values[valuesById[7] = "DTMF_SEVEN"] = 7; + values[valuesById[8] = "DTMF_EIGHT"] = 8; + values[valuesById[9] = "DTMF_NINE"] = 9; + values[valuesById[10] = "DTMF_ZERO"] = 10; + values[valuesById[11] = "DTMF_A"] = 11; + values[valuesById[12] = "DTMF_B"] = 12; + values[valuesById[13] = "DTMF_C"] = 13; + values[valuesById[14] = "DTMF_D"] = 14; + values[valuesById[15] = "DTMF_STAR"] = 15; + values[valuesById[16] = "DTMF_POUND"] = 16; + return values; + })(); + + v2.TelephonyDtmfEvents = (function() { + + /** + * Properties of a TelephonyDtmfEvents. + * @memberof google.cloud.dialogflow.v2 + * @interface ITelephonyDtmfEvents + * @property {Array.|null} [dtmfEvents] TelephonyDtmfEvents dtmfEvents + */ + + /** + * Constructs a new TelephonyDtmfEvents. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a TelephonyDtmfEvents. + * @implements ITelephonyDtmfEvents + * @constructor + * @param {google.cloud.dialogflow.v2.ITelephonyDtmfEvents=} [properties] Properties to set + */ + function TelephonyDtmfEvents(properties) { + this.dtmfEvents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TelephonyDtmfEvents dtmfEvents. + * @member {Array.} dtmfEvents + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @instance + */ + TelephonyDtmfEvents.prototype.dtmfEvents = $util.emptyArray; + + /** + * Creates a new TelephonyDtmfEvents instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @static + * @param {google.cloud.dialogflow.v2.ITelephonyDtmfEvents=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.TelephonyDtmfEvents} TelephonyDtmfEvents instance + */ + TelephonyDtmfEvents.create = function create(properties) { + return new TelephonyDtmfEvents(properties); + }; + + /** + * Encodes the specified TelephonyDtmfEvents message. Does not implicitly {@link google.cloud.dialogflow.v2.TelephonyDtmfEvents.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @static + * @param {google.cloud.dialogflow.v2.ITelephonyDtmfEvents} message TelephonyDtmfEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyDtmfEvents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dtmfEvents != null && message.dtmfEvents.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.dtmfEvents.length; ++i) + writer.int32(message.dtmfEvents[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified TelephonyDtmfEvents message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.TelephonyDtmfEvents.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @static + * @param {google.cloud.dialogflow.v2.ITelephonyDtmfEvents} message TelephonyDtmfEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyDtmfEvents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TelephonyDtmfEvents message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.TelephonyDtmfEvents} TelephonyDtmfEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyDtmfEvents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.TelephonyDtmfEvents(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.dtmfEvents && message.dtmfEvents.length)) + message.dtmfEvents = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.dtmfEvents.push(reader.int32()); + } else + message.dtmfEvents.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TelephonyDtmfEvents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.TelephonyDtmfEvents} TelephonyDtmfEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyDtmfEvents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TelephonyDtmfEvents message. + * @function verify + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TelephonyDtmfEvents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dtmfEvents != null && message.hasOwnProperty("dtmfEvents")) { + if (!Array.isArray(message.dtmfEvents)) + return "dtmfEvents: array expected"; + for (var i = 0; i < message.dtmfEvents.length; ++i) + switch (message.dtmfEvents[i]) { + default: + return "dtmfEvents: 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: + break; + } + } + return null; + }; + + /** + * Creates a TelephonyDtmfEvents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.TelephonyDtmfEvents} TelephonyDtmfEvents + */ + TelephonyDtmfEvents.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.TelephonyDtmfEvents) + return object; + var message = new $root.google.cloud.dialogflow.v2.TelephonyDtmfEvents(); + if (object.dtmfEvents) { + if (!Array.isArray(object.dtmfEvents)) + throw TypeError(".google.cloud.dialogflow.v2.TelephonyDtmfEvents.dtmfEvents: array expected"); + message.dtmfEvents = []; + for (var i = 0; i < object.dtmfEvents.length; ++i) + switch (object.dtmfEvents[i]) { + default: + if (typeof object.dtmfEvents[i] === "number") { + message.dtmfEvents[i] = object.dtmfEvents[i]; + break; + } + case "TELEPHONY_DTMF_UNSPECIFIED": + case 0: + message.dtmfEvents[i] = 0; + break; + case "DTMF_ONE": + case 1: + message.dtmfEvents[i] = 1; + break; + case "DTMF_TWO": + case 2: + message.dtmfEvents[i] = 2; + break; + case "DTMF_THREE": + case 3: + message.dtmfEvents[i] = 3; + break; + case "DTMF_FOUR": + case 4: + message.dtmfEvents[i] = 4; + break; + case "DTMF_FIVE": + case 5: + message.dtmfEvents[i] = 5; + break; + case "DTMF_SIX": + case 6: + message.dtmfEvents[i] = 6; + break; + case "DTMF_SEVEN": + case 7: + message.dtmfEvents[i] = 7; + break; + case "DTMF_EIGHT": + case 8: + message.dtmfEvents[i] = 8; + break; + case "DTMF_NINE": + case 9: + message.dtmfEvents[i] = 9; + break; + case "DTMF_ZERO": + case 10: + message.dtmfEvents[i] = 10; + break; + case "DTMF_A": + case 11: + message.dtmfEvents[i] = 11; + break; + case "DTMF_B": + case 12: + message.dtmfEvents[i] = 12; + break; + case "DTMF_C": + case 13: + message.dtmfEvents[i] = 13; + break; + case "DTMF_D": + case 14: + message.dtmfEvents[i] = 14; + break; + case "DTMF_STAR": + case 15: + message.dtmfEvents[i] = 15; + break; + case "DTMF_POUND": + case 16: + message.dtmfEvents[i] = 16; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a TelephonyDtmfEvents message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @static + * @param {google.cloud.dialogflow.v2.TelephonyDtmfEvents} message TelephonyDtmfEvents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TelephonyDtmfEvents.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.dtmfEvents = []; + if (message.dtmfEvents && message.dtmfEvents.length) { + object.dtmfEvents = []; + for (var j = 0; j < message.dtmfEvents.length; ++j) + object.dtmfEvents[j] = options.enums === String ? $root.google.cloud.dialogflow.v2.TelephonyDtmf[message.dtmfEvents[j]] === undefined ? message.dtmfEvents[j] : $root.google.cloud.dialogflow.v2.TelephonyDtmf[message.dtmfEvents[j]] : message.dtmfEvents[j]; + } + return object; + }; + + /** + * Converts this TelephonyDtmfEvents to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @instance + * @returns {Object.} JSON object + */ + TelephonyDtmfEvents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TelephonyDtmfEvents + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.TelephonyDtmfEvents + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TelephonyDtmfEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.TelephonyDtmfEvents"; + }; + + return TelephonyDtmfEvents; + })(); + + v2.SpeechToTextConfig = (function() { + + /** + * Properties of a SpeechToTextConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface ISpeechToTextConfig + * @property {google.cloud.dialogflow.v2.SpeechModelVariant|null} [speechModelVariant] SpeechToTextConfig speechModelVariant + * @property {string|null} [model] SpeechToTextConfig model + */ + + /** + * Constructs a new SpeechToTextConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SpeechToTextConfig. + * @implements ISpeechToTextConfig + * @constructor + * @param {google.cloud.dialogflow.v2.ISpeechToTextConfig=} [properties] Properties to set + */ + function SpeechToTextConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpeechToTextConfig speechModelVariant. + * @member {google.cloud.dialogflow.v2.SpeechModelVariant} speechModelVariant + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @instance + */ + SpeechToTextConfig.prototype.speechModelVariant = 0; + + /** + * SpeechToTextConfig model. + * @member {string} model + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @instance + */ + SpeechToTextConfig.prototype.model = ""; + + /** + * Creates a new SpeechToTextConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @static + * @param {google.cloud.dialogflow.v2.ISpeechToTextConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SpeechToTextConfig} SpeechToTextConfig instance + */ + SpeechToTextConfig.create = function create(properties) { + return new SpeechToTextConfig(properties); + }; + + /** + * Encodes the specified SpeechToTextConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechToTextConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @static + * @param {google.cloud.dialogflow.v2.ISpeechToTextConfig} message SpeechToTextConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechToTextConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.speechModelVariant != null && Object.hasOwnProperty.call(message, "speechModelVariant")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.speechModelVariant); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.model); + return writer; + }; + + /** + * Encodes the specified SpeechToTextConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SpeechToTextConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @static + * @param {google.cloud.dialogflow.v2.ISpeechToTextConfig} message SpeechToTextConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechToTextConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpeechToTextConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SpeechToTextConfig} SpeechToTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechToTextConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SpeechToTextConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.speechModelVariant = reader.int32(); + break; + } + case 2: { + message.model = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpeechToTextConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SpeechToTextConfig} SpeechToTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechToTextConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpeechToTextConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpeechToTextConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.speechModelVariant != null && message.hasOwnProperty("speechModelVariant")) + switch (message.speechModelVariant) { + default: + return "speechModelVariant: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates a SpeechToTextConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SpeechToTextConfig} SpeechToTextConfig + */ + SpeechToTextConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SpeechToTextConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.SpeechToTextConfig(); + switch (object.speechModelVariant) { + default: + if (typeof object.speechModelVariant === "number") { + message.speechModelVariant = object.speechModelVariant; + break; + } + break; + case "SPEECH_MODEL_VARIANT_UNSPECIFIED": + case 0: + message.speechModelVariant = 0; + break; + case "USE_BEST_AVAILABLE": + case 1: + message.speechModelVariant = 1; + break; + case "USE_STANDARD": + case 2: + message.speechModelVariant = 2; + break; + case "USE_ENHANCED": + case 3: + message.speechModelVariant = 3; + break; + } + if (object.model != null) + message.model = String(object.model); + return message; + }; + + /** + * Creates a plain object from a SpeechToTextConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @static + * @param {google.cloud.dialogflow.v2.SpeechToTextConfig} message SpeechToTextConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpeechToTextConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.speechModelVariant = options.enums === String ? "SPEECH_MODEL_VARIANT_UNSPECIFIED" : 0; + object.model = ""; + } + if (message.speechModelVariant != null && message.hasOwnProperty("speechModelVariant")) + object.speechModelVariant = options.enums === String ? $root.google.cloud.dialogflow.v2.SpeechModelVariant[message.speechModelVariant] === undefined ? message.speechModelVariant : $root.google.cloud.dialogflow.v2.SpeechModelVariant[message.speechModelVariant] : message.speechModelVariant; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + return object; + }; + + /** + * Converts this SpeechToTextConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @instance + * @returns {Object.} JSON object + */ + SpeechToTextConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SpeechToTextConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SpeechToTextConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpeechToTextConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SpeechToTextConfig"; + }; + + return SpeechToTextConfig; + })(); + + v2.Sessions = (function() { + + /** + * Constructs a new Sessions service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Sessions + * @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 Sessions(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Sessions.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Sessions; + + /** + * Creates new Sessions service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Sessions + * @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 {Sessions} RPC service. Useful where requests and/or responses are streamed. + */ + Sessions.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Sessions|detectIntent}. + * @memberof google.cloud.dialogflow.v2.Sessions + * @typedef DetectIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.DetectIntentResponse} [response] DetectIntentResponse + */ + + /** + * Calls DetectIntent. + * @function detectIntent + * @memberof google.cloud.dialogflow.v2.Sessions + * @instance + * @param {google.cloud.dialogflow.v2.IDetectIntentRequest} request DetectIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Sessions.DetectIntentCallback} callback Node-style callback called with the error, if any, and DetectIntentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Sessions.prototype.detectIntent = function detectIntent(request, callback) { + return this.rpcCall(detectIntent, $root.google.cloud.dialogflow.v2.DetectIntentRequest, $root.google.cloud.dialogflow.v2.DetectIntentResponse, request, callback); + }, "name", { value: "DetectIntent" }); + + /** + * Calls DetectIntent. + * @function detectIntent + * @memberof google.cloud.dialogflow.v2.Sessions + * @instance + * @param {google.cloud.dialogflow.v2.IDetectIntentRequest} request DetectIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Sessions|streamingDetectIntent}. + * @memberof google.cloud.dialogflow.v2.Sessions + * @typedef StreamingDetectIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.StreamingDetectIntentResponse} [response] StreamingDetectIntentResponse + */ + + /** + * Calls StreamingDetectIntent. + * @function streamingDetectIntent + * @memberof google.cloud.dialogflow.v2.Sessions + * @instance + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentRequest} request StreamingDetectIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Sessions.StreamingDetectIntentCallback} callback Node-style callback called with the error, if any, and StreamingDetectIntentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Sessions.prototype.streamingDetectIntent = function streamingDetectIntent(request, callback) { + return this.rpcCall(streamingDetectIntent, $root.google.cloud.dialogflow.v2.StreamingDetectIntentRequest, $root.google.cloud.dialogflow.v2.StreamingDetectIntentResponse, request, callback); + }, "name", { value: "StreamingDetectIntent" }); + + /** + * Calls StreamingDetectIntent. + * @function streamingDetectIntent + * @memberof google.cloud.dialogflow.v2.Sessions + * @instance + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentRequest} request StreamingDetectIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Sessions; + })(); + + v2.DetectIntentRequest = (function() { + + /** + * Properties of a DetectIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDetectIntentRequest + * @property {string|null} [session] DetectIntentRequest session + * @property {google.cloud.dialogflow.v2.IQueryParameters|null} [queryParams] DetectIntentRequest queryParams + * @property {google.cloud.dialogflow.v2.IQueryInput|null} [queryInput] DetectIntentRequest queryInput + * @property {google.cloud.dialogflow.v2.IOutputAudioConfig|null} [outputAudioConfig] DetectIntentRequest outputAudioConfig + * @property {google.protobuf.IFieldMask|null} [outputAudioConfigMask] DetectIntentRequest outputAudioConfigMask + * @property {Uint8Array|null} [inputAudio] DetectIntentRequest inputAudio + */ + + /** + * Constructs a new DetectIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DetectIntentRequest. + * @implements IDetectIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDetectIntentRequest=} [properties] Properties to set + */ + function DetectIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectIntentRequest session. + * @member {string} session + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.session = ""; + + /** + * DetectIntentRequest queryParams. + * @member {google.cloud.dialogflow.v2.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.queryParams = null; + + /** + * DetectIntentRequest queryInput. + * @member {google.cloud.dialogflow.v2.IQueryInput|null|undefined} queryInput + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.queryInput = null; + + /** + * DetectIntentRequest outputAudioConfig. + * @member {google.cloud.dialogflow.v2.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.outputAudioConfig = null; + + /** + * DetectIntentRequest outputAudioConfigMask. + * @member {google.protobuf.IFieldMask|null|undefined} outputAudioConfigMask + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.outputAudioConfigMask = null; + + /** + * DetectIntentRequest inputAudio. + * @member {Uint8Array} inputAudio + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.inputAudio = $util.newBuffer([]); + + /** + * Creates a new DetectIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDetectIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DetectIntentRequest} DetectIntentRequest instance + */ + DetectIntentRequest.create = function create(properties) { + return new DetectIntentRequest(properties); + }; + + /** + * Encodes the specified DetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DetectIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDetectIntentRequest} message DetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.v2.QueryParameters.encode(message.queryParams, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.queryInput != null && Object.hasOwnProperty.call(message, "queryInput")) + $root.google.cloud.dialogflow.v2.QueryInput.encode(message.queryInput, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.v2.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.inputAudio != null && Object.hasOwnProperty.call(message, "inputAudio")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.inputAudio); + if (message.outputAudioConfigMask != null && Object.hasOwnProperty.call(message, "outputAudioConfigMask")) + $root.google.protobuf.FieldMask.encode(message.outputAudioConfigMask, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DetectIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDetectIntentRequest} message DetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DetectIntentRequest} DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DetectIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.session = reader.string(); + break; + } + case 2: { + message.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.decode(reader, reader.uint32()); + break; + } + case 3: { + message.queryInput = $root.google.cloud.dialogflow.v2.QueryInput.decode(reader, reader.uint32()); + break; + } + case 4: { + message.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.outputAudioConfigMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.inputAudio = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DetectIntentRequest} DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.v2.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.queryInput != null && message.hasOwnProperty("queryInput")) { + var error = $root.google.cloud.dialogflow.v2.QueryInput.verify(message.queryInput); + if (error) + return "queryInput." + error; + } + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + if (message.outputAudioConfigMask != null && message.hasOwnProperty("outputAudioConfigMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.outputAudioConfigMask); + if (error) + return "outputAudioConfigMask." + error; + } + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) + if (!(message.inputAudio && typeof message.inputAudio.length === "number" || $util.isString(message.inputAudio))) + return "inputAudio: buffer expected"; + return null; + }; + + /** + * Creates a DetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DetectIntentRequest} DetectIntentRequest + */ + DetectIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DetectIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DetectIntentRequest(); + if (object.session != null) + message.session = String(object.session); + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2.DetectIntentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.fromObject(object.queryParams); + } + if (object.queryInput != null) { + if (typeof object.queryInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2.DetectIntentRequest.queryInput: object expected"); + message.queryInput = $root.google.cloud.dialogflow.v2.QueryInput.fromObject(object.queryInput); + } + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.DetectIntentRequest.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + if (object.outputAudioConfigMask != null) { + if (typeof object.outputAudioConfigMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.DetectIntentRequest.outputAudioConfigMask: object expected"); + message.outputAudioConfigMask = $root.google.protobuf.FieldMask.fromObject(object.outputAudioConfigMask); + } + if (object.inputAudio != null) + if (typeof object.inputAudio === "string") + $util.base64.decode(object.inputAudio, message.inputAudio = $util.newBuffer($util.base64.length(object.inputAudio)), 0); + else if (object.inputAudio.length >= 0) + message.inputAudio = object.inputAudio; + return message; + }; + + /** + * Creates a plain object from a DetectIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.DetectIntentRequest} message DetectIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.session = ""; + object.queryParams = null; + object.queryInput = null; + object.outputAudioConfig = null; + if (options.bytes === String) + object.inputAudio = ""; + else { + object.inputAudio = []; + if (options.bytes !== Array) + object.inputAudio = $util.newBuffer(object.inputAudio); + } + object.outputAudioConfigMask = null; + } + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.toObject(message.queryParams, options); + if (message.queryInput != null && message.hasOwnProperty("queryInput")) + object.queryInput = $root.google.cloud.dialogflow.v2.QueryInput.toObject(message.queryInput, options); + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.toObject(message.outputAudioConfig, options); + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) + object.inputAudio = options.bytes === String ? $util.base64.encode(message.inputAudio, 0, message.inputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.inputAudio) : message.inputAudio; + if (message.outputAudioConfigMask != null && message.hasOwnProperty("outputAudioConfigMask")) + object.outputAudioConfigMask = $root.google.protobuf.FieldMask.toObject(message.outputAudioConfigMask, options); + return object; + }; + + /** + * Converts this DetectIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @instance + * @returns {Object.} JSON object + */ + DetectIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DetectIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DetectIntentRequest"; + }; + + return DetectIntentRequest; + })(); + + v2.DetectIntentResponse = (function() { + + /** + * Properties of a DetectIntentResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IDetectIntentResponse + * @property {string|null} [responseId] DetectIntentResponse responseId + * @property {google.cloud.dialogflow.v2.IQueryResult|null} [queryResult] DetectIntentResponse queryResult + * @property {google.rpc.IStatus|null} [webhookStatus] DetectIntentResponse webhookStatus + * @property {Uint8Array|null} [outputAudio] DetectIntentResponse outputAudio + * @property {google.cloud.dialogflow.v2.IOutputAudioConfig|null} [outputAudioConfig] DetectIntentResponse outputAudioConfig + */ + + /** + * Constructs a new DetectIntentResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DetectIntentResponse. + * @implements IDetectIntentResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IDetectIntentResponse=} [properties] Properties to set + */ + function DetectIntentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectIntentResponse responseId. + * @member {string} responseId + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.responseId = ""; + + /** + * DetectIntentResponse queryResult. + * @member {google.cloud.dialogflow.v2.IQueryResult|null|undefined} queryResult + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.queryResult = null; + + /** + * DetectIntentResponse webhookStatus. + * @member {google.rpc.IStatus|null|undefined} webhookStatus + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.webhookStatus = null; + + /** + * DetectIntentResponse outputAudio. + * @member {Uint8Array} outputAudio + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.outputAudio = $util.newBuffer([]); + + /** + * DetectIntentResponse outputAudioConfig. + * @member {google.cloud.dialogflow.v2.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.outputAudioConfig = null; + + /** + * Creates a new DetectIntentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2.IDetectIntentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DetectIntentResponse} DetectIntentResponse instance + */ + DetectIntentResponse.create = function create(properties) { + return new DetectIntentResponse(properties); + }; + + /** + * Encodes the specified DetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.DetectIntentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2.IDetectIntentResponse} message DetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseId != null && Object.hasOwnProperty.call(message, "responseId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseId); + if (message.queryResult != null && Object.hasOwnProperty.call(message, "queryResult")) + $root.google.cloud.dialogflow.v2.QueryResult.encode(message.queryResult, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.webhookStatus != null && Object.hasOwnProperty.call(message, "webhookStatus")) + $root.google.rpc.Status.encode(message.webhookStatus, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputAudio != null && Object.hasOwnProperty.call(message, "outputAudio")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.outputAudio); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.v2.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DetectIntentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2.IDetectIntentResponse} message DetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DetectIntentResponse} DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DetectIntentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.responseId = reader.string(); + break; + } + case 2: { + message.queryResult = $root.google.cloud.dialogflow.v2.QueryResult.decode(reader, reader.uint32()); + break; + } + case 3: { + message.webhookStatus = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 4: { + message.outputAudio = reader.bytes(); + break; + } + case 6: { + message.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DetectIntentResponse} DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectIntentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectIntentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseId != null && message.hasOwnProperty("responseId")) + if (!$util.isString(message.responseId)) + return "responseId: string expected"; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + var error = $root.google.cloud.dialogflow.v2.QueryResult.verify(message.queryResult); + if (error) + return "queryResult." + error; + } + if (message.webhookStatus != null && message.hasOwnProperty("webhookStatus")) { + var error = $root.google.rpc.Status.verify(message.webhookStatus); + if (error) + return "webhookStatus." + error; + } + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + if (!(message.outputAudio && typeof message.outputAudio.length === "number" || $util.isString(message.outputAudio))) + return "outputAudio: buffer expected"; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + return null; + }; + + /** + * Creates a DetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DetectIntentResponse} DetectIntentResponse + */ + DetectIntentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DetectIntentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.DetectIntentResponse(); + if (object.responseId != null) + message.responseId = String(object.responseId); + if (object.queryResult != null) { + if (typeof object.queryResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2.DetectIntentResponse.queryResult: object expected"); + message.queryResult = $root.google.cloud.dialogflow.v2.QueryResult.fromObject(object.queryResult); + } + if (object.webhookStatus != null) { + if (typeof object.webhookStatus !== "object") + throw TypeError(".google.cloud.dialogflow.v2.DetectIntentResponse.webhookStatus: object expected"); + message.webhookStatus = $root.google.rpc.Status.fromObject(object.webhookStatus); + } + if (object.outputAudio != null) + if (typeof object.outputAudio === "string") + $util.base64.decode(object.outputAudio, message.outputAudio = $util.newBuffer($util.base64.length(object.outputAudio)), 0); + else if (object.outputAudio.length >= 0) + message.outputAudio = object.outputAudio; + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.DetectIntentResponse.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + return message; + }; + + /** + * Creates a plain object from a DetectIntentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2.DetectIntentResponse} message DetectIntentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectIntentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.responseId = ""; + object.queryResult = null; + object.webhookStatus = null; + if (options.bytes === String) + object.outputAudio = ""; + else { + object.outputAudio = []; + if (options.bytes !== Array) + object.outputAudio = $util.newBuffer(object.outputAudio); + } + object.outputAudioConfig = null; + } + if (message.responseId != null && message.hasOwnProperty("responseId")) + object.responseId = message.responseId; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) + object.queryResult = $root.google.cloud.dialogflow.v2.QueryResult.toObject(message.queryResult, options); + if (message.webhookStatus != null && message.hasOwnProperty("webhookStatus")) + object.webhookStatus = $root.google.rpc.Status.toObject(message.webhookStatus, options); + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + object.outputAudio = options.bytes === String ? $util.base64.encode(message.outputAudio, 0, message.outputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.outputAudio) : message.outputAudio; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.toObject(message.outputAudioConfig, options); + return object; + }; + + /** + * Converts this DetectIntentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @instance + * @returns {Object.} JSON object + */ + DetectIntentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectIntentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DetectIntentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectIntentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DetectIntentResponse"; + }; + + return DetectIntentResponse; + })(); + + v2.QueryParameters = (function() { + + /** + * Properties of a QueryParameters. + * @memberof google.cloud.dialogflow.v2 + * @interface IQueryParameters + * @property {string|null} [timeZone] QueryParameters timeZone + * @property {google.type.ILatLng|null} [geoLocation] QueryParameters geoLocation + * @property {Array.|null} [contexts] QueryParameters contexts + * @property {boolean|null} [resetContexts] QueryParameters resetContexts + * @property {Array.|null} [sessionEntityTypes] QueryParameters sessionEntityTypes + * @property {google.protobuf.IStruct|null} [payload] QueryParameters payload + * @property {google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig|null} [sentimentAnalysisRequestConfig] QueryParameters sentimentAnalysisRequestConfig + * @property {Object.|null} [webhookHeaders] QueryParameters webhookHeaders + */ + + /** + * Constructs a new QueryParameters. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a QueryParameters. + * @implements IQueryParameters + * @constructor + * @param {google.cloud.dialogflow.v2.IQueryParameters=} [properties] Properties to set + */ + function QueryParameters(properties) { + this.contexts = []; + this.sessionEntityTypes = []; + this.webhookHeaders = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParameters timeZone. + * @member {string} timeZone + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @instance + */ + QueryParameters.prototype.timeZone = ""; + + /** + * QueryParameters geoLocation. + * @member {google.type.ILatLng|null|undefined} geoLocation + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @instance + */ + QueryParameters.prototype.geoLocation = null; + + /** + * QueryParameters contexts. + * @member {Array.} contexts + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @instance + */ + QueryParameters.prototype.contexts = $util.emptyArray; + + /** + * QueryParameters resetContexts. + * @member {boolean} resetContexts + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @instance + */ + QueryParameters.prototype.resetContexts = false; + + /** + * QueryParameters sessionEntityTypes. + * @member {Array.} sessionEntityTypes + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @instance + */ + QueryParameters.prototype.sessionEntityTypes = $util.emptyArray; + + /** + * QueryParameters payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @instance + */ + QueryParameters.prototype.payload = null; + + /** + * QueryParameters sentimentAnalysisRequestConfig. + * @member {google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig|null|undefined} sentimentAnalysisRequestConfig + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @instance + */ + QueryParameters.prototype.sentimentAnalysisRequestConfig = null; + + /** + * QueryParameters webhookHeaders. + * @member {Object.} webhookHeaders + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @instance + */ + QueryParameters.prototype.webhookHeaders = $util.emptyObject; + + /** + * Creates a new QueryParameters instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @static + * @param {google.cloud.dialogflow.v2.IQueryParameters=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.QueryParameters} QueryParameters instance + */ + QueryParameters.create = function create(properties) { + return new QueryParameters(properties); + }; + + /** + * Encodes the specified QueryParameters message. Does not implicitly {@link google.cloud.dialogflow.v2.QueryParameters.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @static + * @param {google.cloud.dialogflow.v2.IQueryParameters} message QueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParameters.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.timeZone); + if (message.geoLocation != null && Object.hasOwnProperty.call(message, "geoLocation")) + $root.google.type.LatLng.encode(message.geoLocation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.contexts != null && message.contexts.length) + for (var i = 0; i < message.contexts.length; ++i) + $root.google.cloud.dialogflow.v2.Context.encode(message.contexts[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.resetContexts != null && Object.hasOwnProperty.call(message, "resetContexts")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.resetContexts); + if (message.sessionEntityTypes != null && message.sessionEntityTypes.length) + for (var i = 0; i < message.sessionEntityTypes.length; ++i) + $root.google.cloud.dialogflow.v2.SessionEntityType.encode(message.sessionEntityTypes[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.sentimentAnalysisRequestConfig != null && Object.hasOwnProperty.call(message, "sentimentAnalysisRequestConfig")) + $root.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.encode(message.sentimentAnalysisRequestConfig, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.webhookHeaders != null && Object.hasOwnProperty.call(message, "webhookHeaders")) + for (var keys = Object.keys(message.webhookHeaders), i = 0; i < keys.length; ++i) + writer.uint32(/* id 14, wireType 2 =*/114).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.webhookHeaders[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.QueryParameters.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @static + * @param {google.cloud.dialogflow.v2.IQueryParameters} message QueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParameters.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParameters message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.QueryParameters} QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParameters.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.QueryParameters(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.timeZone = reader.string(); + break; + } + case 2: { + message.geoLocation = $root.google.type.LatLng.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.contexts && message.contexts.length)) + message.contexts = []; + message.contexts.push($root.google.cloud.dialogflow.v2.Context.decode(reader, reader.uint32())); + break; + } + case 4: { + message.resetContexts = reader.bool(); + break; + } + case 5: { + if (!(message.sessionEntityTypes && message.sessionEntityTypes.length)) + message.sessionEntityTypes = []; + message.sessionEntityTypes.push($root.google.cloud.dialogflow.v2.SessionEntityType.decode(reader, reader.uint32())); + break; + } + case 6: { + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 10: { + message.sentimentAnalysisRequestConfig = $root.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.decode(reader, reader.uint32()); + break; + } + case 14: { + if (message.webhookHeaders === $util.emptyObject) + message.webhookHeaders = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.webhookHeaders[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParameters message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.QueryParameters} QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParameters.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParameters message. + * @function verify + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParameters.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.geoLocation != null && message.hasOwnProperty("geoLocation")) { + var error = $root.google.type.LatLng.verify(message.geoLocation); + if (error) + return "geoLocation." + error; + } + if (message.contexts != null && message.hasOwnProperty("contexts")) { + if (!Array.isArray(message.contexts)) + return "contexts: array expected"; + for (var i = 0; i < message.contexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Context.verify(message.contexts[i]); + if (error) + return "contexts." + error; + } + } + if (message.resetContexts != null && message.hasOwnProperty("resetContexts")) + if (typeof message.resetContexts !== "boolean") + return "resetContexts: boolean expected"; + if (message.sessionEntityTypes != null && message.hasOwnProperty("sessionEntityTypes")) { + if (!Array.isArray(message.sessionEntityTypes)) + return "sessionEntityTypes: array expected"; + for (var i = 0; i < message.sessionEntityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SessionEntityType.verify(message.sessionEntityTypes[i]); + if (error) + return "sessionEntityTypes." + error; + } + } + if (message.payload != null && message.hasOwnProperty("payload")) { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + if (message.sentimentAnalysisRequestConfig != null && message.hasOwnProperty("sentimentAnalysisRequestConfig")) { + var error = $root.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.verify(message.sentimentAnalysisRequestConfig); + if (error) + return "sentimentAnalysisRequestConfig." + error; + } + if (message.webhookHeaders != null && message.hasOwnProperty("webhookHeaders")) { + if (!$util.isObject(message.webhookHeaders)) + return "webhookHeaders: object expected"; + var key = Object.keys(message.webhookHeaders); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.webhookHeaders[key[i]])) + return "webhookHeaders: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a QueryParameters message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.QueryParameters} QueryParameters + */ + QueryParameters.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.QueryParameters) + return object; + var message = new $root.google.cloud.dialogflow.v2.QueryParameters(); + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.geoLocation != null) { + if (typeof object.geoLocation !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryParameters.geoLocation: object expected"); + message.geoLocation = $root.google.type.LatLng.fromObject(object.geoLocation); + } + if (object.contexts) { + if (!Array.isArray(object.contexts)) + throw TypeError(".google.cloud.dialogflow.v2.QueryParameters.contexts: array expected"); + message.contexts = []; + for (var i = 0; i < object.contexts.length; ++i) { + if (typeof object.contexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryParameters.contexts: object expected"); + message.contexts[i] = $root.google.cloud.dialogflow.v2.Context.fromObject(object.contexts[i]); + } + } + if (object.resetContexts != null) + message.resetContexts = Boolean(object.resetContexts); + if (object.sessionEntityTypes) { + if (!Array.isArray(object.sessionEntityTypes)) + throw TypeError(".google.cloud.dialogflow.v2.QueryParameters.sessionEntityTypes: array expected"); + message.sessionEntityTypes = []; + for (var i = 0; i < object.sessionEntityTypes.length; ++i) { + if (typeof object.sessionEntityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryParameters.sessionEntityTypes: object expected"); + message.sessionEntityTypes[i] = $root.google.cloud.dialogflow.v2.SessionEntityType.fromObject(object.sessionEntityTypes[i]); + } + } + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryParameters.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.sentimentAnalysisRequestConfig != null) { + if (typeof object.sentimentAnalysisRequestConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryParameters.sentimentAnalysisRequestConfig: object expected"); + message.sentimentAnalysisRequestConfig = $root.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.fromObject(object.sentimentAnalysisRequestConfig); + } + if (object.webhookHeaders) { + if (typeof object.webhookHeaders !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryParameters.webhookHeaders: object expected"); + message.webhookHeaders = {}; + for (var keys = Object.keys(object.webhookHeaders), i = 0; i < keys.length; ++i) + message.webhookHeaders[keys[i]] = String(object.webhookHeaders[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a QueryParameters message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @static + * @param {google.cloud.dialogflow.v2.QueryParameters} message QueryParameters + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParameters.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.contexts = []; + object.sessionEntityTypes = []; + } + if (options.objects || options.defaults) + object.webhookHeaders = {}; + if (options.defaults) { + object.timeZone = ""; + object.geoLocation = null; + object.resetContexts = false; + object.payload = null; + object.sentimentAnalysisRequestConfig = null; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.geoLocation != null && message.hasOwnProperty("geoLocation")) + object.geoLocation = $root.google.type.LatLng.toObject(message.geoLocation, options); + if (message.contexts && message.contexts.length) { + object.contexts = []; + for (var j = 0; j < message.contexts.length; ++j) + object.contexts[j] = $root.google.cloud.dialogflow.v2.Context.toObject(message.contexts[j], options); + } + if (message.resetContexts != null && message.hasOwnProperty("resetContexts")) + object.resetContexts = message.resetContexts; + if (message.sessionEntityTypes && message.sessionEntityTypes.length) { + object.sessionEntityTypes = []; + for (var j = 0; j < message.sessionEntityTypes.length; ++j) + object.sessionEntityTypes[j] = $root.google.cloud.dialogflow.v2.SessionEntityType.toObject(message.sessionEntityTypes[j], options); + } + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (message.sentimentAnalysisRequestConfig != null && message.hasOwnProperty("sentimentAnalysisRequestConfig")) + object.sentimentAnalysisRequestConfig = $root.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.toObject(message.sentimentAnalysisRequestConfig, options); + var keys2; + if (message.webhookHeaders && (keys2 = Object.keys(message.webhookHeaders)).length) { + object.webhookHeaders = {}; + for (var j = 0; j < keys2.length; ++j) + object.webhookHeaders[keys2[j]] = message.webhookHeaders[keys2[j]]; + } + return object; + }; + + /** + * Converts this QueryParameters to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @instance + * @returns {Object.} JSON object + */ + QueryParameters.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryParameters + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.QueryParameters + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryParameters.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.QueryParameters"; + }; + + return QueryParameters; + })(); + + v2.QueryInput = (function() { + + /** + * Properties of a QueryInput. + * @memberof google.cloud.dialogflow.v2 + * @interface IQueryInput + * @property {google.cloud.dialogflow.v2.IInputAudioConfig|null} [audioConfig] QueryInput audioConfig + * @property {google.cloud.dialogflow.v2.ITextInput|null} [text] QueryInput text + * @property {google.cloud.dialogflow.v2.IEventInput|null} [event] QueryInput event + */ + + /** + * Constructs a new QueryInput. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a QueryInput. + * @implements IQueryInput + * @constructor + * @param {google.cloud.dialogflow.v2.IQueryInput=} [properties] Properties to set + */ + function QueryInput(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryInput audioConfig. + * @member {google.cloud.dialogflow.v2.IInputAudioConfig|null|undefined} audioConfig + * @memberof google.cloud.dialogflow.v2.QueryInput + * @instance + */ + QueryInput.prototype.audioConfig = null; + + /** + * QueryInput text. + * @member {google.cloud.dialogflow.v2.ITextInput|null|undefined} text + * @memberof google.cloud.dialogflow.v2.QueryInput + * @instance + */ + QueryInput.prototype.text = null; + + /** + * QueryInput event. + * @member {google.cloud.dialogflow.v2.IEventInput|null|undefined} event + * @memberof google.cloud.dialogflow.v2.QueryInput + * @instance + */ + QueryInput.prototype.event = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueryInput input. + * @member {"audioConfig"|"text"|"event"|undefined} input + * @memberof google.cloud.dialogflow.v2.QueryInput + * @instance + */ + Object.defineProperty(QueryInput.prototype, "input", { + get: $util.oneOfGetter($oneOfFields = ["audioConfig", "text", "event"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueryInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.QueryInput + * @static + * @param {google.cloud.dialogflow.v2.IQueryInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.QueryInput} QueryInput instance + */ + QueryInput.create = function create(properties) { + return new QueryInput(properties); + }; + + /** + * Encodes the specified QueryInput message. Does not implicitly {@link google.cloud.dialogflow.v2.QueryInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.QueryInput + * @static + * @param {google.cloud.dialogflow.v2.IQueryInput} message QueryInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioConfig != null && Object.hasOwnProperty.call(message, "audioConfig")) + $root.google.cloud.dialogflow.v2.InputAudioConfig.encode(message.audioConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + $root.google.cloud.dialogflow.v2.TextInput.encode(message.text, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + $root.google.cloud.dialogflow.v2.EventInput.encode(message.event, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.QueryInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.QueryInput + * @static + * @param {google.cloud.dialogflow.v2.IQueryInput} message QueryInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.QueryInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.QueryInput} QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInput.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.QueryInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.audioConfig = $root.google.cloud.dialogflow.v2.InputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.text = $root.google.cloud.dialogflow.v2.TextInput.decode(reader, reader.uint32()); + break; + } + case 3: { + message.event = $root.google.cloud.dialogflow.v2.EventInput.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.QueryInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.QueryInput} QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryInput message. + * @function verify + * @memberof google.cloud.dialogflow.v2.QueryInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2.InputAudioConfig.verify(message.audioConfig); + if (error) + return "audioConfig." + error; + } + } + if (message.text != null && message.hasOwnProperty("text")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2.TextInput.verify(message.text); + if (error) + return "text." + error; + } + } + if (message.event != null && message.hasOwnProperty("event")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2.EventInput.verify(message.event); + if (error) + return "event." + error; + } + } + return null; + }; + + /** + * Creates a QueryInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.QueryInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.QueryInput} QueryInput + */ + QueryInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.QueryInput) + return object; + var message = new $root.google.cloud.dialogflow.v2.QueryInput(); + if (object.audioConfig != null) { + if (typeof object.audioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryInput.audioConfig: object expected"); + message.audioConfig = $root.google.cloud.dialogflow.v2.InputAudioConfig.fromObject(object.audioConfig); + } + if (object.text != null) { + if (typeof object.text !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryInput.text: object expected"); + message.text = $root.google.cloud.dialogflow.v2.TextInput.fromObject(object.text); + } + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryInput.event: object expected"); + message.event = $root.google.cloud.dialogflow.v2.EventInput.fromObject(object.event); + } + return message; + }; + + /** + * Creates a plain object from a QueryInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.QueryInput + * @static + * @param {google.cloud.dialogflow.v2.QueryInput} message QueryInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { + object.audioConfig = $root.google.cloud.dialogflow.v2.InputAudioConfig.toObject(message.audioConfig, options); + if (options.oneofs) + object.input = "audioConfig"; + } + if (message.text != null && message.hasOwnProperty("text")) { + object.text = $root.google.cloud.dialogflow.v2.TextInput.toObject(message.text, options); + if (options.oneofs) + object.input = "text"; + } + if (message.event != null && message.hasOwnProperty("event")) { + object.event = $root.google.cloud.dialogflow.v2.EventInput.toObject(message.event, options); + if (options.oneofs) + object.input = "event"; + } + return object; + }; + + /** + * Converts this QueryInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.QueryInput + * @instance + * @returns {Object.} JSON object + */ + QueryInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryInput + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.QueryInput + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryInput.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.QueryInput"; + }; + + return QueryInput; + })(); + + v2.QueryResult = (function() { + + /** + * Properties of a QueryResult. + * @memberof google.cloud.dialogflow.v2 + * @interface IQueryResult + * @property {string|null} [queryText] QueryResult queryText + * @property {string|null} [languageCode] QueryResult languageCode + * @property {number|null} [speechRecognitionConfidence] QueryResult speechRecognitionConfidence + * @property {string|null} [action] QueryResult action + * @property {google.protobuf.IStruct|null} [parameters] QueryResult parameters + * @property {boolean|null} [allRequiredParamsPresent] QueryResult allRequiredParamsPresent + * @property {boolean|null} [cancelsSlotFilling] QueryResult cancelsSlotFilling + * @property {string|null} [fulfillmentText] QueryResult fulfillmentText + * @property {Array.|null} [fulfillmentMessages] QueryResult fulfillmentMessages + * @property {string|null} [webhookSource] QueryResult webhookSource + * @property {google.protobuf.IStruct|null} [webhookPayload] QueryResult webhookPayload + * @property {Array.|null} [outputContexts] QueryResult outputContexts + * @property {google.cloud.dialogflow.v2.IIntent|null} [intent] QueryResult intent + * @property {number|null} [intentDetectionConfidence] QueryResult intentDetectionConfidence + * @property {google.protobuf.IStruct|null} [diagnosticInfo] QueryResult diagnosticInfo + * @property {google.cloud.dialogflow.v2.ISentimentAnalysisResult|null} [sentimentAnalysisResult] QueryResult sentimentAnalysisResult + */ + + /** + * Constructs a new QueryResult. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a QueryResult. + * @implements IQueryResult + * @constructor + * @param {google.cloud.dialogflow.v2.IQueryResult=} [properties] Properties to set + */ + function QueryResult(properties) { + this.fulfillmentMessages = []; + this.outputContexts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryResult queryText. + * @member {string} queryText + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.queryText = ""; + + /** + * QueryResult languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.languageCode = ""; + + /** + * QueryResult speechRecognitionConfidence. + * @member {number} speechRecognitionConfidence + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.speechRecognitionConfidence = 0; + + /** + * QueryResult action. + * @member {string} action + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.action = ""; + + /** + * QueryResult parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.parameters = null; + + /** + * QueryResult allRequiredParamsPresent. + * @member {boolean} allRequiredParamsPresent + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.allRequiredParamsPresent = false; + + /** + * QueryResult cancelsSlotFilling. + * @member {boolean} cancelsSlotFilling + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.cancelsSlotFilling = false; + + /** + * QueryResult fulfillmentText. + * @member {string} fulfillmentText + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.fulfillmentText = ""; + + /** + * QueryResult fulfillmentMessages. + * @member {Array.} fulfillmentMessages + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.fulfillmentMessages = $util.emptyArray; + + /** + * QueryResult webhookSource. + * @member {string} webhookSource + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.webhookSource = ""; + + /** + * QueryResult webhookPayload. + * @member {google.protobuf.IStruct|null|undefined} webhookPayload + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.webhookPayload = null; + + /** + * QueryResult outputContexts. + * @member {Array.} outputContexts + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.outputContexts = $util.emptyArray; + + /** + * QueryResult intent. + * @member {google.cloud.dialogflow.v2.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.intent = null; + + /** + * QueryResult intentDetectionConfidence. + * @member {number} intentDetectionConfidence + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.intentDetectionConfidence = 0; + + /** + * QueryResult diagnosticInfo. + * @member {google.protobuf.IStruct|null|undefined} diagnosticInfo + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.diagnosticInfo = null; + + /** + * QueryResult sentimentAnalysisResult. + * @member {google.cloud.dialogflow.v2.ISentimentAnalysisResult|null|undefined} sentimentAnalysisResult + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + */ + QueryResult.prototype.sentimentAnalysisResult = null; + + /** + * Creates a new QueryResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.QueryResult + * @static + * @param {google.cloud.dialogflow.v2.IQueryResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.QueryResult} QueryResult instance + */ + QueryResult.create = function create(properties) { + return new QueryResult(properties); + }; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.dialogflow.v2.QueryResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.QueryResult + * @static + * @param {google.cloud.dialogflow.v2.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryText != null && Object.hasOwnProperty.call(message, "queryText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.queryText); + if (message.speechRecognitionConfidence != null && Object.hasOwnProperty.call(message, "speechRecognitionConfidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.speechRecognitionConfidence); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.action); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allRequiredParamsPresent != null && Object.hasOwnProperty.call(message, "allRequiredParamsPresent")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allRequiredParamsPresent); + if (message.fulfillmentText != null && Object.hasOwnProperty.call(message, "fulfillmentText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.fulfillmentText); + if (message.fulfillmentMessages != null && message.fulfillmentMessages.length) + for (var i = 0; i < message.fulfillmentMessages.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.encode(message.fulfillmentMessages[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.webhookSource != null && Object.hasOwnProperty.call(message, "webhookSource")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.webhookSource); + if (message.webhookPayload != null && Object.hasOwnProperty.call(message, "webhookPayload")) + $root.google.protobuf.Struct.encode(message.webhookPayload, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.outputContexts != null && message.outputContexts.length) + for (var i = 0; i < message.outputContexts.length; ++i) + $root.google.cloud.dialogflow.v2.Context.encode(message.outputContexts[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.v2.Intent.encode(message.intent, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.intentDetectionConfidence != null && Object.hasOwnProperty.call(message, "intentDetectionConfidence")) + writer.uint32(/* id 12, wireType 5 =*/101).float(message.intentDetectionConfidence); + if (message.diagnosticInfo != null && Object.hasOwnProperty.call(message, "diagnosticInfo")) + $root.google.protobuf.Struct.encode(message.diagnosticInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.languageCode); + if (message.sentimentAnalysisResult != null && Object.hasOwnProperty.call(message, "sentimentAnalysisResult")) + $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.encode(message.sentimentAnalysisResult, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.cancelsSlotFilling != null && Object.hasOwnProperty.call(message, "cancelsSlotFilling")) + writer.uint32(/* id 21, wireType 0 =*/168).bool(message.cancelsSlotFilling); + return writer; + }; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.QueryResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.QueryResult + * @static + * @param {google.cloud.dialogflow.v2.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.QueryResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.queryText = reader.string(); + break; + } + case 15: { + message.languageCode = reader.string(); + break; + } + case 2: { + message.speechRecognitionConfidence = reader.float(); + break; + } + case 3: { + message.action = reader.string(); + break; + } + case 4: { + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allRequiredParamsPresent = reader.bool(); + break; + } + case 21: { + message.cancelsSlotFilling = reader.bool(); + break; + } + case 6: { + message.fulfillmentText = reader.string(); + break; + } + case 7: { + if (!(message.fulfillmentMessages && message.fulfillmentMessages.length)) + message.fulfillmentMessages = []; + message.fulfillmentMessages.push($root.google.cloud.dialogflow.v2.Intent.Message.decode(reader, reader.uint32())); + break; + } + case 8: { + message.webhookSource = reader.string(); + break; + } + case 9: { + message.webhookPayload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 10: { + if (!(message.outputContexts && message.outputContexts.length)) + message.outputContexts = []; + message.outputContexts.push($root.google.cloud.dialogflow.v2.Context.decode(reader, reader.uint32())); + break; + } + case 11: { + message.intent = $root.google.cloud.dialogflow.v2.Intent.decode(reader, reader.uint32()); + break; + } + case 12: { + message.intentDetectionConfidence = reader.float(); + break; + } + case 14: { + message.diagnosticInfo = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 17: { + message.sentimentAnalysisResult = $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2.QueryResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryText != null && message.hasOwnProperty("queryText")) + if (!$util.isString(message.queryText)) + return "queryText: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.speechRecognitionConfidence != null && message.hasOwnProperty("speechRecognitionConfidence")) + if (typeof message.speechRecognitionConfidence !== "number") + return "speechRecognitionConfidence: number expected"; + if (message.action != null && message.hasOwnProperty("action")) + if (!$util.isString(message.action)) + return "action: string expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + if (message.allRequiredParamsPresent != null && message.hasOwnProperty("allRequiredParamsPresent")) + if (typeof message.allRequiredParamsPresent !== "boolean") + return "allRequiredParamsPresent: boolean expected"; + if (message.cancelsSlotFilling != null && message.hasOwnProperty("cancelsSlotFilling")) + if (typeof message.cancelsSlotFilling !== "boolean") + return "cancelsSlotFilling: boolean expected"; + if (message.fulfillmentText != null && message.hasOwnProperty("fulfillmentText")) + if (!$util.isString(message.fulfillmentText)) + return "fulfillmentText: string expected"; + if (message.fulfillmentMessages != null && message.hasOwnProperty("fulfillmentMessages")) { + if (!Array.isArray(message.fulfillmentMessages)) + return "fulfillmentMessages: array expected"; + for (var i = 0; i < message.fulfillmentMessages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.verify(message.fulfillmentMessages[i]); + if (error) + return "fulfillmentMessages." + error; + } + } + if (message.webhookSource != null && message.hasOwnProperty("webhookSource")) + if (!$util.isString(message.webhookSource)) + return "webhookSource: string expected"; + if (message.webhookPayload != null && message.hasOwnProperty("webhookPayload")) { + var error = $root.google.protobuf.Struct.verify(message.webhookPayload); + if (error) + return "webhookPayload." + error; + } + if (message.outputContexts != null && message.hasOwnProperty("outputContexts")) { + if (!Array.isArray(message.outputContexts)) + return "outputContexts: array expected"; + for (var i = 0; i < message.outputContexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Context.verify(message.outputContexts[i]); + if (error) + return "outputContexts." + error; + } + } + if (message.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.v2.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.intentDetectionConfidence != null && message.hasOwnProperty("intentDetectionConfidence")) + if (typeof message.intentDetectionConfidence !== "number") + return "intentDetectionConfidence: number expected"; + if (message.diagnosticInfo != null && message.hasOwnProperty("diagnosticInfo")) { + var error = $root.google.protobuf.Struct.verify(message.diagnosticInfo); + if (error) + return "diagnosticInfo." + error; + } + if (message.sentimentAnalysisResult != null && message.hasOwnProperty("sentimentAnalysisResult")) { + var error = $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.verify(message.sentimentAnalysisResult); + if (error) + return "sentimentAnalysisResult." + error; + } + return null; + }; + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.QueryResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.QueryResult} QueryResult + */ + QueryResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.QueryResult) + return object; + var message = new $root.google.cloud.dialogflow.v2.QueryResult(); + if (object.queryText != null) + message.queryText = String(object.queryText); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.speechRecognitionConfidence != null) + message.speechRecognitionConfidence = Number(object.speechRecognitionConfidence); + if (object.action != null) + message.action = String(object.action); + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryResult.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + if (object.allRequiredParamsPresent != null) + message.allRequiredParamsPresent = Boolean(object.allRequiredParamsPresent); + if (object.cancelsSlotFilling != null) + message.cancelsSlotFilling = Boolean(object.cancelsSlotFilling); + if (object.fulfillmentText != null) + message.fulfillmentText = String(object.fulfillmentText); + if (object.fulfillmentMessages) { + if (!Array.isArray(object.fulfillmentMessages)) + throw TypeError(".google.cloud.dialogflow.v2.QueryResult.fulfillmentMessages: array expected"); + message.fulfillmentMessages = []; + for (var i = 0; i < object.fulfillmentMessages.length; ++i) { + if (typeof object.fulfillmentMessages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryResult.fulfillmentMessages: object expected"); + message.fulfillmentMessages[i] = $root.google.cloud.dialogflow.v2.Intent.Message.fromObject(object.fulfillmentMessages[i]); + } + } + if (object.webhookSource != null) + message.webhookSource = String(object.webhookSource); + if (object.webhookPayload != null) { + if (typeof object.webhookPayload !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryResult.webhookPayload: object expected"); + message.webhookPayload = $root.google.protobuf.Struct.fromObject(object.webhookPayload); + } + if (object.outputContexts) { + if (!Array.isArray(object.outputContexts)) + throw TypeError(".google.cloud.dialogflow.v2.QueryResult.outputContexts: array expected"); + message.outputContexts = []; + for (var i = 0; i < object.outputContexts.length; ++i) { + if (typeof object.outputContexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryResult.outputContexts: object expected"); + message.outputContexts[i] = $root.google.cloud.dialogflow.v2.Context.fromObject(object.outputContexts[i]); + } + } + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryResult.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.v2.Intent.fromObject(object.intent); + } + if (object.intentDetectionConfidence != null) + message.intentDetectionConfidence = Number(object.intentDetectionConfidence); + if (object.diagnosticInfo != null) { + if (typeof object.diagnosticInfo !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryResult.diagnosticInfo: object expected"); + message.diagnosticInfo = $root.google.protobuf.Struct.fromObject(object.diagnosticInfo); + } + if (object.sentimentAnalysisResult != null) { + if (typeof object.sentimentAnalysisResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2.QueryResult.sentimentAnalysisResult: object expected"); + message.sentimentAnalysisResult = $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.fromObject(object.sentimentAnalysisResult); + } + return message; + }; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.QueryResult + * @static + * @param {google.cloud.dialogflow.v2.QueryResult} message QueryResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.fulfillmentMessages = []; + object.outputContexts = []; + } + if (options.defaults) { + object.queryText = ""; + object.speechRecognitionConfidence = 0; + object.action = ""; + object.parameters = null; + object.allRequiredParamsPresent = false; + object.fulfillmentText = ""; + object.webhookSource = ""; + object.webhookPayload = null; + object.intent = null; + object.intentDetectionConfidence = 0; + object.diagnosticInfo = null; + object.languageCode = ""; + object.sentimentAnalysisResult = null; + object.cancelsSlotFilling = false; + } + if (message.queryText != null && message.hasOwnProperty("queryText")) + object.queryText = message.queryText; + if (message.speechRecognitionConfidence != null && message.hasOwnProperty("speechRecognitionConfidence")) + object.speechRecognitionConfidence = options.json && !isFinite(message.speechRecognitionConfidence) ? String(message.speechRecognitionConfidence) : message.speechRecognitionConfidence; + if (message.action != null && message.hasOwnProperty("action")) + object.action = message.action; + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + if (message.allRequiredParamsPresent != null && message.hasOwnProperty("allRequiredParamsPresent")) + object.allRequiredParamsPresent = message.allRequiredParamsPresent; + if (message.fulfillmentText != null && message.hasOwnProperty("fulfillmentText")) + object.fulfillmentText = message.fulfillmentText; + if (message.fulfillmentMessages && message.fulfillmentMessages.length) { + object.fulfillmentMessages = []; + for (var j = 0; j < message.fulfillmentMessages.length; ++j) + object.fulfillmentMessages[j] = $root.google.cloud.dialogflow.v2.Intent.Message.toObject(message.fulfillmentMessages[j], options); + } + if (message.webhookSource != null && message.hasOwnProperty("webhookSource")) + object.webhookSource = message.webhookSource; + if (message.webhookPayload != null && message.hasOwnProperty("webhookPayload")) + object.webhookPayload = $root.google.protobuf.Struct.toObject(message.webhookPayload, options); + if (message.outputContexts && message.outputContexts.length) { + object.outputContexts = []; + for (var j = 0; j < message.outputContexts.length; ++j) + object.outputContexts[j] = $root.google.cloud.dialogflow.v2.Context.toObject(message.outputContexts[j], options); + } + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.v2.Intent.toObject(message.intent, options); + if (message.intentDetectionConfidence != null && message.hasOwnProperty("intentDetectionConfidence")) + object.intentDetectionConfidence = options.json && !isFinite(message.intentDetectionConfidence) ? String(message.intentDetectionConfidence) : message.intentDetectionConfidence; + if (message.diagnosticInfo != null && message.hasOwnProperty("diagnosticInfo")) + object.diagnosticInfo = $root.google.protobuf.Struct.toObject(message.diagnosticInfo, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.sentimentAnalysisResult != null && message.hasOwnProperty("sentimentAnalysisResult")) + object.sentimentAnalysisResult = $root.google.cloud.dialogflow.v2.SentimentAnalysisResult.toObject(message.sentimentAnalysisResult, options); + if (message.cancelsSlotFilling != null && message.hasOwnProperty("cancelsSlotFilling")) + object.cancelsSlotFilling = message.cancelsSlotFilling; + return object; + }; + + /** + * Converts this QueryResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.QueryResult + * @instance + * @returns {Object.} JSON object + */ + QueryResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.QueryResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.QueryResult"; + }; + + return QueryResult; + })(); + + v2.StreamingDetectIntentRequest = (function() { + + /** + * Properties of a StreamingDetectIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IStreamingDetectIntentRequest + * @property {string|null} [session] StreamingDetectIntentRequest session + * @property {google.cloud.dialogflow.v2.IQueryParameters|null} [queryParams] StreamingDetectIntentRequest queryParams + * @property {google.cloud.dialogflow.v2.IQueryInput|null} [queryInput] StreamingDetectIntentRequest queryInput + * @property {boolean|null} [singleUtterance] StreamingDetectIntentRequest singleUtterance + * @property {google.cloud.dialogflow.v2.IOutputAudioConfig|null} [outputAudioConfig] StreamingDetectIntentRequest outputAudioConfig + * @property {google.protobuf.IFieldMask|null} [outputAudioConfigMask] StreamingDetectIntentRequest outputAudioConfigMask + * @property {Uint8Array|null} [inputAudio] StreamingDetectIntentRequest inputAudio + */ + + /** + * Constructs a new StreamingDetectIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a StreamingDetectIntentRequest. + * @implements IStreamingDetectIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentRequest=} [properties] Properties to set + */ + function StreamingDetectIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingDetectIntentRequest session. + * @member {string} session + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.session = ""; + + /** + * StreamingDetectIntentRequest queryParams. + * @member {google.cloud.dialogflow.v2.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.queryParams = null; + + /** + * StreamingDetectIntentRequest queryInput. + * @member {google.cloud.dialogflow.v2.IQueryInput|null|undefined} queryInput + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.queryInput = null; + + /** + * StreamingDetectIntentRequest singleUtterance. + * @member {boolean} singleUtterance + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.singleUtterance = false; + + /** + * StreamingDetectIntentRequest outputAudioConfig. + * @member {google.cloud.dialogflow.v2.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.outputAudioConfig = null; + + /** + * StreamingDetectIntentRequest outputAudioConfigMask. + * @member {google.protobuf.IFieldMask|null|undefined} outputAudioConfigMask + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.outputAudioConfigMask = null; + + /** + * StreamingDetectIntentRequest inputAudio. + * @member {Uint8Array} inputAudio + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.inputAudio = $util.newBuffer([]); + + /** + * Creates a new StreamingDetectIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.StreamingDetectIntentRequest} StreamingDetectIntentRequest instance + */ + StreamingDetectIntentRequest.create = function create(properties) { + return new StreamingDetectIntentRequest(properties); + }; + + /** + * Encodes the specified StreamingDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingDetectIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentRequest} message StreamingDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.v2.QueryParameters.encode(message.queryParams, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.queryInput != null && Object.hasOwnProperty.call(message, "queryInput")) + $root.google.cloud.dialogflow.v2.QueryInput.encode(message.queryInput, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.singleUtterance != null && Object.hasOwnProperty.call(message, "singleUtterance")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.singleUtterance); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.v2.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.inputAudio != null && Object.hasOwnProperty.call(message, "inputAudio")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.inputAudio); + if (message.outputAudioConfigMask != null && Object.hasOwnProperty.call(message, "outputAudioConfigMask")) + $root.google.protobuf.FieldMask.encode(message.outputAudioConfigMask, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingDetectIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentRequest} message StreamingDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.StreamingDetectIntentRequest} StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.StreamingDetectIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.session = reader.string(); + break; + } + case 2: { + message.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.decode(reader, reader.uint32()); + break; + } + case 3: { + message.queryInput = $root.google.cloud.dialogflow.v2.QueryInput.decode(reader, reader.uint32()); + break; + } + case 4: { + message.singleUtterance = reader.bool(); + break; + } + case 5: { + message.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.outputAudioConfigMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 6: { + message.inputAudio = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.StreamingDetectIntentRequest} StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingDetectIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingDetectIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.v2.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.queryInput != null && message.hasOwnProperty("queryInput")) { + var error = $root.google.cloud.dialogflow.v2.QueryInput.verify(message.queryInput); + if (error) + return "queryInput." + error; + } + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + if (typeof message.singleUtterance !== "boolean") + return "singleUtterance: boolean expected"; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + if (message.outputAudioConfigMask != null && message.hasOwnProperty("outputAudioConfigMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.outputAudioConfigMask); + if (error) + return "outputAudioConfigMask." + error; + } + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) + if (!(message.inputAudio && typeof message.inputAudio.length === "number" || $util.isString(message.inputAudio))) + return "inputAudio: buffer expected"; + return null; + }; + + /** + * Creates a StreamingDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.StreamingDetectIntentRequest} StreamingDetectIntentRequest + */ + StreamingDetectIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.StreamingDetectIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.StreamingDetectIntentRequest(); + if (object.session != null) + message.session = String(object.session); + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingDetectIntentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.fromObject(object.queryParams); + } + if (object.queryInput != null) { + if (typeof object.queryInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingDetectIntentRequest.queryInput: object expected"); + message.queryInput = $root.google.cloud.dialogflow.v2.QueryInput.fromObject(object.queryInput); + } + if (object.singleUtterance != null) + message.singleUtterance = Boolean(object.singleUtterance); + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingDetectIntentRequest.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + if (object.outputAudioConfigMask != null) { + if (typeof object.outputAudioConfigMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingDetectIntentRequest.outputAudioConfigMask: object expected"); + message.outputAudioConfigMask = $root.google.protobuf.FieldMask.fromObject(object.outputAudioConfigMask); + } + if (object.inputAudio != null) + if (typeof object.inputAudio === "string") + $util.base64.decode(object.inputAudio, message.inputAudio = $util.newBuffer($util.base64.length(object.inputAudio)), 0); + else if (object.inputAudio.length >= 0) + message.inputAudio = object.inputAudio; + return message; + }; + + /** + * Creates a plain object from a StreamingDetectIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.StreamingDetectIntentRequest} message StreamingDetectIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingDetectIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.session = ""; + object.queryParams = null; + object.queryInput = null; + object.singleUtterance = false; + object.outputAudioConfig = null; + if (options.bytes === String) + object.inputAudio = ""; + else { + object.inputAudio = []; + if (options.bytes !== Array) + object.inputAudio = $util.newBuffer(object.inputAudio); + } + object.outputAudioConfigMask = null; + } + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.v2.QueryParameters.toObject(message.queryParams, options); + if (message.queryInput != null && message.hasOwnProperty("queryInput")) + object.queryInput = $root.google.cloud.dialogflow.v2.QueryInput.toObject(message.queryInput, options); + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + object.singleUtterance = message.singleUtterance; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.toObject(message.outputAudioConfig, options); + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) + object.inputAudio = options.bytes === String ? $util.base64.encode(message.inputAudio, 0, message.inputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.inputAudio) : message.inputAudio; + if (message.outputAudioConfigMask != null && message.hasOwnProperty("outputAudioConfigMask")) + object.outputAudioConfigMask = $root.google.protobuf.FieldMask.toObject(message.outputAudioConfigMask, options); + return object; + }; + + /** + * Converts this StreamingDetectIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @instance + * @returns {Object.} JSON object + */ + StreamingDetectIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingDetectIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingDetectIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.StreamingDetectIntentRequest"; + }; + + return StreamingDetectIntentRequest; + })(); + + v2.StreamingDetectIntentResponse = (function() { + + /** + * Properties of a StreamingDetectIntentResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IStreamingDetectIntentResponse + * @property {string|null} [responseId] StreamingDetectIntentResponse responseId + * @property {google.cloud.dialogflow.v2.IStreamingRecognitionResult|null} [recognitionResult] StreamingDetectIntentResponse recognitionResult + * @property {google.cloud.dialogflow.v2.IQueryResult|null} [queryResult] StreamingDetectIntentResponse queryResult + * @property {google.rpc.IStatus|null} [webhookStatus] StreamingDetectIntentResponse webhookStatus + * @property {Uint8Array|null} [outputAudio] StreamingDetectIntentResponse outputAudio + * @property {google.cloud.dialogflow.v2.IOutputAudioConfig|null} [outputAudioConfig] StreamingDetectIntentResponse outputAudioConfig + */ + + /** + * Constructs a new StreamingDetectIntentResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a StreamingDetectIntentResponse. + * @implements IStreamingDetectIntentResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentResponse=} [properties] Properties to set + */ + function StreamingDetectIntentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingDetectIntentResponse responseId. + * @member {string} responseId + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.responseId = ""; + + /** + * StreamingDetectIntentResponse recognitionResult. + * @member {google.cloud.dialogflow.v2.IStreamingRecognitionResult|null|undefined} recognitionResult + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.recognitionResult = null; + + /** + * StreamingDetectIntentResponse queryResult. + * @member {google.cloud.dialogflow.v2.IQueryResult|null|undefined} queryResult + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.queryResult = null; + + /** + * StreamingDetectIntentResponse webhookStatus. + * @member {google.rpc.IStatus|null|undefined} webhookStatus + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.webhookStatus = null; + + /** + * StreamingDetectIntentResponse outputAudio. + * @member {Uint8Array} outputAudio + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.outputAudio = $util.newBuffer([]); + + /** + * StreamingDetectIntentResponse outputAudioConfig. + * @member {google.cloud.dialogflow.v2.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.outputAudioConfig = null; + + /** + * Creates a new StreamingDetectIntentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.StreamingDetectIntentResponse} StreamingDetectIntentResponse instance + */ + StreamingDetectIntentResponse.create = function create(properties) { + return new StreamingDetectIntentResponse(properties); + }; + + /** + * Encodes the specified StreamingDetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingDetectIntentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentResponse} message StreamingDetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseId != null && Object.hasOwnProperty.call(message, "responseId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseId); + if (message.recognitionResult != null && Object.hasOwnProperty.call(message, "recognitionResult")) + $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.encode(message.recognitionResult, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.queryResult != null && Object.hasOwnProperty.call(message, "queryResult")) + $root.google.cloud.dialogflow.v2.QueryResult.encode(message.queryResult, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.webhookStatus != null && Object.hasOwnProperty.call(message, "webhookStatus")) + $root.google.rpc.Status.encode(message.webhookStatus, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.outputAudio != null && Object.hasOwnProperty.call(message, "outputAudio")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.outputAudio); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.v2.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingDetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingDetectIntentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2.IStreamingDetectIntentResponse} message StreamingDetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.StreamingDetectIntentResponse} StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.StreamingDetectIntentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.responseId = reader.string(); + break; + } + case 2: { + message.recognitionResult = $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.decode(reader, reader.uint32()); + break; + } + case 3: { + message.queryResult = $root.google.cloud.dialogflow.v2.QueryResult.decode(reader, reader.uint32()); + break; + } + case 4: { + message.webhookStatus = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 5: { + message.outputAudio = reader.bytes(); + break; + } + case 6: { + message.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.StreamingDetectIntentResponse} StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingDetectIntentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingDetectIntentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseId != null && message.hasOwnProperty("responseId")) + if (!$util.isString(message.responseId)) + return "responseId: string expected"; + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) { + var error = $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.verify(message.recognitionResult); + if (error) + return "recognitionResult." + error; + } + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + var error = $root.google.cloud.dialogflow.v2.QueryResult.verify(message.queryResult); + if (error) + return "queryResult." + error; + } + if (message.webhookStatus != null && message.hasOwnProperty("webhookStatus")) { + var error = $root.google.rpc.Status.verify(message.webhookStatus); + if (error) + return "webhookStatus." + error; + } + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + if (!(message.outputAudio && typeof message.outputAudio.length === "number" || $util.isString(message.outputAudio))) + return "outputAudio: buffer expected"; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + return null; + }; + + /** + * Creates a StreamingDetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.StreamingDetectIntentResponse} StreamingDetectIntentResponse + */ + StreamingDetectIntentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.StreamingDetectIntentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.StreamingDetectIntentResponse(); + if (object.responseId != null) + message.responseId = String(object.responseId); + if (object.recognitionResult != null) { + if (typeof object.recognitionResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingDetectIntentResponse.recognitionResult: object expected"); + message.recognitionResult = $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.fromObject(object.recognitionResult); + } + if (object.queryResult != null) { + if (typeof object.queryResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingDetectIntentResponse.queryResult: object expected"); + message.queryResult = $root.google.cloud.dialogflow.v2.QueryResult.fromObject(object.queryResult); + } + if (object.webhookStatus != null) { + if (typeof object.webhookStatus !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingDetectIntentResponse.webhookStatus: object expected"); + message.webhookStatus = $root.google.rpc.Status.fromObject(object.webhookStatus); + } + if (object.outputAudio != null) + if (typeof object.outputAudio === "string") + $util.base64.decode(object.outputAudio, message.outputAudio = $util.newBuffer($util.base64.length(object.outputAudio)), 0); + else if (object.outputAudio.length >= 0) + message.outputAudio = object.outputAudio; + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingDetectIntentResponse.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + return message; + }; + + /** + * Creates a plain object from a StreamingDetectIntentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2.StreamingDetectIntentResponse} message StreamingDetectIntentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingDetectIntentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.responseId = ""; + object.recognitionResult = null; + object.queryResult = null; + object.webhookStatus = null; + if (options.bytes === String) + object.outputAudio = ""; + else { + object.outputAudio = []; + if (options.bytes !== Array) + object.outputAudio = $util.newBuffer(object.outputAudio); + } + object.outputAudioConfig = null; + } + if (message.responseId != null && message.hasOwnProperty("responseId")) + object.responseId = message.responseId; + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) + object.recognitionResult = $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.toObject(message.recognitionResult, options); + if (message.queryResult != null && message.hasOwnProperty("queryResult")) + object.queryResult = $root.google.cloud.dialogflow.v2.QueryResult.toObject(message.queryResult, options); + if (message.webhookStatus != null && message.hasOwnProperty("webhookStatus")) + object.webhookStatus = $root.google.rpc.Status.toObject(message.webhookStatus, options); + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + object.outputAudio = options.bytes === String ? $util.base64.encode(message.outputAudio, 0, message.outputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.outputAudio) : message.outputAudio; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.v2.OutputAudioConfig.toObject(message.outputAudioConfig, options); + return object; + }; + + /** + * Converts this StreamingDetectIntentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @instance + * @returns {Object.} JSON object + */ + StreamingDetectIntentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingDetectIntentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.StreamingDetectIntentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingDetectIntentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.StreamingDetectIntentResponse"; + }; + + return StreamingDetectIntentResponse; + })(); + + v2.StreamingRecognitionResult = (function() { + + /** + * Properties of a StreamingRecognitionResult. + * @memberof google.cloud.dialogflow.v2 + * @interface IStreamingRecognitionResult + * @property {google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType|null} [messageType] StreamingRecognitionResult messageType + * @property {string|null} [transcript] StreamingRecognitionResult transcript + * @property {boolean|null} [isFinal] StreamingRecognitionResult isFinal + * @property {number|null} [confidence] StreamingRecognitionResult confidence + * @property {Array.|null} [speechWordInfo] StreamingRecognitionResult speechWordInfo + * @property {google.protobuf.IDuration|null} [speechEndOffset] StreamingRecognitionResult speechEndOffset + * @property {string|null} [languageCode] StreamingRecognitionResult languageCode + */ + + /** + * Constructs a new StreamingRecognitionResult. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a StreamingRecognitionResult. + * @implements IStreamingRecognitionResult + * @constructor + * @param {google.cloud.dialogflow.v2.IStreamingRecognitionResult=} [properties] Properties to set + */ + function StreamingRecognitionResult(properties) { + this.speechWordInfo = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingRecognitionResult messageType. + * @member {google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType} messageType + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.messageType = 0; + + /** + * StreamingRecognitionResult transcript. + * @member {string} transcript + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.transcript = ""; + + /** + * StreamingRecognitionResult isFinal. + * @member {boolean} isFinal + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.isFinal = false; + + /** + * StreamingRecognitionResult confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.confidence = 0; + + /** + * StreamingRecognitionResult speechWordInfo. + * @member {Array.} speechWordInfo + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.speechWordInfo = $util.emptyArray; + + /** + * StreamingRecognitionResult speechEndOffset. + * @member {google.protobuf.IDuration|null|undefined} speechEndOffset + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.speechEndOffset = null; + + /** + * StreamingRecognitionResult languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.languageCode = ""; + + /** + * Creates a new StreamingRecognitionResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.v2.IStreamingRecognitionResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.StreamingRecognitionResult} StreamingRecognitionResult instance + */ + StreamingRecognitionResult.create = function create(properties) { + return new StreamingRecognitionResult(properties); + }; + + /** + * Encodes the specified StreamingRecognitionResult message. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingRecognitionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.v2.IStreamingRecognitionResult} message StreamingRecognitionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRecognitionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageType != null && Object.hasOwnProperty.call(message, "messageType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.messageType); + if (message.transcript != null && Object.hasOwnProperty.call(message, "transcript")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.transcript); + if (message.isFinal != null && Object.hasOwnProperty.call(message, "isFinal")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.isFinal); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + if (message.speechWordInfo != null && message.speechWordInfo.length) + for (var i = 0; i < message.speechWordInfo.length; ++i) + $root.google.cloud.dialogflow.v2.SpeechWordInfo.encode(message.speechWordInfo[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.speechEndOffset != null && Object.hasOwnProperty.call(message, "speechEndOffset")) + $root.google.protobuf.Duration.encode(message.speechEndOffset, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified StreamingRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.StreamingRecognitionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.v2.IStreamingRecognitionResult} message StreamingRecognitionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRecognitionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.StreamingRecognitionResult} StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRecognitionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.StreamingRecognitionResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.messageType = reader.int32(); + break; + } + case 2: { + message.transcript = reader.string(); + break; + } + case 3: { + message.isFinal = reader.bool(); + break; + } + case 4: { + message.confidence = reader.float(); + break; + } + case 7: { + if (!(message.speechWordInfo && message.speechWordInfo.length)) + message.speechWordInfo = []; + message.speechWordInfo.push($root.google.cloud.dialogflow.v2.SpeechWordInfo.decode(reader, reader.uint32())); + break; + } + case 8: { + message.speechEndOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 10: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.StreamingRecognitionResult} StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRecognitionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingRecognitionResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingRecognitionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageType != null && message.hasOwnProperty("messageType")) + switch (message.messageType) { + default: + return "messageType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.transcript != null && message.hasOwnProperty("transcript")) + if (!$util.isString(message.transcript)) + return "transcript: string expected"; + if (message.isFinal != null && message.hasOwnProperty("isFinal")) + if (typeof message.isFinal !== "boolean") + return "isFinal: boolean expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.speechWordInfo != null && message.hasOwnProperty("speechWordInfo")) { + if (!Array.isArray(message.speechWordInfo)) + return "speechWordInfo: array expected"; + for (var i = 0; i < message.speechWordInfo.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SpeechWordInfo.verify(message.speechWordInfo[i]); + if (error) + return "speechWordInfo." + error; + } + } + if (message.speechEndOffset != null && message.hasOwnProperty("speechEndOffset")) { + var error = $root.google.protobuf.Duration.verify(message.speechEndOffset); + if (error) + return "speechEndOffset." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a StreamingRecognitionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.StreamingRecognitionResult} StreamingRecognitionResult + */ + StreamingRecognitionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.StreamingRecognitionResult) + return object; + var message = new $root.google.cloud.dialogflow.v2.StreamingRecognitionResult(); + switch (object.messageType) { + default: + if (typeof object.messageType === "number") { + message.messageType = object.messageType; + break; + } + break; + case "MESSAGE_TYPE_UNSPECIFIED": + case 0: + message.messageType = 0; + break; + case "TRANSCRIPT": + case 1: + message.messageType = 1; + break; + case "END_OF_SINGLE_UTTERANCE": + case 2: + message.messageType = 2; + break; + } + if (object.transcript != null) + message.transcript = String(object.transcript); + if (object.isFinal != null) + message.isFinal = Boolean(object.isFinal); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.speechWordInfo) { + if (!Array.isArray(object.speechWordInfo)) + throw TypeError(".google.cloud.dialogflow.v2.StreamingRecognitionResult.speechWordInfo: array expected"); + message.speechWordInfo = []; + for (var i = 0; i < object.speechWordInfo.length; ++i) { + if (typeof object.speechWordInfo[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingRecognitionResult.speechWordInfo: object expected"); + message.speechWordInfo[i] = $root.google.cloud.dialogflow.v2.SpeechWordInfo.fromObject(object.speechWordInfo[i]); + } + } + if (object.speechEndOffset != null) { + if (typeof object.speechEndOffset !== "object") + throw TypeError(".google.cloud.dialogflow.v2.StreamingRecognitionResult.speechEndOffset: object expected"); + message.speechEndOffset = $root.google.protobuf.Duration.fromObject(object.speechEndOffset); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a StreamingRecognitionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.v2.StreamingRecognitionResult} message StreamingRecognitionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingRecognitionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.speechWordInfo = []; + if (options.defaults) { + object.messageType = options.enums === String ? "MESSAGE_TYPE_UNSPECIFIED" : 0; + object.transcript = ""; + object.isFinal = false; + object.confidence = 0; + object.speechEndOffset = null; + object.languageCode = ""; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) + object.messageType = options.enums === String ? $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType[message.messageType] === undefined ? message.messageType : $root.google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType[message.messageType] : message.messageType; + if (message.transcript != null && message.hasOwnProperty("transcript")) + object.transcript = message.transcript; + if (message.isFinal != null && message.hasOwnProperty("isFinal")) + object.isFinal = message.isFinal; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.speechWordInfo && message.speechWordInfo.length) { + object.speechWordInfo = []; + for (var j = 0; j < message.speechWordInfo.length; ++j) + object.speechWordInfo[j] = $root.google.cloud.dialogflow.v2.SpeechWordInfo.toObject(message.speechWordInfo[j], options); + } + if (message.speechEndOffset != null && message.hasOwnProperty("speechEndOffset")) + object.speechEndOffset = $root.google.protobuf.Duration.toObject(message.speechEndOffset, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this StreamingRecognitionResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @instance + * @returns {Object.} JSON object + */ + StreamingRecognitionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingRecognitionResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.StreamingRecognitionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingRecognitionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.StreamingRecognitionResult"; + }; + + /** + * MessageType enum. + * @name google.cloud.dialogflow.v2.StreamingRecognitionResult.MessageType + * @enum {number} + * @property {number} MESSAGE_TYPE_UNSPECIFIED=0 MESSAGE_TYPE_UNSPECIFIED value + * @property {number} TRANSCRIPT=1 TRANSCRIPT value + * @property {number} END_OF_SINGLE_UTTERANCE=2 END_OF_SINGLE_UTTERANCE value + */ + StreamingRecognitionResult.MessageType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "TRANSCRIPT"] = 1; + values[valuesById[2] = "END_OF_SINGLE_UTTERANCE"] = 2; + return values; + })(); + + return StreamingRecognitionResult; + })(); + + v2.TextInput = (function() { + + /** + * Properties of a TextInput. + * @memberof google.cloud.dialogflow.v2 + * @interface ITextInput + * @property {string|null} [text] TextInput text + * @property {string|null} [languageCode] TextInput languageCode + */ + + /** + * Constructs a new TextInput. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a TextInput. + * @implements ITextInput + * @constructor + * @param {google.cloud.dialogflow.v2.ITextInput=} [properties] Properties to set + */ + function TextInput(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextInput text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2.TextInput + * @instance + */ + TextInput.prototype.text = ""; + + /** + * TextInput languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.TextInput + * @instance + */ + TextInput.prototype.languageCode = ""; + + /** + * Creates a new TextInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.TextInput + * @static + * @param {google.cloud.dialogflow.v2.ITextInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.TextInput} TextInput instance + */ + TextInput.create = function create(properties) { + return new TextInput(properties); + }; + + /** + * Encodes the specified TextInput message. Does not implicitly {@link google.cloud.dialogflow.v2.TextInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.TextInput + * @static + * @param {google.cloud.dialogflow.v2.ITextInput} message TextInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified TextInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.TextInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.TextInput + * @static + * @param {google.cloud.dialogflow.v2.ITextInput} message TextInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.TextInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.TextInput} TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextInput.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.TextInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.TextInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.TextInput} TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextInput message. + * @function verify + * @memberof google.cloud.dialogflow.v2.TextInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a TextInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.TextInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.TextInput} TextInput + */ + TextInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.TextInput) + return object; + var message = new $root.google.cloud.dialogflow.v2.TextInput(); + if (object.text != null) + message.text = String(object.text); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a TextInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.TextInput + * @static + * @param {google.cloud.dialogflow.v2.TextInput} message TextInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.languageCode = ""; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this TextInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.TextInput + * @instance + * @returns {Object.} JSON object + */ + TextInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TextInput + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.TextInput + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextInput.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.TextInput"; + }; + + return TextInput; + })(); + + v2.EventInput = (function() { + + /** + * Properties of an EventInput. + * @memberof google.cloud.dialogflow.v2 + * @interface IEventInput + * @property {string|null} [name] EventInput name + * @property {google.protobuf.IStruct|null} [parameters] EventInput parameters + * @property {string|null} [languageCode] EventInput languageCode + */ + + /** + * Constructs a new EventInput. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an EventInput. + * @implements IEventInput + * @constructor + * @param {google.cloud.dialogflow.v2.IEventInput=} [properties] Properties to set + */ + function EventInput(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventInput name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.EventInput + * @instance + */ + EventInput.prototype.name = ""; + + /** + * EventInput parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.v2.EventInput + * @instance + */ + EventInput.prototype.parameters = null; + + /** + * EventInput languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.EventInput + * @instance + */ + EventInput.prototype.languageCode = ""; + + /** + * Creates a new EventInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.EventInput + * @static + * @param {google.cloud.dialogflow.v2.IEventInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.EventInput} EventInput instance + */ + EventInput.create = function create(properties) { + return new EventInput(properties); + }; + + /** + * Encodes the specified EventInput message. Does not implicitly {@link google.cloud.dialogflow.v2.EventInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.EventInput + * @static + * @param {google.cloud.dialogflow.v2.IEventInput} message EventInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventInput.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.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified EventInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EventInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.EventInput + * @static + * @param {google.cloud.dialogflow.v2.IEventInput} message EventInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.EventInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.EventInput} EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventInput.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.EventInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.EventInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.EventInput} EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventInput message. + * @function verify + * @memberof google.cloud.dialogflow.v2.EventInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventInput.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.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates an EventInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.EventInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.EventInput} EventInput + */ + EventInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.EventInput) + return object; + var message = new $root.google.cloud.dialogflow.v2.EventInput(); + if (object.name != null) + message.name = String(object.name); + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2.EventInput.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from an EventInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.EventInput + * @static + * @param {google.cloud.dialogflow.v2.EventInput} message EventInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.parameters = null; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this EventInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.EventInput + * @instance + * @returns {Object.} JSON object + */ + EventInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EventInput + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.EventInput + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventInput.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.EventInput"; + }; + + return EventInput; + })(); + + v2.SentimentAnalysisRequestConfig = (function() { + + /** + * Properties of a SentimentAnalysisRequestConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface ISentimentAnalysisRequestConfig + * @property {boolean|null} [analyzeQueryTextSentiment] SentimentAnalysisRequestConfig analyzeQueryTextSentiment + */ + + /** + * Constructs a new SentimentAnalysisRequestConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SentimentAnalysisRequestConfig. + * @implements ISentimentAnalysisRequestConfig + * @constructor + * @param {google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig=} [properties] Properties to set + */ + function SentimentAnalysisRequestConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SentimentAnalysisRequestConfig analyzeQueryTextSentiment. + * @member {boolean} analyzeQueryTextSentiment + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @instance + */ + SentimentAnalysisRequestConfig.prototype.analyzeQueryTextSentiment = false; + + /** + * Creates a new SentimentAnalysisRequestConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @static + * @param {google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig} SentimentAnalysisRequestConfig instance + */ + SentimentAnalysisRequestConfig.create = function create(properties) { + return new SentimentAnalysisRequestConfig(properties); + }; + + /** + * Encodes the specified SentimentAnalysisRequestConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @static + * @param {google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig} message SentimentAnalysisRequestConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisRequestConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.analyzeQueryTextSentiment != null && Object.hasOwnProperty.call(message, "analyzeQueryTextSentiment")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.analyzeQueryTextSentiment); + return writer; + }; + + /** + * Encodes the specified SentimentAnalysisRequestConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @static + * @param {google.cloud.dialogflow.v2.ISentimentAnalysisRequestConfig} message SentimentAnalysisRequestConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisRequestConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SentimentAnalysisRequestConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig} SentimentAnalysisRequestConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisRequestConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.analyzeQueryTextSentiment = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SentimentAnalysisRequestConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig} SentimentAnalysisRequestConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisRequestConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SentimentAnalysisRequestConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SentimentAnalysisRequestConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.analyzeQueryTextSentiment != null && message.hasOwnProperty("analyzeQueryTextSentiment")) + if (typeof message.analyzeQueryTextSentiment !== "boolean") + return "analyzeQueryTextSentiment: boolean expected"; + return null; + }; + + /** + * Creates a SentimentAnalysisRequestConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig} SentimentAnalysisRequestConfig + */ + SentimentAnalysisRequestConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig(); + if (object.analyzeQueryTextSentiment != null) + message.analyzeQueryTextSentiment = Boolean(object.analyzeQueryTextSentiment); + return message; + }; + + /** + * Creates a plain object from a SentimentAnalysisRequestConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @static + * @param {google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig} message SentimentAnalysisRequestConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SentimentAnalysisRequestConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.analyzeQueryTextSentiment = false; + if (message.analyzeQueryTextSentiment != null && message.hasOwnProperty("analyzeQueryTextSentiment")) + object.analyzeQueryTextSentiment = message.analyzeQueryTextSentiment; + return object; + }; + + /** + * Converts this SentimentAnalysisRequestConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @instance + * @returns {Object.} JSON object + */ + SentimentAnalysisRequestConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SentimentAnalysisRequestConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SentimentAnalysisRequestConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SentimentAnalysisRequestConfig"; + }; + + return SentimentAnalysisRequestConfig; + })(); + + v2.SentimentAnalysisResult = (function() { + + /** + * Properties of a SentimentAnalysisResult. + * @memberof google.cloud.dialogflow.v2 + * @interface ISentimentAnalysisResult + * @property {google.cloud.dialogflow.v2.ISentiment|null} [queryTextSentiment] SentimentAnalysisResult queryTextSentiment + */ + + /** + * Constructs a new SentimentAnalysisResult. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SentimentAnalysisResult. + * @implements ISentimentAnalysisResult + * @constructor + * @param {google.cloud.dialogflow.v2.ISentimentAnalysisResult=} [properties] Properties to set + */ + function SentimentAnalysisResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SentimentAnalysisResult queryTextSentiment. + * @member {google.cloud.dialogflow.v2.ISentiment|null|undefined} queryTextSentiment + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @instance + */ + SentimentAnalysisResult.prototype.queryTextSentiment = null; + + /** + * Creates a new SentimentAnalysisResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.v2.ISentimentAnalysisResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SentimentAnalysisResult} SentimentAnalysisResult instance + */ + SentimentAnalysisResult.create = function create(properties) { + return new SentimentAnalysisResult(properties); + }; + + /** + * Encodes the specified SentimentAnalysisResult message. Does not implicitly {@link google.cloud.dialogflow.v2.SentimentAnalysisResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.v2.ISentimentAnalysisResult} message SentimentAnalysisResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryTextSentiment != null && Object.hasOwnProperty.call(message, "queryTextSentiment")) + $root.google.cloud.dialogflow.v2.Sentiment.encode(message.queryTextSentiment, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SentimentAnalysisResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SentimentAnalysisResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.v2.ISentimentAnalysisResult} message SentimentAnalysisResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SentimentAnalysisResult} SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SentimentAnalysisResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.queryTextSentiment = $root.google.cloud.dialogflow.v2.Sentiment.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SentimentAnalysisResult} SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SentimentAnalysisResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SentimentAnalysisResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTextSentiment != null && message.hasOwnProperty("queryTextSentiment")) { + var error = $root.google.cloud.dialogflow.v2.Sentiment.verify(message.queryTextSentiment); + if (error) + return "queryTextSentiment." + error; + } + return null; + }; + + /** + * Creates a SentimentAnalysisResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SentimentAnalysisResult} SentimentAnalysisResult + */ + SentimentAnalysisResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SentimentAnalysisResult) + return object; + var message = new $root.google.cloud.dialogflow.v2.SentimentAnalysisResult(); + if (object.queryTextSentiment != null) { + if (typeof object.queryTextSentiment !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SentimentAnalysisResult.queryTextSentiment: object expected"); + message.queryTextSentiment = $root.google.cloud.dialogflow.v2.Sentiment.fromObject(object.queryTextSentiment); + } + return message; + }; + + /** + * Creates a plain object from a SentimentAnalysisResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.v2.SentimentAnalysisResult} message SentimentAnalysisResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SentimentAnalysisResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.queryTextSentiment = null; + if (message.queryTextSentiment != null && message.hasOwnProperty("queryTextSentiment")) + object.queryTextSentiment = $root.google.cloud.dialogflow.v2.Sentiment.toObject(message.queryTextSentiment, options); + return object; + }; + + /** + * Converts this SentimentAnalysisResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @instance + * @returns {Object.} JSON object + */ + SentimentAnalysisResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SentimentAnalysisResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SentimentAnalysisResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SentimentAnalysisResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SentimentAnalysisResult"; + }; + + return SentimentAnalysisResult; + })(); + + v2.Sentiment = (function() { + + /** + * Properties of a Sentiment. + * @memberof google.cloud.dialogflow.v2 + * @interface ISentiment + * @property {number|null} [score] Sentiment score + * @property {number|null} [magnitude] Sentiment magnitude + */ + + /** + * Constructs a new Sentiment. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Sentiment. + * @implements ISentiment + * @constructor + * @param {google.cloud.dialogflow.v2.ISentiment=} [properties] Properties to set + */ + function Sentiment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Sentiment score. + * @member {number} score + * @memberof google.cloud.dialogflow.v2.Sentiment + * @instance + */ + Sentiment.prototype.score = 0; + + /** + * Sentiment magnitude. + * @member {number} magnitude + * @memberof google.cloud.dialogflow.v2.Sentiment + * @instance + */ + Sentiment.prototype.magnitude = 0; + + /** + * Creates a new Sentiment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Sentiment + * @static + * @param {google.cloud.dialogflow.v2.ISentiment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Sentiment} Sentiment instance + */ + Sentiment.create = function create(properties) { + return new Sentiment(properties); + }; + + /** + * Encodes the specified Sentiment message. Does not implicitly {@link google.cloud.dialogflow.v2.Sentiment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Sentiment + * @static + * @param {google.cloud.dialogflow.v2.ISentiment} message Sentiment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sentiment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.score != null && Object.hasOwnProperty.call(message, "score")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.score); + if (message.magnitude != null && Object.hasOwnProperty.call(message, "magnitude")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.magnitude); + return writer; + }; + + /** + * Encodes the specified Sentiment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Sentiment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Sentiment + * @static + * @param {google.cloud.dialogflow.v2.ISentiment} message Sentiment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sentiment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Sentiment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Sentiment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Sentiment} Sentiment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sentiment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Sentiment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.score = reader.float(); + break; + } + case 2: { + message.magnitude = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Sentiment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Sentiment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Sentiment} Sentiment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sentiment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Sentiment message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Sentiment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Sentiment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.magnitude != null && message.hasOwnProperty("magnitude")) + if (typeof message.magnitude !== "number") + return "magnitude: number expected"; + return null; + }; + + /** + * Creates a Sentiment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Sentiment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Sentiment} Sentiment + */ + Sentiment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Sentiment) + return object; + var message = new $root.google.cloud.dialogflow.v2.Sentiment(); + if (object.score != null) + message.score = Number(object.score); + if (object.magnitude != null) + message.magnitude = Number(object.magnitude); + return message; + }; + + /** + * Creates a plain object from a Sentiment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Sentiment + * @static + * @param {google.cloud.dialogflow.v2.Sentiment} message Sentiment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Sentiment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.score = 0; + object.magnitude = 0; + } + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.magnitude != null && message.hasOwnProperty("magnitude")) + object.magnitude = options.json && !isFinite(message.magnitude) ? String(message.magnitude) : message.magnitude; + return object; + }; + + /** + * Converts this Sentiment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Sentiment + * @instance + * @returns {Object.} JSON object + */ + Sentiment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Sentiment + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Sentiment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Sentiment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Sentiment"; + }; + + return Sentiment; + })(); + + v2.Contexts = (function() { + + /** + * Constructs a new Contexts service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Contexts + * @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 Contexts(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Contexts.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Contexts; + + /** + * Creates new Contexts service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Contexts + * @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 {Contexts} RPC service. Useful where requests and/or responses are streamed. + */ + Contexts.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|listContexts}. + * @memberof google.cloud.dialogflow.v2.Contexts + * @typedef ListContextsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListContextsResponse} [response] ListContextsResponse + */ + + /** + * Calls ListContexts. + * @function listContexts + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IListContextsRequest} request ListContextsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Contexts.ListContextsCallback} callback Node-style callback called with the error, if any, and ListContextsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.listContexts = function listContexts(request, callback) { + return this.rpcCall(listContexts, $root.google.cloud.dialogflow.v2.ListContextsRequest, $root.google.cloud.dialogflow.v2.ListContextsResponse, request, callback); + }, "name", { value: "ListContexts" }); + + /** + * Calls ListContexts. + * @function listContexts + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IListContextsRequest} request ListContextsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|getContext}. + * @memberof google.cloud.dialogflow.v2.Contexts + * @typedef GetContextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Context} [response] Context + */ + + /** + * Calls GetContext. + * @function getContext + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IGetContextRequest} request GetContextRequest message or plain object + * @param {google.cloud.dialogflow.v2.Contexts.GetContextCallback} callback Node-style callback called with the error, if any, and Context + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.getContext = function getContext(request, callback) { + return this.rpcCall(getContext, $root.google.cloud.dialogflow.v2.GetContextRequest, $root.google.cloud.dialogflow.v2.Context, request, callback); + }, "name", { value: "GetContext" }); + + /** + * Calls GetContext. + * @function getContext + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IGetContextRequest} request GetContextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|createContext}. + * @memberof google.cloud.dialogflow.v2.Contexts + * @typedef CreateContextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Context} [response] Context + */ + + /** + * Calls CreateContext. + * @function createContext + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.ICreateContextRequest} request CreateContextRequest message or plain object + * @param {google.cloud.dialogflow.v2.Contexts.CreateContextCallback} callback Node-style callback called with the error, if any, and Context + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.createContext = function createContext(request, callback) { + return this.rpcCall(createContext, $root.google.cloud.dialogflow.v2.CreateContextRequest, $root.google.cloud.dialogflow.v2.Context, request, callback); + }, "name", { value: "CreateContext" }); + + /** + * Calls CreateContext. + * @function createContext + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.ICreateContextRequest} request CreateContextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|updateContext}. + * @memberof google.cloud.dialogflow.v2.Contexts + * @typedef UpdateContextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Context} [response] Context + */ + + /** + * Calls UpdateContext. + * @function updateContext + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateContextRequest} request UpdateContextRequest message or plain object + * @param {google.cloud.dialogflow.v2.Contexts.UpdateContextCallback} callback Node-style callback called with the error, if any, and Context + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.updateContext = function updateContext(request, callback) { + return this.rpcCall(updateContext, $root.google.cloud.dialogflow.v2.UpdateContextRequest, $root.google.cloud.dialogflow.v2.Context, request, callback); + }, "name", { value: "UpdateContext" }); + + /** + * Calls UpdateContext. + * @function updateContext + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateContextRequest} request UpdateContextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|deleteContext}. + * @memberof google.cloud.dialogflow.v2.Contexts + * @typedef DeleteContextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteContext. + * @function deleteContext + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteContextRequest} request DeleteContextRequest message or plain object + * @param {google.cloud.dialogflow.v2.Contexts.DeleteContextCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.deleteContext = function deleteContext(request, callback) { + return this.rpcCall(deleteContext, $root.google.cloud.dialogflow.v2.DeleteContextRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteContext" }); + + /** + * Calls DeleteContext. + * @function deleteContext + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteContextRequest} request DeleteContextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Contexts|deleteAllContexts}. + * @memberof google.cloud.dialogflow.v2.Contexts + * @typedef DeleteAllContextsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteAllContexts. + * @function deleteAllContexts + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteAllContextsRequest} request DeleteAllContextsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Contexts.DeleteAllContextsCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.deleteAllContexts = function deleteAllContexts(request, callback) { + return this.rpcCall(deleteAllContexts, $root.google.cloud.dialogflow.v2.DeleteAllContextsRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteAllContexts" }); + + /** + * Calls DeleteAllContexts. + * @function deleteAllContexts + * @memberof google.cloud.dialogflow.v2.Contexts + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteAllContextsRequest} request DeleteAllContextsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Contexts; + })(); + + v2.Context = (function() { + + /** + * Properties of a Context. + * @memberof google.cloud.dialogflow.v2 + * @interface IContext + * @property {string|null} [name] Context name + * @property {number|null} [lifespanCount] Context lifespanCount + * @property {google.protobuf.IStruct|null} [parameters] Context parameters + */ + + /** + * Constructs a new Context. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Context. + * @implements IContext + * @constructor + * @param {google.cloud.dialogflow.v2.IContext=} [properties] Properties to set + */ + function Context(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Context name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Context + * @instance + */ + Context.prototype.name = ""; + + /** + * Context lifespanCount. + * @member {number} lifespanCount + * @memberof google.cloud.dialogflow.v2.Context + * @instance + */ + Context.prototype.lifespanCount = 0; + + /** + * Context parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.v2.Context + * @instance + */ + Context.prototype.parameters = null; + + /** + * Creates a new Context instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Context + * @static + * @param {google.cloud.dialogflow.v2.IContext=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Context} Context instance + */ + Context.create = function create(properties) { + return new Context(properties); + }; + + /** + * Encodes the specified Context message. Does not implicitly {@link google.cloud.dialogflow.v2.Context.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Context + * @static + * @param {google.cloud.dialogflow.v2.IContext} message Context message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Context.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.lifespanCount != null && Object.hasOwnProperty.call(message, "lifespanCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.lifespanCount); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Context message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Context.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Context + * @static + * @param {google.cloud.dialogflow.v2.IContext} message Context message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Context.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Context message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Context + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Context} Context + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Context.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Context(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.lifespanCount = reader.int32(); + break; + } + case 3: { + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Context message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Context + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Context} Context + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Context.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Context message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Context + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Context.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.lifespanCount != null && message.hasOwnProperty("lifespanCount")) + if (!$util.isInteger(message.lifespanCount)) + return "lifespanCount: integer expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + return null; + }; + + /** + * Creates a Context message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Context + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Context} Context + */ + Context.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Context) + return object; + var message = new $root.google.cloud.dialogflow.v2.Context(); + if (object.name != null) + message.name = String(object.name); + if (object.lifespanCount != null) + message.lifespanCount = object.lifespanCount | 0; + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Context.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + return message; + }; + + /** + * Creates a plain object from a Context message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Context + * @static + * @param {google.cloud.dialogflow.v2.Context} message Context + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Context.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.lifespanCount = 0; + object.parameters = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.lifespanCount != null && message.hasOwnProperty("lifespanCount")) + object.lifespanCount = message.lifespanCount; + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + return object; + }; + + /** + * Converts this Context to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Context + * @instance + * @returns {Object.} JSON object + */ + Context.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Context + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Context + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Context.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Context"; + }; + + return Context; + })(); + + v2.ListContextsRequest = (function() { + + /** + * Properties of a ListContextsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListContextsRequest + * @property {string|null} [parent] ListContextsRequest parent + * @property {number|null} [pageSize] ListContextsRequest pageSize + * @property {string|null} [pageToken] ListContextsRequest pageToken + */ + + /** + * Constructs a new ListContextsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListContextsRequest. + * @implements IListContextsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListContextsRequest=} [properties] Properties to set + */ + function ListContextsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListContextsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @instance + */ + ListContextsRequest.prototype.parent = ""; + + /** + * ListContextsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @instance + */ + ListContextsRequest.prototype.pageSize = 0; + + /** + * ListContextsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @instance + */ + ListContextsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListContextsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListContextsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListContextsRequest} ListContextsRequest instance + */ + ListContextsRequest.create = function create(properties) { + return new ListContextsRequest(properties); + }; + + /** + * Encodes the specified ListContextsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListContextsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListContextsRequest} message ListContextsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListContextsRequest.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 ListContextsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListContextsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListContextsRequest} message ListContextsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListContextsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListContextsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListContextsRequest} ListContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListContextsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListContextsRequest(); + 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 ListContextsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListContextsRequest} ListContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListContextsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListContextsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListContextsRequest.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 ListContextsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListContextsRequest} ListContextsRequest + */ + ListContextsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListContextsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListContextsRequest(); + 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 ListContextsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListContextsRequest} message ListContextsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListContextsRequest.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 ListContextsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @instance + * @returns {Object.} JSON object + */ + ListContextsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListContextsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListContextsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListContextsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListContextsRequest"; + }; + + return ListContextsRequest; + })(); + + v2.ListContextsResponse = (function() { + + /** + * Properties of a ListContextsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListContextsResponse + * @property {Array.|null} [contexts] ListContextsResponse contexts + * @property {string|null} [nextPageToken] ListContextsResponse nextPageToken + */ + + /** + * Constructs a new ListContextsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListContextsResponse. + * @implements IListContextsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListContextsResponse=} [properties] Properties to set + */ + function ListContextsResponse(properties) { + this.contexts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListContextsResponse contexts. + * @member {Array.} contexts + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @instance + */ + ListContextsResponse.prototype.contexts = $util.emptyArray; + + /** + * ListContextsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @instance + */ + ListContextsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListContextsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListContextsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListContextsResponse} ListContextsResponse instance + */ + ListContextsResponse.create = function create(properties) { + return new ListContextsResponse(properties); + }; + + /** + * Encodes the specified ListContextsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListContextsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListContextsResponse} message ListContextsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListContextsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contexts != null && message.contexts.length) + for (var i = 0; i < message.contexts.length; ++i) + $root.google.cloud.dialogflow.v2.Context.encode(message.contexts[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 ListContextsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListContextsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListContextsResponse} message ListContextsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListContextsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListContextsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListContextsResponse} ListContextsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListContextsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListContextsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.contexts && message.contexts.length)) + message.contexts = []; + message.contexts.push($root.google.cloud.dialogflow.v2.Context.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListContextsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListContextsResponse} ListContextsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListContextsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListContextsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListContextsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contexts != null && message.hasOwnProperty("contexts")) { + if (!Array.isArray(message.contexts)) + return "contexts: array expected"; + for (var i = 0; i < message.contexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Context.verify(message.contexts[i]); + if (error) + return "contexts." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListContextsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListContextsResponse} ListContextsResponse + */ + ListContextsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListContextsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListContextsResponse(); + if (object.contexts) { + if (!Array.isArray(object.contexts)) + throw TypeError(".google.cloud.dialogflow.v2.ListContextsResponse.contexts: array expected"); + message.contexts = []; + for (var i = 0; i < object.contexts.length; ++i) { + if (typeof object.contexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListContextsResponse.contexts: object expected"); + message.contexts[i] = $root.google.cloud.dialogflow.v2.Context.fromObject(object.contexts[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListContextsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListContextsResponse} message ListContextsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListContextsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.contexts = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.contexts && message.contexts.length) { + object.contexts = []; + for (var j = 0; j < message.contexts.length; ++j) + object.contexts[j] = $root.google.cloud.dialogflow.v2.Context.toObject(message.contexts[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListContextsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @instance + * @returns {Object.} JSON object + */ + ListContextsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListContextsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListContextsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListContextsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListContextsResponse"; + }; + + return ListContextsResponse; + })(); + + v2.GetContextRequest = (function() { + + /** + * Properties of a GetContextRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetContextRequest + * @property {string|null} [name] GetContextRequest name + */ + + /** + * Constructs a new GetContextRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetContextRequest. + * @implements IGetContextRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetContextRequest=} [properties] Properties to set + */ + function GetContextRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetContextRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @instance + */ + GetContextRequest.prototype.name = ""; + + /** + * Creates a new GetContextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetContextRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetContextRequest} GetContextRequest instance + */ + GetContextRequest.create = function create(properties) { + return new GetContextRequest(properties); + }; + + /** + * Encodes the specified GetContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetContextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetContextRequest} message GetContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetContextRequest.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 GetContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetContextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetContextRequest} message GetContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetContextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetContextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetContextRequest} GetContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetContextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetContextRequest(); + 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 GetContextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetContextRequest} GetContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetContextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetContextRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetContextRequest.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 GetContextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetContextRequest} GetContextRequest + */ + GetContextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetContextRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetContextRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetContextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @static + * @param {google.cloud.dialogflow.v2.GetContextRequest} message GetContextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetContextRequest.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 GetContextRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @instance + * @returns {Object.} JSON object + */ + GetContextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetContextRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetContextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetContextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetContextRequest"; + }; + + return GetContextRequest; + })(); + + v2.CreateContextRequest = (function() { + + /** + * Properties of a CreateContextRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateContextRequest + * @property {string|null} [parent] CreateContextRequest parent + * @property {google.cloud.dialogflow.v2.IContext|null} [context] CreateContextRequest context + */ + + /** + * Constructs a new CreateContextRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateContextRequest. + * @implements ICreateContextRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateContextRequest=} [properties] Properties to set + */ + function CreateContextRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateContextRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @instance + */ + CreateContextRequest.prototype.parent = ""; + + /** + * CreateContextRequest context. + * @member {google.cloud.dialogflow.v2.IContext|null|undefined} context + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @instance + */ + CreateContextRequest.prototype.context = null; + + /** + * Creates a new CreateContextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateContextRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateContextRequest} CreateContextRequest instance + */ + CreateContextRequest.create = function create(properties) { + return new CreateContextRequest(properties); + }; + + /** + * Encodes the specified CreateContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateContextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateContextRequest} message CreateContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateContextRequest.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.context != null && Object.hasOwnProperty.call(message, "context")) + $root.google.cloud.dialogflow.v2.Context.encode(message.context, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateContextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateContextRequest} message CreateContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateContextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateContextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateContextRequest} CreateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateContextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateContextRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.context = $root.google.cloud.dialogflow.v2.Context.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateContextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateContextRequest} CreateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateContextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateContextRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateContextRequest.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.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.dialogflow.v2.Context.verify(message.context); + if (error) + return "context." + error; + } + return null; + }; + + /** + * Creates a CreateContextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateContextRequest} CreateContextRequest + */ + CreateContextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateContextRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateContextRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateContextRequest.context: object expected"); + message.context = $root.google.cloud.dialogflow.v2.Context.fromObject(object.context); + } + return message; + }; + + /** + * Creates a plain object from a CreateContextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateContextRequest} message CreateContextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateContextRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.context = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.dialogflow.v2.Context.toObject(message.context, options); + return object; + }; + + /** + * Converts this CreateContextRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @instance + * @returns {Object.} JSON object + */ + CreateContextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateContextRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateContextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateContextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateContextRequest"; + }; + + return CreateContextRequest; + })(); + + v2.UpdateContextRequest = (function() { + + /** + * Properties of an UpdateContextRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateContextRequest + * @property {google.cloud.dialogflow.v2.IContext|null} [context] UpdateContextRequest context + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateContextRequest updateMask + */ + + /** + * Constructs a new UpdateContextRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateContextRequest. + * @implements IUpdateContextRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateContextRequest=} [properties] Properties to set + */ + function UpdateContextRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateContextRequest context. + * @member {google.cloud.dialogflow.v2.IContext|null|undefined} context + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @instance + */ + UpdateContextRequest.prototype.context = null; + + /** + * UpdateContextRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @instance + */ + UpdateContextRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateContextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateContextRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateContextRequest} UpdateContextRequest instance + */ + UpdateContextRequest.create = function create(properties) { + return new UpdateContextRequest(properties); + }; + + /** + * Encodes the specified UpdateContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateContextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateContextRequest} message UpdateContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateContextRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.context != null && Object.hasOwnProperty.call(message, "context")) + $root.google.cloud.dialogflow.v2.Context.encode(message.context, 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 UpdateContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateContextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateContextRequest} message UpdateContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateContextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateContextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateContextRequest} UpdateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateContextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateContextRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.context = $root.google.cloud.dialogflow.v2.Context.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 UpdateContextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateContextRequest} UpdateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateContextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateContextRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateContextRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.dialogflow.v2.Context.verify(message.context); + if (error) + return "context." + 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 UpdateContextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateContextRequest} UpdateContextRequest + */ + UpdateContextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateContextRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateContextRequest(); + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateContextRequest.context: object expected"); + message.context = $root.google.cloud.dialogflow.v2.Context.fromObject(object.context); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateContextRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateContextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateContextRequest} message UpdateContextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateContextRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.context = null; + object.updateMask = null; + } + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.dialogflow.v2.Context.toObject(message.context, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateContextRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateContextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateContextRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateContextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateContextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateContextRequest"; + }; + + return UpdateContextRequest; + })(); + + v2.DeleteContextRequest = (function() { + + /** + * Properties of a DeleteContextRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteContextRequest + * @property {string|null} [name] DeleteContextRequest name + */ + + /** + * Constructs a new DeleteContextRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteContextRequest. + * @implements IDeleteContextRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteContextRequest=} [properties] Properties to set + */ + function DeleteContextRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteContextRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @instance + */ + DeleteContextRequest.prototype.name = ""; + + /** + * Creates a new DeleteContextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteContextRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteContextRequest} DeleteContextRequest instance + */ + DeleteContextRequest.create = function create(properties) { + return new DeleteContextRequest(properties); + }; + + /** + * Encodes the specified DeleteContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteContextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteContextRequest} message DeleteContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteContextRequest.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 DeleteContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteContextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteContextRequest} message DeleteContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteContextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteContextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteContextRequest} DeleteContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteContextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteContextRequest(); + 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 DeleteContextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteContextRequest} DeleteContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteContextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteContextRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteContextRequest.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 DeleteContextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteContextRequest} DeleteContextRequest + */ + DeleteContextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteContextRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteContextRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteContextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteContextRequest} message DeleteContextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteContextRequest.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 DeleteContextRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteContextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteContextRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteContextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteContextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteContextRequest"; + }; + + return DeleteContextRequest; + })(); + + v2.DeleteAllContextsRequest = (function() { + + /** + * Properties of a DeleteAllContextsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteAllContextsRequest + * @property {string|null} [parent] DeleteAllContextsRequest parent + */ + + /** + * Constructs a new DeleteAllContextsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteAllContextsRequest. + * @implements IDeleteAllContextsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteAllContextsRequest=} [properties] Properties to set + */ + function DeleteAllContextsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteAllContextsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @instance + */ + DeleteAllContextsRequest.prototype.parent = ""; + + /** + * Creates a new DeleteAllContextsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteAllContextsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteAllContextsRequest} DeleteAllContextsRequest instance + */ + DeleteAllContextsRequest.create = function create(properties) { + return new DeleteAllContextsRequest(properties); + }; + + /** + * Encodes the specified DeleteAllContextsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteAllContextsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteAllContextsRequest} message DeleteAllContextsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAllContextsRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteAllContextsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteAllContextsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteAllContextsRequest} message DeleteAllContextsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAllContextsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteAllContextsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteAllContextsRequest} DeleteAllContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAllContextsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteAllContextsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteAllContextsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteAllContextsRequest} DeleteAllContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAllContextsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteAllContextsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteAllContextsRequest.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"; + return null; + }; + + /** + * Creates a DeleteAllContextsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteAllContextsRequest} DeleteAllContextsRequest + */ + DeleteAllContextsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteAllContextsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteAllContextsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a DeleteAllContextsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteAllContextsRequest} message DeleteAllContextsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteAllContextsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this DeleteAllContextsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteAllContextsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteAllContextsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteAllContextsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteAllContextsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteAllContextsRequest"; + }; + + return DeleteAllContextsRequest; + })(); + + v2.Intents = (function() { + + /** + * Constructs a new Intents service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an Intents + * @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 Intents(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Intents.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Intents; + + /** + * Creates new Intents service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Intents + * @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 {Intents} RPC service. Useful where requests and/or responses are streamed. + */ + Intents.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|listIntents}. + * @memberof google.cloud.dialogflow.v2.Intents + * @typedef ListIntentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListIntentsResponse} [response] ListIntentsResponse + */ + + /** + * Calls ListIntents. + * @function listIntents + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IListIntentsRequest} request ListIntentsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Intents.ListIntentsCallback} callback Node-style callback called with the error, if any, and ListIntentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.listIntents = function listIntents(request, callback) { + return this.rpcCall(listIntents, $root.google.cloud.dialogflow.v2.ListIntentsRequest, $root.google.cloud.dialogflow.v2.ListIntentsResponse, request, callback); + }, "name", { value: "ListIntents" }); + + /** + * Calls ListIntents. + * @function listIntents + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IListIntentsRequest} request ListIntentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|getIntent}. + * @memberof google.cloud.dialogflow.v2.Intents + * @typedef GetIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Intent} [response] Intent + */ + + /** + * Calls GetIntent. + * @function getIntent + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IGetIntentRequest} request GetIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Intents.GetIntentCallback} callback Node-style callback called with the error, if any, and Intent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.getIntent = function getIntent(request, callback) { + return this.rpcCall(getIntent, $root.google.cloud.dialogflow.v2.GetIntentRequest, $root.google.cloud.dialogflow.v2.Intent, request, callback); + }, "name", { value: "GetIntent" }); + + /** + * Calls GetIntent. + * @function getIntent + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IGetIntentRequest} request GetIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|createIntent}. + * @memberof google.cloud.dialogflow.v2.Intents + * @typedef CreateIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Intent} [response] Intent + */ + + /** + * Calls CreateIntent. + * @function createIntent + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.ICreateIntentRequest} request CreateIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Intents.CreateIntentCallback} callback Node-style callback called with the error, if any, and Intent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.createIntent = function createIntent(request, callback) { + return this.rpcCall(createIntent, $root.google.cloud.dialogflow.v2.CreateIntentRequest, $root.google.cloud.dialogflow.v2.Intent, request, callback); + }, "name", { value: "CreateIntent" }); + + /** + * Calls CreateIntent. + * @function createIntent + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.ICreateIntentRequest} request CreateIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|updateIntent}. + * @memberof google.cloud.dialogflow.v2.Intents + * @typedef UpdateIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Intent} [response] Intent + */ + + /** + * Calls UpdateIntent. + * @function updateIntent + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateIntentRequest} request UpdateIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Intents.UpdateIntentCallback} callback Node-style callback called with the error, if any, and Intent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.updateIntent = function updateIntent(request, callback) { + return this.rpcCall(updateIntent, $root.google.cloud.dialogflow.v2.UpdateIntentRequest, $root.google.cloud.dialogflow.v2.Intent, request, callback); + }, "name", { value: "UpdateIntent" }); + + /** + * Calls UpdateIntent. + * @function updateIntent + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateIntentRequest} request UpdateIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|deleteIntent}. + * @memberof google.cloud.dialogflow.v2.Intents + * @typedef DeleteIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteIntent. + * @function deleteIntent + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteIntentRequest} request DeleteIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Intents.DeleteIntentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.deleteIntent = function deleteIntent(request, callback) { + return this.rpcCall(deleteIntent, $root.google.cloud.dialogflow.v2.DeleteIntentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteIntent" }); + + /** + * Calls DeleteIntent. + * @function deleteIntent + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteIntentRequest} request DeleteIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|batchUpdateIntents}. + * @memberof google.cloud.dialogflow.v2.Intents + * @typedef BatchUpdateIntentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchUpdateIntents. + * @function batchUpdateIntents + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest} request BatchUpdateIntentsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Intents.BatchUpdateIntentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.batchUpdateIntents = function batchUpdateIntents(request, callback) { + return this.rpcCall(batchUpdateIntents, $root.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchUpdateIntents" }); + + /** + * Calls BatchUpdateIntents. + * @function batchUpdateIntents + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest} request BatchUpdateIntentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Intents|batchDeleteIntents}. + * @memberof google.cloud.dialogflow.v2.Intents + * @typedef BatchDeleteIntentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchDeleteIntents. + * @function batchDeleteIntents + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest} request BatchDeleteIntentsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Intents.BatchDeleteIntentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.batchDeleteIntents = function batchDeleteIntents(request, callback) { + return this.rpcCall(batchDeleteIntents, $root.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchDeleteIntents" }); + + /** + * Calls BatchDeleteIntents. + * @function batchDeleteIntents + * @memberof google.cloud.dialogflow.v2.Intents + * @instance + * @param {google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest} request BatchDeleteIntentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Intents; + })(); + + v2.Intent = (function() { + + /** + * Properties of an Intent. + * @memberof google.cloud.dialogflow.v2 + * @interface IIntent + * @property {string|null} [name] Intent name + * @property {string|null} [displayName] Intent displayName + * @property {google.cloud.dialogflow.v2.Intent.WebhookState|null} [webhookState] Intent webhookState + * @property {number|null} [priority] Intent priority + * @property {boolean|null} [isFallback] Intent isFallback + * @property {boolean|null} [mlDisabled] Intent mlDisabled + * @property {boolean|null} [liveAgentHandoff] Intent liveAgentHandoff + * @property {boolean|null} [endInteraction] Intent endInteraction + * @property {Array.|null} [inputContextNames] Intent inputContextNames + * @property {Array.|null} [events] Intent events + * @property {Array.|null} [trainingPhrases] Intent trainingPhrases + * @property {string|null} [action] Intent action + * @property {Array.|null} [outputContexts] Intent outputContexts + * @property {boolean|null} [resetContexts] Intent resetContexts + * @property {Array.|null} [parameters] Intent parameters + * @property {Array.|null} [messages] Intent messages + * @property {Array.|null} [defaultResponsePlatforms] Intent defaultResponsePlatforms + * @property {string|null} [rootFollowupIntentName] Intent rootFollowupIntentName + * @property {string|null} [parentFollowupIntentName] Intent parentFollowupIntentName + * @property {Array.|null} [followupIntentInfo] Intent followupIntentInfo + */ + + /** + * Constructs a new Intent. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an Intent. + * @implements IIntent + * @constructor + * @param {google.cloud.dialogflow.v2.IIntent=} [properties] Properties to set + */ + function Intent(properties) { + this.inputContextNames = []; + this.events = []; + this.trainingPhrases = []; + this.outputContexts = []; + this.parameters = []; + this.messages = []; + this.defaultResponsePlatforms = []; + this.followupIntentInfo = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Intent name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.name = ""; + + /** + * Intent displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.displayName = ""; + + /** + * Intent webhookState. + * @member {google.cloud.dialogflow.v2.Intent.WebhookState} webhookState + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.webhookState = 0; + + /** + * Intent priority. + * @member {number} priority + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.priority = 0; + + /** + * Intent isFallback. + * @member {boolean} isFallback + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.isFallback = false; + + /** + * Intent mlDisabled. + * @member {boolean} mlDisabled + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.mlDisabled = false; + + /** + * Intent liveAgentHandoff. + * @member {boolean} liveAgentHandoff + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.liveAgentHandoff = false; + + /** + * Intent endInteraction. + * @member {boolean} endInteraction + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.endInteraction = false; + + /** + * Intent inputContextNames. + * @member {Array.} inputContextNames + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.inputContextNames = $util.emptyArray; + + /** + * Intent events. + * @member {Array.} events + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.events = $util.emptyArray; + + /** + * Intent trainingPhrases. + * @member {Array.} trainingPhrases + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.trainingPhrases = $util.emptyArray; + + /** + * Intent action. + * @member {string} action + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.action = ""; + + /** + * Intent outputContexts. + * @member {Array.} outputContexts + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.outputContexts = $util.emptyArray; + + /** + * Intent resetContexts. + * @member {boolean} resetContexts + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.resetContexts = false; + + /** + * Intent parameters. + * @member {Array.} parameters + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.parameters = $util.emptyArray; + + /** + * Intent messages. + * @member {Array.} messages + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.messages = $util.emptyArray; + + /** + * Intent defaultResponsePlatforms. + * @member {Array.} defaultResponsePlatforms + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.defaultResponsePlatforms = $util.emptyArray; + + /** + * Intent rootFollowupIntentName. + * @member {string} rootFollowupIntentName + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.rootFollowupIntentName = ""; + + /** + * Intent parentFollowupIntentName. + * @member {string} parentFollowupIntentName + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.parentFollowupIntentName = ""; + + /** + * Intent followupIntentInfo. + * @member {Array.} followupIntentInfo + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + */ + Intent.prototype.followupIntentInfo = $util.emptyArray; + + /** + * Creates a new Intent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent + * @static + * @param {google.cloud.dialogflow.v2.IIntent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent} Intent instance + */ + Intent.create = function create(properties) { + return new Intent(properties); + }; + + /** + * Encodes the specified Intent message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent + * @static + * @param {google.cloud.dialogflow.v2.IIntent} message Intent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Intent.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.priority != null && Object.hasOwnProperty.call(message, "priority")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.priority); + if (message.isFallback != null && Object.hasOwnProperty.call(message, "isFallback")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.isFallback); + if (message.webhookState != null && Object.hasOwnProperty.call(message, "webhookState")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.webhookState); + if (message.inputContextNames != null && message.inputContextNames.length) + for (var i = 0; i < message.inputContextNames.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.inputContextNames[i]); + if (message.events != null && message.events.length) + for (var i = 0; i < message.events.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.events[i]); + if (message.trainingPhrases != null && message.trainingPhrases.length) + for (var i = 0; i < message.trainingPhrases.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.encode(message.trainingPhrases[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.action); + if (message.outputContexts != null && message.outputContexts.length) + for (var i = 0; i < message.outputContexts.length; ++i) + $root.google.cloud.dialogflow.v2.Context.encode(message.outputContexts[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.resetContexts != null && Object.hasOwnProperty.call(message, "resetContexts")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.resetContexts); + if (message.parameters != null && message.parameters.length) + for (var i = 0; i < message.parameters.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Parameter.encode(message.parameters[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.encode(message.messages[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.defaultResponsePlatforms != null && message.defaultResponsePlatforms.length) { + writer.uint32(/* id 15, wireType 2 =*/122).fork(); + for (var i = 0; i < message.defaultResponsePlatforms.length; ++i) + writer.int32(message.defaultResponsePlatforms[i]); + writer.ldelim(); + } + if (message.rootFollowupIntentName != null && Object.hasOwnProperty.call(message, "rootFollowupIntentName")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.rootFollowupIntentName); + if (message.parentFollowupIntentName != null && Object.hasOwnProperty.call(message, "parentFollowupIntentName")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.parentFollowupIntentName); + if (message.followupIntentInfo != null && message.followupIntentInfo.length) + for (var i = 0; i < message.followupIntentInfo.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.encode(message.followupIntentInfo[i], writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.mlDisabled != null && Object.hasOwnProperty.call(message, "mlDisabled")) + writer.uint32(/* id 19, wireType 0 =*/152).bool(message.mlDisabled); + if (message.liveAgentHandoff != null && Object.hasOwnProperty.call(message, "liveAgentHandoff")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.liveAgentHandoff); + if (message.endInteraction != null && Object.hasOwnProperty.call(message, "endInteraction")) + writer.uint32(/* id 21, wireType 0 =*/168).bool(message.endInteraction); + return writer; + }; + + /** + * Encodes the specified Intent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent + * @static + * @param {google.cloud.dialogflow.v2.IIntent} message Intent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Intent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Intent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent} Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Intent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent(); + 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 6: { + message.webhookState = reader.int32(); + break; + } + case 3: { + message.priority = reader.int32(); + break; + } + case 4: { + message.isFallback = reader.bool(); + break; + } + case 19: { + message.mlDisabled = reader.bool(); + break; + } + case 20: { + message.liveAgentHandoff = reader.bool(); + break; + } + case 21: { + message.endInteraction = reader.bool(); + break; + } + case 7: { + if (!(message.inputContextNames && message.inputContextNames.length)) + message.inputContextNames = []; + message.inputContextNames.push(reader.string()); + break; + } + case 8: { + if (!(message.events && message.events.length)) + message.events = []; + message.events.push(reader.string()); + break; + } + case 9: { + if (!(message.trainingPhrases && message.trainingPhrases.length)) + message.trainingPhrases = []; + message.trainingPhrases.push($root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.decode(reader, reader.uint32())); + break; + } + case 10: { + message.action = reader.string(); + break; + } + case 11: { + if (!(message.outputContexts && message.outputContexts.length)) + message.outputContexts = []; + message.outputContexts.push($root.google.cloud.dialogflow.v2.Context.decode(reader, reader.uint32())); + break; + } + case 12: { + message.resetContexts = reader.bool(); + break; + } + case 13: { + if (!(message.parameters && message.parameters.length)) + message.parameters = []; + message.parameters.push($root.google.cloud.dialogflow.v2.Intent.Parameter.decode(reader, reader.uint32())); + break; + } + case 14: { + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.dialogflow.v2.Intent.Message.decode(reader, reader.uint32())); + break; + } + case 15: { + if (!(message.defaultResponsePlatforms && message.defaultResponsePlatforms.length)) + message.defaultResponsePlatforms = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.defaultResponsePlatforms.push(reader.int32()); + } else + message.defaultResponsePlatforms.push(reader.int32()); + break; + } + case 16: { + message.rootFollowupIntentName = reader.string(); + break; + } + case 17: { + message.parentFollowupIntentName = reader.string(); + break; + } + case 18: { + if (!(message.followupIntentInfo && message.followupIntentInfo.length)) + message.followupIntentInfo = []; + message.followupIntentInfo.push($root.google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Intent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent} Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Intent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Intent message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Intent.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.webhookState != null && message.hasOwnProperty("webhookState")) + switch (message.webhookState) { + default: + return "webhookState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.priority != null && message.hasOwnProperty("priority")) + if (!$util.isInteger(message.priority)) + return "priority: integer expected"; + if (message.isFallback != null && message.hasOwnProperty("isFallback")) + if (typeof message.isFallback !== "boolean") + return "isFallback: boolean expected"; + if (message.mlDisabled != null && message.hasOwnProperty("mlDisabled")) + if (typeof message.mlDisabled !== "boolean") + return "mlDisabled: boolean expected"; + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) + if (typeof message.liveAgentHandoff !== "boolean") + return "liveAgentHandoff: boolean expected"; + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) + if (typeof message.endInteraction !== "boolean") + return "endInteraction: boolean expected"; + if (message.inputContextNames != null && message.hasOwnProperty("inputContextNames")) { + if (!Array.isArray(message.inputContextNames)) + return "inputContextNames: array expected"; + for (var i = 0; i < message.inputContextNames.length; ++i) + if (!$util.isString(message.inputContextNames[i])) + return "inputContextNames: string[] expected"; + } + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (var i = 0; i < message.events.length; ++i) + if (!$util.isString(message.events[i])) + return "events: string[] expected"; + } + if (message.trainingPhrases != null && message.hasOwnProperty("trainingPhrases")) { + if (!Array.isArray(message.trainingPhrases)) + return "trainingPhrases: array expected"; + for (var i = 0; i < message.trainingPhrases.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.verify(message.trainingPhrases[i]); + if (error) + return "trainingPhrases." + error; + } + } + if (message.action != null && message.hasOwnProperty("action")) + if (!$util.isString(message.action)) + return "action: string expected"; + if (message.outputContexts != null && message.hasOwnProperty("outputContexts")) { + if (!Array.isArray(message.outputContexts)) + return "outputContexts: array expected"; + for (var i = 0; i < message.outputContexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Context.verify(message.outputContexts[i]); + if (error) + return "outputContexts." + error; + } + } + if (message.resetContexts != null && message.hasOwnProperty("resetContexts")) + if (typeof message.resetContexts !== "boolean") + return "resetContexts: boolean expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + if (!Array.isArray(message.parameters)) + return "parameters: array expected"; + for (var i = 0; i < message.parameters.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Parameter.verify(message.parameters[i]); + if (error) + return "parameters." + error; + } + } + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.defaultResponsePlatforms != null && message.hasOwnProperty("defaultResponsePlatforms")) { + if (!Array.isArray(message.defaultResponsePlatforms)) + return "defaultResponsePlatforms: array expected"; + for (var i = 0; i < message.defaultResponsePlatforms.length; ++i) + switch (message.defaultResponsePlatforms[i]) { + default: + return "defaultResponsePlatforms: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 11: + break; + } + } + if (message.rootFollowupIntentName != null && message.hasOwnProperty("rootFollowupIntentName")) + if (!$util.isString(message.rootFollowupIntentName)) + return "rootFollowupIntentName: string expected"; + if (message.parentFollowupIntentName != null && message.hasOwnProperty("parentFollowupIntentName")) + if (!$util.isString(message.parentFollowupIntentName)) + return "parentFollowupIntentName: string expected"; + if (message.followupIntentInfo != null && message.hasOwnProperty("followupIntentInfo")) { + if (!Array.isArray(message.followupIntentInfo)) + return "followupIntentInfo: array expected"; + for (var i = 0; i < message.followupIntentInfo.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.verify(message.followupIntentInfo[i]); + if (error) + return "followupIntentInfo." + error; + } + } + return null; + }; + + /** + * Creates an Intent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent} Intent + */ + Intent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.webhookState) { + default: + if (typeof object.webhookState === "number") { + message.webhookState = object.webhookState; + break; + } + break; + case "WEBHOOK_STATE_UNSPECIFIED": + case 0: + message.webhookState = 0; + break; + case "WEBHOOK_STATE_ENABLED": + case 1: + message.webhookState = 1; + break; + case "WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING": + case 2: + message.webhookState = 2; + break; + } + if (object.priority != null) + message.priority = object.priority | 0; + if (object.isFallback != null) + message.isFallback = Boolean(object.isFallback); + if (object.mlDisabled != null) + message.mlDisabled = Boolean(object.mlDisabled); + if (object.liveAgentHandoff != null) + message.liveAgentHandoff = Boolean(object.liveAgentHandoff); + if (object.endInteraction != null) + message.endInteraction = Boolean(object.endInteraction); + if (object.inputContextNames) { + if (!Array.isArray(object.inputContextNames)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.inputContextNames: array expected"); + message.inputContextNames = []; + for (var i = 0; i < object.inputContextNames.length; ++i) + message.inputContextNames[i] = String(object.inputContextNames[i]); + } + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.events: array expected"); + message.events = []; + for (var i = 0; i < object.events.length; ++i) + message.events[i] = String(object.events[i]); + } + if (object.trainingPhrases) { + if (!Array.isArray(object.trainingPhrases)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.trainingPhrases: array expected"); + message.trainingPhrases = []; + for (var i = 0; i < object.trainingPhrases.length; ++i) { + if (typeof object.trainingPhrases[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.trainingPhrases: object expected"); + message.trainingPhrases[i] = $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.fromObject(object.trainingPhrases[i]); + } + } + if (object.action != null) + message.action = String(object.action); + if (object.outputContexts) { + if (!Array.isArray(object.outputContexts)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.outputContexts: array expected"); + message.outputContexts = []; + for (var i = 0; i < object.outputContexts.length; ++i) { + if (typeof object.outputContexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.outputContexts: object expected"); + message.outputContexts[i] = $root.google.cloud.dialogflow.v2.Context.fromObject(object.outputContexts[i]); + } + } + if (object.resetContexts != null) + message.resetContexts = Boolean(object.resetContexts); + if (object.parameters) { + if (!Array.isArray(object.parameters)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.parameters: array expected"); + message.parameters = []; + for (var i = 0; i < object.parameters.length; ++i) { + if (typeof object.parameters[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.parameters: object expected"); + message.parameters[i] = $root.google.cloud.dialogflow.v2.Intent.Parameter.fromObject(object.parameters[i]); + } + } + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.messages: object expected"); + message.messages[i] = $root.google.cloud.dialogflow.v2.Intent.Message.fromObject(object.messages[i]); + } + } + if (object.defaultResponsePlatforms) { + if (!Array.isArray(object.defaultResponsePlatforms)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.defaultResponsePlatforms: array expected"); + message.defaultResponsePlatforms = []; + for (var i = 0; i < object.defaultResponsePlatforms.length; ++i) + switch (object.defaultResponsePlatforms[i]) { + default: + if (typeof object.defaultResponsePlatforms[i] === "number") { + message.defaultResponsePlatforms[i] = object.defaultResponsePlatforms[i]; + break; + } + case "PLATFORM_UNSPECIFIED": + case 0: + message.defaultResponsePlatforms[i] = 0; + break; + case "FACEBOOK": + case 1: + message.defaultResponsePlatforms[i] = 1; + break; + case "SLACK": + case 2: + message.defaultResponsePlatforms[i] = 2; + break; + case "TELEGRAM": + case 3: + message.defaultResponsePlatforms[i] = 3; + break; + case "KIK": + case 4: + message.defaultResponsePlatforms[i] = 4; + break; + case "SKYPE": + case 5: + message.defaultResponsePlatforms[i] = 5; + break; + case "LINE": + case 6: + message.defaultResponsePlatforms[i] = 6; + break; + case "VIBER": + case 7: + message.defaultResponsePlatforms[i] = 7; + break; + case "ACTIONS_ON_GOOGLE": + case 8: + message.defaultResponsePlatforms[i] = 8; + break; + case "GOOGLE_HANGOUTS": + case 11: + message.defaultResponsePlatforms[i] = 11; + break; + } + } + if (object.rootFollowupIntentName != null) + message.rootFollowupIntentName = String(object.rootFollowupIntentName); + if (object.parentFollowupIntentName != null) + message.parentFollowupIntentName = String(object.parentFollowupIntentName); + if (object.followupIntentInfo) { + if (!Array.isArray(object.followupIntentInfo)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.followupIntentInfo: array expected"); + message.followupIntentInfo = []; + for (var i = 0; i < object.followupIntentInfo.length; ++i) { + if (typeof object.followupIntentInfo[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.followupIntentInfo: object expected"); + message.followupIntentInfo[i] = $root.google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.fromObject(object.followupIntentInfo[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an Intent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent + * @static + * @param {google.cloud.dialogflow.v2.Intent} message Intent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Intent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.inputContextNames = []; + object.events = []; + object.trainingPhrases = []; + object.outputContexts = []; + object.parameters = []; + object.messages = []; + object.defaultResponsePlatforms = []; + object.followupIntentInfo = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.priority = 0; + object.isFallback = false; + object.webhookState = options.enums === String ? "WEBHOOK_STATE_UNSPECIFIED" : 0; + object.action = ""; + object.resetContexts = false; + object.rootFollowupIntentName = ""; + object.parentFollowupIntentName = ""; + object.mlDisabled = false; + object.liveAgentHandoff = false; + object.endInteraction = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.priority != null && message.hasOwnProperty("priority")) + object.priority = message.priority; + if (message.isFallback != null && message.hasOwnProperty("isFallback")) + object.isFallback = message.isFallback; + if (message.webhookState != null && message.hasOwnProperty("webhookState")) + object.webhookState = options.enums === String ? $root.google.cloud.dialogflow.v2.Intent.WebhookState[message.webhookState] === undefined ? message.webhookState : $root.google.cloud.dialogflow.v2.Intent.WebhookState[message.webhookState] : message.webhookState; + if (message.inputContextNames && message.inputContextNames.length) { + object.inputContextNames = []; + for (var j = 0; j < message.inputContextNames.length; ++j) + object.inputContextNames[j] = message.inputContextNames[j]; + } + if (message.events && message.events.length) { + object.events = []; + for (var j = 0; j < message.events.length; ++j) + object.events[j] = message.events[j]; + } + if (message.trainingPhrases && message.trainingPhrases.length) { + object.trainingPhrases = []; + for (var j = 0; j < message.trainingPhrases.length; ++j) + object.trainingPhrases[j] = $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.toObject(message.trainingPhrases[j], options); + } + if (message.action != null && message.hasOwnProperty("action")) + object.action = message.action; + if (message.outputContexts && message.outputContexts.length) { + object.outputContexts = []; + for (var j = 0; j < message.outputContexts.length; ++j) + object.outputContexts[j] = $root.google.cloud.dialogflow.v2.Context.toObject(message.outputContexts[j], options); + } + if (message.resetContexts != null && message.hasOwnProperty("resetContexts")) + object.resetContexts = message.resetContexts; + if (message.parameters && message.parameters.length) { + object.parameters = []; + for (var j = 0; j < message.parameters.length; ++j) + object.parameters[j] = $root.google.cloud.dialogflow.v2.Intent.Parameter.toObject(message.parameters[j], options); + } + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.dialogflow.v2.Intent.Message.toObject(message.messages[j], options); + } + if (message.defaultResponsePlatforms && message.defaultResponsePlatforms.length) { + object.defaultResponsePlatforms = []; + for (var j = 0; j < message.defaultResponsePlatforms.length; ++j) + object.defaultResponsePlatforms[j] = options.enums === String ? $root.google.cloud.dialogflow.v2.Intent.Message.Platform[message.defaultResponsePlatforms[j]] === undefined ? message.defaultResponsePlatforms[j] : $root.google.cloud.dialogflow.v2.Intent.Message.Platform[message.defaultResponsePlatforms[j]] : message.defaultResponsePlatforms[j]; + } + if (message.rootFollowupIntentName != null && message.hasOwnProperty("rootFollowupIntentName")) + object.rootFollowupIntentName = message.rootFollowupIntentName; + if (message.parentFollowupIntentName != null && message.hasOwnProperty("parentFollowupIntentName")) + object.parentFollowupIntentName = message.parentFollowupIntentName; + if (message.followupIntentInfo && message.followupIntentInfo.length) { + object.followupIntentInfo = []; + for (var j = 0; j < message.followupIntentInfo.length; ++j) + object.followupIntentInfo[j] = $root.google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.toObject(message.followupIntentInfo[j], options); + } + if (message.mlDisabled != null && message.hasOwnProperty("mlDisabled")) + object.mlDisabled = message.mlDisabled; + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) + object.liveAgentHandoff = message.liveAgentHandoff; + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) + object.endInteraction = message.endInteraction; + return object; + }; + + /** + * Converts this Intent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent + * @instance + * @returns {Object.} JSON object + */ + Intent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Intent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Intent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent"; + }; + + /** + * WebhookState enum. + * @name google.cloud.dialogflow.v2.Intent.WebhookState + * @enum {number} + * @property {number} WEBHOOK_STATE_UNSPECIFIED=0 WEBHOOK_STATE_UNSPECIFIED value + * @property {number} WEBHOOK_STATE_ENABLED=1 WEBHOOK_STATE_ENABLED value + * @property {number} WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING=2 WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING value + */ + Intent.WebhookState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WEBHOOK_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "WEBHOOK_STATE_ENABLED"] = 1; + values[valuesById[2] = "WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING"] = 2; + return values; + })(); + + Intent.TrainingPhrase = (function() { + + /** + * Properties of a TrainingPhrase. + * @memberof google.cloud.dialogflow.v2.Intent + * @interface ITrainingPhrase + * @property {string|null} [name] TrainingPhrase name + * @property {google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type|null} [type] TrainingPhrase type + * @property {Array.|null} [parts] TrainingPhrase parts + * @property {number|null} [timesAddedCount] TrainingPhrase timesAddedCount + */ + + /** + * Constructs a new TrainingPhrase. + * @memberof google.cloud.dialogflow.v2.Intent + * @classdesc Represents a TrainingPhrase. + * @implements ITrainingPhrase + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.ITrainingPhrase=} [properties] Properties to set + */ + function TrainingPhrase(properties) { + this.parts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TrainingPhrase name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.name = ""; + + /** + * TrainingPhrase type. + * @member {google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type} type + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.type = 0; + + /** + * TrainingPhrase parts. + * @member {Array.} parts + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.parts = $util.emptyArray; + + /** + * TrainingPhrase timesAddedCount. + * @member {number} timesAddedCount + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.timesAddedCount = 0; + + /** + * Creates a new TrainingPhrase instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.v2.Intent.ITrainingPhrase=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.TrainingPhrase} TrainingPhrase instance + */ + TrainingPhrase.create = function create(properties) { + return new TrainingPhrase(properties); + }; + + /** + * Encodes the specified TrainingPhrase message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.TrainingPhrase.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.v2.Intent.ITrainingPhrase} message TrainingPhrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainingPhrase.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.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.parts != null && message.parts.length) + for (var i = 0; i < message.parts.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.encode(message.parts[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.timesAddedCount != null && Object.hasOwnProperty.call(message, "timesAddedCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.timesAddedCount); + return writer; + }; + + /** + * Encodes the specified TrainingPhrase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.TrainingPhrase.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.v2.Intent.ITrainingPhrase} message TrainingPhrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainingPhrase.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.TrainingPhrase} TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainingPhrase.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + if (!(message.parts && message.parts.length)) + message.parts = []; + message.parts.push($root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.decode(reader, reader.uint32())); + break; + } + case 4: { + message.timesAddedCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.TrainingPhrase} TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainingPhrase.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TrainingPhrase message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TrainingPhrase.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.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.parts != null && message.hasOwnProperty("parts")) { + if (!Array.isArray(message.parts)) + return "parts: array expected"; + for (var i = 0; i < message.parts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.verify(message.parts[i]); + if (error) + return "parts." + error; + } + } + if (message.timesAddedCount != null && message.hasOwnProperty("timesAddedCount")) + if (!$util.isInteger(message.timesAddedCount)) + return "timesAddedCount: integer expected"; + return null; + }; + + /** + * Creates a TrainingPhrase message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.TrainingPhrase} TrainingPhrase + */ + TrainingPhrase.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase(); + if (object.name != null) + message.name = String(object.name); + 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 "EXAMPLE": + case 1: + message.type = 1; + break; + case "TEMPLATE": + case 2: + message.type = 2; + break; + } + if (object.parts) { + if (!Array.isArray(object.parts)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.TrainingPhrase.parts: array expected"); + message.parts = []; + for (var i = 0; i < object.parts.length; ++i) { + if (typeof object.parts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.TrainingPhrase.parts: object expected"); + message.parts[i] = $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.fromObject(object.parts[i]); + } + } + if (object.timesAddedCount != null) + message.timesAddedCount = object.timesAddedCount | 0; + return message; + }; + + /** + * Creates a plain object from a TrainingPhrase message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.v2.Intent.TrainingPhrase} message TrainingPhrase + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TrainingPhrase.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parts = []; + if (options.defaults) { + object.name = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.timesAddedCount = 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type[message.type] === undefined ? message.type : $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type[message.type] : message.type; + if (message.parts && message.parts.length) { + object.parts = []; + for (var j = 0; j < message.parts.length; ++j) + object.parts[j] = $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.toObject(message.parts[j], options); + } + if (message.timesAddedCount != null && message.hasOwnProperty("timesAddedCount")) + object.timesAddedCount = message.timesAddedCount; + return object; + }; + + /** + * Converts this TrainingPhrase to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @instance + * @returns {Object.} JSON object + */ + TrainingPhrase.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TrainingPhrase + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TrainingPhrase.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.TrainingPhrase"; + }; + + /** + * Type enum. + * @name google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} EXAMPLE=1 EXAMPLE value + * @property {number} TEMPLATE=2 TEMPLATE value + */ + TrainingPhrase.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "EXAMPLE"] = 1; + values[valuesById[2] = "TEMPLATE"] = 2; + return values; + })(); + + TrainingPhrase.Part = (function() { + + /** + * Properties of a Part. + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @interface IPart + * @property {string|null} [text] Part text + * @property {string|null} [entityType] Part entityType + * @property {string|null} [alias] Part alias + * @property {boolean|null} [userDefined] Part userDefined + */ + + /** + * Constructs a new Part. + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase + * @classdesc Represents a Part. + * @implements IPart + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart=} [properties] Properties to set + */ + function Part(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Part text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.text = ""; + + /** + * Part entityType. + * @member {string} entityType + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.entityType = ""; + + /** + * Part alias. + * @member {string} alias + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.alias = ""; + + /** + * Part userDefined. + * @member {boolean} userDefined + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.userDefined = false; + + /** + * Creates a new Part instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part} Part instance + */ + Part.create = function create(properties) { + return new Part(properties); + }; + + /** + * Encodes the specified Part message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart} message Part message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Part.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityType); + if (message.alias != null && Object.hasOwnProperty.call(message, "alias")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.alias); + if (message.userDefined != null && Object.hasOwnProperty.call(message, "userDefined")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.userDefined); + return writer; + }; + + /** + * Encodes the specified Part message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.v2.Intent.TrainingPhrase.IPart} message Part message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Part.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Part message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part} Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Part.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.entityType = reader.string(); + break; + } + case 3: { + message.alias = reader.string(); + break; + } + case 4: { + message.userDefined = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Part message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part} Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Part.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Part message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Part.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) + if (!$util.isString(message.entityType)) + return "entityType: string expected"; + if (message.alias != null && message.hasOwnProperty("alias")) + if (!$util.isString(message.alias)) + return "alias: string expected"; + if (message.userDefined != null && message.hasOwnProperty("userDefined")) + if (typeof message.userDefined !== "boolean") + return "userDefined: boolean expected"; + return null; + }; + + /** + * Creates a Part message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part} Part + */ + Part.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part(); + if (object.text != null) + message.text = String(object.text); + if (object.entityType != null) + message.entityType = String(object.entityType); + if (object.alias != null) + message.alias = String(object.alias); + if (object.userDefined != null) + message.userDefined = Boolean(object.userDefined); + return message; + }; + + /** + * Creates a plain object from a Part message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part} message Part + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Part.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.entityType = ""; + object.alias = ""; + object.userDefined = false; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = message.entityType; + if (message.alias != null && message.hasOwnProperty("alias")) + object.alias = message.alias; + if (message.userDefined != null && message.hasOwnProperty("userDefined")) + object.userDefined = message.userDefined; + return object; + }; + + /** + * Converts this Part to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @instance + * @returns {Object.} JSON object + */ + Part.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Part + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Part.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.TrainingPhrase.Part"; + }; + + return Part; + })(); + + return TrainingPhrase; + })(); + + Intent.Parameter = (function() { + + /** + * Properties of a Parameter. + * @memberof google.cloud.dialogflow.v2.Intent + * @interface IParameter + * @property {string|null} [name] Parameter name + * @property {string|null} [displayName] Parameter displayName + * @property {string|null} [value] Parameter value + * @property {string|null} [defaultValue] Parameter defaultValue + * @property {string|null} [entityTypeDisplayName] Parameter entityTypeDisplayName + * @property {boolean|null} [mandatory] Parameter mandatory + * @property {Array.|null} [prompts] Parameter prompts + * @property {boolean|null} [isList] Parameter isList + */ + + /** + * Constructs a new Parameter. + * @memberof google.cloud.dialogflow.v2.Intent + * @classdesc Represents a Parameter. + * @implements IParameter + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.IParameter=} [properties] Properties to set + */ + function Parameter(properties) { + this.prompts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Parameter name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @instance + */ + Parameter.prototype.name = ""; + + /** + * Parameter displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @instance + */ + Parameter.prototype.displayName = ""; + + /** + * Parameter value. + * @member {string} value + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @instance + */ + Parameter.prototype.value = ""; + + /** + * Parameter defaultValue. + * @member {string} defaultValue + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @instance + */ + Parameter.prototype.defaultValue = ""; + + /** + * Parameter entityTypeDisplayName. + * @member {string} entityTypeDisplayName + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @instance + */ + Parameter.prototype.entityTypeDisplayName = ""; + + /** + * Parameter mandatory. + * @member {boolean} mandatory + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @instance + */ + Parameter.prototype.mandatory = false; + + /** + * Parameter prompts. + * @member {Array.} prompts + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @instance + */ + Parameter.prototype.prompts = $util.emptyArray; + + /** + * Parameter isList. + * @member {boolean} isList + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @instance + */ + Parameter.prototype.isList = false; + + /** + * Creates a new Parameter instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.v2.Intent.IParameter=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Parameter} Parameter instance + */ + Parameter.create = function create(properties) { + return new Parameter(properties); + }; + + /** + * Encodes the specified Parameter message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Parameter.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.v2.Intent.IParameter} message Parameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parameter.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.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.value); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.defaultValue); + if (message.entityTypeDisplayName != null && Object.hasOwnProperty.call(message, "entityTypeDisplayName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.entityTypeDisplayName); + if (message.mandatory != null && Object.hasOwnProperty.call(message, "mandatory")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.mandatory); + if (message.prompts != null && message.prompts.length) + for (var i = 0; i < message.prompts.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.prompts[i]); + if (message.isList != null && Object.hasOwnProperty.call(message, "isList")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.isList); + return writer; + }; + + /** + * Encodes the specified Parameter message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Parameter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.v2.Intent.IParameter} message Parameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parameter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Parameter message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Parameter} Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parameter.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Parameter(); + 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.value = reader.string(); + break; + } + case 4: { + message.defaultValue = reader.string(); + break; + } + case 5: { + message.entityTypeDisplayName = reader.string(); + break; + } + case 6: { + message.mandatory = reader.bool(); + break; + } + case 7: { + if (!(message.prompts && message.prompts.length)) + message.prompts = []; + message.prompts.push(reader.string()); + break; + } + case 8: { + message.isList = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Parameter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Parameter} Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parameter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Parameter message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Parameter.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.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.entityTypeDisplayName != null && message.hasOwnProperty("entityTypeDisplayName")) + if (!$util.isString(message.entityTypeDisplayName)) + return "entityTypeDisplayName: string expected"; + if (message.mandatory != null && message.hasOwnProperty("mandatory")) + if (typeof message.mandatory !== "boolean") + return "mandatory: boolean expected"; + if (message.prompts != null && message.hasOwnProperty("prompts")) { + if (!Array.isArray(message.prompts)) + return "prompts: array expected"; + for (var i = 0; i < message.prompts.length; ++i) + if (!$util.isString(message.prompts[i])) + return "prompts: string[] expected"; + } + if (message.isList != null && message.hasOwnProperty("isList")) + if (typeof message.isList !== "boolean") + return "isList: boolean expected"; + return null; + }; + + /** + * Creates a Parameter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Parameter} Parameter + */ + Parameter.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Parameter) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Parameter(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.value != null) + message.value = String(object.value); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.entityTypeDisplayName != null) + message.entityTypeDisplayName = String(object.entityTypeDisplayName); + if (object.mandatory != null) + message.mandatory = Boolean(object.mandatory); + if (object.prompts) { + if (!Array.isArray(object.prompts)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Parameter.prompts: array expected"); + message.prompts = []; + for (var i = 0; i < object.prompts.length; ++i) + message.prompts[i] = String(object.prompts[i]); + } + if (object.isList != null) + message.isList = Boolean(object.isList); + return message; + }; + + /** + * Creates a plain object from a Parameter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.v2.Intent.Parameter} message Parameter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Parameter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.prompts = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.value = ""; + object.defaultValue = ""; + object.entityTypeDisplayName = ""; + object.mandatory = false; + object.isList = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.entityTypeDisplayName != null && message.hasOwnProperty("entityTypeDisplayName")) + object.entityTypeDisplayName = message.entityTypeDisplayName; + if (message.mandatory != null && message.hasOwnProperty("mandatory")) + object.mandatory = message.mandatory; + if (message.prompts && message.prompts.length) { + object.prompts = []; + for (var j = 0; j < message.prompts.length; ++j) + object.prompts[j] = message.prompts[j]; + } + if (message.isList != null && message.hasOwnProperty("isList")) + object.isList = message.isList; + return object; + }; + + /** + * Converts this Parameter to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @instance + * @returns {Object.} JSON object + */ + Parameter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Parameter + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Parameter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Parameter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Parameter"; + }; + + return Parameter; + })(); + + Intent.Message = (function() { + + /** + * Properties of a Message. + * @memberof google.cloud.dialogflow.v2.Intent + * @interface IMessage + * @property {google.cloud.dialogflow.v2.Intent.Message.IText|null} [text] Message text + * @property {google.cloud.dialogflow.v2.Intent.Message.IImage|null} [image] Message image + * @property {google.cloud.dialogflow.v2.Intent.Message.IQuickReplies|null} [quickReplies] Message quickReplies + * @property {google.cloud.dialogflow.v2.Intent.Message.ICard|null} [card] Message card + * @property {google.protobuf.IStruct|null} [payload] Message payload + * @property {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses|null} [simpleResponses] Message simpleResponses + * @property {google.cloud.dialogflow.v2.Intent.Message.IBasicCard|null} [basicCard] Message basicCard + * @property {google.cloud.dialogflow.v2.Intent.Message.ISuggestions|null} [suggestions] Message suggestions + * @property {google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion|null} [linkOutSuggestion] Message linkOutSuggestion + * @property {google.cloud.dialogflow.v2.Intent.Message.IListSelect|null} [listSelect] Message listSelect + * @property {google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect|null} [carouselSelect] Message carouselSelect + * @property {google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard|null} [browseCarouselCard] Message browseCarouselCard + * @property {google.cloud.dialogflow.v2.Intent.Message.ITableCard|null} [tableCard] Message tableCard + * @property {google.cloud.dialogflow.v2.Intent.Message.IMediaContent|null} [mediaContent] Message mediaContent + * @property {google.cloud.dialogflow.v2.Intent.Message.Platform|null} [platform] Message platform + */ + + /** + * Constructs a new Message. + * @memberof google.cloud.dialogflow.v2.Intent + * @classdesc Represents a Message. + * @implements IMessage + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.IMessage=} [properties] Properties to set + */ + function Message(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Message text. + * @member {google.cloud.dialogflow.v2.Intent.Message.IText|null|undefined} text + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.text = null; + + /** + * Message image. + * @member {google.cloud.dialogflow.v2.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.image = null; + + /** + * Message quickReplies. + * @member {google.cloud.dialogflow.v2.Intent.Message.IQuickReplies|null|undefined} quickReplies + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.quickReplies = null; + + /** + * Message card. + * @member {google.cloud.dialogflow.v2.Intent.Message.ICard|null|undefined} card + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.card = null; + + /** + * Message payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.payload = null; + + /** + * Message simpleResponses. + * @member {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses|null|undefined} simpleResponses + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.simpleResponses = null; + + /** + * Message basicCard. + * @member {google.cloud.dialogflow.v2.Intent.Message.IBasicCard|null|undefined} basicCard + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.basicCard = null; + + /** + * Message suggestions. + * @member {google.cloud.dialogflow.v2.Intent.Message.ISuggestions|null|undefined} suggestions + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.suggestions = null; + + /** + * Message linkOutSuggestion. + * @member {google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion|null|undefined} linkOutSuggestion + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.linkOutSuggestion = null; + + /** + * Message listSelect. + * @member {google.cloud.dialogflow.v2.Intent.Message.IListSelect|null|undefined} listSelect + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.listSelect = null; + + /** + * Message carouselSelect. + * @member {google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect|null|undefined} carouselSelect + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.carouselSelect = null; + + /** + * Message browseCarouselCard. + * @member {google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard|null|undefined} browseCarouselCard + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.browseCarouselCard = null; + + /** + * Message tableCard. + * @member {google.cloud.dialogflow.v2.Intent.Message.ITableCard|null|undefined} tableCard + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.tableCard = null; + + /** + * Message mediaContent. + * @member {google.cloud.dialogflow.v2.Intent.Message.IMediaContent|null|undefined} mediaContent + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.mediaContent = null; + + /** + * Message platform. + * @member {google.cloud.dialogflow.v2.Intent.Message.Platform} platform + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Message.prototype.platform = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Message message. + * @member {"text"|"image"|"quickReplies"|"card"|"payload"|"simpleResponses"|"basicCard"|"suggestions"|"linkOutSuggestion"|"listSelect"|"carouselSelect"|"browseCarouselCard"|"tableCard"|"mediaContent"|undefined} message + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + */ + Object.defineProperty(Message.prototype, "message", { + get: $util.oneOfGetter($oneOfFields = ["text", "image", "quickReplies", "card", "payload", "simpleResponses", "basicCard", "suggestions", "linkOutSuggestion", "listSelect", "carouselSelect", "browseCarouselCard", "tableCard", "mediaContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Message instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @static + * @param {google.cloud.dialogflow.v2.Intent.IMessage=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message} Message instance + */ + Message.create = function create(properties) { + return new Message(properties); + }; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @static + * @param {google.cloud.dialogflow.v2.Intent.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + $root.google.cloud.dialogflow.v2.Intent.Message.Text.encode(message.text, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2.Intent.Message.Image.encode(message.image, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.quickReplies != null && Object.hasOwnProperty.call(message, "quickReplies")) + $root.google.cloud.dialogflow.v2.Intent.Message.QuickReplies.encode(message.quickReplies, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.card != null && Object.hasOwnProperty.call(message, "card")) + $root.google.cloud.dialogflow.v2.Intent.Message.Card.encode(message.card, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.platform != null && Object.hasOwnProperty.call(message, "platform")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.platform); + if (message.simpleResponses != null && Object.hasOwnProperty.call(message, "simpleResponses")) + $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.encode(message.simpleResponses, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.basicCard != null && Object.hasOwnProperty.call(message, "basicCard")) + $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.encode(message.basicCard, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.suggestions != null && Object.hasOwnProperty.call(message, "suggestions")) + $root.google.cloud.dialogflow.v2.Intent.Message.Suggestions.encode(message.suggestions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.linkOutSuggestion != null && Object.hasOwnProperty.call(message, "linkOutSuggestion")) + $root.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.encode(message.linkOutSuggestion, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.listSelect != null && Object.hasOwnProperty.call(message, "listSelect")) + $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.encode(message.listSelect, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.carouselSelect != null && Object.hasOwnProperty.call(message, "carouselSelect")) + $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.encode(message.carouselSelect, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.browseCarouselCard != null && Object.hasOwnProperty.call(message, "browseCarouselCard")) + $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.encode(message.browseCarouselCard, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.tableCard != null && Object.hasOwnProperty.call(message, "tableCard")) + $root.google.cloud.dialogflow.v2.Intent.Message.TableCard.encode(message.tableCard, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.mediaContent != null && Object.hasOwnProperty.call(message, "mediaContent")) + $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.encode(message.mediaContent, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @static + * @param {google.cloud.dialogflow.v2.Intent.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Message message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = $root.google.cloud.dialogflow.v2.Intent.Message.Text.decode(reader, reader.uint32()); + break; + } + case 2: { + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 3: { + message.quickReplies = $root.google.cloud.dialogflow.v2.Intent.Message.QuickReplies.decode(reader, reader.uint32()); + break; + } + case 4: { + message.card = $root.google.cloud.dialogflow.v2.Intent.Message.Card.decode(reader, reader.uint32()); + break; + } + case 5: { + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 7: { + message.simpleResponses = $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.decode(reader, reader.uint32()); + break; + } + case 8: { + message.basicCard = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.decode(reader, reader.uint32()); + break; + } + case 9: { + message.suggestions = $root.google.cloud.dialogflow.v2.Intent.Message.Suggestions.decode(reader, reader.uint32()); + break; + } + case 10: { + message.linkOutSuggestion = $root.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.decode(reader, reader.uint32()); + break; + } + case 11: { + message.listSelect = $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.decode(reader, reader.uint32()); + break; + } + case 12: { + message.carouselSelect = $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.decode(reader, reader.uint32()); + break; + } + case 22: { + message.browseCarouselCard = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.decode(reader, reader.uint32()); + break; + } + case 23: { + message.tableCard = $root.google.cloud.dialogflow.v2.Intent.Message.TableCard.decode(reader, reader.uint32()); + break; + } + case 24: { + message.mediaContent = $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.decode(reader, reader.uint32()); + break; + } + case 6: { + message.platform = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Message message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Message.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Text.verify(message.text); + if (error) + return "text." + error; + } + } + if (message.image != null && message.hasOwnProperty("image")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + } + if (message.quickReplies != null && message.hasOwnProperty("quickReplies")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.QuickReplies.verify(message.quickReplies); + if (error) + return "quickReplies." + error; + } + } + if (message.card != null && message.hasOwnProperty("card")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Card.verify(message.card); + if (error) + return "card." + error; + } + } + if (message.payload != null && message.hasOwnProperty("payload")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + } + if (message.simpleResponses != null && message.hasOwnProperty("simpleResponses")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.verify(message.simpleResponses); + if (error) + return "simpleResponses." + error; + } + } + if (message.basicCard != null && message.hasOwnProperty("basicCard")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.verify(message.basicCard); + if (error) + return "basicCard." + error; + } + } + if (message.suggestions != null && message.hasOwnProperty("suggestions")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Suggestions.verify(message.suggestions); + if (error) + return "suggestions." + error; + } + } + if (message.linkOutSuggestion != null && message.hasOwnProperty("linkOutSuggestion")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.verify(message.linkOutSuggestion); + if (error) + return "linkOutSuggestion." + error; + } + } + if (message.listSelect != null && message.hasOwnProperty("listSelect")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.verify(message.listSelect); + if (error) + return "listSelect." + error; + } + } + if (message.carouselSelect != null && message.hasOwnProperty("carouselSelect")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.verify(message.carouselSelect); + if (error) + return "carouselSelect." + error; + } + } + if (message.browseCarouselCard != null && message.hasOwnProperty("browseCarouselCard")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.verify(message.browseCarouselCard); + if (error) + return "browseCarouselCard." + error; + } + } + if (message.tableCard != null && message.hasOwnProperty("tableCard")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.TableCard.verify(message.tableCard); + if (error) + return "tableCard." + error; + } + } + if (message.mediaContent != null && message.hasOwnProperty("mediaContent")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.verify(message.mediaContent); + if (error) + return "mediaContent." + error; + } + } + if (message.platform != null && message.hasOwnProperty("platform")) + switch (message.platform) { + default: + return "platform: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 11: + break; + } + return null; + }; + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message} Message + */ + Message.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message(); + if (object.text != null) { + if (typeof object.text !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.text: object expected"); + message.text = $root.google.cloud.dialogflow.v2.Intent.Message.Text.fromObject(object.text); + } + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.fromObject(object.image); + } + if (object.quickReplies != null) { + if (typeof object.quickReplies !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.quickReplies: object expected"); + message.quickReplies = $root.google.cloud.dialogflow.v2.Intent.Message.QuickReplies.fromObject(object.quickReplies); + } + if (object.card != null) { + if (typeof object.card !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.card: object expected"); + message.card = $root.google.cloud.dialogflow.v2.Intent.Message.Card.fromObject(object.card); + } + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.simpleResponses != null) { + if (typeof object.simpleResponses !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.simpleResponses: object expected"); + message.simpleResponses = $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.fromObject(object.simpleResponses); + } + if (object.basicCard != null) { + if (typeof object.basicCard !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.basicCard: object expected"); + message.basicCard = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.fromObject(object.basicCard); + } + if (object.suggestions != null) { + if (typeof object.suggestions !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.suggestions: object expected"); + message.suggestions = $root.google.cloud.dialogflow.v2.Intent.Message.Suggestions.fromObject(object.suggestions); + } + if (object.linkOutSuggestion != null) { + if (typeof object.linkOutSuggestion !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.linkOutSuggestion: object expected"); + message.linkOutSuggestion = $root.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.fromObject(object.linkOutSuggestion); + } + if (object.listSelect != null) { + if (typeof object.listSelect !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.listSelect: object expected"); + message.listSelect = $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.fromObject(object.listSelect); + } + if (object.carouselSelect != null) { + if (typeof object.carouselSelect !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.carouselSelect: object expected"); + message.carouselSelect = $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.fromObject(object.carouselSelect); + } + if (object.browseCarouselCard != null) { + if (typeof object.browseCarouselCard !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.browseCarouselCard: object expected"); + message.browseCarouselCard = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.fromObject(object.browseCarouselCard); + } + if (object.tableCard != null) { + if (typeof object.tableCard !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.tableCard: object expected"); + message.tableCard = $root.google.cloud.dialogflow.v2.Intent.Message.TableCard.fromObject(object.tableCard); + } + if (object.mediaContent != null) { + if (typeof object.mediaContent !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.mediaContent: object expected"); + message.mediaContent = $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.fromObject(object.mediaContent); + } + switch (object.platform) { + default: + if (typeof object.platform === "number") { + message.platform = object.platform; + break; + } + break; + case "PLATFORM_UNSPECIFIED": + case 0: + message.platform = 0; + break; + case "FACEBOOK": + case 1: + message.platform = 1; + break; + case "SLACK": + case 2: + message.platform = 2; + break; + case "TELEGRAM": + case 3: + message.platform = 3; + break; + case "KIK": + case 4: + message.platform = 4; + break; + case "SKYPE": + case 5: + message.platform = 5; + break; + case "LINE": + case 6: + message.platform = 6; + break; + case "VIBER": + case 7: + message.platform = 7; + break; + case "ACTIONS_ON_GOOGLE": + case 8: + message.platform = 8; + break; + case "GOOGLE_HANGOUTS": + case 11: + message.platform = 11; + break; + } + return message; + }; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message} message Message + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Message.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.platform = options.enums === String ? "PLATFORM_UNSPECIFIED" : 0; + if (message.text != null && message.hasOwnProperty("text")) { + object.text = $root.google.cloud.dialogflow.v2.Intent.Message.Text.toObject(message.text, options); + if (options.oneofs) + object.message = "text"; + } + if (message.image != null && message.hasOwnProperty("image")) { + object.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.toObject(message.image, options); + if (options.oneofs) + object.message = "image"; + } + if (message.quickReplies != null && message.hasOwnProperty("quickReplies")) { + object.quickReplies = $root.google.cloud.dialogflow.v2.Intent.Message.QuickReplies.toObject(message.quickReplies, options); + if (options.oneofs) + object.message = "quickReplies"; + } + if (message.card != null && message.hasOwnProperty("card")) { + object.card = $root.google.cloud.dialogflow.v2.Intent.Message.Card.toObject(message.card, options); + if (options.oneofs) + object.message = "card"; + } + if (message.payload != null && message.hasOwnProperty("payload")) { + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (options.oneofs) + object.message = "payload"; + } + if (message.platform != null && message.hasOwnProperty("platform")) + object.platform = options.enums === String ? $root.google.cloud.dialogflow.v2.Intent.Message.Platform[message.platform] === undefined ? message.platform : $root.google.cloud.dialogflow.v2.Intent.Message.Platform[message.platform] : message.platform; + if (message.simpleResponses != null && message.hasOwnProperty("simpleResponses")) { + object.simpleResponses = $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.toObject(message.simpleResponses, options); + if (options.oneofs) + object.message = "simpleResponses"; + } + if (message.basicCard != null && message.hasOwnProperty("basicCard")) { + object.basicCard = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.toObject(message.basicCard, options); + if (options.oneofs) + object.message = "basicCard"; + } + if (message.suggestions != null && message.hasOwnProperty("suggestions")) { + object.suggestions = $root.google.cloud.dialogflow.v2.Intent.Message.Suggestions.toObject(message.suggestions, options); + if (options.oneofs) + object.message = "suggestions"; + } + if (message.linkOutSuggestion != null && message.hasOwnProperty("linkOutSuggestion")) { + object.linkOutSuggestion = $root.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.toObject(message.linkOutSuggestion, options); + if (options.oneofs) + object.message = "linkOutSuggestion"; + } + if (message.listSelect != null && message.hasOwnProperty("listSelect")) { + object.listSelect = $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.toObject(message.listSelect, options); + if (options.oneofs) + object.message = "listSelect"; + } + if (message.carouselSelect != null && message.hasOwnProperty("carouselSelect")) { + object.carouselSelect = $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.toObject(message.carouselSelect, options); + if (options.oneofs) + object.message = "carouselSelect"; + } + if (message.browseCarouselCard != null && message.hasOwnProperty("browseCarouselCard")) { + object.browseCarouselCard = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.toObject(message.browseCarouselCard, options); + if (options.oneofs) + object.message = "browseCarouselCard"; + } + if (message.tableCard != null && message.hasOwnProperty("tableCard")) { + object.tableCard = $root.google.cloud.dialogflow.v2.Intent.Message.TableCard.toObject(message.tableCard, options); + if (options.oneofs) + object.message = "tableCard"; + } + if (message.mediaContent != null && message.hasOwnProperty("mediaContent")) { + object.mediaContent = $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.toObject(message.mediaContent, options); + if (options.oneofs) + object.message = "mediaContent"; + } + return object; + }; + + /** + * Converts this Message to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @instance + * @returns {Object.} JSON object + */ + Message.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Message + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message"; + }; + + /** + * Platform enum. + * @name google.cloud.dialogflow.v2.Intent.Message.Platform + * @enum {number} + * @property {number} PLATFORM_UNSPECIFIED=0 PLATFORM_UNSPECIFIED value + * @property {number} FACEBOOK=1 FACEBOOK value + * @property {number} SLACK=2 SLACK value + * @property {number} TELEGRAM=3 TELEGRAM value + * @property {number} KIK=4 KIK value + * @property {number} SKYPE=5 SKYPE value + * @property {number} LINE=6 LINE value + * @property {number} VIBER=7 VIBER value + * @property {number} ACTIONS_ON_GOOGLE=8 ACTIONS_ON_GOOGLE value + * @property {number} GOOGLE_HANGOUTS=11 GOOGLE_HANGOUTS value + */ + Message.Platform = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PLATFORM_UNSPECIFIED"] = 0; + values[valuesById[1] = "FACEBOOK"] = 1; + values[valuesById[2] = "SLACK"] = 2; + values[valuesById[3] = "TELEGRAM"] = 3; + values[valuesById[4] = "KIK"] = 4; + values[valuesById[5] = "SKYPE"] = 5; + values[valuesById[6] = "LINE"] = 6; + values[valuesById[7] = "VIBER"] = 7; + values[valuesById[8] = "ACTIONS_ON_GOOGLE"] = 8; + values[valuesById[11] = "GOOGLE_HANGOUTS"] = 11; + return values; + })(); + + Message.Text = (function() { + + /** + * Properties of a Text. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface IText + * @property {Array.|null} [text] Text text + */ + + /** + * Constructs a new Text. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a Text. + * @implements IText + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.IText=} [properties] Properties to set + */ + function Text(properties) { + this.text = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Text text. + * @member {Array.} text + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @instance + */ + Text.prototype.text = $util.emptyArray; + + /** + * Creates a new Text instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IText=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.Text} Text instance + */ + Text.create = function create(properties) { + return new Text(properties); + }; + + /** + * Encodes the specified Text message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Text.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IText} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + return writer; + }; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Text.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IText} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Text message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.Text(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Text message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Text.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + return null; + }; + + /** + * Creates a Text message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.Text} Text + */ + Text.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.Text) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.Text(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.Text.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + return message; + }; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.Text} message Text + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Text.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.text = []; + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + return object; + }; + + /** + * Converts this Text to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @instance + * @returns {Object.} JSON object + */ + Text.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Text + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.Text + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Text.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.Text"; + }; + + return Text; + })(); + + Message.Image = (function() { + + /** + * Properties of an Image. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface IImage + * @property {string|null} [imageUri] Image imageUri + * @property {string|null} [accessibilityText] Image accessibilityText + */ + + /** + * Constructs a new Image. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents an Image. + * @implements IImage + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.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 imageUri. + * @member {string} imageUri + * @memberof google.cloud.dialogflow.v2.Intent.Message.Image + * @instance + */ + Image.prototype.imageUri = ""; + + /** + * Image accessibilityText. + * @member {string} accessibilityText + * @memberof google.cloud.dialogflow.v2.Intent.Message.Image + * @instance + */ + Image.prototype.accessibilityText = ""; + + /** + * Creates a new Image instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.Image + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IImage=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.Image} Image instance + */ + Image.create = function create(properties) { + return new Image(properties); + }; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Image.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Image + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.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.imageUri != null && Object.hasOwnProperty.call(message, "imageUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.imageUri); + if (message.accessibilityText != null && Object.hasOwnProperty.call(message, "accessibilityText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.accessibilityText); + return writer; + }; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Image.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Image + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.Image(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.imageUri = reader.string(); + break; + } + case 2: { + message.accessibilityText = reader.string(); + 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.dialogflow.v2.Intent.Message.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.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.imageUri != null && message.hasOwnProperty("imageUri")) + if (!$util.isString(message.imageUri)) + return "imageUri: string expected"; + if (message.accessibilityText != null && message.hasOwnProperty("accessibilityText")) + if (!$util.isString(message.accessibilityText)) + return "accessibilityText: string expected"; + return null; + }; + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Image + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.Image} Image + */ + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.Image) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.Image(); + if (object.imageUri != null) + message.imageUri = String(object.imageUri); + if (object.accessibilityText != null) + message.accessibilityText = String(object.accessibilityText); + return message; + }; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Image + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.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) { + object.imageUri = ""; + object.accessibilityText = ""; + } + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + object.imageUri = message.imageUri; + if (message.accessibilityText != null && message.hasOwnProperty("accessibilityText")) + object.accessibilityText = message.accessibilityText; + return object; + }; + + /** + * Converts this Image to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.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.dialogflow.v2.Intent.Message.Image"; + }; + + return Image; + })(); + + Message.QuickReplies = (function() { + + /** + * Properties of a QuickReplies. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface IQuickReplies + * @property {string|null} [title] QuickReplies title + * @property {Array.|null} [quickReplies] QuickReplies quickReplies + */ + + /** + * Constructs a new QuickReplies. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a QuickReplies. + * @implements IQuickReplies + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.IQuickReplies=} [properties] Properties to set + */ + function QuickReplies(properties) { + this.quickReplies = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuickReplies title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @instance + */ + QuickReplies.prototype.title = ""; + + /** + * QuickReplies quickReplies. + * @member {Array.} quickReplies + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @instance + */ + QuickReplies.prototype.quickReplies = $util.emptyArray; + + /** + * Creates a new QuickReplies instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IQuickReplies=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.QuickReplies} QuickReplies instance + */ + QuickReplies.create = function create(properties) { + return new QuickReplies(properties); + }; + + /** + * Encodes the specified QuickReplies message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.QuickReplies.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IQuickReplies} message QuickReplies message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuickReplies.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.quickReplies != null && message.quickReplies.length) + for (var i = 0; i < message.quickReplies.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.quickReplies[i]); + return writer; + }; + + /** + * Encodes the specified QuickReplies message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.QuickReplies.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IQuickReplies} message QuickReplies message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuickReplies.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuickReplies message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.QuickReplies} QuickReplies + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuickReplies.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.QuickReplies(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + if (!(message.quickReplies && message.quickReplies.length)) + message.quickReplies = []; + message.quickReplies.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuickReplies message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.QuickReplies} QuickReplies + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuickReplies.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuickReplies message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuickReplies.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.quickReplies != null && message.hasOwnProperty("quickReplies")) { + if (!Array.isArray(message.quickReplies)) + return "quickReplies: array expected"; + for (var i = 0; i < message.quickReplies.length; ++i) + if (!$util.isString(message.quickReplies[i])) + return "quickReplies: string[] expected"; + } + return null; + }; + + /** + * Creates a QuickReplies message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.QuickReplies} QuickReplies + */ + QuickReplies.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.QuickReplies) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.QuickReplies(); + if (object.title != null) + message.title = String(object.title); + if (object.quickReplies) { + if (!Array.isArray(object.quickReplies)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.QuickReplies.quickReplies: array expected"); + message.quickReplies = []; + for (var i = 0; i < object.quickReplies.length; ++i) + message.quickReplies[i] = String(object.quickReplies[i]); + } + return message; + }; + + /** + * Creates a plain object from a QuickReplies message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.QuickReplies} message QuickReplies + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuickReplies.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.quickReplies = []; + if (options.defaults) + object.title = ""; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.quickReplies && message.quickReplies.length) { + object.quickReplies = []; + for (var j = 0; j < message.quickReplies.length; ++j) + object.quickReplies[j] = message.quickReplies[j]; + } + return object; + }; + + /** + * Converts this QuickReplies to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @instance + * @returns {Object.} JSON object + */ + QuickReplies.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QuickReplies + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.QuickReplies + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QuickReplies.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.QuickReplies"; + }; + + return QuickReplies; + })(); + + Message.Card = (function() { + + /** + * Properties of a Card. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ICard + * @property {string|null} [title] Card title + * @property {string|null} [subtitle] Card subtitle + * @property {string|null} [imageUri] Card imageUri + * @property {Array.|null} [buttons] Card buttons + */ + + /** + * Constructs a new Card. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a Card. + * @implements ICard + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ICard=} [properties] Properties to set + */ + function Card(properties) { + this.buttons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Card title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @instance + */ + Card.prototype.title = ""; + + /** + * Card subtitle. + * @member {string} subtitle + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @instance + */ + Card.prototype.subtitle = ""; + + /** + * Card imageUri. + * @member {string} imageUri + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @instance + */ + Card.prototype.imageUri = ""; + + /** + * Card buttons. + * @member {Array.} buttons + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @instance + */ + Card.prototype.buttons = $util.emptyArray; + + /** + * Creates a new Card instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ICard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.Card} Card instance + */ + Card.create = function create(properties) { + return new Card(properties); + }; + + /** + * Encodes the specified Card message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Card.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ICard} message Card message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Card.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.subtitle != null && Object.hasOwnProperty.call(message, "subtitle")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subtitle); + if (message.imageUri != null && Object.hasOwnProperty.call(message, "imageUri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.imageUri); + if (message.buttons != null && message.buttons.length) + for (var i = 0; i < message.buttons.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.Card.Button.encode(message.buttons[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Card message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Card.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ICard} message Card message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Card.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Card message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.Card} Card + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Card.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.Card(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.subtitle = reader.string(); + break; + } + case 3: { + message.imageUri = reader.string(); + break; + } + case 4: { + if (!(message.buttons && message.buttons.length)) + message.buttons = []; + message.buttons.push($root.google.cloud.dialogflow.v2.Intent.Message.Card.Button.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Card message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.Card} Card + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Card.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Card message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Card.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + if (!$util.isString(message.subtitle)) + return "subtitle: string expected"; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + if (!$util.isString(message.imageUri)) + return "imageUri: string expected"; + if (message.buttons != null && message.hasOwnProperty("buttons")) { + if (!Array.isArray(message.buttons)) + return "buttons: array expected"; + for (var i = 0; i < message.buttons.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Card.Button.verify(message.buttons[i]); + if (error) + return "buttons." + error; + } + } + return null; + }; + + /** + * Creates a Card message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.Card} Card + */ + Card.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.Card) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.Card(); + if (object.title != null) + message.title = String(object.title); + if (object.subtitle != null) + message.subtitle = String(object.subtitle); + if (object.imageUri != null) + message.imageUri = String(object.imageUri); + if (object.buttons) { + if (!Array.isArray(object.buttons)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.Card.buttons: array expected"); + message.buttons = []; + for (var i = 0; i < object.buttons.length; ++i) { + if (typeof object.buttons[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.Card.buttons: object expected"); + message.buttons[i] = $root.google.cloud.dialogflow.v2.Intent.Message.Card.Button.fromObject(object.buttons[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Card message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.Card} message Card + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Card.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.buttons = []; + if (options.defaults) { + object.title = ""; + object.subtitle = ""; + object.imageUri = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + object.subtitle = message.subtitle; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + object.imageUri = message.imageUri; + if (message.buttons && message.buttons.length) { + object.buttons = []; + for (var j = 0; j < message.buttons.length; ++j) + object.buttons[j] = $root.google.cloud.dialogflow.v2.Intent.Message.Card.Button.toObject(message.buttons[j], options); + } + return object; + }; + + /** + * Converts this Card to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @instance + * @returns {Object.} JSON object + */ + Card.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Card + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Card.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.Card"; + }; + + Card.Button = (function() { + + /** + * Properties of a Button. + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @interface IButton + * @property {string|null} [text] Button text + * @property {string|null} [postback] Button postback + */ + + /** + * Constructs a new Button. + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card + * @classdesc Represents a Button. + * @implements IButton + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.Card.IButton=} [properties] Properties to set + */ + function Button(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Button text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @instance + */ + Button.prototype.text = ""; + + /** + * Button postback. + * @member {string} postback + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @instance + */ + Button.prototype.postback = ""; + + /** + * Creates a new Button instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.Card.IButton=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.Card.Button} Button instance + */ + Button.create = function create(properties) { + return new Button(properties); + }; + + /** + * Encodes the specified Button message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Card.Button.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.Card.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.postback != null && Object.hasOwnProperty.call(message, "postback")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.postback); + return writer; + }; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Card.Button.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.Card.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Button message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.Card.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.Card.Button(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.postback = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.Card.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Button message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Button.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.postback != null && message.hasOwnProperty("postback")) + if (!$util.isString(message.postback)) + return "postback: string expected"; + return null; + }; + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.Card.Button} Button + */ + Button.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.Card.Button) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.Card.Button(); + if (object.text != null) + message.text = String(object.text); + if (object.postback != null) + message.postback = String(object.postback); + return message; + }; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.Card.Button} message Button + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Button.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.postback = ""; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.postback != null && message.hasOwnProperty("postback")) + object.postback = message.postback; + return object; + }; + + /** + * Converts this Button to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @instance + * @returns {Object.} JSON object + */ + Button.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Button + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.Card.Button + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Button.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.Card.Button"; + }; + + return Button; + })(); + + return Card; + })(); + + Message.SimpleResponse = (function() { + + /** + * Properties of a SimpleResponse. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ISimpleResponse + * @property {string|null} [textToSpeech] SimpleResponse textToSpeech + * @property {string|null} [ssml] SimpleResponse ssml + * @property {string|null} [displayText] SimpleResponse displayText + */ + + /** + * Constructs a new SimpleResponse. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a SimpleResponse. + * @implements ISimpleResponse + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse=} [properties] Properties to set + */ + function SimpleResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SimpleResponse textToSpeech. + * @member {string} textToSpeech + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @instance + */ + SimpleResponse.prototype.textToSpeech = ""; + + /** + * SimpleResponse ssml. + * @member {string} ssml + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @instance + */ + SimpleResponse.prototype.ssml = ""; + + /** + * SimpleResponse displayText. + * @member {string} displayText + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @instance + */ + SimpleResponse.prototype.displayText = ""; + + /** + * Creates a new SimpleResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.SimpleResponse} SimpleResponse instance + */ + SimpleResponse.create = function create(properties) { + return new SimpleResponse(properties); + }; + + /** + * Encodes the specified SimpleResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse} message SimpleResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textToSpeech != null && Object.hasOwnProperty.call(message, "textToSpeech")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.textToSpeech); + if (message.ssml != null && Object.hasOwnProperty.call(message, "ssml")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ssml); + if (message.displayText != null && Object.hasOwnProperty.call(message, "displayText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayText); + return writer; + }; + + /** + * Encodes the specified SimpleResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponse} message SimpleResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SimpleResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.SimpleResponse} SimpleResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.textToSpeech = reader.string(); + break; + } + case 2: { + message.ssml = reader.string(); + break; + } + case 3: { + message.displayText = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SimpleResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.SimpleResponse} SimpleResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SimpleResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SimpleResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textToSpeech != null && message.hasOwnProperty("textToSpeech")) + if (!$util.isString(message.textToSpeech)) + return "textToSpeech: string expected"; + if (message.ssml != null && message.hasOwnProperty("ssml")) + if (!$util.isString(message.ssml)) + return "ssml: string expected"; + if (message.displayText != null && message.hasOwnProperty("displayText")) + if (!$util.isString(message.displayText)) + return "displayText: string expected"; + return null; + }; + + /** + * Creates a SimpleResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.SimpleResponse} SimpleResponse + */ + SimpleResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponse(); + if (object.textToSpeech != null) + message.textToSpeech = String(object.textToSpeech); + if (object.ssml != null) + message.ssml = String(object.ssml); + if (object.displayText != null) + message.displayText = String(object.displayText); + return message; + }; + + /** + * Creates a plain object from a SimpleResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.SimpleResponse} message SimpleResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SimpleResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textToSpeech = ""; + object.ssml = ""; + object.displayText = ""; + } + if (message.textToSpeech != null && message.hasOwnProperty("textToSpeech")) + object.textToSpeech = message.textToSpeech; + if (message.ssml != null && message.hasOwnProperty("ssml")) + object.ssml = message.ssml; + if (message.displayText != null && message.hasOwnProperty("displayText")) + object.displayText = message.displayText; + return object; + }; + + /** + * Converts this SimpleResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @instance + * @returns {Object.} JSON object + */ + SimpleResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SimpleResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SimpleResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.SimpleResponse"; + }; + + return SimpleResponse; + })(); + + Message.SimpleResponses = (function() { + + /** + * Properties of a SimpleResponses. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ISimpleResponses + * @property {Array.|null} [simpleResponses] SimpleResponses simpleResponses + */ + + /** + * Constructs a new SimpleResponses. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a SimpleResponses. + * @implements ISimpleResponses + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses=} [properties] Properties to set + */ + function SimpleResponses(properties) { + this.simpleResponses = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SimpleResponses simpleResponses. + * @member {Array.} simpleResponses + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @instance + */ + SimpleResponses.prototype.simpleResponses = $util.emptyArray; + + /** + * Creates a new SimpleResponses instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.SimpleResponses} SimpleResponses instance + */ + SimpleResponses.create = function create(properties) { + return new SimpleResponses(properties); + }; + + /** + * Encodes the specified SimpleResponses message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses} message SimpleResponses message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleResponses.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.simpleResponses != null && message.simpleResponses.length) + for (var i = 0; i < message.simpleResponses.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.encode(message.simpleResponses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SimpleResponses message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISimpleResponses} message SimpleResponses message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleResponses.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SimpleResponses message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.SimpleResponses} SimpleResponses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleResponses.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponses(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.simpleResponses && message.simpleResponses.length)) + message.simpleResponses = []; + message.simpleResponses.push($root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SimpleResponses message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.SimpleResponses} SimpleResponses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleResponses.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SimpleResponses message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SimpleResponses.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.simpleResponses != null && message.hasOwnProperty("simpleResponses")) { + if (!Array.isArray(message.simpleResponses)) + return "simpleResponses: array expected"; + for (var i = 0; i < message.simpleResponses.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.verify(message.simpleResponses[i]); + if (error) + return "simpleResponses." + error; + } + } + return null; + }; + + /** + * Creates a SimpleResponses message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.SimpleResponses} SimpleResponses + */ + SimpleResponses.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponses) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponses(); + if (object.simpleResponses) { + if (!Array.isArray(object.simpleResponses)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.simpleResponses: array expected"); + message.simpleResponses = []; + for (var i = 0; i < object.simpleResponses.length; ++i) { + if (typeof object.simpleResponses[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.SimpleResponses.simpleResponses: object expected"); + message.simpleResponses[i] = $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.fromObject(object.simpleResponses[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SimpleResponses message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.SimpleResponses} message SimpleResponses + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SimpleResponses.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.simpleResponses = []; + if (message.simpleResponses && message.simpleResponses.length) { + object.simpleResponses = []; + for (var j = 0; j < message.simpleResponses.length; ++j) + object.simpleResponses[j] = $root.google.cloud.dialogflow.v2.Intent.Message.SimpleResponse.toObject(message.simpleResponses[j], options); + } + return object; + }; + + /** + * Converts this SimpleResponses to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @instance + * @returns {Object.} JSON object + */ + SimpleResponses.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SimpleResponses + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.SimpleResponses + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SimpleResponses.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.SimpleResponses"; + }; + + return SimpleResponses; + })(); + + Message.BasicCard = (function() { + + /** + * Properties of a BasicCard. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface IBasicCard + * @property {string|null} [title] BasicCard title + * @property {string|null} [subtitle] BasicCard subtitle + * @property {string|null} [formattedText] BasicCard formattedText + * @property {google.cloud.dialogflow.v2.Intent.Message.IImage|null} [image] BasicCard image + * @property {Array.|null} [buttons] BasicCard buttons + */ + + /** + * Constructs a new BasicCard. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a BasicCard. + * @implements IBasicCard + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.IBasicCard=} [properties] Properties to set + */ + function BasicCard(properties) { + this.buttons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BasicCard title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.title = ""; + + /** + * BasicCard subtitle. + * @member {string} subtitle + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.subtitle = ""; + + /** + * BasicCard formattedText. + * @member {string} formattedText + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.formattedText = ""; + + /** + * BasicCard image. + * @member {google.cloud.dialogflow.v2.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.image = null; + + /** + * BasicCard buttons. + * @member {Array.} buttons + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.buttons = $util.emptyArray; + + /** + * Creates a new BasicCard instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IBasicCard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard} BasicCard instance + */ + BasicCard.create = function create(properties) { + return new BasicCard(properties); + }; + + /** + * Encodes the specified BasicCard message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IBasicCard} message BasicCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BasicCard.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.subtitle != null && Object.hasOwnProperty.call(message, "subtitle")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subtitle); + if (message.formattedText != null && Object.hasOwnProperty.call(message, "formattedText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.formattedText); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2.Intent.Message.Image.encode(message.image, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.buttons != null && message.buttons.length) + for (var i = 0; i < message.buttons.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.encode(message.buttons[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BasicCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IBasicCard} message BasicCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BasicCard.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BasicCard message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard} BasicCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BasicCard.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.subtitle = reader.string(); + break; + } + case 3: { + message.formattedText = reader.string(); + break; + } + case 4: { + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.buttons && message.buttons.length)) + message.buttons = []; + message.buttons.push($root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BasicCard message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard} BasicCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BasicCard.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BasicCard message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BasicCard.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + if (!$util.isString(message.subtitle)) + return "subtitle: string expected"; + if (message.formattedText != null && message.hasOwnProperty("formattedText")) + if (!$util.isString(message.formattedText)) + return "formattedText: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.buttons != null && message.hasOwnProperty("buttons")) { + if (!Array.isArray(message.buttons)) + return "buttons: array expected"; + for (var i = 0; i < message.buttons.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.verify(message.buttons[i]); + if (error) + return "buttons." + error; + } + } + return null; + }; + + /** + * Creates a BasicCard message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard} BasicCard + */ + BasicCard.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard(); + if (object.title != null) + message.title = String(object.title); + if (object.subtitle != null) + message.subtitle = String(object.subtitle); + if (object.formattedText != null) + message.formattedText = String(object.formattedText); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.BasicCard.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.fromObject(object.image); + } + if (object.buttons) { + if (!Array.isArray(object.buttons)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.BasicCard.buttons: array expected"); + message.buttons = []; + for (var i = 0; i < object.buttons.length; ++i) { + if (typeof object.buttons[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.BasicCard.buttons: object expected"); + message.buttons[i] = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.fromObject(object.buttons[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BasicCard message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard} message BasicCard + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BasicCard.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.buttons = []; + if (options.defaults) { + object.title = ""; + object.subtitle = ""; + object.formattedText = ""; + object.image = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + object.subtitle = message.subtitle; + if (message.formattedText != null && message.hasOwnProperty("formattedText")) + object.formattedText = message.formattedText; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.toObject(message.image, options); + if (message.buttons && message.buttons.length) { + object.buttons = []; + for (var j = 0; j < message.buttons.length; ++j) + object.buttons[j] = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.toObject(message.buttons[j], options); + } + return object; + }; + + /** + * Converts this BasicCard to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @instance + * @returns {Object.} JSON object + */ + BasicCard.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BasicCard + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BasicCard.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.BasicCard"; + }; + + BasicCard.Button = (function() { + + /** + * Properties of a Button. + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @interface IButton + * @property {string|null} [title] Button title + * @property {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction|null} [openUriAction] Button openUriAction + */ + + /** + * Constructs a new Button. + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard + * @classdesc Represents a Button. + * @implements IButton + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton=} [properties] Properties to set + */ + function Button(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Button title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @instance + */ + Button.prototype.title = ""; + + /** + * Button openUriAction. + * @member {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction|null|undefined} openUriAction + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @instance + */ + Button.prototype.openUriAction = null; + + /** + * Creates a new Button instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button} Button instance + */ + Button.create = function create(properties) { + return new Button(properties); + }; + + /** + * Encodes the specified Button message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.openUriAction != null && Object.hasOwnProperty.call(message, "openUriAction")) + $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.encode(message.openUriAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Button message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.openUriAction = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Button message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Button.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.openUriAction != null && message.hasOwnProperty("openUriAction")) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.verify(message.openUriAction); + if (error) + return "openUriAction." + error; + } + return null; + }; + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button} Button + */ + Button.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button(); + if (object.title != null) + message.title = String(object.title); + if (object.openUriAction != null) { + if (typeof object.openUriAction !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.openUriAction: object expected"); + message.openUriAction = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.fromObject(object.openUriAction); + } + return message; + }; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button} message Button + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Button.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.title = ""; + object.openUriAction = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.openUriAction != null && message.hasOwnProperty("openUriAction")) + object.openUriAction = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.toObject(message.openUriAction, options); + return object; + }; + + /** + * Converts this Button to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @instance + * @returns {Object.} JSON object + */ + Button.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Button + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Button.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button"; + }; + + Button.OpenUriAction = (function() { + + /** + * Properties of an OpenUriAction. + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @interface IOpenUriAction + * @property {string|null} [uri] OpenUriAction uri + */ + + /** + * Constructs a new OpenUriAction. + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button + * @classdesc Represents an OpenUriAction. + * @implements IOpenUriAction + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction=} [properties] Properties to set + */ + function OpenUriAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OpenUriAction uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @instance + */ + OpenUriAction.prototype.uri = ""; + + /** + * Creates a new OpenUriAction instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction} OpenUriAction instance + */ + OpenUriAction.create = function create(properties) { + return new OpenUriAction(properties); + }; + + /** + * Encodes the specified OpenUriAction message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction} message OpenUriAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OpenUriAction.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 OpenUriAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.IOpenUriAction} message OpenUriAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OpenUriAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OpenUriAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction} OpenUriAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OpenUriAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction(); + 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 an OpenUriAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction} OpenUriAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OpenUriAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OpenUriAction message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OpenUriAction.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 an OpenUriAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction} OpenUriAction + */ + OpenUriAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from an OpenUriAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction} message OpenUriAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OpenUriAction.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 OpenUriAction to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @instance + * @returns {Object.} JSON object + */ + OpenUriAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OpenUriAction + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OpenUriAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.OpenUriAction"; + }; + + return OpenUriAction; + })(); + + return Button; + })(); + + return BasicCard; + })(); + + Message.Suggestion = (function() { + + /** + * Properties of a Suggestion. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ISuggestion + * @property {string|null} [title] Suggestion title + */ + + /** + * Constructs a new Suggestion. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a Suggestion. + * @implements ISuggestion + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ISuggestion=} [properties] Properties to set + */ + function Suggestion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Suggestion title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @instance + */ + Suggestion.prototype.title = ""; + + /** + * Creates a new Suggestion instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISuggestion=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.Suggestion} Suggestion instance + */ + Suggestion.create = function create(properties) { + return new Suggestion(properties); + }; + + /** + * Encodes the specified Suggestion message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Suggestion.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISuggestion} message Suggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + return writer; + }; + + /** + * Encodes the specified Suggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Suggestion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISuggestion} message Suggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Suggestion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.Suggestion} Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.Suggestion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Suggestion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.Suggestion} Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Suggestion message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Suggestion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + return null; + }; + + /** + * Creates a Suggestion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.Suggestion} Suggestion + */ + Suggestion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.Suggestion) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.Suggestion(); + if (object.title != null) + message.title = String(object.title); + return message; + }; + + /** + * Creates a plain object from a Suggestion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.Suggestion} message Suggestion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Suggestion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.title = ""; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + return object; + }; + + /** + * Converts this Suggestion to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @instance + * @returns {Object.} JSON object + */ + Suggestion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Suggestion + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Suggestion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.Suggestion"; + }; + + return Suggestion; + })(); + + Message.Suggestions = (function() { + + /** + * Properties of a Suggestions. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ISuggestions + * @property {Array.|null} [suggestions] Suggestions suggestions + */ + + /** + * Constructs a new Suggestions. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a Suggestions. + * @implements ISuggestions + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ISuggestions=} [properties] Properties to set + */ + function Suggestions(properties) { + this.suggestions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Suggestions suggestions. + * @member {Array.} suggestions + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @instance + */ + Suggestions.prototype.suggestions = $util.emptyArray; + + /** + * Creates a new Suggestions instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISuggestions=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.Suggestions} Suggestions instance + */ + Suggestions.create = function create(properties) { + return new Suggestions(properties); + }; + + /** + * Encodes the specified Suggestions message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Suggestions.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISuggestions} message Suggestions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestions != null && message.suggestions.length) + for (var i = 0; i < message.suggestions.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.Suggestion.encode(message.suggestions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Suggestions message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.Suggestions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISuggestions} message Suggestions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Suggestions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.Suggestions} Suggestions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.Suggestions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.suggestions && message.suggestions.length)) + message.suggestions = []; + message.suggestions.push($root.google.cloud.dialogflow.v2.Intent.Message.Suggestion.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Suggestions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.Suggestions} Suggestions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Suggestions message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Suggestions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestions != null && message.hasOwnProperty("suggestions")) { + if (!Array.isArray(message.suggestions)) + return "suggestions: array expected"; + for (var i = 0; i < message.suggestions.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Suggestion.verify(message.suggestions[i]); + if (error) + return "suggestions." + error; + } + } + return null; + }; + + /** + * Creates a Suggestions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.Suggestions} Suggestions + */ + Suggestions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.Suggestions) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.Suggestions(); + if (object.suggestions) { + if (!Array.isArray(object.suggestions)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.Suggestions.suggestions: array expected"); + message.suggestions = []; + for (var i = 0; i < object.suggestions.length; ++i) { + if (typeof object.suggestions[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.Suggestions.suggestions: object expected"); + message.suggestions[i] = $root.google.cloud.dialogflow.v2.Intent.Message.Suggestion.fromObject(object.suggestions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Suggestions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.Suggestions} message Suggestions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Suggestions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.suggestions = []; + if (message.suggestions && message.suggestions.length) { + object.suggestions = []; + for (var j = 0; j < message.suggestions.length; ++j) + object.suggestions[j] = $root.google.cloud.dialogflow.v2.Intent.Message.Suggestion.toObject(message.suggestions[j], options); + } + return object; + }; + + /** + * Converts this Suggestions to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @instance + * @returns {Object.} JSON object + */ + Suggestions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Suggestions + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.Suggestions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Suggestions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.Suggestions"; + }; + + return Suggestions; + })(); + + Message.LinkOutSuggestion = (function() { + + /** + * Properties of a LinkOutSuggestion. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ILinkOutSuggestion + * @property {string|null} [destinationName] LinkOutSuggestion destinationName + * @property {string|null} [uri] LinkOutSuggestion uri + */ + + /** + * Constructs a new LinkOutSuggestion. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a LinkOutSuggestion. + * @implements ILinkOutSuggestion + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion=} [properties] Properties to set + */ + function LinkOutSuggestion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LinkOutSuggestion destinationName. + * @member {string} destinationName + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @instance + */ + LinkOutSuggestion.prototype.destinationName = ""; + + /** + * LinkOutSuggestion uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @instance + */ + LinkOutSuggestion.prototype.uri = ""; + + /** + * Creates a new LinkOutSuggestion instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion} LinkOutSuggestion instance + */ + LinkOutSuggestion.create = function create(properties) { + return new LinkOutSuggestion(properties); + }; + + /** + * Encodes the specified LinkOutSuggestion message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion} message LinkOutSuggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkOutSuggestion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.destinationName != null && Object.hasOwnProperty.call(message, "destinationName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.destinationName); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); + return writer; + }; + + /** + * Encodes the specified LinkOutSuggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ILinkOutSuggestion} message LinkOutSuggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkOutSuggestion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LinkOutSuggestion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion} LinkOutSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkOutSuggestion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.destinationName = reader.string(); + break; + } + case 2: { + message.uri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LinkOutSuggestion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion} LinkOutSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkOutSuggestion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LinkOutSuggestion message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LinkOutSuggestion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.destinationName != null && message.hasOwnProperty("destinationName")) + if (!$util.isString(message.destinationName)) + return "destinationName: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + return null; + }; + + /** + * Creates a LinkOutSuggestion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion} LinkOutSuggestion + */ + LinkOutSuggestion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion(); + if (object.destinationName != null) + message.destinationName = String(object.destinationName); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from a LinkOutSuggestion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion} message LinkOutSuggestion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LinkOutSuggestion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.destinationName = ""; + object.uri = ""; + } + if (message.destinationName != null && message.hasOwnProperty("destinationName")) + object.destinationName = message.destinationName; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; + + /** + * Converts this LinkOutSuggestion to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @instance + * @returns {Object.} JSON object + */ + LinkOutSuggestion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LinkOutSuggestion + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LinkOutSuggestion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.LinkOutSuggestion"; + }; + + return LinkOutSuggestion; + })(); + + Message.ListSelect = (function() { + + /** + * Properties of a ListSelect. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface IListSelect + * @property {string|null} [title] ListSelect title + * @property {Array.|null} [items] ListSelect items + * @property {string|null} [subtitle] ListSelect subtitle + */ + + /** + * Constructs a new ListSelect. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a ListSelect. + * @implements IListSelect + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.IListSelect=} [properties] Properties to set + */ + function ListSelect(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSelect title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @instance + */ + ListSelect.prototype.title = ""; + + /** + * ListSelect items. + * @member {Array.} items + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @instance + */ + ListSelect.prototype.items = $util.emptyArray; + + /** + * ListSelect subtitle. + * @member {string} subtitle + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @instance + */ + ListSelect.prototype.subtitle = ""; + + /** + * Creates a new ListSelect instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IListSelect=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.ListSelect} ListSelect instance + */ + ListSelect.create = function create(properties) { + return new ListSelect(properties); + }; + + /** + * Encodes the specified ListSelect message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ListSelect.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IListSelect} message ListSelect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSelect.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.subtitle != null && Object.hasOwnProperty.call(message, "subtitle")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.subtitle); + return writer; + }; + + /** + * Encodes the specified ListSelect message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ListSelect.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IListSelect} message ListSelect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSelect.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSelect message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.ListSelect} ListSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSelect.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.decode(reader, reader.uint32())); + break; + } + case 3: { + message.subtitle = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSelect message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.ListSelect} ListSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSelect.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSelect message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSelect.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + if (!$util.isString(message.subtitle)) + return "subtitle: string expected"; + return null; + }; + + /** + * Creates a ListSelect message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.ListSelect} ListSelect + */ + ListSelect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect(); + if (object.title != null) + message.title = String(object.title); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.ListSelect.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.ListSelect.items: object expected"); + message.items[i] = $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.fromObject(object.items[i]); + } + } + if (object.subtitle != null) + message.subtitle = String(object.subtitle); + return message; + }; + + /** + * Creates a plain object from a ListSelect message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ListSelect} message ListSelect + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSelect.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) { + object.title = ""; + object.subtitle = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.toObject(message.items[j], options); + } + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + object.subtitle = message.subtitle; + return object; + }; + + /** + * Converts this ListSelect to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @instance + * @returns {Object.} JSON object + */ + ListSelect.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSelect + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSelect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.ListSelect"; + }; + + ListSelect.Item = (function() { + + /** + * Properties of an Item. + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @interface IItem + * @property {google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo|null} [info] Item info + * @property {string|null} [title] Item title + * @property {string|null} [description] Item description + * @property {google.cloud.dialogflow.v2.Intent.Message.IImage|null} [image] Item image + */ + + /** + * Constructs a new Item. + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect + * @classdesc Represents an Item. + * @implements IItem + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem=} [properties] Properties to set + */ + function Item(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Item info. + * @member {google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo|null|undefined} info + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @instance + */ + Item.prototype.info = null; + + /** + * Item title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @instance + */ + Item.prototype.title = ""; + + /** + * Item description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @instance + */ + Item.prototype.description = ""; + + /** + * Item image. + * @member {google.cloud.dialogflow.v2.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @instance + */ + Item.prototype.image = null; + + /** + * Creates a new Item instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item} Item instance + */ + Item.create = function create(properties) { + return new Item(properties); + }; + + /** + * Encodes the specified Item message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem} message Item message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Item.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.encode(message.info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2.Intent.Message.Image.encode(message.image, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Item message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ListSelect.IItem} message Item message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Item.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Item message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item} Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Item.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.info = $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.decode(reader, reader.uint32()); + break; + } + case 2: { + message.title = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Item message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item} Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Item.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Item message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Item.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.info != null && message.hasOwnProperty("info")) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.verify(message.info); + if (error) + return "info." + error; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + return null; + }; + + /** + * Creates an Item message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item} Item + */ + Item.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item(); + if (object.info != null) { + if (typeof object.info !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.info: object expected"); + message.info = $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.fromObject(object.info); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.fromObject(object.image); + } + return message; + }; + + /** + * Creates a plain object from an Item message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item} message Item + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Item.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.info = null; + object.title = ""; + object.description = ""; + object.image = null; + } + if (message.info != null && message.hasOwnProperty("info")) + object.info = $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.toObject(message.info, options); + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.toObject(message.image, options); + return object; + }; + + /** + * Converts this Item to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @instance + * @returns {Object.} JSON object + */ + Item.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Item + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Item.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.ListSelect.Item"; + }; + + return Item; + })(); + + return ListSelect; + })(); + + Message.CarouselSelect = (function() { + + /** + * Properties of a CarouselSelect. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ICarouselSelect + * @property {Array.|null} [items] CarouselSelect items + */ + + /** + * Constructs a new CarouselSelect. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a CarouselSelect. + * @implements ICarouselSelect + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect=} [properties] Properties to set + */ + function CarouselSelect(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CarouselSelect items. + * @member {Array.} items + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @instance + */ + CarouselSelect.prototype.items = $util.emptyArray; + + /** + * Creates a new CarouselSelect instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect} CarouselSelect instance + */ + CarouselSelect.create = function create(properties) { + return new CarouselSelect(properties); + }; + + /** + * Encodes the specified CarouselSelect message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect} message CarouselSelect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CarouselSelect.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CarouselSelect message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ICarouselSelect} message CarouselSelect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CarouselSelect.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CarouselSelect message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect} CarouselSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CarouselSelect.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CarouselSelect message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect} CarouselSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CarouselSelect.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CarouselSelect message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CarouselSelect.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a CarouselSelect message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect} CarouselSelect + */ + CarouselSelect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect(); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.items: object expected"); + message.items[i] = $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CarouselSelect message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect} message CarouselSelect + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CarouselSelect.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this CarouselSelect to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @instance + * @returns {Object.} JSON object + */ + CarouselSelect.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CarouselSelect + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CarouselSelect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.CarouselSelect"; + }; + + CarouselSelect.Item = (function() { + + /** + * Properties of an Item. + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @interface IItem + * @property {google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo|null} [info] Item info + * @property {string|null} [title] Item title + * @property {string|null} [description] Item description + * @property {google.cloud.dialogflow.v2.Intent.Message.IImage|null} [image] Item image + */ + + /** + * Constructs a new Item. + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect + * @classdesc Represents an Item. + * @implements IItem + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem=} [properties] Properties to set + */ + function Item(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Item info. + * @member {google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo|null|undefined} info + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @instance + */ + Item.prototype.info = null; + + /** + * Item title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @instance + */ + Item.prototype.title = ""; + + /** + * Item description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @instance + */ + Item.prototype.description = ""; + + /** + * Item image. + * @member {google.cloud.dialogflow.v2.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @instance + */ + Item.prototype.image = null; + + /** + * Creates a new Item instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item} Item instance + */ + Item.create = function create(properties) { + return new Item(properties); + }; + + /** + * Encodes the specified Item message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem} message Item message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Item.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.encode(message.info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2.Intent.Message.Image.encode(message.image, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Item message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.IItem} message Item message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Item.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Item message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item} Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Item.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.info = $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.decode(reader, reader.uint32()); + break; + } + case 2: { + message.title = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Item message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item} Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Item.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Item message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Item.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.info != null && message.hasOwnProperty("info")) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.verify(message.info); + if (error) + return "info." + error; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + return null; + }; + + /** + * Creates an Item message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item} Item + */ + Item.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item(); + if (object.info != null) { + if (typeof object.info !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.info: object expected"); + message.info = $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.fromObject(object.info); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.fromObject(object.image); + } + return message; + }; + + /** + * Creates a plain object from an Item message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item} message Item + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Item.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.info = null; + object.title = ""; + object.description = ""; + object.image = null; + } + if (message.info != null && message.hasOwnProperty("info")) + object.info = $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.toObject(message.info, options); + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.toObject(message.image, options); + return object; + }; + + /** + * Converts this Item to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @instance + * @returns {Object.} JSON object + */ + Item.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Item + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Item.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.CarouselSelect.Item"; + }; + + return Item; + })(); + + return CarouselSelect; + })(); + + Message.SelectItemInfo = (function() { + + /** + * Properties of a SelectItemInfo. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ISelectItemInfo + * @property {string|null} [key] SelectItemInfo key + * @property {Array.|null} [synonyms] SelectItemInfo synonyms + */ + + /** + * Constructs a new SelectItemInfo. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a SelectItemInfo. + * @implements ISelectItemInfo + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo=} [properties] Properties to set + */ + function SelectItemInfo(properties) { + this.synonyms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SelectItemInfo key. + * @member {string} key + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @instance + */ + SelectItemInfo.prototype.key = ""; + + /** + * SelectItemInfo synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @instance + */ + SelectItemInfo.prototype.synonyms = $util.emptyArray; + + /** + * Creates a new SelectItemInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo} SelectItemInfo instance + */ + SelectItemInfo.create = function create(properties) { + return new SelectItemInfo(properties); + }; + + /** + * Encodes the specified SelectItemInfo message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo} message SelectItemInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectItemInfo.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.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.synonyms[i]); + return writer; + }; + + /** + * Encodes the specified SelectItemInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ISelectItemInfo} message SelectItemInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectItemInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectItemInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo} SelectItemInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectItemInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectItemInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo} SelectItemInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectItemInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectItemInfo message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectItemInfo.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.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + return null; + }; + + /** + * Creates a SelectItemInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo} SelectItemInfo + */ + SelectItemInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo(); + if (object.key != null) + message.key = String(object.key); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + return message; + }; + + /** + * Creates a plain object from a SelectItemInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo} message SelectItemInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectItemInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (options.defaults) + object.key = ""; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this SelectItemInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @instance + * @returns {Object.} JSON object + */ + SelectItemInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectItemInfo + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectItemInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.SelectItemInfo"; + }; + + return SelectItemInfo; + })(); + + Message.MediaContent = (function() { + + /** + * Properties of a MediaContent. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface IMediaContent + * @property {google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType|null} [mediaType] MediaContent mediaType + * @property {Array.|null} [mediaObjects] MediaContent mediaObjects + */ + + /** + * Constructs a new MediaContent. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a MediaContent. + * @implements IMediaContent + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.IMediaContent=} [properties] Properties to set + */ + function MediaContent(properties) { + this.mediaObjects = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MediaContent mediaType. + * @member {google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType} mediaType + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @instance + */ + MediaContent.prototype.mediaType = 0; + + /** + * MediaContent mediaObjects. + * @member {Array.} mediaObjects + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @instance + */ + MediaContent.prototype.mediaObjects = $util.emptyArray; + + /** + * Creates a new MediaContent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IMediaContent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.MediaContent} MediaContent instance + */ + MediaContent.create = function create(properties) { + return new MediaContent(properties); + }; + + /** + * Encodes the specified MediaContent message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.MediaContent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IMediaContent} message MediaContent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaContent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mediaType != null && Object.hasOwnProperty.call(message, "mediaType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mediaType); + if (message.mediaObjects != null && message.mediaObjects.length) + for (var i = 0; i < message.mediaObjects.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.encode(message.mediaObjects[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MediaContent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.MediaContent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IMediaContent} message MediaContent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaContent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MediaContent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.MediaContent} MediaContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaContent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mediaType = reader.int32(); + break; + } + case 2: { + if (!(message.mediaObjects && message.mediaObjects.length)) + message.mediaObjects = []; + message.mediaObjects.push($root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MediaContent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.MediaContent} MediaContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaContent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MediaContent message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MediaContent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mediaType != null && message.hasOwnProperty("mediaType")) + switch (message.mediaType) { + default: + return "mediaType: enum value expected"; + case 0: + case 1: + break; + } + if (message.mediaObjects != null && message.hasOwnProperty("mediaObjects")) { + if (!Array.isArray(message.mediaObjects)) + return "mediaObjects: array expected"; + for (var i = 0; i < message.mediaObjects.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.verify(message.mediaObjects[i]); + if (error) + return "mediaObjects." + error; + } + } + return null; + }; + + /** + * Creates a MediaContent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.MediaContent} MediaContent + */ + MediaContent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent(); + switch (object.mediaType) { + default: + if (typeof object.mediaType === "number") { + message.mediaType = object.mediaType; + break; + } + break; + case "RESPONSE_MEDIA_TYPE_UNSPECIFIED": + case 0: + message.mediaType = 0; + break; + case "AUDIO": + case 1: + message.mediaType = 1; + break; + } + if (object.mediaObjects) { + if (!Array.isArray(object.mediaObjects)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.MediaContent.mediaObjects: array expected"); + message.mediaObjects = []; + for (var i = 0; i < object.mediaObjects.length; ++i) { + if (typeof object.mediaObjects[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.MediaContent.mediaObjects: object expected"); + message.mediaObjects[i] = $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.fromObject(object.mediaObjects[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MediaContent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.MediaContent} message MediaContent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MediaContent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.mediaObjects = []; + if (options.defaults) + object.mediaType = options.enums === String ? "RESPONSE_MEDIA_TYPE_UNSPECIFIED" : 0; + if (message.mediaType != null && message.hasOwnProperty("mediaType")) + object.mediaType = options.enums === String ? $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType[message.mediaType] === undefined ? message.mediaType : $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType[message.mediaType] : message.mediaType; + if (message.mediaObjects && message.mediaObjects.length) { + object.mediaObjects = []; + for (var j = 0; j < message.mediaObjects.length; ++j) + object.mediaObjects[j] = $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.toObject(message.mediaObjects[j], options); + } + return object; + }; + + /** + * Converts this MediaContent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @instance + * @returns {Object.} JSON object + */ + MediaContent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MediaContent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MediaContent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.MediaContent"; + }; + + /** + * ResponseMediaType enum. + * @name google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaType + * @enum {number} + * @property {number} RESPONSE_MEDIA_TYPE_UNSPECIFIED=0 RESPONSE_MEDIA_TYPE_UNSPECIFIED value + * @property {number} AUDIO=1 AUDIO value + */ + MediaContent.ResponseMediaType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESPONSE_MEDIA_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUDIO"] = 1; + return values; + })(); + + MediaContent.ResponseMediaObject = (function() { + + /** + * Properties of a ResponseMediaObject. + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @interface IResponseMediaObject + * @property {string|null} [name] ResponseMediaObject name + * @property {string|null} [description] ResponseMediaObject description + * @property {google.cloud.dialogflow.v2.Intent.Message.IImage|null} [largeImage] ResponseMediaObject largeImage + * @property {google.cloud.dialogflow.v2.Intent.Message.IImage|null} [icon] ResponseMediaObject icon + * @property {string|null} [contentUrl] ResponseMediaObject contentUrl + */ + + /** + * Constructs a new ResponseMediaObject. + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent + * @classdesc Represents a ResponseMediaObject. + * @implements IResponseMediaObject + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject=} [properties] Properties to set + */ + function ResponseMediaObject(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseMediaObject name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.name = ""; + + /** + * ResponseMediaObject description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.description = ""; + + /** + * ResponseMediaObject largeImage. + * @member {google.cloud.dialogflow.v2.Intent.Message.IImage|null|undefined} largeImage + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.largeImage = null; + + /** + * ResponseMediaObject icon. + * @member {google.cloud.dialogflow.v2.Intent.Message.IImage|null|undefined} icon + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.icon = null; + + /** + * ResponseMediaObject contentUrl. + * @member {string} contentUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.contentUrl = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ResponseMediaObject image. + * @member {"largeImage"|"icon"|undefined} image + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + Object.defineProperty(ResponseMediaObject.prototype, "image", { + get: $util.oneOfGetter($oneOfFields = ["largeImage", "icon"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ResponseMediaObject instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject} ResponseMediaObject instance + */ + ResponseMediaObject.create = function create(properties) { + return new ResponseMediaObject(properties); + }; + + /** + * Encodes the specified ResponseMediaObject message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject} message ResponseMediaObject message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseMediaObject.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.largeImage != null && Object.hasOwnProperty.call(message, "largeImage")) + $root.google.cloud.dialogflow.v2.Intent.Message.Image.encode(message.largeImage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.icon != null && Object.hasOwnProperty.call(message, "icon")) + $root.google.cloud.dialogflow.v2.Intent.Message.Image.encode(message.icon, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.contentUrl != null && Object.hasOwnProperty.call(message, "contentUrl")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.contentUrl); + return writer; + }; + + /** + * Encodes the specified ResponseMediaObject message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.MediaContent.IResponseMediaObject} message ResponseMediaObject message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseMediaObject.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseMediaObject message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject} ResponseMediaObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseMediaObject.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.largeImage = $root.google.cloud.dialogflow.v2.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 4: { + message.icon = $root.google.cloud.dialogflow.v2.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 5: { + message.contentUrl = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseMediaObject message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject} ResponseMediaObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseMediaObject.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseMediaObject message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseMediaObject.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.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.largeImage != null && message.hasOwnProperty("largeImage")) { + properties.image = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Image.verify(message.largeImage); + if (error) + return "largeImage." + error; + } + } + if (message.icon != null && message.hasOwnProperty("icon")) { + if (properties.image === 1) + return "image: multiple values"; + properties.image = 1; + { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Image.verify(message.icon); + if (error) + return "icon." + error; + } + } + if (message.contentUrl != null && message.hasOwnProperty("contentUrl")) + if (!$util.isString(message.contentUrl)) + return "contentUrl: string expected"; + return null; + }; + + /** + * Creates a ResponseMediaObject message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject} ResponseMediaObject + */ + ResponseMediaObject.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.largeImage != null) { + if (typeof object.largeImage !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.largeImage: object expected"); + message.largeImage = $root.google.cloud.dialogflow.v2.Intent.Message.Image.fromObject(object.largeImage); + } + if (object.icon != null) { + if (typeof object.icon !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject.icon: object expected"); + message.icon = $root.google.cloud.dialogflow.v2.Intent.Message.Image.fromObject(object.icon); + } + if (object.contentUrl != null) + message.contentUrl = String(object.contentUrl); + return message; + }; + + /** + * Creates a plain object from a ResponseMediaObject message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject} message ResponseMediaObject + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseMediaObject.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.contentUrl = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.largeImage != null && message.hasOwnProperty("largeImage")) { + object.largeImage = $root.google.cloud.dialogflow.v2.Intent.Message.Image.toObject(message.largeImage, options); + if (options.oneofs) + object.image = "largeImage"; + } + if (message.icon != null && message.hasOwnProperty("icon")) { + object.icon = $root.google.cloud.dialogflow.v2.Intent.Message.Image.toObject(message.icon, options); + if (options.oneofs) + object.image = "icon"; + } + if (message.contentUrl != null && message.hasOwnProperty("contentUrl")) + object.contentUrl = message.contentUrl; + return object; + }; + + /** + * Converts this ResponseMediaObject to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @instance + * @returns {Object.} JSON object + */ + ResponseMediaObject.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResponseMediaObject + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResponseMediaObject.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.MediaContent.ResponseMediaObject"; + }; + + return ResponseMediaObject; + })(); + + return MediaContent; + })(); + + Message.BrowseCarouselCard = (function() { + + /** + * Properties of a BrowseCarouselCard. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface IBrowseCarouselCard + * @property {Array.|null} [items] BrowseCarouselCard items + * @property {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions|null} [imageDisplayOptions] BrowseCarouselCard imageDisplayOptions + */ + + /** + * Constructs a new BrowseCarouselCard. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a BrowseCarouselCard. + * @implements IBrowseCarouselCard + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard=} [properties] Properties to set + */ + function BrowseCarouselCard(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BrowseCarouselCard items. + * @member {Array.} items + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @instance + */ + BrowseCarouselCard.prototype.items = $util.emptyArray; + + /** + * BrowseCarouselCard imageDisplayOptions. + * @member {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions} imageDisplayOptions + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @instance + */ + BrowseCarouselCard.prototype.imageDisplayOptions = 0; + + /** + * Creates a new BrowseCarouselCard instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard} BrowseCarouselCard instance + */ + BrowseCarouselCard.create = function create(properties) { + return new BrowseCarouselCard(properties); + }; + + /** + * Encodes the specified BrowseCarouselCard message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard} message BrowseCarouselCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BrowseCarouselCard.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.imageDisplayOptions != null && Object.hasOwnProperty.call(message, "imageDisplayOptions")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.imageDisplayOptions); + return writer; + }; + + /** + * Encodes the specified BrowseCarouselCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IBrowseCarouselCard} message BrowseCarouselCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BrowseCarouselCard.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BrowseCarouselCard message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard} BrowseCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BrowseCarouselCard.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.decode(reader, reader.uint32())); + break; + } + case 2: { + message.imageDisplayOptions = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BrowseCarouselCard message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard} BrowseCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BrowseCarouselCard.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BrowseCarouselCard message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BrowseCarouselCard.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.imageDisplayOptions != null && message.hasOwnProperty("imageDisplayOptions")) + switch (message.imageDisplayOptions) { + default: + return "imageDisplayOptions: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a BrowseCarouselCard message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard} BrowseCarouselCard + */ + BrowseCarouselCard.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard(); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.items: object expected"); + message.items[i] = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.fromObject(object.items[i]); + } + } + switch (object.imageDisplayOptions) { + default: + if (typeof object.imageDisplayOptions === "number") { + message.imageDisplayOptions = object.imageDisplayOptions; + break; + } + break; + case "IMAGE_DISPLAY_OPTIONS_UNSPECIFIED": + case 0: + message.imageDisplayOptions = 0; + break; + case "GRAY": + case 1: + message.imageDisplayOptions = 1; + break; + case "WHITE": + case 2: + message.imageDisplayOptions = 2; + break; + case "CROPPED": + case 3: + message.imageDisplayOptions = 3; + break; + case "BLURRED_BACKGROUND": + case 4: + message.imageDisplayOptions = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a BrowseCarouselCard message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard} message BrowseCarouselCard + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BrowseCarouselCard.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.imageDisplayOptions = options.enums === String ? "IMAGE_DISPLAY_OPTIONS_UNSPECIFIED" : 0; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.toObject(message.items[j], options); + } + if (message.imageDisplayOptions != null && message.hasOwnProperty("imageDisplayOptions")) + object.imageDisplayOptions = options.enums === String ? $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions[message.imageDisplayOptions] === undefined ? message.imageDisplayOptions : $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions[message.imageDisplayOptions] : message.imageDisplayOptions; + return object; + }; + + /** + * Converts this BrowseCarouselCard to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @instance + * @returns {Object.} JSON object + */ + BrowseCarouselCard.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BrowseCarouselCard + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BrowseCarouselCard.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard"; + }; + + BrowseCarouselCard.BrowseCarouselCardItem = (function() { + + /** + * Properties of a BrowseCarouselCardItem. + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @interface IBrowseCarouselCardItem + * @property {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction|null} [openUriAction] BrowseCarouselCardItem openUriAction + * @property {string|null} [title] BrowseCarouselCardItem title + * @property {string|null} [description] BrowseCarouselCardItem description + * @property {google.cloud.dialogflow.v2.Intent.Message.IImage|null} [image] BrowseCarouselCardItem image + * @property {string|null} [footer] BrowseCarouselCardItem footer + */ + + /** + * Constructs a new BrowseCarouselCardItem. + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard + * @classdesc Represents a BrowseCarouselCardItem. + * @implements IBrowseCarouselCardItem + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem=} [properties] Properties to set + */ + function BrowseCarouselCardItem(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BrowseCarouselCardItem openUriAction. + * @member {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction|null|undefined} openUriAction + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.openUriAction = null; + + /** + * BrowseCarouselCardItem title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.title = ""; + + /** + * BrowseCarouselCardItem description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.description = ""; + + /** + * BrowseCarouselCardItem image. + * @member {google.cloud.dialogflow.v2.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.image = null; + + /** + * BrowseCarouselCardItem footer. + * @member {string} footer + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.footer = ""; + + /** + * Creates a new BrowseCarouselCardItem instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} BrowseCarouselCardItem instance + */ + BrowseCarouselCardItem.create = function create(properties) { + return new BrowseCarouselCardItem(properties); + }; + + /** + * Encodes the specified BrowseCarouselCardItem message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem} message BrowseCarouselCardItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BrowseCarouselCardItem.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.openUriAction != null && Object.hasOwnProperty.call(message, "openUriAction")) + $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.encode(message.openUriAction, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2.Intent.Message.Image.encode(message.image, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.footer != null && Object.hasOwnProperty.call(message, "footer")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.footer); + return writer; + }; + + /** + * Encodes the specified BrowseCarouselCardItem message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem} message BrowseCarouselCardItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BrowseCarouselCardItem.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BrowseCarouselCardItem message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} BrowseCarouselCardItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BrowseCarouselCardItem.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.openUriAction = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.decode(reader, reader.uint32()); + break; + } + case 2: { + message.title = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 5: { + message.footer = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BrowseCarouselCardItem message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} BrowseCarouselCardItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BrowseCarouselCardItem.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BrowseCarouselCardItem message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BrowseCarouselCardItem.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.openUriAction != null && message.hasOwnProperty("openUriAction")) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify(message.openUriAction); + if (error) + return "openUriAction." + error; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.footer != null && message.hasOwnProperty("footer")) + if (!$util.isString(message.footer)) + return "footer: string expected"; + return null; + }; + + /** + * Creates a BrowseCarouselCardItem message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} BrowseCarouselCardItem + */ + BrowseCarouselCardItem.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem(); + if (object.openUriAction != null) { + if (typeof object.openUriAction !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.openUriAction: object expected"); + message.openUriAction = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.fromObject(object.openUriAction); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.fromObject(object.image); + } + if (object.footer != null) + message.footer = String(object.footer); + return message; + }; + + /** + * Creates a plain object from a BrowseCarouselCardItem message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} message BrowseCarouselCardItem + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BrowseCarouselCardItem.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.openUriAction = null; + object.title = ""; + object.description = ""; + object.image = null; + object.footer = ""; + } + if (message.openUriAction != null && message.hasOwnProperty("openUriAction")) + object.openUriAction = $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.toObject(message.openUriAction, options); + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.toObject(message.image, options); + if (message.footer != null && message.hasOwnProperty("footer")) + object.footer = message.footer; + return object; + }; + + /** + * Converts this BrowseCarouselCardItem to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + * @returns {Object.} JSON object + */ + BrowseCarouselCardItem.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BrowseCarouselCardItem + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BrowseCarouselCardItem.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem"; + }; + + BrowseCarouselCardItem.OpenUrlAction = (function() { + + /** + * Properties of an OpenUrlAction. + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @interface IOpenUrlAction + * @property {string|null} [url] OpenUrlAction url + * @property {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint|null} [urlTypeHint] OpenUrlAction urlTypeHint + */ + + /** + * Constructs a new OpenUrlAction. + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @classdesc Represents an OpenUrlAction. + * @implements IOpenUrlAction + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction=} [properties] Properties to set + */ + function OpenUrlAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OpenUrlAction url. + * @member {string} url + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @instance + */ + OpenUrlAction.prototype.url = ""; + + /** + * OpenUrlAction urlTypeHint. + * @member {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint} urlTypeHint + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @instance + */ + OpenUrlAction.prototype.urlTypeHint = 0; + + /** + * Creates a new OpenUrlAction instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} OpenUrlAction instance + */ + OpenUrlAction.create = function create(properties) { + return new OpenUrlAction(properties); + }; + + /** + * Encodes the specified OpenUrlAction message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction} message OpenUrlAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OpenUrlAction.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.urlTypeHint != null && Object.hasOwnProperty.call(message, "urlTypeHint")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.urlTypeHint); + return writer; + }; + + /** + * Encodes the specified OpenUrlAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction} message OpenUrlAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OpenUrlAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OpenUrlAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} OpenUrlAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OpenUrlAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.url = reader.string(); + break; + } + case 3: { + message.urlTypeHint = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OpenUrlAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} OpenUrlAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OpenUrlAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OpenUrlAction message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OpenUrlAction.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.urlTypeHint != null && message.hasOwnProperty("urlTypeHint")) + switch (message.urlTypeHint) { + default: + return "urlTypeHint: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an OpenUrlAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} OpenUrlAction + */ + OpenUrlAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction(); + if (object.url != null) + message.url = String(object.url); + switch (object.urlTypeHint) { + default: + if (typeof object.urlTypeHint === "number") { + message.urlTypeHint = object.urlTypeHint; + break; + } + break; + case "URL_TYPE_HINT_UNSPECIFIED": + case 0: + message.urlTypeHint = 0; + break; + case "AMP_ACTION": + case 1: + message.urlTypeHint = 1; + break; + case "AMP_CONTENT": + case 2: + message.urlTypeHint = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an OpenUrlAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} message OpenUrlAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OpenUrlAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + object.urlTypeHint = options.enums === String ? "URL_TYPE_HINT_UNSPECIFIED" : 0; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.urlTypeHint != null && message.hasOwnProperty("urlTypeHint")) + object.urlTypeHint = options.enums === String ? $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint[message.urlTypeHint] === undefined ? message.urlTypeHint : $root.google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint[message.urlTypeHint] : message.urlTypeHint; + return object; + }; + + /** + * Converts this OpenUrlAction to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @instance + * @returns {Object.} JSON object + */ + OpenUrlAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OpenUrlAction + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OpenUrlAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction"; + }; + + /** + * UrlTypeHint enum. + * @name google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint + * @enum {number} + * @property {number} URL_TYPE_HINT_UNSPECIFIED=0 URL_TYPE_HINT_UNSPECIFIED value + * @property {number} AMP_ACTION=1 AMP_ACTION value + * @property {number} AMP_CONTENT=2 AMP_CONTENT value + */ + OpenUrlAction.UrlTypeHint = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "URL_TYPE_HINT_UNSPECIFIED"] = 0; + values[valuesById[1] = "AMP_ACTION"] = 1; + values[valuesById[2] = "AMP_CONTENT"] = 2; + return values; + })(); + + return OpenUrlAction; + })(); + + return BrowseCarouselCardItem; + })(); + + /** + * ImageDisplayOptions enum. + * @name google.cloud.dialogflow.v2.Intent.Message.BrowseCarouselCard.ImageDisplayOptions + * @enum {number} + * @property {number} IMAGE_DISPLAY_OPTIONS_UNSPECIFIED=0 IMAGE_DISPLAY_OPTIONS_UNSPECIFIED value + * @property {number} GRAY=1 GRAY value + * @property {number} WHITE=2 WHITE value + * @property {number} CROPPED=3 CROPPED value + * @property {number} BLURRED_BACKGROUND=4 BLURRED_BACKGROUND value + */ + BrowseCarouselCard.ImageDisplayOptions = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IMAGE_DISPLAY_OPTIONS_UNSPECIFIED"] = 0; + values[valuesById[1] = "GRAY"] = 1; + values[valuesById[2] = "WHITE"] = 2; + values[valuesById[3] = "CROPPED"] = 3; + values[valuesById[4] = "BLURRED_BACKGROUND"] = 4; + return values; + })(); + + return BrowseCarouselCard; + })(); + + Message.TableCard = (function() { + + /** + * Properties of a TableCard. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ITableCard + * @property {string|null} [title] TableCard title + * @property {string|null} [subtitle] TableCard subtitle + * @property {google.cloud.dialogflow.v2.Intent.Message.IImage|null} [image] TableCard image + * @property {Array.|null} [columnProperties] TableCard columnProperties + * @property {Array.|null} [rows] TableCard rows + * @property {Array.|null} [buttons] TableCard buttons + */ + + /** + * Constructs a new TableCard. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a TableCard. + * @implements ITableCard + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCard=} [properties] Properties to set + */ + function TableCard(properties) { + this.columnProperties = []; + this.rows = []; + this.buttons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCard title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.title = ""; + + /** + * TableCard subtitle. + * @member {string} subtitle + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.subtitle = ""; + + /** + * TableCard image. + * @member {google.cloud.dialogflow.v2.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.image = null; + + /** + * TableCard columnProperties. + * @member {Array.} columnProperties + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.columnProperties = $util.emptyArray; + + /** + * TableCard rows. + * @member {Array.} rows + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.rows = $util.emptyArray; + + /** + * TableCard buttons. + * @member {Array.} buttons + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.buttons = $util.emptyArray; + + /** + * Creates a new TableCard instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCard} TableCard instance + */ + TableCard.create = function create(properties) { + return new TableCard(properties); + }; + + /** + * Encodes the specified TableCard message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCard.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCard} message TableCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCard.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.subtitle != null && Object.hasOwnProperty.call(message, "subtitle")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subtitle); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2.Intent.Message.Image.encode(message.image, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.columnProperties != null && message.columnProperties.length) + for (var i = 0; i < message.columnProperties.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.encode(message.columnProperties[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.rows != null && message.rows.length) + for (var i = 0; i < message.rows.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.TableCardRow.encode(message.rows[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.buttons != null && message.buttons.length) + for (var i = 0; i < message.buttons.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.encode(message.buttons[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCard.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCard} message TableCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCard.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCard message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCard} TableCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCard.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.TableCard(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.subtitle = reader.string(); + break; + } + case 3: { + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.columnProperties && message.columnProperties.length)) + message.columnProperties = []; + message.columnProperties.push($root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.rows && message.rows.length)) + message.rows = []; + message.rows.push($root.google.cloud.dialogflow.v2.Intent.Message.TableCardRow.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.buttons && message.buttons.length)) + message.buttons = []; + message.buttons.push($root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCard message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCard} TableCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCard.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCard message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCard.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + if (!$util.isString(message.subtitle)) + return "subtitle: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.columnProperties != null && message.hasOwnProperty("columnProperties")) { + if (!Array.isArray(message.columnProperties)) + return "columnProperties: array expected"; + for (var i = 0; i < message.columnProperties.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.verify(message.columnProperties[i]); + if (error) + return "columnProperties." + error; + } + } + if (message.rows != null && message.hasOwnProperty("rows")) { + if (!Array.isArray(message.rows)) + return "rows: array expected"; + for (var i = 0; i < message.rows.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.TableCardRow.verify(message.rows[i]); + if (error) + return "rows." + error; + } + } + if (message.buttons != null && message.hasOwnProperty("buttons")) { + if (!Array.isArray(message.buttons)) + return "buttons: array expected"; + for (var i = 0; i < message.buttons.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.verify(message.buttons[i]); + if (error) + return "buttons." + error; + } + } + return null; + }; + + /** + * Creates a TableCard message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCard} TableCard + */ + TableCard.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.TableCard) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.TableCard(); + if (object.title != null) + message.title = String(object.title); + if (object.subtitle != null) + message.subtitle = String(object.subtitle); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.TableCard.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.fromObject(object.image); + } + if (object.columnProperties) { + if (!Array.isArray(object.columnProperties)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.TableCard.columnProperties: array expected"); + message.columnProperties = []; + for (var i = 0; i < object.columnProperties.length; ++i) { + if (typeof object.columnProperties[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.TableCard.columnProperties: object expected"); + message.columnProperties[i] = $root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.fromObject(object.columnProperties[i]); + } + } + if (object.rows) { + if (!Array.isArray(object.rows)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.TableCard.rows: array expected"); + message.rows = []; + for (var i = 0; i < object.rows.length; ++i) { + if (typeof object.rows[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.TableCard.rows: object expected"); + message.rows[i] = $root.google.cloud.dialogflow.v2.Intent.Message.TableCardRow.fromObject(object.rows[i]); + } + } + if (object.buttons) { + if (!Array.isArray(object.buttons)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.TableCard.buttons: array expected"); + message.buttons = []; + for (var i = 0; i < object.buttons.length; ++i) { + if (typeof object.buttons[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.TableCard.buttons: object expected"); + message.buttons[i] = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.fromObject(object.buttons[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableCard message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.TableCard} message TableCard + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCard.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.columnProperties = []; + object.rows = []; + object.buttons = []; + } + if (options.defaults) { + object.title = ""; + object.subtitle = ""; + object.image = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + object.subtitle = message.subtitle; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2.Intent.Message.Image.toObject(message.image, options); + if (message.columnProperties && message.columnProperties.length) { + object.columnProperties = []; + for (var j = 0; j < message.columnProperties.length; ++j) + object.columnProperties[j] = $root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.toObject(message.columnProperties[j], options); + } + if (message.rows && message.rows.length) { + object.rows = []; + for (var j = 0; j < message.rows.length; ++j) + object.rows[j] = $root.google.cloud.dialogflow.v2.Intent.Message.TableCardRow.toObject(message.rows[j], options); + } + if (message.buttons && message.buttons.length) { + object.buttons = []; + for (var j = 0; j < message.buttons.length; ++j) + object.buttons[j] = $root.google.cloud.dialogflow.v2.Intent.Message.BasicCard.Button.toObject(message.buttons[j], options); + } + return object; + }; + + /** + * Converts this TableCard to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @instance + * @returns {Object.} JSON object + */ + TableCard.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TableCard + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCard + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCard.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.TableCard"; + }; + + return TableCard; + })(); + + Message.ColumnProperties = (function() { + + /** + * Properties of a ColumnProperties. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface IColumnProperties + * @property {string|null} [header] ColumnProperties header + * @property {google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment|null} [horizontalAlignment] ColumnProperties horizontalAlignment + */ + + /** + * Constructs a new ColumnProperties. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a ColumnProperties. + * @implements IColumnProperties + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.IColumnProperties=} [properties] Properties to set + */ + function ColumnProperties(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ColumnProperties header. + * @member {string} header + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @instance + */ + ColumnProperties.prototype.header = ""; + + /** + * ColumnProperties horizontalAlignment. + * @member {google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment} horizontalAlignment + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @instance + */ + ColumnProperties.prototype.horizontalAlignment = 0; + + /** + * Creates a new ColumnProperties instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IColumnProperties=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.ColumnProperties} ColumnProperties instance + */ + ColumnProperties.create = function create(properties) { + return new ColumnProperties(properties); + }; + + /** + * Encodes the specified ColumnProperties message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IColumnProperties} message ColumnProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ColumnProperties.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.header); + if (message.horizontalAlignment != null && Object.hasOwnProperty.call(message, "horizontalAlignment")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.horizontalAlignment); + return writer; + }; + + /** + * Encodes the specified ColumnProperties message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.IColumnProperties} message ColumnProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ColumnProperties.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ColumnProperties message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.ColumnProperties} ColumnProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ColumnProperties.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.header = reader.string(); + break; + } + case 2: { + message.horizontalAlignment = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ColumnProperties message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.ColumnProperties} ColumnProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ColumnProperties.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ColumnProperties message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ColumnProperties.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.header != null && message.hasOwnProperty("header")) + if (!$util.isString(message.header)) + return "header: string expected"; + if (message.horizontalAlignment != null && message.hasOwnProperty("horizontalAlignment")) + switch (message.horizontalAlignment) { + default: + return "horizontalAlignment: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a ColumnProperties message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.ColumnProperties} ColumnProperties + */ + ColumnProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties(); + if (object.header != null) + message.header = String(object.header); + switch (object.horizontalAlignment) { + default: + if (typeof object.horizontalAlignment === "number") { + message.horizontalAlignment = object.horizontalAlignment; + break; + } + break; + case "HORIZONTAL_ALIGNMENT_UNSPECIFIED": + case 0: + message.horizontalAlignment = 0; + break; + case "LEADING": + case 1: + message.horizontalAlignment = 1; + break; + case "CENTER": + case 2: + message.horizontalAlignment = 2; + break; + case "TRAILING": + case 3: + message.horizontalAlignment = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a ColumnProperties message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ColumnProperties} message ColumnProperties + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ColumnProperties.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.header = ""; + object.horizontalAlignment = options.enums === String ? "HORIZONTAL_ALIGNMENT_UNSPECIFIED" : 0; + } + if (message.header != null && message.hasOwnProperty("header")) + object.header = message.header; + if (message.horizontalAlignment != null && message.hasOwnProperty("horizontalAlignment")) + object.horizontalAlignment = options.enums === String ? $root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment[message.horizontalAlignment] === undefined ? message.horizontalAlignment : $root.google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment[message.horizontalAlignment] : message.horizontalAlignment; + return object; + }; + + /** + * Converts this ColumnProperties to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @instance + * @returns {Object.} JSON object + */ + ColumnProperties.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ColumnProperties + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.ColumnProperties + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ColumnProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.ColumnProperties"; + }; + + /** + * HorizontalAlignment enum. + * @name google.cloud.dialogflow.v2.Intent.Message.ColumnProperties.HorizontalAlignment + * @enum {number} + * @property {number} HORIZONTAL_ALIGNMENT_UNSPECIFIED=0 HORIZONTAL_ALIGNMENT_UNSPECIFIED value + * @property {number} LEADING=1 LEADING value + * @property {number} CENTER=2 CENTER value + * @property {number} TRAILING=3 TRAILING value + */ + ColumnProperties.HorizontalAlignment = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HORIZONTAL_ALIGNMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "LEADING"] = 1; + values[valuesById[2] = "CENTER"] = 2; + values[valuesById[3] = "TRAILING"] = 3; + return values; + })(); + + return ColumnProperties; + })(); + + Message.TableCardRow = (function() { + + /** + * Properties of a TableCardRow. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ITableCardRow + * @property {Array.|null} [cells] TableCardRow cells + * @property {boolean|null} [dividerAfter] TableCardRow dividerAfter + */ + + /** + * Constructs a new TableCardRow. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a TableCardRow. + * @implements ITableCardRow + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCardRow=} [properties] Properties to set + */ + function TableCardRow(properties) { + this.cells = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCardRow cells. + * @member {Array.} cells + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @instance + */ + TableCardRow.prototype.cells = $util.emptyArray; + + /** + * TableCardRow dividerAfter. + * @member {boolean} dividerAfter + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @instance + */ + TableCardRow.prototype.dividerAfter = false; + + /** + * Creates a new TableCardRow instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCardRow=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCardRow} TableCardRow instance + */ + TableCardRow.create = function create(properties) { + return new TableCardRow(properties); + }; + + /** + * Encodes the specified TableCardRow message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCardRow.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCardRow} message TableCardRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCardRow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cells != null && message.cells.length) + for (var i = 0; i < message.cells.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.TableCardCell.encode(message.cells[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.dividerAfter != null && Object.hasOwnProperty.call(message, "dividerAfter")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.dividerAfter); + return writer; + }; + + /** + * Encodes the specified TableCardRow message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCardRow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCardRow} message TableCardRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCardRow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCardRow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCardRow} TableCardRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCardRow.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.TableCardRow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.dialogflow.v2.Intent.Message.TableCardCell.decode(reader, reader.uint32())); + break; + } + case 2: { + message.dividerAfter = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCardRow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCardRow} TableCardRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCardRow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCardRow message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCardRow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cells != null && message.hasOwnProperty("cells")) { + if (!Array.isArray(message.cells)) + return "cells: array expected"; + for (var i = 0; i < message.cells.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.TableCardCell.verify(message.cells[i]); + if (error) + return "cells." + error; + } + } + if (message.dividerAfter != null && message.hasOwnProperty("dividerAfter")) + if (typeof message.dividerAfter !== "boolean") + return "dividerAfter: boolean expected"; + return null; + }; + + /** + * Creates a TableCardRow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCardRow} TableCardRow + */ + TableCardRow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.TableCardRow) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.TableCardRow(); + if (object.cells) { + if (!Array.isArray(object.cells)) + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.TableCardRow.cells: array expected"); + message.cells = []; + for (var i = 0; i < object.cells.length; ++i) { + if (typeof object.cells[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Intent.Message.TableCardRow.cells: object expected"); + message.cells[i] = $root.google.cloud.dialogflow.v2.Intent.Message.TableCardCell.fromObject(object.cells[i]); + } + } + if (object.dividerAfter != null) + message.dividerAfter = Boolean(object.dividerAfter); + return message; + }; + + /** + * Creates a plain object from a TableCardRow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.TableCardRow} message TableCardRow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCardRow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cells = []; + if (options.defaults) + object.dividerAfter = false; + if (message.cells && message.cells.length) { + object.cells = []; + for (var j = 0; j < message.cells.length; ++j) + object.cells[j] = $root.google.cloud.dialogflow.v2.Intent.Message.TableCardCell.toObject(message.cells[j], options); + } + if (message.dividerAfter != null && message.hasOwnProperty("dividerAfter")) + object.dividerAfter = message.dividerAfter; + return object; + }; + + /** + * Converts this TableCardRow to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @instance + * @returns {Object.} JSON object + */ + TableCardRow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TableCardRow + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardRow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCardRow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.TableCardRow"; + }; + + return TableCardRow; + })(); + + Message.TableCardCell = (function() { + + /** + * Properties of a TableCardCell. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @interface ITableCardCell + * @property {string|null} [text] TableCardCell text + */ + + /** + * Constructs a new TableCardCell. + * @memberof google.cloud.dialogflow.v2.Intent.Message + * @classdesc Represents a TableCardCell. + * @implements ITableCardCell + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCardCell=} [properties] Properties to set + */ + function TableCardCell(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCardCell text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @instance + */ + TableCardCell.prototype.text = ""; + + /** + * Creates a new TableCardCell instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCardCell=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCardCell} TableCardCell instance + */ + TableCardCell.create = function create(properties) { + return new TableCardCell(properties); + }; + + /** + * Encodes the specified TableCardCell message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCardCell.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCardCell} message TableCardCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCardCell.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + return writer; + }; + + /** + * Encodes the specified TableCardCell message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.Message.TableCardCell.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.ITableCardCell} message TableCardCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCardCell.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCardCell message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCardCell} TableCardCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCardCell.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.Message.TableCardCell(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCardCell message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCardCell} TableCardCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCardCell.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCardCell message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCardCell.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a TableCardCell message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.Message.TableCardCell} TableCardCell + */ + TableCardCell.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.Message.TableCardCell) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.Message.TableCardCell(); + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a TableCardCell message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @static + * @param {google.cloud.dialogflow.v2.Intent.Message.TableCardCell} message TableCardCell + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCardCell.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.text = ""; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + return object; + }; + + /** + * Converts this TableCardCell to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @instance + * @returns {Object.} JSON object + */ + TableCardCell.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TableCardCell + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.Message.TableCardCell + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCardCell.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.Message.TableCardCell"; + }; + + return TableCardCell; + })(); + + return Message; + })(); + + Intent.FollowupIntentInfo = (function() { + + /** + * Properties of a FollowupIntentInfo. + * @memberof google.cloud.dialogflow.v2.Intent + * @interface IFollowupIntentInfo + * @property {string|null} [followupIntentName] FollowupIntentInfo followupIntentName + * @property {string|null} [parentFollowupIntentName] FollowupIntentInfo parentFollowupIntentName + */ + + /** + * Constructs a new FollowupIntentInfo. + * @memberof google.cloud.dialogflow.v2.Intent + * @classdesc Represents a FollowupIntentInfo. + * @implements IFollowupIntentInfo + * @constructor + * @param {google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo=} [properties] Properties to set + */ + function FollowupIntentInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FollowupIntentInfo followupIntentName. + * @member {string} followupIntentName + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @instance + */ + FollowupIntentInfo.prototype.followupIntentName = ""; + + /** + * FollowupIntentInfo parentFollowupIntentName. + * @member {string} parentFollowupIntentName + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @instance + */ + FollowupIntentInfo.prototype.parentFollowupIntentName = ""; + + /** + * Creates a new FollowupIntentInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @static + * @param {google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Intent.FollowupIntentInfo} FollowupIntentInfo instance + */ + FollowupIntentInfo.create = function create(properties) { + return new FollowupIntentInfo(properties); + }; + + /** + * Encodes the specified FollowupIntentInfo message. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @static + * @param {google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo} message FollowupIntentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FollowupIntentInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.followupIntentName != null && Object.hasOwnProperty.call(message, "followupIntentName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.followupIntentName); + if (message.parentFollowupIntentName != null && Object.hasOwnProperty.call(message, "parentFollowupIntentName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.parentFollowupIntentName); + return writer; + }; + + /** + * Encodes the specified FollowupIntentInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Intent.FollowupIntentInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @static + * @param {google.cloud.dialogflow.v2.Intent.IFollowupIntentInfo} message FollowupIntentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FollowupIntentInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FollowupIntentInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Intent.FollowupIntentInfo} FollowupIntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FollowupIntentInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Intent.FollowupIntentInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.followupIntentName = reader.string(); + break; + } + case 2: { + message.parentFollowupIntentName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FollowupIntentInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Intent.FollowupIntentInfo} FollowupIntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FollowupIntentInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FollowupIntentInfo message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FollowupIntentInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.followupIntentName != null && message.hasOwnProperty("followupIntentName")) + if (!$util.isString(message.followupIntentName)) + return "followupIntentName: string expected"; + if (message.parentFollowupIntentName != null && message.hasOwnProperty("parentFollowupIntentName")) + if (!$util.isString(message.parentFollowupIntentName)) + return "parentFollowupIntentName: string expected"; + return null; + }; + + /** + * Creates a FollowupIntentInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Intent.FollowupIntentInfo} FollowupIntentInfo + */ + FollowupIntentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Intent.FollowupIntentInfo) + return object; + var message = new $root.google.cloud.dialogflow.v2.Intent.FollowupIntentInfo(); + if (object.followupIntentName != null) + message.followupIntentName = String(object.followupIntentName); + if (object.parentFollowupIntentName != null) + message.parentFollowupIntentName = String(object.parentFollowupIntentName); + return message; + }; + + /** + * Creates a plain object from a FollowupIntentInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @static + * @param {google.cloud.dialogflow.v2.Intent.FollowupIntentInfo} message FollowupIntentInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FollowupIntentInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.followupIntentName = ""; + object.parentFollowupIntentName = ""; + } + if (message.followupIntentName != null && message.hasOwnProperty("followupIntentName")) + object.followupIntentName = message.followupIntentName; + if (message.parentFollowupIntentName != null && message.hasOwnProperty("parentFollowupIntentName")) + object.parentFollowupIntentName = message.parentFollowupIntentName; + return object; + }; + + /** + * Converts this FollowupIntentInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @instance + * @returns {Object.} JSON object + */ + FollowupIntentInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FollowupIntentInfo + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Intent.FollowupIntentInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FollowupIntentInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Intent.FollowupIntentInfo"; + }; + + return FollowupIntentInfo; + })(); + + return Intent; + })(); + + v2.ListIntentsRequest = (function() { + + /** + * Properties of a ListIntentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListIntentsRequest + * @property {string|null} [parent] ListIntentsRequest parent + * @property {string|null} [languageCode] ListIntentsRequest languageCode + * @property {google.cloud.dialogflow.v2.IntentView|null} [intentView] ListIntentsRequest intentView + * @property {number|null} [pageSize] ListIntentsRequest pageSize + * @property {string|null} [pageToken] ListIntentsRequest pageToken + */ + + /** + * Constructs a new ListIntentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListIntentsRequest. + * @implements IListIntentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListIntentsRequest=} [properties] Properties to set + */ + function ListIntentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListIntentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.parent = ""; + + /** + * ListIntentsRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.languageCode = ""; + + /** + * ListIntentsRequest intentView. + * @member {google.cloud.dialogflow.v2.IntentView} intentView + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.intentView = 0; + + /** + * ListIntentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.pageSize = 0; + + /** + * ListIntentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListIntentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListIntentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListIntentsRequest} ListIntentsRequest instance + */ + ListIntentsRequest.create = function create(properties) { + return new ListIntentsRequest(properties); + }; + + /** + * Encodes the specified ListIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListIntentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListIntentsRequest} message ListIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.intentView); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListIntentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListIntentsRequest} message ListIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListIntentsRequest} ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListIntentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.intentView = reader.int32(); + break; + } + case 4: { + message.pageSize = reader.int32(); + break; + } + case 5: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListIntentsRequest} ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListIntentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListIntentsRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + 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 ListIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListIntentsRequest} ListIntentsRequest + */ + ListIntentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListIntentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListIntentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + 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 ListIntentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListIntentsRequest} message ListIntentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListIntentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2.IntentView[message.intentView] : message.intentView; + 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 ListIntentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListIntentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListIntentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListIntentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListIntentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListIntentsRequest"; + }; + + return ListIntentsRequest; + })(); + + v2.ListIntentsResponse = (function() { + + /** + * Properties of a ListIntentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListIntentsResponse + * @property {Array.|null} [intents] ListIntentsResponse intents + * @property {string|null} [nextPageToken] ListIntentsResponse nextPageToken + */ + + /** + * Constructs a new ListIntentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListIntentsResponse. + * @implements IListIntentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListIntentsResponse=} [properties] Properties to set + */ + function ListIntentsResponse(properties) { + this.intents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListIntentsResponse intents. + * @member {Array.} intents + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @instance + */ + ListIntentsResponse.prototype.intents = $util.emptyArray; + + /** + * ListIntentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @instance + */ + ListIntentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListIntentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListIntentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListIntentsResponse} ListIntentsResponse instance + */ + ListIntentsResponse.create = function create(properties) { + return new ListIntentsResponse(properties); + }; + + /** + * Encodes the specified ListIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListIntentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListIntentsResponse} message ListIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intents != null && message.intents.length) + for (var i = 0; i < message.intents.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.encode(message.intents[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 ListIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListIntentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListIntentsResponse} message ListIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListIntentsResponse} ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListIntentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.intents && message.intents.length)) + message.intents = []; + message.intents.push($root.google.cloud.dialogflow.v2.Intent.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListIntentsResponse} ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListIntentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListIntentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intents != null && message.hasOwnProperty("intents")) { + if (!Array.isArray(message.intents)) + return "intents: array expected"; + for (var i = 0; i < message.intents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.verify(message.intents[i]); + if (error) + return "intents." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListIntentsResponse} ListIntentsResponse + */ + ListIntentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListIntentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListIntentsResponse(); + if (object.intents) { + if (!Array.isArray(object.intents)) + throw TypeError(".google.cloud.dialogflow.v2.ListIntentsResponse.intents: array expected"); + message.intents = []; + for (var i = 0; i < object.intents.length; ++i) { + if (typeof object.intents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListIntentsResponse.intents: object expected"); + message.intents[i] = $root.google.cloud.dialogflow.v2.Intent.fromObject(object.intents[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListIntentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListIntentsResponse} message ListIntentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListIntentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.intents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.intents && message.intents.length) { + object.intents = []; + for (var j = 0; j < message.intents.length; ++j) + object.intents[j] = $root.google.cloud.dialogflow.v2.Intent.toObject(message.intents[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListIntentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListIntentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListIntentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListIntentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListIntentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListIntentsResponse"; + }; + + return ListIntentsResponse; + })(); + + v2.GetIntentRequest = (function() { + + /** + * Properties of a GetIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetIntentRequest + * @property {string|null} [name] GetIntentRequest name + * @property {string|null} [languageCode] GetIntentRequest languageCode + * @property {google.cloud.dialogflow.v2.IntentView|null} [intentView] GetIntentRequest intentView + */ + + /** + * Constructs a new GetIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetIntentRequest. + * @implements IGetIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetIntentRequest=} [properties] Properties to set + */ + function GetIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIntentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @instance + */ + GetIntentRequest.prototype.name = ""; + + /** + * GetIntentRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @instance + */ + GetIntentRequest.prototype.languageCode = ""; + + /** + * GetIntentRequest intentView. + * @member {google.cloud.dialogflow.v2.IntentView} intentView + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @instance + */ + GetIntentRequest.prototype.intentView = 0; + + /** + * Creates a new GetIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetIntentRequest} GetIntentRequest instance + */ + GetIntentRequest.create = function create(properties) { + return new GetIntentRequest(properties); + }; + + /** + * Encodes the specified GetIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetIntentRequest} message GetIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIntentRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.intentView); + return writer; + }; + + /** + * Encodes the specified GetIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetIntentRequest} message GetIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetIntentRequest} GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.intentView = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetIntentRequest} GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIntentRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a GetIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetIntentRequest} GetIntentRequest + */ + GetIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetIntentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a GetIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.GetIntentRequest} message GetIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.languageCode = ""; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2.IntentView[message.intentView] : message.intentView; + return object; + }; + + /** + * Converts this GetIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @instance + * @returns {Object.} JSON object + */ + GetIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetIntentRequest"; + }; + + return GetIntentRequest; + })(); + + v2.CreateIntentRequest = (function() { + + /** + * Properties of a CreateIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateIntentRequest + * @property {string|null} [parent] CreateIntentRequest parent + * @property {google.cloud.dialogflow.v2.IIntent|null} [intent] CreateIntentRequest intent + * @property {string|null} [languageCode] CreateIntentRequest languageCode + * @property {google.cloud.dialogflow.v2.IntentView|null} [intentView] CreateIntentRequest intentView + */ + + /** + * Constructs a new CreateIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateIntentRequest. + * @implements ICreateIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateIntentRequest=} [properties] Properties to set + */ + function CreateIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateIntentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.parent = ""; + + /** + * CreateIntentRequest intent. + * @member {google.cloud.dialogflow.v2.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.intent = null; + + /** + * CreateIntentRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.languageCode = ""; + + /** + * CreateIntentRequest intentView. + * @member {google.cloud.dialogflow.v2.IntentView} intentView + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.intentView = 0; + + /** + * Creates a new CreateIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateIntentRequest} CreateIntentRequest instance + */ + CreateIntentRequest.create = function create(properties) { + return new CreateIntentRequest(properties); + }; + + /** + * Encodes the specified CreateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateIntentRequest} message CreateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateIntentRequest.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.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.v2.Intent.encode(message.intent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.intentView); + return writer; + }; + + /** + * Encodes the specified CreateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateIntentRequest} message CreateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateIntentRequest} CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.intent = $root.google.cloud.dialogflow.v2.Intent.decode(reader, reader.uint32()); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 4: { + message.intentView = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateIntentRequest} CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateIntentRequest.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.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.v2.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a CreateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateIntentRequest} CreateIntentRequest + */ + CreateIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateIntentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateIntentRequest.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.v2.Intent.fromObject(object.intent); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a CreateIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateIntentRequest} message CreateIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.intent = null; + object.languageCode = ""; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.v2.Intent.toObject(message.intent, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2.IntentView[message.intentView] : message.intentView; + return object; + }; + + /** + * Converts this CreateIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateIntentRequest"; + }; + + return CreateIntentRequest; + })(); + + v2.UpdateIntentRequest = (function() { + + /** + * Properties of an UpdateIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateIntentRequest + * @property {google.cloud.dialogflow.v2.IIntent|null} [intent] UpdateIntentRequest intent + * @property {string|null} [languageCode] UpdateIntentRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateIntentRequest updateMask + * @property {google.cloud.dialogflow.v2.IntentView|null} [intentView] UpdateIntentRequest intentView + */ + + /** + * Constructs a new UpdateIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateIntentRequest. + * @implements IUpdateIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateIntentRequest=} [properties] Properties to set + */ + function UpdateIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateIntentRequest intent. + * @member {google.cloud.dialogflow.v2.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.intent = null; + + /** + * UpdateIntentRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.languageCode = ""; + + /** + * UpdateIntentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.updateMask = null; + + /** + * UpdateIntentRequest intentView. + * @member {google.cloud.dialogflow.v2.IntentView} intentView + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.intentView = 0; + + /** + * Creates a new UpdateIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateIntentRequest} UpdateIntentRequest instance + */ + UpdateIntentRequest.create = function create(properties) { + return new UpdateIntentRequest(properties); + }; + + /** + * Encodes the specified UpdateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateIntentRequest} message UpdateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.v2.Intent.encode(message.intent, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.intentView); + return writer; + }; + + /** + * Encodes the specified UpdateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateIntentRequest} message UpdateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateIntentRequest} UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.intent = $root.google.cloud.dialogflow.v2.Intent.decode(reader, reader.uint32()); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 4: { + message.intentView = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateIntentRequest} UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.v2.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates an UpdateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateIntentRequest} UpdateIntentRequest + */ + UpdateIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateIntentRequest(); + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateIntentRequest.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.v2.Intent.fromObject(object.intent); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateIntentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from an UpdateIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateIntentRequest} message UpdateIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.intent = null; + object.languageCode = ""; + object.updateMask = null; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + } + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.v2.Intent.toObject(message.intent, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2.IntentView[message.intentView] : message.intentView; + return object; + }; + + /** + * Converts this UpdateIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateIntentRequest"; + }; + + return UpdateIntentRequest; + })(); + + v2.DeleteIntentRequest = (function() { + + /** + * Properties of a DeleteIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteIntentRequest + * @property {string|null} [name] DeleteIntentRequest name + */ + + /** + * Constructs a new DeleteIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteIntentRequest. + * @implements IDeleteIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteIntentRequest=} [properties] Properties to set + */ + function DeleteIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteIntentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @instance + */ + DeleteIntentRequest.prototype.name = ""; + + /** + * Creates a new DeleteIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteIntentRequest} DeleteIntentRequest instance + */ + DeleteIntentRequest.create = function create(properties) { + return new DeleteIntentRequest(properties); + }; + + /** + * Encodes the specified DeleteIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteIntentRequest} message DeleteIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteIntentRequest.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 DeleteIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteIntentRequest} message DeleteIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteIntentRequest} DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteIntentRequest(); + 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 DeleteIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteIntentRequest} DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteIntentRequest.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 DeleteIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteIntentRequest} DeleteIntentRequest + */ + DeleteIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteIntentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteIntentRequest} message DeleteIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteIntentRequest.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 DeleteIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteIntentRequest"; + }; + + return DeleteIntentRequest; + })(); + + v2.BatchUpdateIntentsRequest = (function() { + + /** + * Properties of a BatchUpdateIntentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IBatchUpdateIntentsRequest + * @property {string|null} [parent] BatchUpdateIntentsRequest parent + * @property {string|null} [intentBatchUri] BatchUpdateIntentsRequest intentBatchUri + * @property {google.cloud.dialogflow.v2.IIntentBatch|null} [intentBatchInline] BatchUpdateIntentsRequest intentBatchInline + * @property {string|null} [languageCode] BatchUpdateIntentsRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] BatchUpdateIntentsRequest updateMask + * @property {google.cloud.dialogflow.v2.IntentView|null} [intentView] BatchUpdateIntentsRequest intentView + */ + + /** + * Constructs a new BatchUpdateIntentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a BatchUpdateIntentsRequest. + * @implements IBatchUpdateIntentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest=} [properties] Properties to set + */ + function BatchUpdateIntentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateIntentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.parent = ""; + + /** + * BatchUpdateIntentsRequest intentBatchUri. + * @member {string|null|undefined} intentBatchUri + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.intentBatchUri = null; + + /** + * BatchUpdateIntentsRequest intentBatchInline. + * @member {google.cloud.dialogflow.v2.IIntentBatch|null|undefined} intentBatchInline + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.intentBatchInline = null; + + /** + * BatchUpdateIntentsRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.languageCode = ""; + + /** + * BatchUpdateIntentsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.updateMask = null; + + /** + * BatchUpdateIntentsRequest intentView. + * @member {google.cloud.dialogflow.v2.IntentView} intentView + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.intentView = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchUpdateIntentsRequest intentBatch. + * @member {"intentBatchUri"|"intentBatchInline"|undefined} intentBatch + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @instance + */ + Object.defineProperty(BatchUpdateIntentsRequest.prototype, "intentBatch", { + get: $util.oneOfGetter($oneOfFields = ["intentBatchUri", "intentBatchInline"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchUpdateIntentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.BatchUpdateIntentsRequest} BatchUpdateIntentsRequest instance + */ + BatchUpdateIntentsRequest.create = function create(properties) { + return new BatchUpdateIntentsRequest(properties); + }; + + /** + * Encodes the specified BatchUpdateIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest} message BatchUpdateIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateIntentsRequest.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.intentBatchUri != null && Object.hasOwnProperty.call(message, "intentBatchUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.intentBatchUri); + if (message.intentBatchInline != null && Object.hasOwnProperty.call(message, "intentBatchInline")) + $root.google.cloud.dialogflow.v2.IntentBatch.encode(message.intentBatchInline, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.intentView); + return writer; + }; + + /** + * Encodes the specified BatchUpdateIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest} message BatchUpdateIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateIntentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateIntentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.BatchUpdateIntentsRequest} BatchUpdateIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateIntentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.intentBatchUri = reader.string(); + break; + } + case 3: { + message.intentBatchInline = $root.google.cloud.dialogflow.v2.IntentBatch.decode(reader, reader.uint32()); + break; + } + case 4: { + message.languageCode = reader.string(); + break; + } + case 5: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 6: { + message.intentView = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateIntentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.BatchUpdateIntentsRequest} BatchUpdateIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateIntentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateIntentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateIntentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.intentBatchUri != null && message.hasOwnProperty("intentBatchUri")) { + properties.intentBatch = 1; + if (!$util.isString(message.intentBatchUri)) + return "intentBatchUri: string expected"; + } + if (message.intentBatchInline != null && message.hasOwnProperty("intentBatchInline")) { + if (properties.intentBatch === 1) + return "intentBatch: multiple values"; + properties.intentBatch = 1; + { + var error = $root.google.cloud.dialogflow.v2.IntentBatch.verify(message.intentBatchInline); + if (error) + return "intentBatchInline." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a BatchUpdateIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.BatchUpdateIntentsRequest} BatchUpdateIntentsRequest + */ + BatchUpdateIntentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.intentBatchUri != null) + message.intentBatchUri = String(object.intentBatchUri); + if (object.intentBatchInline != null) { + if (typeof object.intentBatchInline !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.intentBatchInline: object expected"); + message.intentBatchInline = $root.google.cloud.dialogflow.v2.IntentBatch.fromObject(object.intentBatchInline); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateIntentsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateIntentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.BatchUpdateIntentsRequest} message BatchUpdateIntentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateIntentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.updateMask = null; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.intentBatchUri != null && message.hasOwnProperty("intentBatchUri")) { + object.intentBatchUri = message.intentBatchUri; + if (options.oneofs) + object.intentBatch = "intentBatchUri"; + } + if (message.intentBatchInline != null && message.hasOwnProperty("intentBatchInline")) { + object.intentBatchInline = $root.google.cloud.dialogflow.v2.IntentBatch.toObject(message.intentBatchInline, options); + if (options.oneofs) + object.intentBatch = "intentBatchInline"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2.IntentView[message.intentView] : message.intentView; + return object; + }; + + /** + * Converts this BatchUpdateIntentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateIntentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateIntentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateIntentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.BatchUpdateIntentsRequest"; + }; + + return BatchUpdateIntentsRequest; + })(); + + v2.BatchUpdateIntentsResponse = (function() { + + /** + * Properties of a BatchUpdateIntentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IBatchUpdateIntentsResponse + * @property {Array.|null} [intents] BatchUpdateIntentsResponse intents + */ + + /** + * Constructs a new BatchUpdateIntentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a BatchUpdateIntentsResponse. + * @implements IBatchUpdateIntentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse=} [properties] Properties to set + */ + function BatchUpdateIntentsResponse(properties) { + this.intents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateIntentsResponse intents. + * @member {Array.} intents + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @instance + */ + BatchUpdateIntentsResponse.prototype.intents = $util.emptyArray; + + /** + * Creates a new BatchUpdateIntentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.BatchUpdateIntentsResponse} BatchUpdateIntentsResponse instance + */ + BatchUpdateIntentsResponse.create = function create(properties) { + return new BatchUpdateIntentsResponse(properties); + }; + + /** + * Encodes the specified BatchUpdateIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateIntentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse} message BatchUpdateIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateIntentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intents != null && message.intents.length) + for (var i = 0; i < message.intents.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.encode(message.intents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchUpdateIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateIntentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse} message BatchUpdateIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateIntentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateIntentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.BatchUpdateIntentsResponse} BatchUpdateIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateIntentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.BatchUpdateIntentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.intents && message.intents.length)) + message.intents = []; + message.intents.push($root.google.cloud.dialogflow.v2.Intent.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateIntentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.BatchUpdateIntentsResponse} BatchUpdateIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateIntentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateIntentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateIntentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intents != null && message.hasOwnProperty("intents")) { + if (!Array.isArray(message.intents)) + return "intents: array expected"; + for (var i = 0; i < message.intents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.verify(message.intents[i]); + if (error) + return "intents." + error; + } + } + return null; + }; + + /** + * Creates a BatchUpdateIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.BatchUpdateIntentsResponse} BatchUpdateIntentsResponse + */ + BatchUpdateIntentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.BatchUpdateIntentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.BatchUpdateIntentsResponse(); + if (object.intents) { + if (!Array.isArray(object.intents)) + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateIntentsResponse.intents: array expected"); + message.intents = []; + for (var i = 0; i < object.intents.length; ++i) { + if (typeof object.intents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateIntentsResponse.intents: object expected"); + message.intents[i] = $root.google.cloud.dialogflow.v2.Intent.fromObject(object.intents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateIntentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2.BatchUpdateIntentsResponse} message BatchUpdateIntentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateIntentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.intents = []; + if (message.intents && message.intents.length) { + object.intents = []; + for (var j = 0; j < message.intents.length; ++j) + object.intents[j] = $root.google.cloud.dialogflow.v2.Intent.toObject(message.intents[j], options); + } + return object; + }; + + /** + * Converts this BatchUpdateIntentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateIntentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateIntentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.BatchUpdateIntentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateIntentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.BatchUpdateIntentsResponse"; + }; + + return BatchUpdateIntentsResponse; + })(); + + v2.BatchDeleteIntentsRequest = (function() { + + /** + * Properties of a BatchDeleteIntentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IBatchDeleteIntentsRequest + * @property {string|null} [parent] BatchDeleteIntentsRequest parent + * @property {Array.|null} [intents] BatchDeleteIntentsRequest intents + */ + + /** + * Constructs a new BatchDeleteIntentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a BatchDeleteIntentsRequest. + * @implements IBatchDeleteIntentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest=} [properties] Properties to set + */ + function BatchDeleteIntentsRequest(properties) { + this.intents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDeleteIntentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @instance + */ + BatchDeleteIntentsRequest.prototype.parent = ""; + + /** + * BatchDeleteIntentsRequest intents. + * @member {Array.} intents + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @instance + */ + BatchDeleteIntentsRequest.prototype.intents = $util.emptyArray; + + /** + * Creates a new BatchDeleteIntentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.BatchDeleteIntentsRequest} BatchDeleteIntentsRequest instance + */ + BatchDeleteIntentsRequest.create = function create(properties) { + return new BatchDeleteIntentsRequest(properties); + }; + + /** + * Encodes the specified BatchDeleteIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteIntentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest} message BatchDeleteIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteIntentsRequest.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.intents != null && message.intents.length) + for (var i = 0; i < message.intents.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.encode(message.intents[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchDeleteIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteIntentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest} message BatchDeleteIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteIntentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDeleteIntentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.BatchDeleteIntentsRequest} BatchDeleteIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteIntentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.intents && message.intents.length)) + message.intents = []; + message.intents.push($root.google.cloud.dialogflow.v2.Intent.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDeleteIntentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.BatchDeleteIntentsRequest} BatchDeleteIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteIntentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDeleteIntentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDeleteIntentsRequest.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.intents != null && message.hasOwnProperty("intents")) { + if (!Array.isArray(message.intents)) + return "intents: array expected"; + for (var i = 0; i < message.intents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.verify(message.intents[i]); + if (error) + return "intents." + error; + } + } + return null; + }; + + /** + * Creates a BatchDeleteIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.BatchDeleteIntentsRequest} BatchDeleteIntentsRequest + */ + BatchDeleteIntentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.intents) { + if (!Array.isArray(object.intents)) + throw TypeError(".google.cloud.dialogflow.v2.BatchDeleteIntentsRequest.intents: array expected"); + message.intents = []; + for (var i = 0; i < object.intents.length; ++i) { + if (typeof object.intents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchDeleteIntentsRequest.intents: object expected"); + message.intents[i] = $root.google.cloud.dialogflow.v2.Intent.fromObject(object.intents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchDeleteIntentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2.BatchDeleteIntentsRequest} message BatchDeleteIntentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDeleteIntentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.intents = []; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.intents && message.intents.length) { + object.intents = []; + for (var j = 0; j < message.intents.length; ++j) + object.intents[j] = $root.google.cloud.dialogflow.v2.Intent.toObject(message.intents[j], options); + } + return object; + }; + + /** + * Converts this BatchDeleteIntentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @instance + * @returns {Object.} JSON object + */ + BatchDeleteIntentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDeleteIntentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.BatchDeleteIntentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDeleteIntentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.BatchDeleteIntentsRequest"; + }; + + return BatchDeleteIntentsRequest; + })(); + + /** + * IntentView enum. + * @name google.cloud.dialogflow.v2.IntentView + * @enum {number} + * @property {number} INTENT_VIEW_UNSPECIFIED=0 INTENT_VIEW_UNSPECIFIED value + * @property {number} INTENT_VIEW_FULL=1 INTENT_VIEW_FULL value + */ + v2.IntentView = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INTENT_VIEW_UNSPECIFIED"] = 0; + values[valuesById[1] = "INTENT_VIEW_FULL"] = 1; + return values; + })(); + + v2.IntentBatch = (function() { + + /** + * Properties of an IntentBatch. + * @memberof google.cloud.dialogflow.v2 + * @interface IIntentBatch + * @property {Array.|null} [intents] IntentBatch intents + */ + + /** + * Constructs a new IntentBatch. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an IntentBatch. + * @implements IIntentBatch + * @constructor + * @param {google.cloud.dialogflow.v2.IIntentBatch=} [properties] Properties to set + */ + function IntentBatch(properties) { + this.intents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IntentBatch intents. + * @member {Array.} intents + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @instance + */ + IntentBatch.prototype.intents = $util.emptyArray; + + /** + * Creates a new IntentBatch instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @static + * @param {google.cloud.dialogflow.v2.IIntentBatch=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.IntentBatch} IntentBatch instance + */ + IntentBatch.create = function create(properties) { + return new IntentBatch(properties); + }; + + /** + * Encodes the specified IntentBatch message. Does not implicitly {@link google.cloud.dialogflow.v2.IntentBatch.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @static + * @param {google.cloud.dialogflow.v2.IIntentBatch} message IntentBatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentBatch.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intents != null && message.intents.length) + for (var i = 0; i < message.intents.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.encode(message.intents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IntentBatch message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.IntentBatch.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @static + * @param {google.cloud.dialogflow.v2.IIntentBatch} message IntentBatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentBatch.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IntentBatch message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.IntentBatch} IntentBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentBatch.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.IntentBatch(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.intents && message.intents.length)) + message.intents = []; + message.intents.push($root.google.cloud.dialogflow.v2.Intent.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IntentBatch message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.IntentBatch} IntentBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentBatch.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IntentBatch message. + * @function verify + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IntentBatch.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intents != null && message.hasOwnProperty("intents")) { + if (!Array.isArray(message.intents)) + return "intents: array expected"; + for (var i = 0; i < message.intents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.verify(message.intents[i]); + if (error) + return "intents." + error; + } + } + return null; + }; + + /** + * Creates an IntentBatch message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.IntentBatch} IntentBatch + */ + IntentBatch.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.IntentBatch) + return object; + var message = new $root.google.cloud.dialogflow.v2.IntentBatch(); + if (object.intents) { + if (!Array.isArray(object.intents)) + throw TypeError(".google.cloud.dialogflow.v2.IntentBatch.intents: array expected"); + message.intents = []; + for (var i = 0; i < object.intents.length; ++i) { + if (typeof object.intents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.IntentBatch.intents: object expected"); + message.intents[i] = $root.google.cloud.dialogflow.v2.Intent.fromObject(object.intents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an IntentBatch message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @static + * @param {google.cloud.dialogflow.v2.IntentBatch} message IntentBatch + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IntentBatch.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.intents = []; + if (message.intents && message.intents.length) { + object.intents = []; + for (var j = 0; j < message.intents.length; ++j) + object.intents[j] = $root.google.cloud.dialogflow.v2.Intent.toObject(message.intents[j], options); + } + return object; + }; + + /** + * Converts this IntentBatch to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @instance + * @returns {Object.} JSON object + */ + IntentBatch.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IntentBatch + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.IntentBatch + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IntentBatch.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.IntentBatch"; + }; + + return IntentBatch; + })(); + + v2.SessionEntityTypes = (function() { + + /** + * Constructs a new SessionEntityTypes service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SessionEntityTypes + * @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 SessionEntityTypes(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SessionEntityTypes.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SessionEntityTypes; + + /** + * Creates new SessionEntityTypes service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @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 {SessionEntityTypes} RPC service. Useful where requests and/or responses are streamed. + */ + SessionEntityTypes.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|listSessionEntityTypes}. + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @typedef ListSessionEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListSessionEntityTypesResponse} [response] ListSessionEntityTypesResponse + */ + + /** + * Calls ListSessionEntityTypes. + * @function listSessionEntityTypes + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesRequest} request ListSessionEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypesCallback} callback Node-style callback called with the error, if any, and ListSessionEntityTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.listSessionEntityTypes = function listSessionEntityTypes(request, callback) { + return this.rpcCall(listSessionEntityTypes, $root.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest, $root.google.cloud.dialogflow.v2.ListSessionEntityTypesResponse, request, callback); + }, "name", { value: "ListSessionEntityTypes" }); + + /** + * Calls ListSessionEntityTypes. + * @function listSessionEntityTypes + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesRequest} request ListSessionEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|getSessionEntityType}. + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @typedef GetSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.SessionEntityType} [response] SessionEntityType + */ + + /** + * Calls GetSessionEntityType. + * @function getSessionEntityType + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest} request GetSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and SessionEntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.getSessionEntityType = function getSessionEntityType(request, callback) { + return this.rpcCall(getSessionEntityType, $root.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest, $root.google.cloud.dialogflow.v2.SessionEntityType, request, callback); + }, "name", { value: "GetSessionEntityType" }); + + /** + * Calls GetSessionEntityType. + * @function getSessionEntityType + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest} request GetSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|createSessionEntityType}. + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @typedef CreateSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.SessionEntityType} [response] SessionEntityType + */ + + /** + * Calls CreateSessionEntityType. + * @function createSessionEntityType + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest} request CreateSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and SessionEntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.createSessionEntityType = function createSessionEntityType(request, callback) { + return this.rpcCall(createSessionEntityType, $root.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest, $root.google.cloud.dialogflow.v2.SessionEntityType, request, callback); + }, "name", { value: "CreateSessionEntityType" }); + + /** + * Calls CreateSessionEntityType. + * @function createSessionEntityType + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest} request CreateSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|updateSessionEntityType}. + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @typedef UpdateSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.SessionEntityType} [response] SessionEntityType + */ + + /** + * Calls UpdateSessionEntityType. + * @function updateSessionEntityType + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest} request UpdateSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and SessionEntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.updateSessionEntityType = function updateSessionEntityType(request, callback) { + return this.rpcCall(updateSessionEntityType, $root.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest, $root.google.cloud.dialogflow.v2.SessionEntityType, request, callback); + }, "name", { value: "UpdateSessionEntityType" }); + + /** + * Calls UpdateSessionEntityType. + * @function updateSessionEntityType + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest} request UpdateSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.SessionEntityTypes|deleteSessionEntityType}. + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @typedef DeleteSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteSessionEntityType. + * @function deleteSessionEntityType + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest} request DeleteSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.deleteSessionEntityType = function deleteSessionEntityType(request, callback) { + return this.rpcCall(deleteSessionEntityType, $root.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteSessionEntityType" }); + + /** + * Calls DeleteSessionEntityType. + * @function deleteSessionEntityType + * @memberof google.cloud.dialogflow.v2.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest} request DeleteSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SessionEntityTypes; + })(); + + v2.SessionEntityType = (function() { + + /** + * Properties of a SessionEntityType. + * @memberof google.cloud.dialogflow.v2 + * @interface ISessionEntityType + * @property {string|null} [name] SessionEntityType name + * @property {google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode|null} [entityOverrideMode] SessionEntityType entityOverrideMode + * @property {Array.|null} [entities] SessionEntityType entities + */ + + /** + * Constructs a new SessionEntityType. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SessionEntityType. + * @implements ISessionEntityType + * @constructor + * @param {google.cloud.dialogflow.v2.ISessionEntityType=} [properties] Properties to set + */ + function SessionEntityType(properties) { + this.entities = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SessionEntityType name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @instance + */ + SessionEntityType.prototype.name = ""; + + /** + * SessionEntityType entityOverrideMode. + * @member {google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode} entityOverrideMode + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @instance + */ + SessionEntityType.prototype.entityOverrideMode = 0; + + /** + * SessionEntityType entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @instance + */ + SessionEntityType.prototype.entities = $util.emptyArray; + + /** + * Creates a new SessionEntityType instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @static + * @param {google.cloud.dialogflow.v2.ISessionEntityType=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SessionEntityType} SessionEntityType instance + */ + SessionEntityType.create = function create(properties) { + return new SessionEntityType(properties); + }; + + /** + * Encodes the specified SessionEntityType message. Does not implicitly {@link google.cloud.dialogflow.v2.SessionEntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @static + * @param {google.cloud.dialogflow.v2.ISessionEntityType} message SessionEntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionEntityType.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.entityOverrideMode != null && Object.hasOwnProperty.call(message, "entityOverrideMode")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.entityOverrideMode); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.v2.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SessionEntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SessionEntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @static + * @param {google.cloud.dialogflow.v2.ISessionEntityType} message SessionEntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionEntityType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SessionEntityType} SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionEntityType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SessionEntityType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.entityOverrideMode = reader.int32(); + break; + } + case 3: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.v2.EntityType.Entity.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SessionEntityType} SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionEntityType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SessionEntityType message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SessionEntityType.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.entityOverrideMode != null && message.hasOwnProperty("entityOverrideMode")) + switch (message.entityOverrideMode) { + default: + return "entityOverrideMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + return null; + }; + + /** + * Creates a SessionEntityType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SessionEntityType} SessionEntityType + */ + SessionEntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SessionEntityType) + return object; + var message = new $root.google.cloud.dialogflow.v2.SessionEntityType(); + if (object.name != null) + message.name = String(object.name); + switch (object.entityOverrideMode) { + default: + if (typeof object.entityOverrideMode === "number") { + message.entityOverrideMode = object.entityOverrideMode; + break; + } + break; + case "ENTITY_OVERRIDE_MODE_UNSPECIFIED": + case 0: + message.entityOverrideMode = 0; + break; + case "ENTITY_OVERRIDE_MODE_OVERRIDE": + case 1: + message.entityOverrideMode = 1; + break; + case "ENTITY_OVERRIDE_MODE_SUPPLEMENT": + case 2: + message.entityOverrideMode = 2; + break; + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.v2.SessionEntityType.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SessionEntityType.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.v2.EntityType.Entity.fromObject(object.entities[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SessionEntityType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @static + * @param {google.cloud.dialogflow.v2.SessionEntityType} message SessionEntityType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SessionEntityType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entities = []; + if (options.defaults) { + object.name = ""; + object.entityOverrideMode = options.enums === String ? "ENTITY_OVERRIDE_MODE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.entityOverrideMode != null && message.hasOwnProperty("entityOverrideMode")) + object.entityOverrideMode = options.enums === String ? $root.google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode[message.entityOverrideMode] === undefined ? message.entityOverrideMode : $root.google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode[message.entityOverrideMode] : message.entityOverrideMode; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.v2.EntityType.Entity.toObject(message.entities[j], options); + } + return object; + }; + + /** + * Converts this SessionEntityType to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @instance + * @returns {Object.} JSON object + */ + SessionEntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SessionEntityType + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SessionEntityType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SessionEntityType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SessionEntityType"; + }; + + /** + * EntityOverrideMode enum. + * @name google.cloud.dialogflow.v2.SessionEntityType.EntityOverrideMode + * @enum {number} + * @property {number} ENTITY_OVERRIDE_MODE_UNSPECIFIED=0 ENTITY_OVERRIDE_MODE_UNSPECIFIED value + * @property {number} ENTITY_OVERRIDE_MODE_OVERRIDE=1 ENTITY_OVERRIDE_MODE_OVERRIDE value + * @property {number} ENTITY_OVERRIDE_MODE_SUPPLEMENT=2 ENTITY_OVERRIDE_MODE_SUPPLEMENT value + */ + SessionEntityType.EntityOverrideMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENTITY_OVERRIDE_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENTITY_OVERRIDE_MODE_OVERRIDE"] = 1; + values[valuesById[2] = "ENTITY_OVERRIDE_MODE_SUPPLEMENT"] = 2; + return values; + })(); + + return SessionEntityType; + })(); + + v2.ListSessionEntityTypesRequest = (function() { + + /** + * Properties of a ListSessionEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListSessionEntityTypesRequest + * @property {string|null} [parent] ListSessionEntityTypesRequest parent + * @property {number|null} [pageSize] ListSessionEntityTypesRequest pageSize + * @property {string|null} [pageToken] ListSessionEntityTypesRequest pageToken + */ + + /** + * Constructs a new ListSessionEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListSessionEntityTypesRequest. + * @implements IListSessionEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesRequest=} [properties] Properties to set + */ + function ListSessionEntityTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSessionEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @instance + */ + ListSessionEntityTypesRequest.prototype.parent = ""; + + /** + * ListSessionEntityTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @instance + */ + ListSessionEntityTypesRequest.prototype.pageSize = 0; + + /** + * ListSessionEntityTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @instance + */ + ListSessionEntityTypesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListSessionEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest instance + */ + ListSessionEntityTypesRequest.create = function create(properties) { + return new ListSessionEntityTypesRequest(properties); + }; + + /** + * Encodes the specified ListSessionEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListSessionEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesRequest} message ListSessionEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesRequest.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 ListSessionEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListSessionEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesRequest} message ListSessionEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest(); + 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 ListSessionEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSessionEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSessionEntityTypesRequest.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 ListSessionEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest + */ + ListSessionEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest(); + 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 ListSessionEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.ListSessionEntityTypesRequest} message ListSessionEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSessionEntityTypesRequest.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 ListSessionEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListSessionEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSessionEntityTypesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSessionEntityTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListSessionEntityTypesRequest"; + }; + + return ListSessionEntityTypesRequest; + })(); + + v2.ListSessionEntityTypesResponse = (function() { + + /** + * Properties of a ListSessionEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListSessionEntityTypesResponse + * @property {Array.|null} [sessionEntityTypes] ListSessionEntityTypesResponse sessionEntityTypes + * @property {string|null} [nextPageToken] ListSessionEntityTypesResponse nextPageToken + */ + + /** + * Constructs a new ListSessionEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListSessionEntityTypesResponse. + * @implements IListSessionEntityTypesResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesResponse=} [properties] Properties to set + */ + function ListSessionEntityTypesResponse(properties) { + this.sessionEntityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSessionEntityTypesResponse sessionEntityTypes. + * @member {Array.} sessionEntityTypes + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @instance + */ + ListSessionEntityTypesResponse.prototype.sessionEntityTypes = $util.emptyArray; + + /** + * ListSessionEntityTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @instance + */ + ListSessionEntityTypesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListSessionEntityTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse instance + */ + ListSessionEntityTypesResponse.create = function create(properties) { + return new ListSessionEntityTypesResponse(properties); + }; + + /** + * Encodes the specified ListSessionEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListSessionEntityTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesResponse} message ListSessionEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sessionEntityTypes != null && message.sessionEntityTypes.length) + for (var i = 0; i < message.sessionEntityTypes.length; ++i) + $root.google.cloud.dialogflow.v2.SessionEntityType.encode(message.sessionEntityTypes[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 ListSessionEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListSessionEntityTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListSessionEntityTypesResponse} message ListSessionEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListSessionEntityTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.sessionEntityTypes && message.sessionEntityTypes.length)) + message.sessionEntityTypes = []; + message.sessionEntityTypes.push($root.google.cloud.dialogflow.v2.SessionEntityType.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSessionEntityTypesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSessionEntityTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sessionEntityTypes != null && message.hasOwnProperty("sessionEntityTypes")) { + if (!Array.isArray(message.sessionEntityTypes)) + return "sessionEntityTypes: array expected"; + for (var i = 0; i < message.sessionEntityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SessionEntityType.verify(message.sessionEntityTypes[i]); + if (error) + return "sessionEntityTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListSessionEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse + */ + ListSessionEntityTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListSessionEntityTypesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListSessionEntityTypesResponse(); + if (object.sessionEntityTypes) { + if (!Array.isArray(object.sessionEntityTypes)) + throw TypeError(".google.cloud.dialogflow.v2.ListSessionEntityTypesResponse.sessionEntityTypes: array expected"); + message.sessionEntityTypes = []; + for (var i = 0; i < object.sessionEntityTypes.length; ++i) { + if (typeof object.sessionEntityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListSessionEntityTypesResponse.sessionEntityTypes: object expected"); + message.sessionEntityTypes[i] = $root.google.cloud.dialogflow.v2.SessionEntityType.fromObject(object.sessionEntityTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListSessionEntityTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.ListSessionEntityTypesResponse} message ListSessionEntityTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSessionEntityTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.sessionEntityTypes = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.sessionEntityTypes && message.sessionEntityTypes.length) { + object.sessionEntityTypes = []; + for (var j = 0; j < message.sessionEntityTypes.length; ++j) + object.sessionEntityTypes[j] = $root.google.cloud.dialogflow.v2.SessionEntityType.toObject(message.sessionEntityTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListSessionEntityTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListSessionEntityTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSessionEntityTypesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListSessionEntityTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSessionEntityTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListSessionEntityTypesResponse"; + }; + + return ListSessionEntityTypesResponse; + })(); + + v2.GetSessionEntityTypeRequest = (function() { + + /** + * Properties of a GetSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetSessionEntityTypeRequest + * @property {string|null} [name] GetSessionEntityTypeRequest name + */ + + /** + * Constructs a new GetSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetSessionEntityTypeRequest. + * @implements IGetSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest=} [properties] Properties to set + */ + function GetSessionEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetSessionEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @instance + */ + GetSessionEntityTypeRequest.prototype.name = ""; + + /** + * Creates a new GetSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest instance + */ + GetSessionEntityTypeRequest.create = function create(properties) { + return new GetSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified GetSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest} message GetSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSessionEntityTypeRequest.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 GetSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest} message GetSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSessionEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest(); + 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 GetSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSessionEntityTypeRequest.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 GetSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest + */ + GetSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.GetSessionEntityTypeRequest} message GetSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSessionEntityTypeRequest.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 GetSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + GetSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetSessionEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetSessionEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetSessionEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetSessionEntityTypeRequest"; + }; + + return GetSessionEntityTypeRequest; + })(); + + v2.CreateSessionEntityTypeRequest = (function() { + + /** + * Properties of a CreateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateSessionEntityTypeRequest + * @property {string|null} [parent] CreateSessionEntityTypeRequest parent + * @property {google.cloud.dialogflow.v2.ISessionEntityType|null} [sessionEntityType] CreateSessionEntityTypeRequest sessionEntityType + */ + + /** + * Constructs a new CreateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateSessionEntityTypeRequest. + * @implements ICreateSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest=} [properties] Properties to set + */ + function CreateSessionEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateSessionEntityTypeRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @instance + */ + CreateSessionEntityTypeRequest.prototype.parent = ""; + + /** + * CreateSessionEntityTypeRequest sessionEntityType. + * @member {google.cloud.dialogflow.v2.ISessionEntityType|null|undefined} sessionEntityType + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @instance + */ + CreateSessionEntityTypeRequest.prototype.sessionEntityType = null; + + /** + * Creates a new CreateSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest instance + */ + CreateSessionEntityTypeRequest.create = function create(properties) { + return new CreateSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest} message CreateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSessionEntityTypeRequest.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.sessionEntityType != null && Object.hasOwnProperty.call(message, "sessionEntityType")) + $root.google.cloud.dialogflow.v2.SessionEntityType.encode(message.sessionEntityType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest} message CreateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSessionEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sessionEntityType = $root.google.cloud.dialogflow.v2.SessionEntityType.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSessionEntityTypeRequest.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.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) { + var error = $root.google.cloud.dialogflow.v2.SessionEntityType.verify(message.sessionEntityType); + if (error) + return "sessionEntityType." + error; + } + return null; + }; + + /** + * Creates a CreateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest + */ + CreateSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sessionEntityType != null) { + if (typeof object.sessionEntityType !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest.sessionEntityType: object expected"); + message.sessionEntityType = $root.google.cloud.dialogflow.v2.SessionEntityType.fromObject(object.sessionEntityType); + } + return message; + }; + + /** + * Creates a plain object from a CreateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest} message CreateSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSessionEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.sessionEntityType = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) + object.sessionEntityType = $root.google.cloud.dialogflow.v2.SessionEntityType.toObject(message.sessionEntityType, options); + return object; + }; + + /** + * Converts this CreateSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSessionEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSessionEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest"; + }; + + return CreateSessionEntityTypeRequest; + })(); + + v2.UpdateSessionEntityTypeRequest = (function() { + + /** + * Properties of an UpdateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateSessionEntityTypeRequest + * @property {google.cloud.dialogflow.v2.ISessionEntityType|null} [sessionEntityType] UpdateSessionEntityTypeRequest sessionEntityType + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSessionEntityTypeRequest updateMask + */ + + /** + * Constructs a new UpdateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateSessionEntityTypeRequest. + * @implements IUpdateSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest=} [properties] Properties to set + */ + function UpdateSessionEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateSessionEntityTypeRequest sessionEntityType. + * @member {google.cloud.dialogflow.v2.ISessionEntityType|null|undefined} sessionEntityType + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @instance + */ + UpdateSessionEntityTypeRequest.prototype.sessionEntityType = null; + + /** + * UpdateSessionEntityTypeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @instance + */ + UpdateSessionEntityTypeRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest instance + */ + UpdateSessionEntityTypeRequest.create = function create(properties) { + return new UpdateSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest} message UpdateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSessionEntityTypeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sessionEntityType != null && Object.hasOwnProperty.call(message, "sessionEntityType")) + $root.google.cloud.dialogflow.v2.SessionEntityType.encode(message.sessionEntityType, 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 UpdateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest} message UpdateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSessionEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.sessionEntityType = $root.google.cloud.dialogflow.v2.SessionEntityType.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 UpdateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSessionEntityTypeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) { + var error = $root.google.cloud.dialogflow.v2.SessionEntityType.verify(message.sessionEntityType); + if (error) + return "sessionEntityType." + 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 UpdateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest + */ + UpdateSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest(); + if (object.sessionEntityType != null) { + if (typeof object.sessionEntityType !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest.sessionEntityType: object expected"); + message.sessionEntityType = $root.google.cloud.dialogflow.v2.SessionEntityType.fromObject(object.sessionEntityType); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest} message UpdateSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSessionEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sessionEntityType = null; + object.updateMask = null; + } + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) + object.sessionEntityType = $root.google.cloud.dialogflow.v2.SessionEntityType.toObject(message.sessionEntityType, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateSessionEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateSessionEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest"; + }; + + return UpdateSessionEntityTypeRequest; + })(); + + v2.DeleteSessionEntityTypeRequest = (function() { + + /** + * Properties of a DeleteSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteSessionEntityTypeRequest + * @property {string|null} [name] DeleteSessionEntityTypeRequest name + */ + + /** + * Constructs a new DeleteSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteSessionEntityTypeRequest. + * @implements IDeleteSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest=} [properties] Properties to set + */ + function DeleteSessionEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteSessionEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @instance + */ + DeleteSessionEntityTypeRequest.prototype.name = ""; + + /** + * Creates a new DeleteSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest instance + */ + DeleteSessionEntityTypeRequest.create = function create(properties) { + return new DeleteSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest} message DeleteSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSessionEntityTypeRequest.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 DeleteSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest} message DeleteSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSessionEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest(); + 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 DeleteSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSessionEntityTypeRequest.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 DeleteSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest + */ + DeleteSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest} message DeleteSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSessionEntityTypeRequest.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 DeleteSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteSessionEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteSessionEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest"; + }; + + return DeleteSessionEntityTypeRequest; + })(); + + v2.EntityTypes = (function() { + + /** + * Constructs a new EntityTypes service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an EntityTypes + * @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 EntityTypes(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (EntityTypes.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = EntityTypes; + + /** + * Creates new EntityTypes service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @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 {EntityTypes} RPC service. Useful where requests and/or responses are streamed. + */ + EntityTypes.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|listEntityTypes}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef ListEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListEntityTypesResponse} [response] ListEntityTypesResponse + */ + + /** + * Calls ListEntityTypes. + * @function listEntityTypes + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IListEntityTypesRequest} request ListEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.ListEntityTypesCallback} callback Node-style callback called with the error, if any, and ListEntityTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.listEntityTypes = function listEntityTypes(request, callback) { + return this.rpcCall(listEntityTypes, $root.google.cloud.dialogflow.v2.ListEntityTypesRequest, $root.google.cloud.dialogflow.v2.ListEntityTypesResponse, request, callback); + }, "name", { value: "ListEntityTypes" }); + + /** + * Calls ListEntityTypes. + * @function listEntityTypes + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IListEntityTypesRequest} request ListEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|getEntityType}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef GetEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.EntityType} [response] EntityType + */ + + /** + * Calls GetEntityType. + * @function getEntityType + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IGetEntityTypeRequest} request GetEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.GetEntityTypeCallback} callback Node-style callback called with the error, if any, and EntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.getEntityType = function getEntityType(request, callback) { + return this.rpcCall(getEntityType, $root.google.cloud.dialogflow.v2.GetEntityTypeRequest, $root.google.cloud.dialogflow.v2.EntityType, request, callback); + }, "name", { value: "GetEntityType" }); + + /** + * Calls GetEntityType. + * @function getEntityType + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IGetEntityTypeRequest} request GetEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|createEntityType}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef CreateEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.EntityType} [response] EntityType + */ + + /** + * Calls CreateEntityType. + * @function createEntityType + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.ICreateEntityTypeRequest} request CreateEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.CreateEntityTypeCallback} callback Node-style callback called with the error, if any, and EntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.createEntityType = function createEntityType(request, callback) { + return this.rpcCall(createEntityType, $root.google.cloud.dialogflow.v2.CreateEntityTypeRequest, $root.google.cloud.dialogflow.v2.EntityType, request, callback); + }, "name", { value: "CreateEntityType" }); + + /** + * Calls CreateEntityType. + * @function createEntityType + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.ICreateEntityTypeRequest} request CreateEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|updateEntityType}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef UpdateEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.EntityType} [response] EntityType + */ + + /** + * Calls UpdateEntityType. + * @function updateEntityType + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateEntityTypeRequest} request UpdateEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.UpdateEntityTypeCallback} callback Node-style callback called with the error, if any, and EntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.updateEntityType = function updateEntityType(request, callback) { + return this.rpcCall(updateEntityType, $root.google.cloud.dialogflow.v2.UpdateEntityTypeRequest, $root.google.cloud.dialogflow.v2.EntityType, request, callback); + }, "name", { value: "UpdateEntityType" }); + + /** + * Calls UpdateEntityType. + * @function updateEntityType + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateEntityTypeRequest} request UpdateEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|deleteEntityType}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef DeleteEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteEntityType. + * @function deleteEntityType + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteEntityTypeRequest} request DeleteEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.DeleteEntityTypeCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.deleteEntityType = function deleteEntityType(request, callback) { + return this.rpcCall(deleteEntityType, $root.google.cloud.dialogflow.v2.DeleteEntityTypeRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteEntityType" }); + + /** + * Calls DeleteEntityType. + * @function deleteEntityType + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteEntityTypeRequest} request DeleteEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchUpdateEntityTypes}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef BatchUpdateEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchUpdateEntityTypes. + * @function batchUpdateEntityTypes + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest} request BatchUpdateEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchUpdateEntityTypes = function batchUpdateEntityTypes(request, callback) { + return this.rpcCall(batchUpdateEntityTypes, $root.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchUpdateEntityTypes" }); + + /** + * Calls BatchUpdateEntityTypes. + * @function batchUpdateEntityTypes + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest} request BatchUpdateEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchDeleteEntityTypes}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef BatchDeleteEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchDeleteEntityTypes. + * @function batchDeleteEntityTypes + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest} request BatchDeleteEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchDeleteEntityTypes = function batchDeleteEntityTypes(request, callback) { + return this.rpcCall(batchDeleteEntityTypes, $root.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchDeleteEntityTypes" }); + + /** + * Calls BatchDeleteEntityTypes. + * @function batchDeleteEntityTypes + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest} request BatchDeleteEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchCreateEntities}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef BatchCreateEntitiesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchCreateEntities. + * @function batchCreateEntities + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest} request BatchCreateEntitiesRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntitiesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchCreateEntities = function batchCreateEntities(request, callback) { + return this.rpcCall(batchCreateEntities, $root.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchCreateEntities" }); + + /** + * Calls BatchCreateEntities. + * @function batchCreateEntities + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest} request BatchCreateEntitiesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchUpdateEntities}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef BatchUpdateEntitiesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchUpdateEntities. + * @function batchUpdateEntities + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest} request BatchUpdateEntitiesRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntitiesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchUpdateEntities = function batchUpdateEntities(request, callback) { + return this.rpcCall(batchUpdateEntities, $root.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchUpdateEntities" }); + + /** + * Calls BatchUpdateEntities. + * @function batchUpdateEntities + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest} request BatchUpdateEntitiesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.EntityTypes|batchDeleteEntities}. + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @typedef BatchDeleteEntitiesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchDeleteEntities. + * @function batchDeleteEntities + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest} request BatchDeleteEntitiesRequest message or plain object + * @param {google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntitiesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchDeleteEntities = function batchDeleteEntities(request, callback) { + return this.rpcCall(batchDeleteEntities, $root.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchDeleteEntities" }); + + /** + * Calls BatchDeleteEntities. + * @function batchDeleteEntities + * @memberof google.cloud.dialogflow.v2.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest} request BatchDeleteEntitiesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return EntityTypes; + })(); + + v2.EntityType = (function() { + + /** + * Properties of an EntityType. + * @memberof google.cloud.dialogflow.v2 + * @interface IEntityType + * @property {string|null} [name] EntityType name + * @property {string|null} [displayName] EntityType displayName + * @property {google.cloud.dialogflow.v2.EntityType.Kind|null} [kind] EntityType kind + * @property {google.cloud.dialogflow.v2.EntityType.AutoExpansionMode|null} [autoExpansionMode] EntityType autoExpansionMode + * @property {Array.|null} [entities] EntityType entities + * @property {boolean|null} [enableFuzzyExtraction] EntityType enableFuzzyExtraction + */ + + /** + * Constructs a new EntityType. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an EntityType. + * @implements IEntityType + * @constructor + * @param {google.cloud.dialogflow.v2.IEntityType=} [properties] Properties to set + */ + function EntityType(properties) { + this.entities = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityType name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.EntityType + * @instance + */ + EntityType.prototype.name = ""; + + /** + * EntityType displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.EntityType + * @instance + */ + EntityType.prototype.displayName = ""; + + /** + * EntityType kind. + * @member {google.cloud.dialogflow.v2.EntityType.Kind} kind + * @memberof google.cloud.dialogflow.v2.EntityType + * @instance + */ + EntityType.prototype.kind = 0; + + /** + * EntityType autoExpansionMode. + * @member {google.cloud.dialogflow.v2.EntityType.AutoExpansionMode} autoExpansionMode + * @memberof google.cloud.dialogflow.v2.EntityType + * @instance + */ + EntityType.prototype.autoExpansionMode = 0; + + /** + * EntityType entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.v2.EntityType + * @instance + */ + EntityType.prototype.entities = $util.emptyArray; + + /** + * EntityType enableFuzzyExtraction. + * @member {boolean} enableFuzzyExtraction + * @memberof google.cloud.dialogflow.v2.EntityType + * @instance + */ + EntityType.prototype.enableFuzzyExtraction = false; + + /** + * Creates a new EntityType instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.EntityType + * @static + * @param {google.cloud.dialogflow.v2.IEntityType=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.EntityType} EntityType instance + */ + EntityType.create = function create(properties) { + return new EntityType(properties); + }; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.dialogflow.v2.EntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.EntityType + * @static + * @param {google.cloud.dialogflow.v2.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.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.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.kind); + if (message.autoExpansionMode != null && Object.hasOwnProperty.call(message, "autoExpansionMode")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.autoExpansionMode); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.v2.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.enableFuzzyExtraction != null && Object.hasOwnProperty.call(message, "enableFuzzyExtraction")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.enableFuzzyExtraction); + return writer; + }; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.EntityType + * @static + * @param {google.cloud.dialogflow.v2.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.EntityType(); + 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.kind = reader.int32(); + break; + } + case 4: { + message.autoExpansionMode = reader.int32(); + break; + } + case 6: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.v2.EntityType.Entity.decode(reader, reader.uint32())); + break; + } + case 7: { + message.enableFuzzyExtraction = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityType message. + * @function verify + * @memberof google.cloud.dialogflow.v2.EntityType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityType.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.kind != null && message.hasOwnProperty("kind")) + switch (message.kind) { + default: + return "kind: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.autoExpansionMode != null && message.hasOwnProperty("autoExpansionMode")) + switch (message.autoExpansionMode) { + default: + return "autoExpansionMode: enum value expected"; + case 0: + case 1: + break; + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.enableFuzzyExtraction != null && message.hasOwnProperty("enableFuzzyExtraction")) + if (typeof message.enableFuzzyExtraction !== "boolean") + return "enableFuzzyExtraction: boolean expected"; + return null; + }; + + /** + * Creates an EntityType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.EntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.EntityType} EntityType + */ + EntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.EntityType) + return object; + var message = new $root.google.cloud.dialogflow.v2.EntityType(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.kind) { + default: + if (typeof object.kind === "number") { + message.kind = object.kind; + break; + } + break; + case "KIND_UNSPECIFIED": + case 0: + message.kind = 0; + break; + case "KIND_MAP": + case 1: + message.kind = 1; + break; + case "KIND_LIST": + case 2: + message.kind = 2; + break; + case "KIND_REGEXP": + case 3: + message.kind = 3; + break; + } + switch (object.autoExpansionMode) { + default: + if (typeof object.autoExpansionMode === "number") { + message.autoExpansionMode = object.autoExpansionMode; + break; + } + break; + case "AUTO_EXPANSION_MODE_UNSPECIFIED": + case 0: + message.autoExpansionMode = 0; + break; + case "AUTO_EXPANSION_MODE_DEFAULT": + case 1: + message.autoExpansionMode = 1; + break; + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.v2.EntityType.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.EntityType.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.v2.EntityType.Entity.fromObject(object.entities[i]); + } + } + if (object.enableFuzzyExtraction != null) + message.enableFuzzyExtraction = Boolean(object.enableFuzzyExtraction); + return message; + }; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.EntityType + * @static + * @param {google.cloud.dialogflow.v2.EntityType} message EntityType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entities = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.kind = options.enums === String ? "KIND_UNSPECIFIED" : 0; + object.autoExpansionMode = options.enums === String ? "AUTO_EXPANSION_MODE_UNSPECIFIED" : 0; + object.enableFuzzyExtraction = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = options.enums === String ? $root.google.cloud.dialogflow.v2.EntityType.Kind[message.kind] === undefined ? message.kind : $root.google.cloud.dialogflow.v2.EntityType.Kind[message.kind] : message.kind; + if (message.autoExpansionMode != null && message.hasOwnProperty("autoExpansionMode")) + object.autoExpansionMode = options.enums === String ? $root.google.cloud.dialogflow.v2.EntityType.AutoExpansionMode[message.autoExpansionMode] === undefined ? message.autoExpansionMode : $root.google.cloud.dialogflow.v2.EntityType.AutoExpansionMode[message.autoExpansionMode] : message.autoExpansionMode; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.v2.EntityType.Entity.toObject(message.entities[j], options); + } + if (message.enableFuzzyExtraction != null && message.hasOwnProperty("enableFuzzyExtraction")) + object.enableFuzzyExtraction = message.enableFuzzyExtraction; + return object; + }; + + /** + * Converts this EntityType to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.EntityType + * @instance + * @returns {Object.} JSON object + */ + EntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EntityType + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.EntityType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.EntityType"; + }; + + /** + * Kind enum. + * @name google.cloud.dialogflow.v2.EntityType.Kind + * @enum {number} + * @property {number} KIND_UNSPECIFIED=0 KIND_UNSPECIFIED value + * @property {number} KIND_MAP=1 KIND_MAP value + * @property {number} KIND_LIST=2 KIND_LIST value + * @property {number} KIND_REGEXP=3 KIND_REGEXP value + */ + EntityType.Kind = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "KIND_UNSPECIFIED"] = 0; + values[valuesById[1] = "KIND_MAP"] = 1; + values[valuesById[2] = "KIND_LIST"] = 2; + values[valuesById[3] = "KIND_REGEXP"] = 3; + return values; + })(); + + /** + * AutoExpansionMode enum. + * @name google.cloud.dialogflow.v2.EntityType.AutoExpansionMode + * @enum {number} + * @property {number} AUTO_EXPANSION_MODE_UNSPECIFIED=0 AUTO_EXPANSION_MODE_UNSPECIFIED value + * @property {number} AUTO_EXPANSION_MODE_DEFAULT=1 AUTO_EXPANSION_MODE_DEFAULT value + */ + EntityType.AutoExpansionMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUTO_EXPANSION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTO_EXPANSION_MODE_DEFAULT"] = 1; + return values; + })(); + + EntityType.Entity = (function() { + + /** + * Properties of an Entity. + * @memberof google.cloud.dialogflow.v2.EntityType + * @interface IEntity + * @property {string|null} [value] Entity value + * @property {Array.|null} [synonyms] Entity synonyms + */ + + /** + * Constructs a new Entity. + * @memberof google.cloud.dialogflow.v2.EntityType + * @classdesc Represents an Entity. + * @implements IEntity + * @constructor + * @param {google.cloud.dialogflow.v2.EntityType.IEntity=} [properties] Properties to set + */ + function Entity(properties) { + this.synonyms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entity value. + * @member {string} value + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @instance + */ + Entity.prototype.value = ""; + + /** + * Entity synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @instance + */ + Entity.prototype.synonyms = $util.emptyArray; + + /** + * Creates a new Entity instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.v2.EntityType.IEntity=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.EntityType.Entity} Entity instance + */ + Entity.create = function create(properties) { + return new Entity(properties); + }; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.dialogflow.v2.EntityType.Entity.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.v2.EntityType.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.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); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.synonyms[i]); + return writer; + }; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EntityType.Entity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.v2.EntityType.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.EntityType.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.EntityType.Entity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + case 2: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.EntityType.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entity message. + * @function verify + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entity.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"; + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + return null; + }; + + /** + * Creates an Entity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.EntityType.Entity} Entity + */ + Entity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.EntityType.Entity) + return object; + var message = new $root.google.cloud.dialogflow.v2.EntityType.Entity(); + if (object.value != null) + message.value = String(object.value); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.dialogflow.v2.EntityType.Entity.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + return message; + }; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.v2.EntityType.Entity} message Entity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this Entity to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @instance + * @returns {Object.} JSON object + */ + Entity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Entity + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.EntityType.Entity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.EntityType.Entity"; + }; + + return Entity; + })(); + + return EntityType; + })(); + + v2.ListEntityTypesRequest = (function() { + + /** + * Properties of a ListEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListEntityTypesRequest + * @property {string|null} [parent] ListEntityTypesRequest parent + * @property {string|null} [languageCode] ListEntityTypesRequest languageCode + * @property {number|null} [pageSize] ListEntityTypesRequest pageSize + * @property {string|null} [pageToken] ListEntityTypesRequest pageToken + */ + + /** + * Constructs a new ListEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListEntityTypesRequest. + * @implements IListEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListEntityTypesRequest=} [properties] Properties to set + */ + function ListEntityTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.parent = ""; + + /** + * ListEntityTypesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.languageCode = ""; + + /** + * ListEntityTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.pageSize = 0; + + /** + * ListEntityTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListEntityTypesRequest} ListEntityTypesRequest instance + */ + ListEntityTypesRequest.create = function create(properties) { + return new ListEntityTypesRequest(properties); + }; + + /** + * Encodes the specified ListEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListEntityTypesRequest} message ListEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListEntityTypesRequest} message ListEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListEntityTypesRequest} ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListEntityTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListEntityTypesRequest} ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEntityTypesRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: 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 ListEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListEntityTypesRequest} ListEntityTypesRequest + */ + ListEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListEntityTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + 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 ListEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.ListEntityTypesRequest} message ListEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEntityTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + 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 ListEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEntityTypesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListEntityTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEntityTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListEntityTypesRequest"; + }; + + return ListEntityTypesRequest; + })(); + + v2.ListEntityTypesResponse = (function() { + + /** + * Properties of a ListEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListEntityTypesResponse + * @property {Array.|null} [entityTypes] ListEntityTypesResponse entityTypes + * @property {string|null} [nextPageToken] ListEntityTypesResponse nextPageToken + */ + + /** + * Constructs a new ListEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListEntityTypesResponse. + * @implements IListEntityTypesResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListEntityTypesResponse=} [properties] Properties to set + */ + function ListEntityTypesResponse(properties) { + this.entityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEntityTypesResponse entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @instance + */ + ListEntityTypesResponse.prototype.entityTypes = $util.emptyArray; + + /** + * ListEntityTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @instance + */ + ListEntityTypesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListEntityTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListEntityTypesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListEntityTypesResponse} ListEntityTypesResponse instance + */ + ListEntityTypesResponse.create = function create(properties) { + return new ListEntityTypesResponse(properties); + }; + + /** + * Encodes the specified ListEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListEntityTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListEntityTypesResponse} message ListEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.dialogflow.v2.EntityType.encode(message.entityTypes[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 ListEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListEntityTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListEntityTypesResponse} message ListEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListEntityTypesResponse} ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListEntityTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.dialogflow.v2.EntityType.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListEntityTypesResponse} ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEntityTypesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEntityTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListEntityTypesResponse} ListEntityTypesResponse + */ + ListEntityTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListEntityTypesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListEntityTypesResponse(); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.dialogflow.v2.ListEntityTypesResponse.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListEntityTypesResponse.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.dialogflow.v2.EntityType.fromObject(object.entityTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListEntityTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.ListEntityTypesResponse} message ListEntityTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEntityTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.dialogflow.v2.EntityType.toObject(message.entityTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListEntityTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListEntityTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEntityTypesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListEntityTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEntityTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListEntityTypesResponse"; + }; + + return ListEntityTypesResponse; + })(); + + v2.GetEntityTypeRequest = (function() { + + /** + * Properties of a GetEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetEntityTypeRequest + * @property {string|null} [name] GetEntityTypeRequest name + * @property {string|null} [languageCode] GetEntityTypeRequest languageCode + */ + + /** + * Constructs a new GetEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetEntityTypeRequest. + * @implements IGetEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetEntityTypeRequest=} [properties] Properties to set + */ + function GetEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @instance + */ + GetEntityTypeRequest.prototype.name = ""; + + /** + * GetEntityTypeRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @instance + */ + GetEntityTypeRequest.prototype.languageCode = ""; + + /** + * Creates a new GetEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetEntityTypeRequest} GetEntityTypeRequest instance + */ + GetEntityTypeRequest.create = function create(properties) { + return new GetEntityTypeRequest(properties); + }; + + /** + * Encodes the specified GetEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetEntityTypeRequest} message GetEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEntityTypeRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified GetEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetEntityTypeRequest} message GetEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetEntityTypeRequest} GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetEntityTypeRequest} GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEntityTypeRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a GetEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetEntityTypeRequest} GetEntityTypeRequest + */ + GetEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a GetEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.GetEntityTypeRequest} message GetEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this GetEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + GetEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetEntityTypeRequest"; + }; + + return GetEntityTypeRequest; + })(); + + v2.CreateEntityTypeRequest = (function() { + + /** + * Properties of a CreateEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateEntityTypeRequest + * @property {string|null} [parent] CreateEntityTypeRequest parent + * @property {google.cloud.dialogflow.v2.IEntityType|null} [entityType] CreateEntityTypeRequest entityType + * @property {string|null} [languageCode] CreateEntityTypeRequest languageCode + */ + + /** + * Constructs a new CreateEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateEntityTypeRequest. + * @implements ICreateEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateEntityTypeRequest=} [properties] Properties to set + */ + function CreateEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateEntityTypeRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @instance + */ + CreateEntityTypeRequest.prototype.parent = ""; + + /** + * CreateEntityTypeRequest entityType. + * @member {google.cloud.dialogflow.v2.IEntityType|null|undefined} entityType + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @instance + */ + CreateEntityTypeRequest.prototype.entityType = null; + + /** + * CreateEntityTypeRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @instance + */ + CreateEntityTypeRequest.prototype.languageCode = ""; + + /** + * Creates a new CreateEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateEntityTypeRequest} CreateEntityTypeRequest instance + */ + CreateEntityTypeRequest.create = function create(properties) { + return new CreateEntityTypeRequest(properties); + }; + + /** + * Encodes the specified CreateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateEntityTypeRequest} message CreateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEntityTypeRequest.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.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + $root.google.cloud.dialogflow.v2.EntityType.encode(message.entityType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified CreateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateEntityTypeRequest} message CreateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateEntityTypeRequest} CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.entityType = $root.google.cloud.dialogflow.v2.EntityType.decode(reader, reader.uint32()); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateEntityTypeRequest} CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateEntityTypeRequest.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.entityType != null && message.hasOwnProperty("entityType")) { + var error = $root.google.cloud.dialogflow.v2.EntityType.verify(message.entityType); + if (error) + return "entityType." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a CreateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateEntityTypeRequest} CreateEntityTypeRequest + */ + CreateEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateEntityTypeRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entityType != null) { + if (typeof object.entityType !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateEntityTypeRequest.entityType: object expected"); + message.entityType = $root.google.cloud.dialogflow.v2.EntityType.fromObject(object.entityType); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a CreateEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateEntityTypeRequest} message CreateEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.entityType = null; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = $root.google.cloud.dialogflow.v2.EntityType.toObject(message.entityType, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this CreateEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + CreateEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateEntityTypeRequest"; + }; + + return CreateEntityTypeRequest; + })(); + + v2.UpdateEntityTypeRequest = (function() { + + /** + * Properties of an UpdateEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateEntityTypeRequest + * @property {google.cloud.dialogflow.v2.IEntityType|null} [entityType] UpdateEntityTypeRequest entityType + * @property {string|null} [languageCode] UpdateEntityTypeRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateEntityTypeRequest updateMask + */ + + /** + * Constructs a new UpdateEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateEntityTypeRequest. + * @implements IUpdateEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateEntityTypeRequest=} [properties] Properties to set + */ + function UpdateEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateEntityTypeRequest entityType. + * @member {google.cloud.dialogflow.v2.IEntityType|null|undefined} entityType + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @instance + */ + UpdateEntityTypeRequest.prototype.entityType = null; + + /** + * UpdateEntityTypeRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @instance + */ + UpdateEntityTypeRequest.prototype.languageCode = ""; + + /** + * UpdateEntityTypeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @instance + */ + UpdateEntityTypeRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateEntityTypeRequest} UpdateEntityTypeRequest instance + */ + UpdateEntityTypeRequest.create = function create(properties) { + return new UpdateEntityTypeRequest(properties); + }; + + /** + * Encodes the specified UpdateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateEntityTypeRequest} message UpdateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEntityTypeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + $root.google.cloud.dialogflow.v2.EntityType.encode(message.entityType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateEntityTypeRequest} message UpdateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateEntityTypeRequest} UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.entityType = $root.google.cloud.dialogflow.v2.EntityType.decode(reader, reader.uint32()); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateEntityTypeRequest} UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateEntityTypeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) { + var error = $root.google.cloud.dialogflow.v2.EntityType.verify(message.entityType); + if (error) + return "entityType." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + 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 UpdateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateEntityTypeRequest} UpdateEntityTypeRequest + */ + UpdateEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateEntityTypeRequest(); + if (object.entityType != null) { + if (typeof object.entityType !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateEntityTypeRequest.entityType: object expected"); + message.entityType = $root.google.cloud.dialogflow.v2.EntityType.fromObject(object.entityType); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateEntityTypeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateEntityTypeRequest} message UpdateEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.entityType = null; + object.languageCode = ""; + object.updateMask = null; + } + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = $root.google.cloud.dialogflow.v2.EntityType.toObject(message.entityType, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateEntityTypeRequest"; + }; + + return UpdateEntityTypeRequest; + })(); + + v2.DeleteEntityTypeRequest = (function() { + + /** + * Properties of a DeleteEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteEntityTypeRequest + * @property {string|null} [name] DeleteEntityTypeRequest name + */ + + /** + * Constructs a new DeleteEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteEntityTypeRequest. + * @implements IDeleteEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteEntityTypeRequest=} [properties] Properties to set + */ + function DeleteEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @instance + */ + DeleteEntityTypeRequest.prototype.name = ""; + + /** + * Creates a new DeleteEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteEntityTypeRequest} DeleteEntityTypeRequest instance + */ + DeleteEntityTypeRequest.create = function create(properties) { + return new DeleteEntityTypeRequest(properties); + }; + + /** + * Encodes the specified DeleteEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteEntityTypeRequest} message DeleteEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEntityTypeRequest.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 DeleteEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteEntityTypeRequest} message DeleteEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteEntityTypeRequest} DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteEntityTypeRequest(); + 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 DeleteEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteEntityTypeRequest} DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteEntityTypeRequest.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 DeleteEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteEntityTypeRequest} DeleteEntityTypeRequest + */ + DeleteEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteEntityTypeRequest} message DeleteEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteEntityTypeRequest.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 DeleteEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteEntityTypeRequest"; + }; + + return DeleteEntityTypeRequest; + })(); + + v2.BatchUpdateEntityTypesRequest = (function() { + + /** + * Properties of a BatchUpdateEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IBatchUpdateEntityTypesRequest + * @property {string|null} [parent] BatchUpdateEntityTypesRequest parent + * @property {string|null} [entityTypeBatchUri] BatchUpdateEntityTypesRequest entityTypeBatchUri + * @property {google.cloud.dialogflow.v2.IEntityTypeBatch|null} [entityTypeBatchInline] BatchUpdateEntityTypesRequest entityTypeBatchInline + * @property {string|null} [languageCode] BatchUpdateEntityTypesRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] BatchUpdateEntityTypesRequest updateMask + */ + + /** + * Constructs a new BatchUpdateEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a BatchUpdateEntityTypesRequest. + * @implements IBatchUpdateEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest=} [properties] Properties to set + */ + function BatchUpdateEntityTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.parent = ""; + + /** + * BatchUpdateEntityTypesRequest entityTypeBatchUri. + * @member {string|null|undefined} entityTypeBatchUri + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.entityTypeBatchUri = null; + + /** + * BatchUpdateEntityTypesRequest entityTypeBatchInline. + * @member {google.cloud.dialogflow.v2.IEntityTypeBatch|null|undefined} entityTypeBatchInline + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.entityTypeBatchInline = null; + + /** + * BatchUpdateEntityTypesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.languageCode = ""; + + /** + * BatchUpdateEntityTypesRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.updateMask = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchUpdateEntityTypesRequest entityTypeBatch. + * @member {"entityTypeBatchUri"|"entityTypeBatchInline"|undefined} entityTypeBatch + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @instance + */ + Object.defineProperty(BatchUpdateEntityTypesRequest.prototype, "entityTypeBatch", { + get: $util.oneOfGetter($oneOfFields = ["entityTypeBatchUri", "entityTypeBatchInline"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchUpdateEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest} BatchUpdateEntityTypesRequest instance + */ + BatchUpdateEntityTypesRequest.create = function create(properties) { + return new BatchUpdateEntityTypesRequest(properties); + }; + + /** + * Encodes the specified BatchUpdateEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest} message BatchUpdateEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntityTypesRequest.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.entityTypeBatchUri != null && Object.hasOwnProperty.call(message, "entityTypeBatchUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityTypeBatchUri); + if (message.entityTypeBatchInline != null && Object.hasOwnProperty.call(message, "entityTypeBatchInline")) + $root.google.cloud.dialogflow.v2.EntityTypeBatch.encode(message.entityTypeBatchInline, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchUpdateEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest} message BatchUpdateEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest} BatchUpdateEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntityTypesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.entityTypeBatchUri = reader.string(); + break; + } + case 3: { + message.entityTypeBatchInline = $root.google.cloud.dialogflow.v2.EntityTypeBatch.decode(reader, reader.uint32()); + break; + } + case 4: { + message.languageCode = reader.string(); + break; + } + case 5: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest} BatchUpdateEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateEntityTypesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.entityTypeBatchUri != null && message.hasOwnProperty("entityTypeBatchUri")) { + properties.entityTypeBatch = 1; + if (!$util.isString(message.entityTypeBatchUri)) + return "entityTypeBatchUri: string expected"; + } + if (message.entityTypeBatchInline != null && message.hasOwnProperty("entityTypeBatchInline")) { + if (properties.entityTypeBatch === 1) + return "entityTypeBatch: multiple values"; + properties.entityTypeBatch = 1; + { + var error = $root.google.cloud.dialogflow.v2.EntityTypeBatch.verify(message.entityTypeBatchInline); + if (error) + return "entityTypeBatchInline." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates a BatchUpdateEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest} BatchUpdateEntityTypesRequest + */ + BatchUpdateEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entityTypeBatchUri != null) + message.entityTypeBatchUri = String(object.entityTypeBatchUri); + if (object.entityTypeBatchInline != null) { + if (typeof object.entityTypeBatchInline !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.entityTypeBatchInline: object expected"); + message.entityTypeBatchInline = $root.google.cloud.dialogflow.v2.EntityTypeBatch.fromObject(object.entityTypeBatchInline); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest} message BatchUpdateEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateEntityTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.updateMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entityTypeBatchUri != null && message.hasOwnProperty("entityTypeBatchUri")) { + object.entityTypeBatchUri = message.entityTypeBatchUri; + if (options.oneofs) + object.entityTypeBatch = "entityTypeBatchUri"; + } + if (message.entityTypeBatchInline != null && message.hasOwnProperty("entityTypeBatchInline")) { + object.entityTypeBatchInline = $root.google.cloud.dialogflow.v2.EntityTypeBatch.toObject(message.entityTypeBatchInline, options); + if (options.oneofs) + object.entityTypeBatch = "entityTypeBatchInline"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this BatchUpdateEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateEntityTypesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateEntityTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest"; + }; + + return BatchUpdateEntityTypesRequest; + })(); + + v2.BatchUpdateEntityTypesResponse = (function() { + + /** + * Properties of a BatchUpdateEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IBatchUpdateEntityTypesResponse + * @property {Array.|null} [entityTypes] BatchUpdateEntityTypesResponse entityTypes + */ + + /** + * Constructs a new BatchUpdateEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a BatchUpdateEntityTypesResponse. + * @implements IBatchUpdateEntityTypesResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse=} [properties] Properties to set + */ + function BatchUpdateEntityTypesResponse(properties) { + this.entityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateEntityTypesResponse entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @instance + */ + BatchUpdateEntityTypesResponse.prototype.entityTypes = $util.emptyArray; + + /** + * Creates a new BatchUpdateEntityTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse} BatchUpdateEntityTypesResponse instance + */ + BatchUpdateEntityTypesResponse.create = function create(properties) { + return new BatchUpdateEntityTypesResponse(properties); + }; + + /** + * Encodes the specified BatchUpdateEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse} message BatchUpdateEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntityTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.dialogflow.v2.EntityType.encode(message.entityTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchUpdateEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse} message BatchUpdateEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntityTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateEntityTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse} BatchUpdateEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntityTypesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.dialogflow.v2.EntityType.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateEntityTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse} BatchUpdateEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntityTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateEntityTypesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateEntityTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + return null; + }; + + /** + * Creates a BatchUpdateEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse} BatchUpdateEntityTypesResponse + */ + BatchUpdateEntityTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse(); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.dialogflow.v2.EntityType.fromObject(object.entityTypes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateEntityTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse} message BatchUpdateEntityTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateEntityTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.dialogflow.v2.EntityType.toObject(message.entityTypes[j], options); + } + return object; + }; + + /** + * Converts this BatchUpdateEntityTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateEntityTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateEntityTypesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateEntityTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse"; + }; + + return BatchUpdateEntityTypesResponse; + })(); + + v2.BatchDeleteEntityTypesRequest = (function() { + + /** + * Properties of a BatchDeleteEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IBatchDeleteEntityTypesRequest + * @property {string|null} [parent] BatchDeleteEntityTypesRequest parent + * @property {Array.|null} [entityTypeNames] BatchDeleteEntityTypesRequest entityTypeNames + */ + + /** + * Constructs a new BatchDeleteEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a BatchDeleteEntityTypesRequest. + * @implements IBatchDeleteEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest=} [properties] Properties to set + */ + function BatchDeleteEntityTypesRequest(properties) { + this.entityTypeNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDeleteEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @instance + */ + BatchDeleteEntityTypesRequest.prototype.parent = ""; + + /** + * BatchDeleteEntityTypesRequest entityTypeNames. + * @member {Array.} entityTypeNames + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @instance + */ + BatchDeleteEntityTypesRequest.prototype.entityTypeNames = $util.emptyArray; + + /** + * Creates a new BatchDeleteEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest} BatchDeleteEntityTypesRequest instance + */ + BatchDeleteEntityTypesRequest.create = function create(properties) { + return new BatchDeleteEntityTypesRequest(properties); + }; + + /** + * Encodes the specified BatchDeleteEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest} message BatchDeleteEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteEntityTypesRequest.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.entityTypeNames != null && message.entityTypeNames.length) + for (var i = 0; i < message.entityTypeNames.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityTypeNames[i]); + return writer; + }; + + /** + * Encodes the specified BatchDeleteEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest} message BatchDeleteEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDeleteEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest} BatchDeleteEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteEntityTypesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entityTypeNames && message.entityTypeNames.length)) + message.entityTypeNames = []; + message.entityTypeNames.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDeleteEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest} BatchDeleteEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDeleteEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDeleteEntityTypesRequest.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.entityTypeNames != null && message.hasOwnProperty("entityTypeNames")) { + if (!Array.isArray(message.entityTypeNames)) + return "entityTypeNames: array expected"; + for (var i = 0; i < message.entityTypeNames.length; ++i) + if (!$util.isString(message.entityTypeNames[i])) + return "entityTypeNames: string[] expected"; + } + return null; + }; + + /** + * Creates a BatchDeleteEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest} BatchDeleteEntityTypesRequest + */ + BatchDeleteEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entityTypeNames) { + if (!Array.isArray(object.entityTypeNames)) + throw TypeError(".google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest.entityTypeNames: array expected"); + message.entityTypeNames = []; + for (var i = 0; i < object.entityTypeNames.length; ++i) + message.entityTypeNames[i] = String(object.entityTypeNames[i]); + } + return message; + }; + + /** + * Creates a plain object from a BatchDeleteEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest} message BatchDeleteEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDeleteEntityTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypeNames = []; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entityTypeNames && message.entityTypeNames.length) { + object.entityTypeNames = []; + for (var j = 0; j < message.entityTypeNames.length; ++j) + object.entityTypeNames[j] = message.entityTypeNames[j]; + } + return object; + }; + + /** + * Converts this BatchDeleteEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchDeleteEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDeleteEntityTypesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDeleteEntityTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest"; + }; + + return BatchDeleteEntityTypesRequest; + })(); + + v2.BatchCreateEntitiesRequest = (function() { + + /** + * Properties of a BatchCreateEntitiesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IBatchCreateEntitiesRequest + * @property {string|null} [parent] BatchCreateEntitiesRequest parent + * @property {Array.|null} [entities] BatchCreateEntitiesRequest entities + * @property {string|null} [languageCode] BatchCreateEntitiesRequest languageCode + */ + + /** + * Constructs a new BatchCreateEntitiesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a BatchCreateEntitiesRequest. + * @implements IBatchCreateEntitiesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest=} [properties] Properties to set + */ + function BatchCreateEntitiesRequest(properties) { + this.entities = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchCreateEntitiesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @instance + */ + BatchCreateEntitiesRequest.prototype.parent = ""; + + /** + * BatchCreateEntitiesRequest entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @instance + */ + BatchCreateEntitiesRequest.prototype.entities = $util.emptyArray; + + /** + * BatchCreateEntitiesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @instance + */ + BatchCreateEntitiesRequest.prototype.languageCode = ""; + + /** + * Creates a new BatchCreateEntitiesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.BatchCreateEntitiesRequest} BatchCreateEntitiesRequest instance + */ + BatchCreateEntitiesRequest.create = function create(properties) { + return new BatchCreateEntitiesRequest(properties); + }; + + /** + * Encodes the specified BatchCreateEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchCreateEntitiesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest} message BatchCreateEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchCreateEntitiesRequest.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.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.v2.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified BatchCreateEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchCreateEntitiesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest} message BatchCreateEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchCreateEntitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchCreateEntitiesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.BatchCreateEntitiesRequest} BatchCreateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchCreateEntitiesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.v2.EntityType.Entity.decode(reader, reader.uint32())); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchCreateEntitiesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.BatchCreateEntitiesRequest} BatchCreateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchCreateEntitiesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchCreateEntitiesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchCreateEntitiesRequest.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.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a BatchCreateEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.BatchCreateEntitiesRequest} BatchCreateEntitiesRequest + */ + BatchCreateEntitiesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.v2.BatchCreateEntitiesRequest.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchCreateEntitiesRequest.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.v2.EntityType.Entity.fromObject(object.entities[i]); + } + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a BatchCreateEntitiesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.BatchCreateEntitiesRequest} message BatchCreateEntitiesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchCreateEntitiesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entities = []; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.v2.EntityType.Entity.toObject(message.entities[j], options); + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this BatchCreateEntitiesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchCreateEntitiesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchCreateEntitiesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.BatchCreateEntitiesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchCreateEntitiesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.BatchCreateEntitiesRequest"; + }; + + return BatchCreateEntitiesRequest; + })(); + + v2.BatchUpdateEntitiesRequest = (function() { + + /** + * Properties of a BatchUpdateEntitiesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IBatchUpdateEntitiesRequest + * @property {string|null} [parent] BatchUpdateEntitiesRequest parent + * @property {Array.|null} [entities] BatchUpdateEntitiesRequest entities + * @property {string|null} [languageCode] BatchUpdateEntitiesRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] BatchUpdateEntitiesRequest updateMask + */ + + /** + * Constructs a new BatchUpdateEntitiesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a BatchUpdateEntitiesRequest. + * @implements IBatchUpdateEntitiesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest=} [properties] Properties to set + */ + function BatchUpdateEntitiesRequest(properties) { + this.entities = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateEntitiesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @instance + */ + BatchUpdateEntitiesRequest.prototype.parent = ""; + + /** + * BatchUpdateEntitiesRequest entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @instance + */ + BatchUpdateEntitiesRequest.prototype.entities = $util.emptyArray; + + /** + * BatchUpdateEntitiesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @instance + */ + BatchUpdateEntitiesRequest.prototype.languageCode = ""; + + /** + * BatchUpdateEntitiesRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @instance + */ + BatchUpdateEntitiesRequest.prototype.updateMask = null; + + /** + * Creates a new BatchUpdateEntitiesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest} BatchUpdateEntitiesRequest instance + */ + BatchUpdateEntitiesRequest.create = function create(properties) { + return new BatchUpdateEntitiesRequest(properties); + }; + + /** + * Encodes the specified BatchUpdateEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest} message BatchUpdateEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntitiesRequest.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.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.v2.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchUpdateEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest} message BatchUpdateEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateEntitiesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest} BatchUpdateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntitiesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.v2.EntityType.Entity.decode(reader, reader.uint32())); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 4: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateEntitiesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest} BatchUpdateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntitiesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateEntitiesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateEntitiesRequest.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.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates a BatchUpdateEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest} BatchUpdateEntitiesRequest + */ + BatchUpdateEntitiesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.v2.EntityType.Entity.fromObject(object.entities[i]); + } + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateEntitiesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest} message BatchUpdateEntitiesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateEntitiesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entities = []; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.updateMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.v2.EntityType.Entity.toObject(message.entities[j], options); + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this BatchUpdateEntitiesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateEntitiesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateEntitiesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateEntitiesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest"; + }; + + return BatchUpdateEntitiesRequest; + })(); + + v2.BatchDeleteEntitiesRequest = (function() { + + /** + * Properties of a BatchDeleteEntitiesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IBatchDeleteEntitiesRequest + * @property {string|null} [parent] BatchDeleteEntitiesRequest parent + * @property {Array.|null} [entityValues] BatchDeleteEntitiesRequest entityValues + * @property {string|null} [languageCode] BatchDeleteEntitiesRequest languageCode + */ + + /** + * Constructs a new BatchDeleteEntitiesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a BatchDeleteEntitiesRequest. + * @implements IBatchDeleteEntitiesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest=} [properties] Properties to set + */ + function BatchDeleteEntitiesRequest(properties) { + this.entityValues = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDeleteEntitiesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @instance + */ + BatchDeleteEntitiesRequest.prototype.parent = ""; + + /** + * BatchDeleteEntitiesRequest entityValues. + * @member {Array.} entityValues + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @instance + */ + BatchDeleteEntitiesRequest.prototype.entityValues = $util.emptyArray; + + /** + * BatchDeleteEntitiesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @instance + */ + BatchDeleteEntitiesRequest.prototype.languageCode = ""; + + /** + * Creates a new BatchDeleteEntitiesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest} BatchDeleteEntitiesRequest instance + */ + BatchDeleteEntitiesRequest.create = function create(properties) { + return new BatchDeleteEntitiesRequest(properties); + }; + + /** + * Encodes the specified BatchDeleteEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest} message BatchDeleteEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteEntitiesRequest.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.entityValues != null && message.entityValues.length) + for (var i = 0; i < message.entityValues.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityValues[i]); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified BatchDeleteEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest} message BatchDeleteEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteEntitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDeleteEntitiesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest} BatchDeleteEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteEntitiesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entityValues && message.entityValues.length)) + message.entityValues = []; + message.entityValues.push(reader.string()); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDeleteEntitiesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest} BatchDeleteEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteEntitiesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDeleteEntitiesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDeleteEntitiesRequest.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.entityValues != null && message.hasOwnProperty("entityValues")) { + if (!Array.isArray(message.entityValues)) + return "entityValues: array expected"; + for (var i = 0; i < message.entityValues.length; ++i) + if (!$util.isString(message.entityValues[i])) + return "entityValues: string[] expected"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a BatchDeleteEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest} BatchDeleteEntitiesRequest + */ + BatchDeleteEntitiesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entityValues) { + if (!Array.isArray(object.entityValues)) + throw TypeError(".google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest.entityValues: array expected"); + message.entityValues = []; + for (var i = 0; i < object.entityValues.length; ++i) + message.entityValues[i] = String(object.entityValues[i]); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a BatchDeleteEntitiesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest} message BatchDeleteEntitiesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDeleteEntitiesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityValues = []; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entityValues && message.entityValues.length) { + object.entityValues = []; + for (var j = 0; j < message.entityValues.length; ++j) + object.entityValues[j] = message.entityValues[j]; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this BatchDeleteEntitiesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchDeleteEntitiesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDeleteEntitiesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDeleteEntitiesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest"; + }; + + return BatchDeleteEntitiesRequest; + })(); + + v2.EntityTypeBatch = (function() { + + /** + * Properties of an EntityTypeBatch. + * @memberof google.cloud.dialogflow.v2 + * @interface IEntityTypeBatch + * @property {Array.|null} [entityTypes] EntityTypeBatch entityTypes + */ + + /** + * Constructs a new EntityTypeBatch. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an EntityTypeBatch. + * @implements IEntityTypeBatch + * @constructor + * @param {google.cloud.dialogflow.v2.IEntityTypeBatch=} [properties] Properties to set + */ + function EntityTypeBatch(properties) { + this.entityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityTypeBatch entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @instance + */ + EntityTypeBatch.prototype.entityTypes = $util.emptyArray; + + /** + * Creates a new EntityTypeBatch instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @static + * @param {google.cloud.dialogflow.v2.IEntityTypeBatch=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.EntityTypeBatch} EntityTypeBatch instance + */ + EntityTypeBatch.create = function create(properties) { + return new EntityTypeBatch(properties); + }; + + /** + * Encodes the specified EntityTypeBatch message. Does not implicitly {@link google.cloud.dialogflow.v2.EntityTypeBatch.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @static + * @param {google.cloud.dialogflow.v2.IEntityTypeBatch} message EntityTypeBatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityTypeBatch.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.dialogflow.v2.EntityType.encode(message.entityTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EntityTypeBatch message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EntityTypeBatch.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @static + * @param {google.cloud.dialogflow.v2.IEntityTypeBatch} message EntityTypeBatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityTypeBatch.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityTypeBatch message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.EntityTypeBatch} EntityTypeBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityTypeBatch.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.EntityTypeBatch(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.dialogflow.v2.EntityType.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityTypeBatch message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.EntityTypeBatch} EntityTypeBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityTypeBatch.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityTypeBatch message. + * @function verify + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityTypeBatch.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + return null; + }; + + /** + * Creates an EntityTypeBatch message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.EntityTypeBatch} EntityTypeBatch + */ + EntityTypeBatch.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.EntityTypeBatch) + return object; + var message = new $root.google.cloud.dialogflow.v2.EntityTypeBatch(); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.dialogflow.v2.EntityTypeBatch.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.EntityTypeBatch.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.dialogflow.v2.EntityType.fromObject(object.entityTypes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EntityTypeBatch message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @static + * @param {google.cloud.dialogflow.v2.EntityTypeBatch} message EntityTypeBatch + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityTypeBatch.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.dialogflow.v2.EntityType.toObject(message.entityTypes[j], options); + } + return object; + }; + + /** + * Converts this EntityTypeBatch to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @instance + * @returns {Object.} JSON object + */ + EntityTypeBatch.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EntityTypeBatch + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.EntityTypeBatch + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityTypeBatch.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.EntityTypeBatch"; + }; + + return EntityTypeBatch; + })(); + + v2.Conversations = (function() { + + /** + * Constructs a new Conversations service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Conversations + * @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 Conversations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Conversations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Conversations; + + /** + * Creates new Conversations service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Conversations + * @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 {Conversations} RPC service. Useful where requests and/or responses are streamed. + */ + Conversations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|createConversation}. + * @memberof google.cloud.dialogflow.v2.Conversations + * @typedef CreateConversationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Conversation} [response] Conversation + */ + + /** + * Calls CreateConversation. + * @function createConversation + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationRequest} request CreateConversationRequest message or plain object + * @param {google.cloud.dialogflow.v2.Conversations.CreateConversationCallback} callback Node-style callback called with the error, if any, and Conversation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.createConversation = function createConversation(request, callback) { + return this.rpcCall(createConversation, $root.google.cloud.dialogflow.v2.CreateConversationRequest, $root.google.cloud.dialogflow.v2.Conversation, request, callback); + }, "name", { value: "CreateConversation" }); + + /** + * Calls CreateConversation. + * @function createConversation + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationRequest} request CreateConversationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|listConversations}. + * @memberof google.cloud.dialogflow.v2.Conversations + * @typedef ListConversationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListConversationsResponse} [response] ListConversationsResponse + */ + + /** + * Calls ListConversations. + * @function listConversations + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationsRequest} request ListConversationsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Conversations.ListConversationsCallback} callback Node-style callback called with the error, if any, and ListConversationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.listConversations = function listConversations(request, callback) { + return this.rpcCall(listConversations, $root.google.cloud.dialogflow.v2.ListConversationsRequest, $root.google.cloud.dialogflow.v2.ListConversationsResponse, request, callback); + }, "name", { value: "ListConversations" }); + + /** + * Calls ListConversations. + * @function listConversations + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationsRequest} request ListConversationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|getConversation}. + * @memberof google.cloud.dialogflow.v2.Conversations + * @typedef GetConversationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Conversation} [response] Conversation + */ + + /** + * Calls GetConversation. + * @function getConversation + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationRequest} request GetConversationRequest message or plain object + * @param {google.cloud.dialogflow.v2.Conversations.GetConversationCallback} callback Node-style callback called with the error, if any, and Conversation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.getConversation = function getConversation(request, callback) { + return this.rpcCall(getConversation, $root.google.cloud.dialogflow.v2.GetConversationRequest, $root.google.cloud.dialogflow.v2.Conversation, request, callback); + }, "name", { value: "GetConversation" }); + + /** + * Calls GetConversation. + * @function getConversation + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationRequest} request GetConversationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|completeConversation}. + * @memberof google.cloud.dialogflow.v2.Conversations + * @typedef CompleteConversationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Conversation} [response] Conversation + */ + + /** + * Calls CompleteConversation. + * @function completeConversation + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.ICompleteConversationRequest} request CompleteConversationRequest message or plain object + * @param {google.cloud.dialogflow.v2.Conversations.CompleteConversationCallback} callback Node-style callback called with the error, if any, and Conversation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.completeConversation = function completeConversation(request, callback) { + return this.rpcCall(completeConversation, $root.google.cloud.dialogflow.v2.CompleteConversationRequest, $root.google.cloud.dialogflow.v2.Conversation, request, callback); + }, "name", { value: "CompleteConversation" }); + + /** + * Calls CompleteConversation. + * @function completeConversation + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.ICompleteConversationRequest} request CompleteConversationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Conversations|listMessages}. + * @memberof google.cloud.dialogflow.v2.Conversations + * @typedef ListMessagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListMessagesResponse} [response] ListMessagesResponse + */ + + /** + * Calls ListMessages. + * @function listMessages + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.IListMessagesRequest} request ListMessagesRequest message or plain object + * @param {google.cloud.dialogflow.v2.Conversations.ListMessagesCallback} callback Node-style callback called with the error, if any, and ListMessagesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.listMessages = function listMessages(request, callback) { + return this.rpcCall(listMessages, $root.google.cloud.dialogflow.v2.ListMessagesRequest, $root.google.cloud.dialogflow.v2.ListMessagesResponse, request, callback); + }, "name", { value: "ListMessages" }); + + /** + * Calls ListMessages. + * @function listMessages + * @memberof google.cloud.dialogflow.v2.Conversations + * @instance + * @param {google.cloud.dialogflow.v2.IListMessagesRequest} request ListMessagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Conversations; + })(); + + v2.Conversation = (function() { + + /** + * Properties of a Conversation. + * @memberof google.cloud.dialogflow.v2 + * @interface IConversation + * @property {string|null} [name] Conversation name + * @property {google.cloud.dialogflow.v2.Conversation.LifecycleState|null} [lifecycleState] Conversation lifecycleState + * @property {string|null} [conversationProfile] Conversation conversationProfile + * @property {google.cloud.dialogflow.v2.IConversationPhoneNumber|null} [phoneNumber] Conversation phoneNumber + * @property {google.protobuf.ITimestamp|null} [startTime] Conversation startTime + * @property {google.protobuf.ITimestamp|null} [endTime] Conversation endTime + * @property {google.cloud.dialogflow.v2.Conversation.ConversationStage|null} [conversationStage] Conversation conversationStage + */ + + /** + * Constructs a new Conversation. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Conversation. + * @implements IConversation + * @constructor + * @param {google.cloud.dialogflow.v2.IConversation=} [properties] Properties to set + */ + function Conversation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Conversation name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Conversation + * @instance + */ + Conversation.prototype.name = ""; + + /** + * Conversation lifecycleState. + * @member {google.cloud.dialogflow.v2.Conversation.LifecycleState} lifecycleState + * @memberof google.cloud.dialogflow.v2.Conversation + * @instance + */ + Conversation.prototype.lifecycleState = 0; + + /** + * Conversation conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2.Conversation + * @instance + */ + Conversation.prototype.conversationProfile = ""; + + /** + * Conversation phoneNumber. + * @member {google.cloud.dialogflow.v2.IConversationPhoneNumber|null|undefined} phoneNumber + * @memberof google.cloud.dialogflow.v2.Conversation + * @instance + */ + Conversation.prototype.phoneNumber = null; + + /** + * Conversation startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.dialogflow.v2.Conversation + * @instance + */ + Conversation.prototype.startTime = null; + + /** + * Conversation endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.dialogflow.v2.Conversation + * @instance + */ + Conversation.prototype.endTime = null; + + /** + * Conversation conversationStage. + * @member {google.cloud.dialogflow.v2.Conversation.ConversationStage} conversationStage + * @memberof google.cloud.dialogflow.v2.Conversation + * @instance + */ + Conversation.prototype.conversationStage = 0; + + /** + * Creates a new Conversation instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Conversation + * @static + * @param {google.cloud.dialogflow.v2.IConversation=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Conversation} Conversation instance + */ + Conversation.create = function create(properties) { + return new Conversation(properties); + }; + + /** + * Encodes the specified Conversation message. Does not implicitly {@link google.cloud.dialogflow.v2.Conversation.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Conversation + * @static + * @param {google.cloud.dialogflow.v2.IConversation} message Conversation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Conversation.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.lifecycleState != null && Object.hasOwnProperty.call(message, "lifecycleState")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.lifecycleState); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.conversationProfile); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + $root.google.cloud.dialogflow.v2.ConversationPhoneNumber.encode(message.phoneNumber, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.conversationStage != null && Object.hasOwnProperty.call(message, "conversationStage")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.conversationStage); + return writer; + }; + + /** + * Encodes the specified Conversation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Conversation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Conversation + * @static + * @param {google.cloud.dialogflow.v2.IConversation} message Conversation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Conversation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Conversation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Conversation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Conversation} Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Conversation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Conversation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.lifecycleState = reader.int32(); + break; + } + case 3: { + message.conversationProfile = reader.string(); + break; + } + case 4: { + message.phoneNumber = $root.google.cloud.dialogflow.v2.ConversationPhoneNumber.decode(reader, reader.uint32()); + break; + } + case 5: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.conversationStage = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Conversation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Conversation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Conversation} Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Conversation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Conversation message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Conversation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Conversation.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.lifecycleState != null && message.hasOwnProperty("lifecycleState")) + switch (message.lifecycleState) { + default: + return "lifecycleState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) { + var error = $root.google.cloud.dialogflow.v2.ConversationPhoneNumber.verify(message.phoneNumber); + if (error) + return "phoneNumber." + error; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.conversationStage != null && message.hasOwnProperty("conversationStage")) + switch (message.conversationStage) { + default: + return "conversationStage: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a Conversation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Conversation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Conversation} Conversation + */ + Conversation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Conversation) + return object; + var message = new $root.google.cloud.dialogflow.v2.Conversation(); + if (object.name != null) + message.name = String(object.name); + switch (object.lifecycleState) { + default: + if (typeof object.lifecycleState === "number") { + message.lifecycleState = object.lifecycleState; + break; + } + break; + case "LIFECYCLE_STATE_UNSPECIFIED": + case 0: + message.lifecycleState = 0; + break; + case "IN_PROGRESS": + case 1: + message.lifecycleState = 1; + break; + case "COMPLETED": + case 2: + message.lifecycleState = 2; + break; + } + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + if (object.phoneNumber != null) { + if (typeof object.phoneNumber !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Conversation.phoneNumber: object expected"); + message.phoneNumber = $root.google.cloud.dialogflow.v2.ConversationPhoneNumber.fromObject(object.phoneNumber); + } + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Conversation.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Conversation.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + switch (object.conversationStage) { + default: + if (typeof object.conversationStage === "number") { + message.conversationStage = object.conversationStage; + break; + } + break; + case "CONVERSATION_STAGE_UNSPECIFIED": + case 0: + message.conversationStage = 0; + break; + case "VIRTUAL_AGENT_STAGE": + case 1: + message.conversationStage = 1; + break; + case "HUMAN_ASSIST_STAGE": + case 2: + message.conversationStage = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a Conversation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Conversation + * @static + * @param {google.cloud.dialogflow.v2.Conversation} message Conversation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Conversation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.lifecycleState = options.enums === String ? "LIFECYCLE_STATE_UNSPECIFIED" : 0; + object.conversationProfile = ""; + object.phoneNumber = null; + object.startTime = null; + object.endTime = null; + object.conversationStage = options.enums === String ? "CONVERSATION_STAGE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.lifecycleState != null && message.hasOwnProperty("lifecycleState")) + object.lifecycleState = options.enums === String ? $root.google.cloud.dialogflow.v2.Conversation.LifecycleState[message.lifecycleState] === undefined ? message.lifecycleState : $root.google.cloud.dialogflow.v2.Conversation.LifecycleState[message.lifecycleState] : message.lifecycleState; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + object.phoneNumber = $root.google.cloud.dialogflow.v2.ConversationPhoneNumber.toObject(message.phoneNumber, options); + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.conversationStage != null && message.hasOwnProperty("conversationStage")) + object.conversationStage = options.enums === String ? $root.google.cloud.dialogflow.v2.Conversation.ConversationStage[message.conversationStage] === undefined ? message.conversationStage : $root.google.cloud.dialogflow.v2.Conversation.ConversationStage[message.conversationStage] : message.conversationStage; + return object; + }; + + /** + * Converts this Conversation to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Conversation + * @instance + * @returns {Object.} JSON object + */ + Conversation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Conversation + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Conversation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Conversation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Conversation"; + }; + + /** + * LifecycleState enum. + * @name google.cloud.dialogflow.v2.Conversation.LifecycleState + * @enum {number} + * @property {number} LIFECYCLE_STATE_UNSPECIFIED=0 LIFECYCLE_STATE_UNSPECIFIED value + * @property {number} IN_PROGRESS=1 IN_PROGRESS value + * @property {number} COMPLETED=2 COMPLETED value + */ + Conversation.LifecycleState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LIFECYCLE_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_PROGRESS"] = 1; + values[valuesById[2] = "COMPLETED"] = 2; + return values; + })(); + + /** + * ConversationStage enum. + * @name google.cloud.dialogflow.v2.Conversation.ConversationStage + * @enum {number} + * @property {number} CONVERSATION_STAGE_UNSPECIFIED=0 CONVERSATION_STAGE_UNSPECIFIED value + * @property {number} VIRTUAL_AGENT_STAGE=1 VIRTUAL_AGENT_STAGE value + * @property {number} HUMAN_ASSIST_STAGE=2 HUMAN_ASSIST_STAGE value + */ + Conversation.ConversationStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONVERSATION_STAGE_UNSPECIFIED"] = 0; + values[valuesById[1] = "VIRTUAL_AGENT_STAGE"] = 1; + values[valuesById[2] = "HUMAN_ASSIST_STAGE"] = 2; + return values; + })(); + + return Conversation; + })(); + + v2.CreateConversationRequest = (function() { + + /** + * Properties of a CreateConversationRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateConversationRequest + * @property {string|null} [parent] CreateConversationRequest parent + * @property {google.cloud.dialogflow.v2.IConversation|null} [conversation] CreateConversationRequest conversation + * @property {string|null} [conversationId] CreateConversationRequest conversationId + */ + + /** + * Constructs a new CreateConversationRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateConversationRequest. + * @implements ICreateConversationRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateConversationRequest=} [properties] Properties to set + */ + function CreateConversationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @instance + */ + CreateConversationRequest.prototype.parent = ""; + + /** + * CreateConversationRequest conversation. + * @member {google.cloud.dialogflow.v2.IConversation|null|undefined} conversation + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @instance + */ + CreateConversationRequest.prototype.conversation = null; + + /** + * CreateConversationRequest conversationId. + * @member {string} conversationId + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @instance + */ + CreateConversationRequest.prototype.conversationId = ""; + + /** + * Creates a new CreateConversationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateConversationRequest} CreateConversationRequest instance + */ + CreateConversationRequest.create = function create(properties) { + return new CreateConversationRequest(properties); + }; + + /** + * Encodes the specified CreateConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationRequest} message CreateConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationRequest.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.conversation != null && Object.hasOwnProperty.call(message, "conversation")) + $root.google.cloud.dialogflow.v2.Conversation.encode(message.conversation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.conversationId != null && Object.hasOwnProperty.call(message, "conversationId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.conversationId); + return writer; + }; + + /** + * Encodes the specified CreateConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationRequest} message CreateConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateConversationRequest} CreateConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateConversationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.conversation = $root.google.cloud.dialogflow.v2.Conversation.decode(reader, reader.uint32()); + break; + } + case 3: { + message.conversationId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateConversationRequest} CreateConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationRequest.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.conversation != null && message.hasOwnProperty("conversation")) { + var error = $root.google.cloud.dialogflow.v2.Conversation.verify(message.conversation); + if (error) + return "conversation." + error; + } + if (message.conversationId != null && message.hasOwnProperty("conversationId")) + if (!$util.isString(message.conversationId)) + return "conversationId: string expected"; + return null; + }; + + /** + * Creates a CreateConversationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateConversationRequest} CreateConversationRequest + */ + CreateConversationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateConversationRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateConversationRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.conversation != null) { + if (typeof object.conversation !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateConversationRequest.conversation: object expected"); + message.conversation = $root.google.cloud.dialogflow.v2.Conversation.fromObject(object.conversation); + } + if (object.conversationId != null) + message.conversationId = String(object.conversationId); + return message; + }; + + /** + * Creates a plain object from a CreateConversationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateConversationRequest} message CreateConversationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.conversation = null; + object.conversationId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.conversation != null && message.hasOwnProperty("conversation")) + object.conversation = $root.google.cloud.dialogflow.v2.Conversation.toObject(message.conversation, options); + if (message.conversationId != null && message.hasOwnProperty("conversationId")) + object.conversationId = message.conversationId; + return object; + }; + + /** + * Converts this CreateConversationRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @instance + * @returns {Object.} JSON object + */ + CreateConversationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateConversationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateConversationRequest"; + }; + + return CreateConversationRequest; + })(); + + v2.ListConversationsRequest = (function() { + + /** + * Properties of a ListConversationsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationsRequest + * @property {string|null} [parent] ListConversationsRequest parent + * @property {number|null} [pageSize] ListConversationsRequest pageSize + * @property {string|null} [pageToken] ListConversationsRequest pageToken + * @property {string|null} [filter] ListConversationsRequest filter + */ + + /** + * Constructs a new ListConversationsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationsRequest. + * @implements IListConversationsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationsRequest=} [properties] Properties to set + */ + function ListConversationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @instance + */ + ListConversationsRequest.prototype.parent = ""; + + /** + * ListConversationsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @instance + */ + ListConversationsRequest.prototype.pageSize = 0; + + /** + * ListConversationsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @instance + */ + ListConversationsRequest.prototype.pageToken = ""; + + /** + * ListConversationsRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @instance + */ + ListConversationsRequest.prototype.filter = ""; + + /** + * Creates a new ListConversationsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationsRequest} ListConversationsRequest instance + */ + ListConversationsRequest.create = function create(properties) { + return new ListConversationsRequest(properties); + }; + + /** + * Encodes the specified ListConversationsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationsRequest} message ListConversationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationsRequest.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); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListConversationsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationsRequest} message ListConversationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationsRequest} ListConversationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationsRequest(); + 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; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListConversationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationsRequest} ListConversationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationsRequest.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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListConversationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationsRequest} ListConversationsRequest + */ + ListConversationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationsRequest(); + 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); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListConversationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListConversationsRequest} message ListConversationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + 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; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListConversationsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListConversationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationsRequest"; + }; + + return ListConversationsRequest; + })(); + + v2.ListConversationsResponse = (function() { + + /** + * Properties of a ListConversationsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationsResponse + * @property {Array.|null} [conversations] ListConversationsResponse conversations + * @property {string|null} [nextPageToken] ListConversationsResponse nextPageToken + */ + + /** + * Constructs a new ListConversationsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationsResponse. + * @implements IListConversationsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationsResponse=} [properties] Properties to set + */ + function ListConversationsResponse(properties) { + this.conversations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationsResponse conversations. + * @member {Array.} conversations + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @instance + */ + ListConversationsResponse.prototype.conversations = $util.emptyArray; + + /** + * ListConversationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @instance + */ + ListConversationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListConversationsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationsResponse} ListConversationsResponse instance + */ + ListConversationsResponse.create = function create(properties) { + return new ListConversationsResponse(properties); + }; + + /** + * Encodes the specified ListConversationsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationsResponse} message ListConversationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversations != null && message.conversations.length) + for (var i = 0; i < message.conversations.length; ++i) + $root.google.cloud.dialogflow.v2.Conversation.encode(message.conversations[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 ListConversationsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationsResponse} message ListConversationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationsResponse} ListConversationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.conversations && message.conversations.length)) + message.conversations = []; + message.conversations.push($root.google.cloud.dialogflow.v2.Conversation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListConversationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationsResponse} ListConversationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversations != null && message.hasOwnProperty("conversations")) { + if (!Array.isArray(message.conversations)) + return "conversations: array expected"; + for (var i = 0; i < message.conversations.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Conversation.verify(message.conversations[i]); + if (error) + return "conversations." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListConversationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationsResponse} ListConversationsResponse + */ + ListConversationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationsResponse(); + if (object.conversations) { + if (!Array.isArray(object.conversations)) + throw TypeError(".google.cloud.dialogflow.v2.ListConversationsResponse.conversations: array expected"); + message.conversations = []; + for (var i = 0; i < object.conversations.length; ++i) { + if (typeof object.conversations[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListConversationsResponse.conversations: object expected"); + message.conversations[i] = $root.google.cloud.dialogflow.v2.Conversation.fromObject(object.conversations[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListConversationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListConversationsResponse} message ListConversationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conversations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.conversations && message.conversations.length) { + object.conversations = []; + for (var j = 0; j < message.conversations.length; ++j) + object.conversations[j] = $root.google.cloud.dialogflow.v2.Conversation.toObject(message.conversations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListConversationsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListConversationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationsResponse"; + }; + + return ListConversationsResponse; + })(); + + v2.GetConversationRequest = (function() { + + /** + * Properties of a GetConversationRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetConversationRequest + * @property {string|null} [name] GetConversationRequest name + */ + + /** + * Constructs a new GetConversationRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetConversationRequest. + * @implements IGetConversationRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetConversationRequest=} [properties] Properties to set + */ + function GetConversationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConversationRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @instance + */ + GetConversationRequest.prototype.name = ""; + + /** + * Creates a new GetConversationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetConversationRequest} GetConversationRequest instance + */ + GetConversationRequest.create = function create(properties) { + return new GetConversationRequest(properties); + }; + + /** + * Encodes the specified GetConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationRequest} message GetConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationRequest.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 GetConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationRequest} message GetConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConversationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetConversationRequest} GetConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetConversationRequest(); + 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 GetConversationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetConversationRequest} GetConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConversationRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConversationRequest.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 GetConversationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetConversationRequest} GetConversationRequest + */ + GetConversationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetConversationRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetConversationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetConversationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.GetConversationRequest} message GetConversationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConversationRequest.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 GetConversationRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @instance + * @returns {Object.} JSON object + */ + GetConversationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetConversationRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetConversationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetConversationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetConversationRequest"; + }; + + return GetConversationRequest; + })(); + + v2.CompleteConversationRequest = (function() { + + /** + * Properties of a CompleteConversationRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICompleteConversationRequest + * @property {string|null} [name] CompleteConversationRequest name + */ + + /** + * Constructs a new CompleteConversationRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CompleteConversationRequest. + * @implements ICompleteConversationRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICompleteConversationRequest=} [properties] Properties to set + */ + function CompleteConversationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompleteConversationRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @instance + */ + CompleteConversationRequest.prototype.name = ""; + + /** + * Creates a new CompleteConversationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.ICompleteConversationRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CompleteConversationRequest} CompleteConversationRequest instance + */ + CompleteConversationRequest.create = function create(properties) { + return new CompleteConversationRequest(properties); + }; + + /** + * Encodes the specified CompleteConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CompleteConversationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.ICompleteConversationRequest} message CompleteConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteConversationRequest.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 CompleteConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CompleteConversationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.ICompleteConversationRequest} message CompleteConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteConversationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompleteConversationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CompleteConversationRequest} CompleteConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteConversationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CompleteConversationRequest(); + 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 CompleteConversationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CompleteConversationRequest} CompleteConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteConversationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompleteConversationRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompleteConversationRequest.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 CompleteConversationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CompleteConversationRequest} CompleteConversationRequest + */ + CompleteConversationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CompleteConversationRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CompleteConversationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a CompleteConversationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @static + * @param {google.cloud.dialogflow.v2.CompleteConversationRequest} message CompleteConversationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompleteConversationRequest.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 CompleteConversationRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @instance + * @returns {Object.} JSON object + */ + CompleteConversationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CompleteConversationRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CompleteConversationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompleteConversationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CompleteConversationRequest"; + }; + + return CompleteConversationRequest; + })(); + + v2.ListMessagesRequest = (function() { + + /** + * Properties of a ListMessagesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListMessagesRequest + * @property {string|null} [parent] ListMessagesRequest parent + * @property {string|null} [filter] ListMessagesRequest filter + * @property {number|null} [pageSize] ListMessagesRequest pageSize + * @property {string|null} [pageToken] ListMessagesRequest pageToken + */ + + /** + * Constructs a new ListMessagesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListMessagesRequest. + * @implements IListMessagesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListMessagesRequest=} [properties] Properties to set + */ + function ListMessagesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMessagesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @instance + */ + ListMessagesRequest.prototype.parent = ""; + + /** + * ListMessagesRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @instance + */ + ListMessagesRequest.prototype.filter = ""; + + /** + * ListMessagesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @instance + */ + ListMessagesRequest.prototype.pageSize = 0; + + /** + * ListMessagesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @instance + */ + ListMessagesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListMessagesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListMessagesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListMessagesRequest} ListMessagesRequest instance + */ + ListMessagesRequest.create = function create(properties) { + return new ListMessagesRequest(properties); + }; + + /** + * Encodes the specified ListMessagesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListMessagesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListMessagesRequest} message ListMessagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessagesRequest.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); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListMessagesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListMessagesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListMessagesRequest} message ListMessagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMessagesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListMessagesRequest} ListMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessagesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListMessagesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 4: { + 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 ListMessagesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListMessagesRequest} ListMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessagesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMessagesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMessagesRequest.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.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 ListMessagesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListMessagesRequest} ListMessagesRequest + */ + ListMessagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListMessagesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListMessagesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + 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 ListMessagesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2.ListMessagesRequest} message ListMessagesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMessagesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + 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; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListMessagesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @instance + * @returns {Object.} JSON object + */ + ListMessagesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMessagesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListMessagesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMessagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListMessagesRequest"; + }; + + return ListMessagesRequest; + })(); + + v2.ListMessagesResponse = (function() { + + /** + * Properties of a ListMessagesResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListMessagesResponse + * @property {Array.|null} [messages] ListMessagesResponse messages + * @property {string|null} [nextPageToken] ListMessagesResponse nextPageToken + */ + + /** + * Constructs a new ListMessagesResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListMessagesResponse. + * @implements IListMessagesResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListMessagesResponse=} [properties] Properties to set + */ + function ListMessagesResponse(properties) { + this.messages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMessagesResponse messages. + * @member {Array.} messages + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @instance + */ + ListMessagesResponse.prototype.messages = $util.emptyArray; + + /** + * ListMessagesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @instance + */ + ListMessagesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListMessagesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListMessagesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListMessagesResponse} ListMessagesResponse instance + */ + ListMessagesResponse.create = function create(properties) { + return new ListMessagesResponse(properties); + }; + + /** + * Encodes the specified ListMessagesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListMessagesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListMessagesResponse} message ListMessagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessagesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.dialogflow.v2.Message.encode(message.messages[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 ListMessagesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListMessagesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListMessagesResponse} message ListMessagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMessagesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListMessagesResponse} ListMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessagesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListMessagesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.dialogflow.v2.Message.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMessagesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListMessagesResponse} ListMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessagesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMessagesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMessagesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Message.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListMessagesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListMessagesResponse} ListMessagesResponse + */ + ListMessagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListMessagesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListMessagesResponse(); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.dialogflow.v2.ListMessagesResponse.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListMessagesResponse.messages: object expected"); + message.messages[i] = $root.google.cloud.dialogflow.v2.Message.fromObject(object.messages[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListMessagesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2.ListMessagesResponse} message ListMessagesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMessagesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.messages = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.dialogflow.v2.Message.toObject(message.messages[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListMessagesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @instance + * @returns {Object.} JSON object + */ + ListMessagesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMessagesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListMessagesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMessagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListMessagesResponse"; + }; + + return ListMessagesResponse; + })(); + + v2.ConversationPhoneNumber = (function() { + + /** + * Properties of a ConversationPhoneNumber. + * @memberof google.cloud.dialogflow.v2 + * @interface IConversationPhoneNumber + * @property {string|null} [phoneNumber] ConversationPhoneNumber phoneNumber + */ + + /** + * Constructs a new ConversationPhoneNumber. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationPhoneNumber. + * @implements IConversationPhoneNumber + * @constructor + * @param {google.cloud.dialogflow.v2.IConversationPhoneNumber=} [properties] Properties to set + */ + function ConversationPhoneNumber(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationPhoneNumber phoneNumber. + * @member {string} phoneNumber + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @instance + */ + ConversationPhoneNumber.prototype.phoneNumber = ""; + + /** + * Creates a new ConversationPhoneNumber instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @static + * @param {google.cloud.dialogflow.v2.IConversationPhoneNumber=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ConversationPhoneNumber} ConversationPhoneNumber instance + */ + ConversationPhoneNumber.create = function create(properties) { + return new ConversationPhoneNumber(properties); + }; + + /** + * Encodes the specified ConversationPhoneNumber message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationPhoneNumber.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @static + * @param {google.cloud.dialogflow.v2.IConversationPhoneNumber} message ConversationPhoneNumber message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationPhoneNumber.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.phoneNumber); + return writer; + }; + + /** + * Encodes the specified ConversationPhoneNumber message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationPhoneNumber.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @static + * @param {google.cloud.dialogflow.v2.IConversationPhoneNumber} message ConversationPhoneNumber message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationPhoneNumber.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationPhoneNumber message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ConversationPhoneNumber} ConversationPhoneNumber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationPhoneNumber.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ConversationPhoneNumber(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.phoneNumber = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationPhoneNumber message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ConversationPhoneNumber} ConversationPhoneNumber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationPhoneNumber.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationPhoneNumber message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationPhoneNumber.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + if (!$util.isString(message.phoneNumber)) + return "phoneNumber: string expected"; + return null; + }; + + /** + * Creates a ConversationPhoneNumber message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ConversationPhoneNumber} ConversationPhoneNumber + */ + ConversationPhoneNumber.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ConversationPhoneNumber) + return object; + var message = new $root.google.cloud.dialogflow.v2.ConversationPhoneNumber(); + if (object.phoneNumber != null) + message.phoneNumber = String(object.phoneNumber); + return message; + }; + + /** + * Creates a plain object from a ConversationPhoneNumber message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @static + * @param {google.cloud.dialogflow.v2.ConversationPhoneNumber} message ConversationPhoneNumber + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationPhoneNumber.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.phoneNumber = ""; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + object.phoneNumber = message.phoneNumber; + return object; + }; + + /** + * Converts this ConversationPhoneNumber to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @instance + * @returns {Object.} JSON object + */ + ConversationPhoneNumber.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationPhoneNumber + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ConversationPhoneNumber + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationPhoneNumber.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ConversationPhoneNumber"; + }; + + return ConversationPhoneNumber; + })(); + + v2.ConversationDatasets = (function() { + + /** + * Constructs a new ConversationDatasets service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationDatasets + * @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 ConversationDatasets(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ConversationDatasets.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ConversationDatasets; + + /** + * Creates new ConversationDatasets service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @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 {ConversationDatasets} RPC service. Useful where requests and/or responses are streamed. + */ + ConversationDatasets.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|createConversationDataset}. + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @typedef CreateConversationDatasetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateConversationDataset. + * @function createConversationDataset + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetRequest} request CreateConversationDatasetRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDatasetCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationDatasets.prototype.createConversationDataset = function createConversationDataset(request, callback) { + return this.rpcCall(createConversationDataset, $root.google.cloud.dialogflow.v2.CreateConversationDatasetRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateConversationDataset" }); + + /** + * Calls CreateConversationDataset. + * @function createConversationDataset + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetRequest} request CreateConversationDatasetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|getConversationDataset}. + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @typedef GetConversationDatasetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ConversationDataset} [response] ConversationDataset + */ + + /** + * Calls GetConversationDataset. + * @function getConversationDataset + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationDatasetRequest} request GetConversationDatasetRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDatasetCallback} callback Node-style callback called with the error, if any, and ConversationDataset + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationDatasets.prototype.getConversationDataset = function getConversationDataset(request, callback) { + return this.rpcCall(getConversationDataset, $root.google.cloud.dialogflow.v2.GetConversationDatasetRequest, $root.google.cloud.dialogflow.v2.ConversationDataset, request, callback); + }, "name", { value: "GetConversationDataset" }); + + /** + * Calls GetConversationDataset. + * @function getConversationDataset + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationDatasetRequest} request GetConversationDatasetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|listConversationDatasets}. + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @typedef ListConversationDatasetsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListConversationDatasetsResponse} [response] ListConversationDatasetsResponse + */ + + /** + * Calls ListConversationDatasets. + * @function listConversationDatasets + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsRequest} request ListConversationDatasetsRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasetsCallback} callback Node-style callback called with the error, if any, and ListConversationDatasetsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationDatasets.prototype.listConversationDatasets = function listConversationDatasets(request, callback) { + return this.rpcCall(listConversationDatasets, $root.google.cloud.dialogflow.v2.ListConversationDatasetsRequest, $root.google.cloud.dialogflow.v2.ListConversationDatasetsResponse, request, callback); + }, "name", { value: "ListConversationDatasets" }); + + /** + * Calls ListConversationDatasets. + * @function listConversationDatasets + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsRequest} request ListConversationDatasetsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|deleteConversationDataset}. + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @typedef DeleteConversationDatasetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteConversationDataset. + * @function deleteConversationDataset + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest} request DeleteConversationDatasetRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDatasetCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationDatasets.prototype.deleteConversationDataset = function deleteConversationDataset(request, callback) { + return this.rpcCall(deleteConversationDataset, $root.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteConversationDataset" }); + + /** + * Calls DeleteConversationDataset. + * @function deleteConversationDataset + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest} request DeleteConversationDatasetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationDatasets|importConversationData}. + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @typedef ImportConversationDataCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportConversationData. + * @function importConversationData + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.IImportConversationDataRequest} request ImportConversationDataRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationDataCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationDatasets.prototype.importConversationData = function importConversationData(request, callback) { + return this.rpcCall(importConversationData, $root.google.cloud.dialogflow.v2.ImportConversationDataRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportConversationData" }); + + /** + * Calls ImportConversationData. + * @function importConversationData + * @memberof google.cloud.dialogflow.v2.ConversationDatasets + * @instance + * @param {google.cloud.dialogflow.v2.IImportConversationDataRequest} request ImportConversationDataRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ConversationDatasets; + })(); + + v2.ConversationInfo = (function() { + + /** + * Properties of a ConversationInfo. + * @memberof google.cloud.dialogflow.v2 + * @interface IConversationInfo + * @property {string|null} [languageCode] ConversationInfo languageCode + */ + + /** + * Constructs a new ConversationInfo. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationInfo. + * @implements IConversationInfo + * @constructor + * @param {google.cloud.dialogflow.v2.IConversationInfo=} [properties] Properties to set + */ + function ConversationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationInfo languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @instance + */ + ConversationInfo.prototype.languageCode = ""; + + /** + * Creates a new ConversationInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @static + * @param {google.cloud.dialogflow.v2.IConversationInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ConversationInfo} ConversationInfo instance + */ + ConversationInfo.create = function create(properties) { + return new ConversationInfo(properties); + }; + + /** + * Encodes the specified ConversationInfo message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @static + * @param {google.cloud.dialogflow.v2.IConversationInfo} message ConversationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationInfo.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); + return writer; + }; + + /** + * Encodes the specified ConversationInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @static + * @param {google.cloud.dialogflow.v2.IConversationInfo} message ConversationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ConversationInfo} ConversationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ConversationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ConversationInfo} ConversationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationInfo message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationInfo.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"; + return null; + }; + + /** + * Creates a ConversationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ConversationInfo} ConversationInfo + */ + ConversationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ConversationInfo) + return object; + var message = new $root.google.cloud.dialogflow.v2.ConversationInfo(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a ConversationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @static + * @param {google.cloud.dialogflow.v2.ConversationInfo} message ConversationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.languageCode = ""; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this ConversationInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @instance + * @returns {Object.} JSON object + */ + ConversationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationInfo + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ConversationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ConversationInfo"; + }; + + return ConversationInfo; + })(); + + v2.InputConfig = (function() { + + /** + * Properties of an InputConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface IInputConfig + * @property {google.cloud.dialogflow.v2.IGcsSources|null} [gcsSource] InputConfig gcsSource + */ + + /** + * Constructs a new InputConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an InputConfig. + * @implements IInputConfig + * @constructor + * @param {google.cloud.dialogflow.v2.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.dialogflow.v2.IGcsSources|null|undefined} gcsSource + * @memberof google.cloud.dialogflow.v2.InputConfig + * @instance + */ + InputConfig.prototype.gcsSource = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * InputConfig source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.dialogflow.v2.InputConfig + * @instance + */ + Object.defineProperty(InputConfig.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new InputConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.InputConfig + * @static + * @param {google.cloud.dialogflow.v2.IInputConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.InputConfig} InputConfig instance + */ + InputConfig.create = function create(properties) { + return new InputConfig(properties); + }; + + /** + * Encodes the specified InputConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.InputConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.InputConfig + * @static + * @param {google.cloud.dialogflow.v2.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.dialogflow.v2.GcsSources.encode(message.gcsSource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InputConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.InputConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.InputConfig + * @static + * @param {google.cloud.dialogflow.v2.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.dialogflow.v2.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.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.dialogflow.v2.InputConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.gcsSource = $root.google.cloud.dialogflow.v2.GcsSources.decode(reader, reader.uint32()); + 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.dialogflow.v2.InputConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.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.dialogflow.v2.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"; + var properties = {}; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.dialogflow.v2.GcsSources.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + return null; + }; + + /** + * Creates an InputConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.InputConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.InputConfig} InputConfig + */ + InputConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.InputConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.InputConfig(); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.dialogflow.v2.InputConfig.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.dialogflow.v2.GcsSources.fromObject(object.gcsSource); + } + return message; + }; + + /** + * Creates a plain object from an InputConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.InputConfig + * @static + * @param {google.cloud.dialogflow.v2.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 (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.dialogflow.v2.GcsSources.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + return object; + }; + + /** + * Converts this InputConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.InputConfig"; + }; + + return InputConfig; + })(); + + v2.ConversationDataset = (function() { + + /** + * Properties of a ConversationDataset. + * @memberof google.cloud.dialogflow.v2 + * @interface IConversationDataset + * @property {string|null} [name] ConversationDataset name + * @property {string|null} [displayName] ConversationDataset displayName + * @property {string|null} [description] ConversationDataset description + * @property {google.protobuf.ITimestamp|null} [createTime] ConversationDataset createTime + * @property {google.cloud.dialogflow.v2.IInputConfig|null} [inputConfig] ConversationDataset inputConfig + * @property {google.cloud.dialogflow.v2.IConversationInfo|null} [conversationInfo] ConversationDataset conversationInfo + * @property {number|Long|null} [conversationCount] ConversationDataset conversationCount + */ + + /** + * Constructs a new ConversationDataset. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationDataset. + * @implements IConversationDataset + * @constructor + * @param {google.cloud.dialogflow.v2.IConversationDataset=} [properties] Properties to set + */ + function ConversationDataset(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationDataset name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @instance + */ + ConversationDataset.prototype.name = ""; + + /** + * ConversationDataset displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @instance + */ + ConversationDataset.prototype.displayName = ""; + + /** + * ConversationDataset description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @instance + */ + ConversationDataset.prototype.description = ""; + + /** + * ConversationDataset createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @instance + */ + ConversationDataset.prototype.createTime = null; + + /** + * ConversationDataset inputConfig. + * @member {google.cloud.dialogflow.v2.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @instance + */ + ConversationDataset.prototype.inputConfig = null; + + /** + * ConversationDataset conversationInfo. + * @member {google.cloud.dialogflow.v2.IConversationInfo|null|undefined} conversationInfo + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @instance + */ + ConversationDataset.prototype.conversationInfo = null; + + /** + * ConversationDataset conversationCount. + * @member {number|Long} conversationCount + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @instance + */ + ConversationDataset.prototype.conversationCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new ConversationDataset instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @static + * @param {google.cloud.dialogflow.v2.IConversationDataset=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ConversationDataset} ConversationDataset instance + */ + ConversationDataset.create = function create(properties) { + return new ConversationDataset(properties); + }; + + /** + * Encodes the specified ConversationDataset message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationDataset.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @static + * @param {google.cloud.dialogflow.v2.IConversationDataset} message ConversationDataset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationDataset.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.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.dialogflow.v2.InputConfig.encode(message.inputConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.conversationInfo != null && Object.hasOwnProperty.call(message, "conversationInfo")) + $root.google.cloud.dialogflow.v2.ConversationInfo.encode(message.conversationInfo, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.conversationCount != null && Object.hasOwnProperty.call(message, "conversationCount")) + writer.uint32(/* id 7, wireType 0 =*/56).int64(message.conversationCount); + return writer; + }; + + /** + * Encodes the specified ConversationDataset message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationDataset.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @static + * @param {google.cloud.dialogflow.v2.IConversationDataset} message ConversationDataset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationDataset.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationDataset message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ConversationDataset} ConversationDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationDataset.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ConversationDataset(); + 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.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.inputConfig = $root.google.cloud.dialogflow.v2.InputConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.conversationInfo = $root.google.cloud.dialogflow.v2.ConversationInfo.decode(reader, reader.uint32()); + break; + } + case 7: { + message.conversationCount = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationDataset message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ConversationDataset} ConversationDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationDataset.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationDataset message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationDataset.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.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.dialogflow.v2.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + if (message.conversationInfo != null && message.hasOwnProperty("conversationInfo")) { + var error = $root.google.cloud.dialogflow.v2.ConversationInfo.verify(message.conversationInfo); + if (error) + return "conversationInfo." + error; + } + if (message.conversationCount != null && message.hasOwnProperty("conversationCount")) + if (!$util.isInteger(message.conversationCount) && !(message.conversationCount && $util.isInteger(message.conversationCount.low) && $util.isInteger(message.conversationCount.high))) + return "conversationCount: integer|Long expected"; + return null; + }; + + /** + * Creates a ConversationDataset message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ConversationDataset} ConversationDataset + */ + ConversationDataset.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ConversationDataset) + return object; + var message = new $root.google.cloud.dialogflow.v2.ConversationDataset(); + 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.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationDataset.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationDataset.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.dialogflow.v2.InputConfig.fromObject(object.inputConfig); + } + if (object.conversationInfo != null) { + if (typeof object.conversationInfo !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationDataset.conversationInfo: object expected"); + message.conversationInfo = $root.google.cloud.dialogflow.v2.ConversationInfo.fromObject(object.conversationInfo); + } + if (object.conversationCount != null) + if ($util.Long) + (message.conversationCount = $util.Long.fromValue(object.conversationCount)).unsigned = false; + else if (typeof object.conversationCount === "string") + message.conversationCount = parseInt(object.conversationCount, 10); + else if (typeof object.conversationCount === "number") + message.conversationCount = object.conversationCount; + else if (typeof object.conversationCount === "object") + message.conversationCount = new $util.LongBits(object.conversationCount.low >>> 0, object.conversationCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a ConversationDataset message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @static + * @param {google.cloud.dialogflow.v2.ConversationDataset} message ConversationDataset + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationDataset.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.description = ""; + object.createTime = null; + object.inputConfig = null; + object.conversationInfo = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.conversationCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.conversationCount = options.longs === String ? "0" : 0; + } + 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.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.dialogflow.v2.InputConfig.toObject(message.inputConfig, options); + if (message.conversationInfo != null && message.hasOwnProperty("conversationInfo")) + object.conversationInfo = $root.google.cloud.dialogflow.v2.ConversationInfo.toObject(message.conversationInfo, options); + if (message.conversationCount != null && message.hasOwnProperty("conversationCount")) + if (typeof message.conversationCount === "number") + object.conversationCount = options.longs === String ? String(message.conversationCount) : message.conversationCount; + else + object.conversationCount = options.longs === String ? $util.Long.prototype.toString.call(message.conversationCount) : options.longs === Number ? new $util.LongBits(message.conversationCount.low >>> 0, message.conversationCount.high >>> 0).toNumber() : message.conversationCount; + return object; + }; + + /** + * Converts this ConversationDataset to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @instance + * @returns {Object.} JSON object + */ + ConversationDataset.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationDataset + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ConversationDataset + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationDataset.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ConversationDataset"; + }; + + return ConversationDataset; + })(); + + v2.CreateConversationDatasetRequest = (function() { + + /** + * Properties of a CreateConversationDatasetRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateConversationDatasetRequest + * @property {string|null} [parent] CreateConversationDatasetRequest parent + * @property {google.cloud.dialogflow.v2.IConversationDataset|null} [conversationDataset] CreateConversationDatasetRequest conversationDataset + */ + + /** + * Constructs a new CreateConversationDatasetRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateConversationDatasetRequest. + * @implements ICreateConversationDatasetRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetRequest=} [properties] Properties to set + */ + function CreateConversationDatasetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationDatasetRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @instance + */ + CreateConversationDatasetRequest.prototype.parent = ""; + + /** + * CreateConversationDatasetRequest conversationDataset. + * @member {google.cloud.dialogflow.v2.IConversationDataset|null|undefined} conversationDataset + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @instance + */ + CreateConversationDatasetRequest.prototype.conversationDataset = null; + + /** + * Creates a new CreateConversationDatasetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateConversationDatasetRequest} CreateConversationDatasetRequest instance + */ + CreateConversationDatasetRequest.create = function create(properties) { + return new CreateConversationDatasetRequest(properties); + }; + + /** + * Encodes the specified CreateConversationDatasetRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationDatasetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetRequest} message CreateConversationDatasetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationDatasetRequest.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.conversationDataset != null && Object.hasOwnProperty.call(message, "conversationDataset")) + $root.google.cloud.dialogflow.v2.ConversationDataset.encode(message.conversationDataset, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateConversationDatasetRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationDatasetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetRequest} message CreateConversationDatasetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationDatasetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationDatasetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateConversationDatasetRequest} CreateConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationDatasetRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateConversationDatasetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.conversationDataset = $root.google.cloud.dialogflow.v2.ConversationDataset.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationDatasetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateConversationDatasetRequest} CreateConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationDatasetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationDatasetRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationDatasetRequest.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.conversationDataset != null && message.hasOwnProperty("conversationDataset")) { + var error = $root.google.cloud.dialogflow.v2.ConversationDataset.verify(message.conversationDataset); + if (error) + return "conversationDataset." + error; + } + return null; + }; + + /** + * Creates a CreateConversationDatasetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateConversationDatasetRequest} CreateConversationDatasetRequest + */ + CreateConversationDatasetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateConversationDatasetRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateConversationDatasetRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.conversationDataset != null) { + if (typeof object.conversationDataset !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateConversationDatasetRequest.conversationDataset: object expected"); + message.conversationDataset = $root.google.cloud.dialogflow.v2.ConversationDataset.fromObject(object.conversationDataset); + } + return message; + }; + + /** + * Creates a plain object from a CreateConversationDatasetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateConversationDatasetRequest} message CreateConversationDatasetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationDatasetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.conversationDataset = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.conversationDataset != null && message.hasOwnProperty("conversationDataset")) + object.conversationDataset = $root.google.cloud.dialogflow.v2.ConversationDataset.toObject(message.conversationDataset, options); + return object; + }; + + /** + * Converts this CreateConversationDatasetRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @instance + * @returns {Object.} JSON object + */ + CreateConversationDatasetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationDatasetRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationDatasetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateConversationDatasetRequest"; + }; + + return CreateConversationDatasetRequest; + })(); + + v2.GetConversationDatasetRequest = (function() { + + /** + * Properties of a GetConversationDatasetRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetConversationDatasetRequest + * @property {string|null} [name] GetConversationDatasetRequest name + */ + + /** + * Constructs a new GetConversationDatasetRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetConversationDatasetRequest. + * @implements IGetConversationDatasetRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetConversationDatasetRequest=} [properties] Properties to set + */ + function GetConversationDatasetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConversationDatasetRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @instance + */ + GetConversationDatasetRequest.prototype.name = ""; + + /** + * Creates a new GetConversationDatasetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationDatasetRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetConversationDatasetRequest} GetConversationDatasetRequest instance + */ + GetConversationDatasetRequest.create = function create(properties) { + return new GetConversationDatasetRequest(properties); + }; + + /** + * Encodes the specified GetConversationDatasetRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationDatasetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationDatasetRequest} message GetConversationDatasetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationDatasetRequest.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 GetConversationDatasetRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationDatasetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationDatasetRequest} message GetConversationDatasetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationDatasetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConversationDatasetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetConversationDatasetRequest} GetConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationDatasetRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetConversationDatasetRequest(); + 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 GetConversationDatasetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetConversationDatasetRequest} GetConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationDatasetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConversationDatasetRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConversationDatasetRequest.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 GetConversationDatasetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetConversationDatasetRequest} GetConversationDatasetRequest + */ + GetConversationDatasetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetConversationDatasetRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetConversationDatasetRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetConversationDatasetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.GetConversationDatasetRequest} message GetConversationDatasetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConversationDatasetRequest.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 GetConversationDatasetRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @instance + * @returns {Object.} JSON object + */ + GetConversationDatasetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetConversationDatasetRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetConversationDatasetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetConversationDatasetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetConversationDatasetRequest"; + }; + + return GetConversationDatasetRequest; + })(); + + v2.ListConversationDatasetsRequest = (function() { + + /** + * Properties of a ListConversationDatasetsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationDatasetsRequest + * @property {string|null} [parent] ListConversationDatasetsRequest parent + * @property {number|null} [pageSize] ListConversationDatasetsRequest pageSize + * @property {string|null} [pageToken] ListConversationDatasetsRequest pageToken + */ + + /** + * Constructs a new ListConversationDatasetsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationDatasetsRequest. + * @implements IListConversationDatasetsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsRequest=} [properties] Properties to set + */ + function ListConversationDatasetsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationDatasetsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @instance + */ + ListConversationDatasetsRequest.prototype.parent = ""; + + /** + * ListConversationDatasetsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @instance + */ + ListConversationDatasetsRequest.prototype.pageSize = 0; + + /** + * ListConversationDatasetsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @instance + */ + ListConversationDatasetsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListConversationDatasetsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationDatasetsRequest} ListConversationDatasetsRequest instance + */ + ListConversationDatasetsRequest.create = function create(properties) { + return new ListConversationDatasetsRequest(properties); + }; + + /** + * Encodes the specified ListConversationDatasetsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationDatasetsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsRequest} message ListConversationDatasetsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationDatasetsRequest.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 ListConversationDatasetsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationDatasetsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsRequest} message ListConversationDatasetsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationDatasetsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationDatasetsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationDatasetsRequest} ListConversationDatasetsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationDatasetsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationDatasetsRequest(); + 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 ListConversationDatasetsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationDatasetsRequest} ListConversationDatasetsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationDatasetsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationDatasetsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationDatasetsRequest.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 ListConversationDatasetsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationDatasetsRequest} ListConversationDatasetsRequest + */ + ListConversationDatasetsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationDatasetsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationDatasetsRequest(); + 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 ListConversationDatasetsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListConversationDatasetsRequest} message ListConversationDatasetsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationDatasetsRequest.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 ListConversationDatasetsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @instance + * @returns {Object.} JSON object + */ + ListConversationDatasetsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationDatasetsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationDatasetsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationDatasetsRequest"; + }; + + return ListConversationDatasetsRequest; + })(); + + v2.ListConversationDatasetsResponse = (function() { + + /** + * Properties of a ListConversationDatasetsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationDatasetsResponse + * @property {Array.|null} [conversationDatasets] ListConversationDatasetsResponse conversationDatasets + * @property {string|null} [nextPageToken] ListConversationDatasetsResponse nextPageToken + */ + + /** + * Constructs a new ListConversationDatasetsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationDatasetsResponse. + * @implements IListConversationDatasetsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsResponse=} [properties] Properties to set + */ + function ListConversationDatasetsResponse(properties) { + this.conversationDatasets = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationDatasetsResponse conversationDatasets. + * @member {Array.} conversationDatasets + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @instance + */ + ListConversationDatasetsResponse.prototype.conversationDatasets = $util.emptyArray; + + /** + * ListConversationDatasetsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @instance + */ + ListConversationDatasetsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListConversationDatasetsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationDatasetsResponse} ListConversationDatasetsResponse instance + */ + ListConversationDatasetsResponse.create = function create(properties) { + return new ListConversationDatasetsResponse(properties); + }; + + /** + * Encodes the specified ListConversationDatasetsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationDatasetsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsResponse} message ListConversationDatasetsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationDatasetsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationDatasets != null && message.conversationDatasets.length) + for (var i = 0; i < message.conversationDatasets.length; ++i) + $root.google.cloud.dialogflow.v2.ConversationDataset.encode(message.conversationDatasets[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 ListConversationDatasetsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationDatasetsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationDatasetsResponse} message ListConversationDatasetsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationDatasetsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationDatasetsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationDatasetsResponse} ListConversationDatasetsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationDatasetsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationDatasetsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.conversationDatasets && message.conversationDatasets.length)) + message.conversationDatasets = []; + message.conversationDatasets.push($root.google.cloud.dialogflow.v2.ConversationDataset.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListConversationDatasetsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationDatasetsResponse} ListConversationDatasetsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationDatasetsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationDatasetsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationDatasetsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationDatasets != null && message.hasOwnProperty("conversationDatasets")) { + if (!Array.isArray(message.conversationDatasets)) + return "conversationDatasets: array expected"; + for (var i = 0; i < message.conversationDatasets.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.ConversationDataset.verify(message.conversationDatasets[i]); + if (error) + return "conversationDatasets." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListConversationDatasetsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationDatasetsResponse} ListConversationDatasetsResponse + */ + ListConversationDatasetsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationDatasetsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationDatasetsResponse(); + if (object.conversationDatasets) { + if (!Array.isArray(object.conversationDatasets)) + throw TypeError(".google.cloud.dialogflow.v2.ListConversationDatasetsResponse.conversationDatasets: array expected"); + message.conversationDatasets = []; + for (var i = 0; i < object.conversationDatasets.length; ++i) { + if (typeof object.conversationDatasets[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListConversationDatasetsResponse.conversationDatasets: object expected"); + message.conversationDatasets[i] = $root.google.cloud.dialogflow.v2.ConversationDataset.fromObject(object.conversationDatasets[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListConversationDatasetsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListConversationDatasetsResponse} message ListConversationDatasetsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationDatasetsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conversationDatasets = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.conversationDatasets && message.conversationDatasets.length) { + object.conversationDatasets = []; + for (var j = 0; j < message.conversationDatasets.length; ++j) + object.conversationDatasets[j] = $root.google.cloud.dialogflow.v2.ConversationDataset.toObject(message.conversationDatasets[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListConversationDatasetsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @instance + * @returns {Object.} JSON object + */ + ListConversationDatasetsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationDatasetsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationDatasetsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationDatasetsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationDatasetsResponse"; + }; + + return ListConversationDatasetsResponse; + })(); + + v2.DeleteConversationDatasetRequest = (function() { + + /** + * Properties of a DeleteConversationDatasetRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteConversationDatasetRequest + * @property {string|null} [name] DeleteConversationDatasetRequest name + */ + + /** + * Constructs a new DeleteConversationDatasetRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteConversationDatasetRequest. + * @implements IDeleteConversationDatasetRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest=} [properties] Properties to set + */ + function DeleteConversationDatasetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteConversationDatasetRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @instance + */ + DeleteConversationDatasetRequest.prototype.name = ""; + + /** + * Creates a new DeleteConversationDatasetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteConversationDatasetRequest} DeleteConversationDatasetRequest instance + */ + DeleteConversationDatasetRequest.create = function create(properties) { + return new DeleteConversationDatasetRequest(properties); + }; + + /** + * Encodes the specified DeleteConversationDatasetRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationDatasetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest} message DeleteConversationDatasetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationDatasetRequest.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 DeleteConversationDatasetRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationDatasetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest} message DeleteConversationDatasetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationDatasetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteConversationDatasetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteConversationDatasetRequest} DeleteConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationDatasetRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest(); + 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 DeleteConversationDatasetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteConversationDatasetRequest} DeleteConversationDatasetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationDatasetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteConversationDatasetRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteConversationDatasetRequest.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 DeleteConversationDatasetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteConversationDatasetRequest} DeleteConversationDatasetRequest + */ + DeleteConversationDatasetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteConversationDatasetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteConversationDatasetRequest} message DeleteConversationDatasetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteConversationDatasetRequest.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 DeleteConversationDatasetRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteConversationDatasetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteConversationDatasetRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteConversationDatasetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteConversationDatasetRequest"; + }; + + return DeleteConversationDatasetRequest; + })(); + + v2.ImportConversationDataRequest = (function() { + + /** + * Properties of an ImportConversationDataRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IImportConversationDataRequest + * @property {string|null} [name] ImportConversationDataRequest name + * @property {google.cloud.dialogflow.v2.IInputConfig|null} [inputConfig] ImportConversationDataRequest inputConfig + */ + + /** + * Constructs a new ImportConversationDataRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ImportConversationDataRequest. + * @implements IImportConversationDataRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IImportConversationDataRequest=} [properties] Properties to set + */ + function ImportConversationDataRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportConversationDataRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @instance + */ + ImportConversationDataRequest.prototype.name = ""; + + /** + * ImportConversationDataRequest inputConfig. + * @member {google.cloud.dialogflow.v2.IInputConfig|null|undefined} inputConfig + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @instance + */ + ImportConversationDataRequest.prototype.inputConfig = null; + + /** + * Creates a new ImportConversationDataRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @static + * @param {google.cloud.dialogflow.v2.IImportConversationDataRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ImportConversationDataRequest} ImportConversationDataRequest instance + */ + ImportConversationDataRequest.create = function create(properties) { + return new ImportConversationDataRequest(properties); + }; + + /** + * Encodes the specified ImportConversationDataRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @static + * @param {google.cloud.dialogflow.v2.IImportConversationDataRequest} message ImportConversationDataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportConversationDataRequest.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.inputConfig != null && Object.hasOwnProperty.call(message, "inputConfig")) + $root.google.cloud.dialogflow.v2.InputConfig.encode(message.inputConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportConversationDataRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @static + * @param {google.cloud.dialogflow.v2.IImportConversationDataRequest} message ImportConversationDataRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportConversationDataRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportConversationDataRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ImportConversationDataRequest} ImportConversationDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportConversationDataRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ImportConversationDataRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputConfig = $root.google.cloud.dialogflow.v2.InputConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportConversationDataRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ImportConversationDataRequest} ImportConversationDataRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportConversationDataRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportConversationDataRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportConversationDataRequest.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.inputConfig != null && message.hasOwnProperty("inputConfig")) { + var error = $root.google.cloud.dialogflow.v2.InputConfig.verify(message.inputConfig); + if (error) + return "inputConfig." + error; + } + return null; + }; + + /** + * Creates an ImportConversationDataRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ImportConversationDataRequest} ImportConversationDataRequest + */ + ImportConversationDataRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ImportConversationDataRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ImportConversationDataRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.inputConfig != null) { + if (typeof object.inputConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ImportConversationDataRequest.inputConfig: object expected"); + message.inputConfig = $root.google.cloud.dialogflow.v2.InputConfig.fromObject(object.inputConfig); + } + return message; + }; + + /** + * Creates a plain object from an ImportConversationDataRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @static + * @param {google.cloud.dialogflow.v2.ImportConversationDataRequest} message ImportConversationDataRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportConversationDataRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputConfig = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputConfig != null && message.hasOwnProperty("inputConfig")) + object.inputConfig = $root.google.cloud.dialogflow.v2.InputConfig.toObject(message.inputConfig, options); + return object; + }; + + /** + * Converts this ImportConversationDataRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @instance + * @returns {Object.} JSON object + */ + ImportConversationDataRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportConversationDataRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ImportConversationDataRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportConversationDataRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ImportConversationDataRequest"; + }; + + return ImportConversationDataRequest; + })(); + + v2.ImportConversationDataOperationMetadata = (function() { + + /** + * Properties of an ImportConversationDataOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface IImportConversationDataOperationMetadata + * @property {string|null} [conversationDataset] ImportConversationDataOperationMetadata conversationDataset + * @property {Array.|null} [partialFailures] ImportConversationDataOperationMetadata partialFailures + * @property {google.protobuf.ITimestamp|null} [createTime] ImportConversationDataOperationMetadata createTime + */ + + /** + * Constructs a new ImportConversationDataOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ImportConversationDataOperationMetadata. + * @implements IImportConversationDataOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata=} [properties] Properties to set + */ + function ImportConversationDataOperationMetadata(properties) { + this.partialFailures = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportConversationDataOperationMetadata conversationDataset. + * @member {string} conversationDataset + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @instance + */ + ImportConversationDataOperationMetadata.prototype.conversationDataset = ""; + + /** + * ImportConversationDataOperationMetadata partialFailures. + * @member {Array.} partialFailures + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @instance + */ + ImportConversationDataOperationMetadata.prototype.partialFailures = $util.emptyArray; + + /** + * ImportConversationDataOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @instance + */ + ImportConversationDataOperationMetadata.prototype.createTime = null; + + /** + * Creates a new ImportConversationDataOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata} ImportConversationDataOperationMetadata instance + */ + ImportConversationDataOperationMetadata.create = function create(properties) { + return new ImportConversationDataOperationMetadata(properties); + }; + + /** + * Encodes the specified ImportConversationDataOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata} message ImportConversationDataOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportConversationDataOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationDataset != null && Object.hasOwnProperty.call(message, "conversationDataset")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationDataset); + if (message.partialFailures != null && message.partialFailures.length) + for (var i = 0; i < message.partialFailures.length; ++i) + $root.google.rpc.Status.encode(message.partialFailures[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportConversationDataOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata} message ImportConversationDataOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportConversationDataOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportConversationDataOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata} ImportConversationDataOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportConversationDataOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationDataset = reader.string(); + break; + } + case 2: { + if (!(message.partialFailures && message.partialFailures.length)) + message.partialFailures = []; + message.partialFailures.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportConversationDataOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata} ImportConversationDataOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportConversationDataOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportConversationDataOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportConversationDataOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationDataset != null && message.hasOwnProperty("conversationDataset")) + if (!$util.isString(message.conversationDataset)) + return "conversationDataset: string expected"; + if (message.partialFailures != null && message.hasOwnProperty("partialFailures")) { + if (!Array.isArray(message.partialFailures)) + return "partialFailures: array expected"; + for (var i = 0; i < message.partialFailures.length; ++i) { + var error = $root.google.rpc.Status.verify(message.partialFailures[i]); + if (error) + return "partialFailures." + error; + } + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates an ImportConversationDataOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata} ImportConversationDataOperationMetadata + */ + ImportConversationDataOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata(); + if (object.conversationDataset != null) + message.conversationDataset = String(object.conversationDataset); + if (object.partialFailures) { + if (!Array.isArray(object.partialFailures)) + throw TypeError(".google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata.partialFailures: array expected"); + message.partialFailures = []; + for (var i = 0; i < object.partialFailures.length; ++i) { + if (typeof object.partialFailures[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata.partialFailures: object expected"); + message.partialFailures[i] = $root.google.rpc.Status.fromObject(object.partialFailures[i]); + } + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from an ImportConversationDataOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata} message ImportConversationDataOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportConversationDataOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.partialFailures = []; + if (options.defaults) { + object.conversationDataset = ""; + object.createTime = null; + } + if (message.conversationDataset != null && message.hasOwnProperty("conversationDataset")) + object.conversationDataset = message.conversationDataset; + if (message.partialFailures && message.partialFailures.length) { + object.partialFailures = []; + for (var j = 0; j < message.partialFailures.length; ++j) + object.partialFailures[j] = $root.google.rpc.Status.toObject(message.partialFailures[j], options); + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this ImportConversationDataOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ImportConversationDataOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportConversationDataOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportConversationDataOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata"; + }; + + return ImportConversationDataOperationMetadata; + })(); + + v2.ImportConversationDataOperationResponse = (function() { + + /** + * Properties of an ImportConversationDataOperationResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IImportConversationDataOperationResponse + * @property {string|null} [conversationDataset] ImportConversationDataOperationResponse conversationDataset + * @property {number|null} [importCount] ImportConversationDataOperationResponse importCount + */ + + /** + * Constructs a new ImportConversationDataOperationResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ImportConversationDataOperationResponse. + * @implements IImportConversationDataOperationResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IImportConversationDataOperationResponse=} [properties] Properties to set + */ + function ImportConversationDataOperationResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportConversationDataOperationResponse conversationDataset. + * @member {string} conversationDataset + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @instance + */ + ImportConversationDataOperationResponse.prototype.conversationDataset = ""; + + /** + * ImportConversationDataOperationResponse importCount. + * @member {number} importCount + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @instance + */ + ImportConversationDataOperationResponse.prototype.importCount = 0; + + /** + * Creates a new ImportConversationDataOperationResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @static + * @param {google.cloud.dialogflow.v2.IImportConversationDataOperationResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ImportConversationDataOperationResponse} ImportConversationDataOperationResponse instance + */ + ImportConversationDataOperationResponse.create = function create(properties) { + return new ImportConversationDataOperationResponse(properties); + }; + + /** + * Encodes the specified ImportConversationDataOperationResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataOperationResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @static + * @param {google.cloud.dialogflow.v2.IImportConversationDataOperationResponse} message ImportConversationDataOperationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportConversationDataOperationResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationDataset != null && Object.hasOwnProperty.call(message, "conversationDataset")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationDataset); + if (message.importCount != null && Object.hasOwnProperty.call(message, "importCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.importCount); + return writer; + }; + + /** + * Encodes the specified ImportConversationDataOperationResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportConversationDataOperationResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @static + * @param {google.cloud.dialogflow.v2.IImportConversationDataOperationResponse} message ImportConversationDataOperationResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportConversationDataOperationResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportConversationDataOperationResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ImportConversationDataOperationResponse} ImportConversationDataOperationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportConversationDataOperationResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ImportConversationDataOperationResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationDataset = reader.string(); + break; + } + case 3: { + message.importCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportConversationDataOperationResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ImportConversationDataOperationResponse} ImportConversationDataOperationResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportConversationDataOperationResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportConversationDataOperationResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportConversationDataOperationResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationDataset != null && message.hasOwnProperty("conversationDataset")) + if (!$util.isString(message.conversationDataset)) + return "conversationDataset: string expected"; + if (message.importCount != null && message.hasOwnProperty("importCount")) + if (!$util.isInteger(message.importCount)) + return "importCount: integer expected"; + return null; + }; + + /** + * Creates an ImportConversationDataOperationResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ImportConversationDataOperationResponse} ImportConversationDataOperationResponse + */ + ImportConversationDataOperationResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ImportConversationDataOperationResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ImportConversationDataOperationResponse(); + if (object.conversationDataset != null) + message.conversationDataset = String(object.conversationDataset); + if (object.importCount != null) + message.importCount = object.importCount | 0; + return message; + }; + + /** + * Creates a plain object from an ImportConversationDataOperationResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @static + * @param {google.cloud.dialogflow.v2.ImportConversationDataOperationResponse} message ImportConversationDataOperationResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportConversationDataOperationResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationDataset = ""; + object.importCount = 0; + } + if (message.conversationDataset != null && message.hasOwnProperty("conversationDataset")) + object.conversationDataset = message.conversationDataset; + if (message.importCount != null && message.hasOwnProperty("importCount")) + object.importCount = message.importCount; + return object; + }; + + /** + * Converts this ImportConversationDataOperationResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @instance + * @returns {Object.} JSON object + */ + ImportConversationDataOperationResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportConversationDataOperationResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ImportConversationDataOperationResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportConversationDataOperationResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ImportConversationDataOperationResponse"; + }; + + return ImportConversationDataOperationResponse; + })(); + + v2.CreateConversationDatasetOperationMetadata = (function() { + + /** + * Properties of a CreateConversationDatasetOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateConversationDatasetOperationMetadata + * @property {string|null} [conversationDataset] CreateConversationDatasetOperationMetadata conversationDataset + */ + + /** + * Constructs a new CreateConversationDatasetOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateConversationDatasetOperationMetadata. + * @implements ICreateConversationDatasetOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata=} [properties] Properties to set + */ + function CreateConversationDatasetOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationDatasetOperationMetadata conversationDataset. + * @member {string} conversationDataset + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @instance + */ + CreateConversationDatasetOperationMetadata.prototype.conversationDataset = ""; + + /** + * Creates a new CreateConversationDatasetOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata} CreateConversationDatasetOperationMetadata instance + */ + CreateConversationDatasetOperationMetadata.create = function create(properties) { + return new CreateConversationDatasetOperationMetadata(properties); + }; + + /** + * Encodes the specified CreateConversationDatasetOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata} message CreateConversationDatasetOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationDatasetOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationDataset != null && Object.hasOwnProperty.call(message, "conversationDataset")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationDataset); + return writer; + }; + + /** + * Encodes the specified CreateConversationDatasetOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata} message CreateConversationDatasetOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationDatasetOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationDatasetOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata} CreateConversationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationDatasetOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationDataset = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationDatasetOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata} CreateConversationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationDatasetOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationDatasetOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationDatasetOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationDataset != null && message.hasOwnProperty("conversationDataset")) + if (!$util.isString(message.conversationDataset)) + return "conversationDataset: string expected"; + return null; + }; + + /** + * Creates a CreateConversationDatasetOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata} CreateConversationDatasetOperationMetadata + */ + CreateConversationDatasetOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata(); + if (object.conversationDataset != null) + message.conversationDataset = String(object.conversationDataset); + return message; + }; + + /** + * Creates a plain object from a CreateConversationDatasetOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata} message CreateConversationDatasetOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationDatasetOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.conversationDataset = ""; + if (message.conversationDataset != null && message.hasOwnProperty("conversationDataset")) + object.conversationDataset = message.conversationDataset; + return object; + }; + + /** + * Converts this CreateConversationDatasetOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateConversationDatasetOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationDatasetOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationDatasetOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata"; + }; + + return CreateConversationDatasetOperationMetadata; + })(); + + v2.DeleteConversationDatasetOperationMetadata = (function() { + + /** + * Properties of a DeleteConversationDatasetOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteConversationDatasetOperationMetadata + */ + + /** + * Constructs a new DeleteConversationDatasetOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteConversationDatasetOperationMetadata. + * @implements IDeleteConversationDatasetOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata=} [properties] Properties to set + */ + function DeleteConversationDatasetOperationMetadata(properties) { + if (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 DeleteConversationDatasetOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata} DeleteConversationDatasetOperationMetadata instance + */ + DeleteConversationDatasetOperationMetadata.create = function create(properties) { + return new DeleteConversationDatasetOperationMetadata(properties); + }; + + /** + * Encodes the specified DeleteConversationDatasetOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata} message DeleteConversationDatasetOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationDatasetOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DeleteConversationDatasetOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata} message DeleteConversationDatasetOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationDatasetOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteConversationDatasetOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata} DeleteConversationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationDatasetOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteConversationDatasetOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata} DeleteConversationDatasetOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationDatasetOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteConversationDatasetOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteConversationDatasetOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DeleteConversationDatasetOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata} DeleteConversationDatasetOperationMetadata + */ + DeleteConversationDatasetOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata) + return object; + return new $root.google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata(); + }; + + /** + * Creates a plain object from a DeleteConversationDatasetOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata} message DeleteConversationDatasetOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteConversationDatasetOperationMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DeleteConversationDatasetOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteConversationDatasetOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteConversationDatasetOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteConversationDatasetOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata"; + }; + + return DeleteConversationDatasetOperationMetadata; + })(); + + v2.GcsSources = (function() { + + /** + * Properties of a GcsSources. + * @memberof google.cloud.dialogflow.v2 + * @interface IGcsSources + * @property {Array.|null} [uris] GcsSources uris + */ + + /** + * Constructs a new GcsSources. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GcsSources. + * @implements IGcsSources + * @constructor + * @param {google.cloud.dialogflow.v2.IGcsSources=} [properties] Properties to set + */ + function GcsSources(properties) { + this.uris = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsSources uris. + * @member {Array.} uris + * @memberof google.cloud.dialogflow.v2.GcsSources + * @instance + */ + GcsSources.prototype.uris = $util.emptyArray; + + /** + * Creates a new GcsSources instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GcsSources + * @static + * @param {google.cloud.dialogflow.v2.IGcsSources=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GcsSources} GcsSources instance + */ + GcsSources.create = function create(properties) { + return new GcsSources(properties); + }; + + /** + * Encodes the specified GcsSources message. Does not implicitly {@link google.cloud.dialogflow.v2.GcsSources.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GcsSources + * @static + * @param {google.cloud.dialogflow.v2.IGcsSources} message GcsSources message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSources.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uris != null && message.uris.length) + for (var i = 0; i < message.uris.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uris[i]); + return writer; + }; + + /** + * Encodes the specified GcsSources message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GcsSources.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GcsSources + * @static + * @param {google.cloud.dialogflow.v2.IGcsSources} message GcsSources message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSources.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsSources message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GcsSources + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GcsSources} GcsSources + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSources.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GcsSources(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (!(message.uris && message.uris.length)) + message.uris = []; + message.uris.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsSources message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GcsSources + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GcsSources} GcsSources + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSources.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsSources message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GcsSources + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsSources.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uris != null && message.hasOwnProperty("uris")) { + if (!Array.isArray(message.uris)) + return "uris: array expected"; + for (var i = 0; i < message.uris.length; ++i) + if (!$util.isString(message.uris[i])) + return "uris: string[] expected"; + } + return null; + }; + + /** + * Creates a GcsSources message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GcsSources + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GcsSources} GcsSources + */ + GcsSources.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GcsSources) + return object; + var message = new $root.google.cloud.dialogflow.v2.GcsSources(); + if (object.uris) { + if (!Array.isArray(object.uris)) + throw TypeError(".google.cloud.dialogflow.v2.GcsSources.uris: array expected"); + message.uris = []; + for (var i = 0; i < object.uris.length; ++i) + message.uris[i] = String(object.uris[i]); + } + return message; + }; + + /** + * Creates a plain object from a GcsSources message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GcsSources + * @static + * @param {google.cloud.dialogflow.v2.GcsSources} message GcsSources + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsSources.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uris = []; + if (message.uris && message.uris.length) { + object.uris = []; + for (var j = 0; j < message.uris.length; ++j) + object.uris[j] = message.uris[j]; + } + return object; + }; + + /** + * Converts this GcsSources to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GcsSources + * @instance + * @returns {Object.} JSON object + */ + GcsSources.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GcsSources + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GcsSources + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsSources.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GcsSources"; + }; + + return GcsSources; + })(); + + v2.GcsDestination = (function() { + + /** + * Properties of a GcsDestination. + * @memberof google.cloud.dialogflow.v2 + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri + */ + + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.dialogflow.v2.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.dialogflow.v2.GcsDestination + * @instance + */ + GcsDestination.prototype.uri = ""; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.dialogflow.v2.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2.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.dialogflow.v2.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2.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.dialogflow.v2.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GcsDestination) + return object; + var message = new $root.google.cloud.dialogflow.v2.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.dialogflow.v2.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.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.dialogflow.v2.GcsDestination"; + }; + + return GcsDestination; + })(); + + v2.ConversationEvent = (function() { + + /** + * Properties of a ConversationEvent. + * @memberof google.cloud.dialogflow.v2 + * @interface IConversationEvent + * @property {string|null} [conversation] ConversationEvent conversation + * @property {google.cloud.dialogflow.v2.ConversationEvent.Type|null} [type] ConversationEvent type + * @property {google.rpc.IStatus|null} [errorStatus] ConversationEvent errorStatus + * @property {google.cloud.dialogflow.v2.IMessage|null} [newMessagePayload] ConversationEvent newMessagePayload + */ + + /** + * Constructs a new ConversationEvent. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationEvent. + * @implements IConversationEvent + * @constructor + * @param {google.cloud.dialogflow.v2.IConversationEvent=} [properties] Properties to set + */ + function ConversationEvent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationEvent conversation. + * @member {string} conversation + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @instance + */ + ConversationEvent.prototype.conversation = ""; + + /** + * ConversationEvent type. + * @member {google.cloud.dialogflow.v2.ConversationEvent.Type} type + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @instance + */ + ConversationEvent.prototype.type = 0; + + /** + * ConversationEvent errorStatus. + * @member {google.rpc.IStatus|null|undefined} errorStatus + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @instance + */ + ConversationEvent.prototype.errorStatus = null; + + /** + * ConversationEvent newMessagePayload. + * @member {google.cloud.dialogflow.v2.IMessage|null|undefined} newMessagePayload + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @instance + */ + ConversationEvent.prototype.newMessagePayload = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ConversationEvent payload. + * @member {"newMessagePayload"|undefined} payload + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @instance + */ + Object.defineProperty(ConversationEvent.prototype, "payload", { + get: $util.oneOfGetter($oneOfFields = ["newMessagePayload"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConversationEvent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @static + * @param {google.cloud.dialogflow.v2.IConversationEvent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ConversationEvent} ConversationEvent instance + */ + ConversationEvent.create = function create(properties) { + return new ConversationEvent(properties); + }; + + /** + * Encodes the specified ConversationEvent message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationEvent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @static + * @param {google.cloud.dialogflow.v2.IConversationEvent} message ConversationEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversation != null && Object.hasOwnProperty.call(message, "conversation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversation); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.errorStatus != null && Object.hasOwnProperty.call(message, "errorStatus")) + $root.google.rpc.Status.encode(message.errorStatus, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.newMessagePayload != null && Object.hasOwnProperty.call(message, "newMessagePayload")) + $root.google.cloud.dialogflow.v2.Message.encode(message.newMessagePayload, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConversationEvent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @static + * @param {google.cloud.dialogflow.v2.IConversationEvent} message ConversationEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationEvent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ConversationEvent} ConversationEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ConversationEvent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversation = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + message.errorStatus = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 4: { + message.newMessagePayload = $root.google.cloud.dialogflow.v2.Message.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ConversationEvent} ConversationEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationEvent message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.conversation != null && message.hasOwnProperty("conversation")) + if (!$util.isString(message.conversation)) + return "conversation: string 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 5: + case 4: + break; + } + if (message.errorStatus != null && message.hasOwnProperty("errorStatus")) { + var error = $root.google.rpc.Status.verify(message.errorStatus); + if (error) + return "errorStatus." + error; + } + if (message.newMessagePayload != null && message.hasOwnProperty("newMessagePayload")) { + properties.payload = 1; + { + var error = $root.google.cloud.dialogflow.v2.Message.verify(message.newMessagePayload); + if (error) + return "newMessagePayload." + error; + } + } + return null; + }; + + /** + * Creates a ConversationEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ConversationEvent} ConversationEvent + */ + ConversationEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ConversationEvent) + return object; + var message = new $root.google.cloud.dialogflow.v2.ConversationEvent(); + if (object.conversation != null) + message.conversation = String(object.conversation); + 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 "CONVERSATION_STARTED": + case 1: + message.type = 1; + break; + case "CONVERSATION_FINISHED": + case 2: + message.type = 2; + break; + case "HUMAN_INTERVENTION_NEEDED": + case 3: + message.type = 3; + break; + case "NEW_MESSAGE": + case 5: + message.type = 5; + break; + case "UNRECOVERABLE_ERROR": + case 4: + message.type = 4; + break; + } + if (object.errorStatus != null) { + if (typeof object.errorStatus !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationEvent.errorStatus: object expected"); + message.errorStatus = $root.google.rpc.Status.fromObject(object.errorStatus); + } + if (object.newMessagePayload != null) { + if (typeof object.newMessagePayload !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationEvent.newMessagePayload: object expected"); + message.newMessagePayload = $root.google.cloud.dialogflow.v2.Message.fromObject(object.newMessagePayload); + } + return message; + }; + + /** + * Creates a plain object from a ConversationEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @static + * @param {google.cloud.dialogflow.v2.ConversationEvent} message ConversationEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversation = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.errorStatus = null; + } + if (message.conversation != null && message.hasOwnProperty("conversation")) + object.conversation = message.conversation; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.dialogflow.v2.ConversationEvent.Type[message.type] === undefined ? message.type : $root.google.cloud.dialogflow.v2.ConversationEvent.Type[message.type] : message.type; + if (message.errorStatus != null && message.hasOwnProperty("errorStatus")) + object.errorStatus = $root.google.rpc.Status.toObject(message.errorStatus, options); + if (message.newMessagePayload != null && message.hasOwnProperty("newMessagePayload")) { + object.newMessagePayload = $root.google.cloud.dialogflow.v2.Message.toObject(message.newMessagePayload, options); + if (options.oneofs) + object.payload = "newMessagePayload"; + } + return object; + }; + + /** + * Converts this ConversationEvent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @instance + * @returns {Object.} JSON object + */ + ConversationEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationEvent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ConversationEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ConversationEvent"; + }; + + /** + * Type enum. + * @name google.cloud.dialogflow.v2.ConversationEvent.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} CONVERSATION_STARTED=1 CONVERSATION_STARTED value + * @property {number} CONVERSATION_FINISHED=2 CONVERSATION_FINISHED value + * @property {number} HUMAN_INTERVENTION_NEEDED=3 HUMAN_INTERVENTION_NEEDED value + * @property {number} NEW_MESSAGE=5 NEW_MESSAGE value + * @property {number} UNRECOVERABLE_ERROR=4 UNRECOVERABLE_ERROR value + */ + ConversationEvent.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CONVERSATION_STARTED"] = 1; + values[valuesById[2] = "CONVERSATION_FINISHED"] = 2; + values[valuesById[3] = "HUMAN_INTERVENTION_NEEDED"] = 3; + values[valuesById[5] = "NEW_MESSAGE"] = 5; + values[valuesById[4] = "UNRECOVERABLE_ERROR"] = 4; + return values; + })(); + + return ConversationEvent; + })(); + + v2.ConversationModels = (function() { + + /** + * Constructs a new ConversationModels service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationModels + * @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 ConversationModels(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ConversationModels.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ConversationModels; + + /** + * Creates new ConversationModels service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @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 {ConversationModels} RPC service. Useful where requests and/or responses are streamed. + */ + ConversationModels.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|createConversationModel}. + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @typedef CreateConversationModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateConversationModel. + * @function createConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationModelRequest} request CreateConversationModelRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationModels.prototype.createConversationModel = function createConversationModel(request, callback) { + return this.rpcCall(createConversationModel, $root.google.cloud.dialogflow.v2.CreateConversationModelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateConversationModel" }); + + /** + * Calls CreateConversationModel. + * @function createConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationModelRequest} request CreateConversationModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|getConversationModel}. + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @typedef GetConversationModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ConversationModel} [response] ConversationModel + */ + + /** + * Calls GetConversationModel. + * @function getConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationModelRequest} request GetConversationModelRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationModels.GetConversationModelCallback} callback Node-style callback called with the error, if any, and ConversationModel + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationModels.prototype.getConversationModel = function getConversationModel(request, callback) { + return this.rpcCall(getConversationModel, $root.google.cloud.dialogflow.v2.GetConversationModelRequest, $root.google.cloud.dialogflow.v2.ConversationModel, request, callback); + }, "name", { value: "GetConversationModel" }); + + /** + * Calls GetConversationModel. + * @function getConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationModelRequest} request GetConversationModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|listConversationModels}. + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @typedef ListConversationModelsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListConversationModelsResponse} [response] ListConversationModelsResponse + */ + + /** + * Calls ListConversationModels. + * @function listConversationModels + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationModelsRequest} request ListConversationModelsRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationModels.ListConversationModelsCallback} callback Node-style callback called with the error, if any, and ListConversationModelsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationModels.prototype.listConversationModels = function listConversationModels(request, callback) { + return this.rpcCall(listConversationModels, $root.google.cloud.dialogflow.v2.ListConversationModelsRequest, $root.google.cloud.dialogflow.v2.ListConversationModelsResponse, request, callback); + }, "name", { value: "ListConversationModels" }); + + /** + * Calls ListConversationModels. + * @function listConversationModels + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationModelsRequest} request ListConversationModelsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|deleteConversationModel}. + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @typedef DeleteConversationModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteConversationModel. + * @function deleteConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelRequest} request DeleteConversationModelRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationModels.prototype.deleteConversationModel = function deleteConversationModel(request, callback) { + return this.rpcCall(deleteConversationModel, $root.google.cloud.dialogflow.v2.DeleteConversationModelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteConversationModel" }); + + /** + * Calls DeleteConversationModel. + * @function deleteConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelRequest} request DeleteConversationModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|deployConversationModel}. + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @typedef DeployConversationModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeployConversationModel. + * @function deployConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IDeployConversationModelRequest} request DeployConversationModelRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationModels.DeployConversationModelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationModels.prototype.deployConversationModel = function deployConversationModel(request, callback) { + return this.rpcCall(deployConversationModel, $root.google.cloud.dialogflow.v2.DeployConversationModelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeployConversationModel" }); + + /** + * Calls DeployConversationModel. + * @function deployConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IDeployConversationModelRequest} request DeployConversationModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|undeployConversationModel}. + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @typedef UndeployConversationModelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UndeployConversationModel. + * @function undeployConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelRequest} request UndeployConversationModelRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModelCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationModels.prototype.undeployConversationModel = function undeployConversationModel(request, callback) { + return this.rpcCall(undeployConversationModel, $root.google.cloud.dialogflow.v2.UndeployConversationModelRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UndeployConversationModel" }); + + /** + * Calls UndeployConversationModel. + * @function undeployConversationModel + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelRequest} request UndeployConversationModelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|getConversationModelEvaluation}. + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @typedef GetConversationModelEvaluationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ConversationModelEvaluation} [response] ConversationModelEvaluation + */ + + /** + * Calls GetConversationModelEvaluation. + * @function getConversationModelEvaluation + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest} request GetConversationModelEvaluationRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluationCallback} callback Node-style callback called with the error, if any, and ConversationModelEvaluation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationModels.prototype.getConversationModelEvaluation = function getConversationModelEvaluation(request, callback) { + return this.rpcCall(getConversationModelEvaluation, $root.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest, $root.google.cloud.dialogflow.v2.ConversationModelEvaluation, request, callback); + }, "name", { value: "GetConversationModelEvaluation" }); + + /** + * Calls GetConversationModelEvaluation. + * @function getConversationModelEvaluation + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest} request GetConversationModelEvaluationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|listConversationModelEvaluations}. + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @typedef ListConversationModelEvaluationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse} [response] ListConversationModelEvaluationsResponse + */ + + /** + * Calls ListConversationModelEvaluations. + * @function listConversationModelEvaluations + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest} request ListConversationModelEvaluationsRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluationsCallback} callback Node-style callback called with the error, if any, and ListConversationModelEvaluationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationModels.prototype.listConversationModelEvaluations = function listConversationModelEvaluations(request, callback) { + return this.rpcCall(listConversationModelEvaluations, $root.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest, $root.google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse, request, callback); + }, "name", { value: "ListConversationModelEvaluations" }); + + /** + * Calls ListConversationModelEvaluations. + * @function listConversationModelEvaluations + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest} request ListConversationModelEvaluationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationModels|createConversationModelEvaluation}. + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @typedef CreateConversationModelEvaluationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateConversationModelEvaluation. + * @function createConversationModelEvaluation + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest} request CreateConversationModelEvaluationRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationModels.prototype.createConversationModelEvaluation = function createConversationModelEvaluation(request, callback) { + return this.rpcCall(createConversationModelEvaluation, $root.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateConversationModelEvaluation" }); + + /** + * Calls CreateConversationModelEvaluation. + * @function createConversationModelEvaluation + * @memberof google.cloud.dialogflow.v2.ConversationModels + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest} request CreateConversationModelEvaluationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ConversationModels; + })(); + + v2.ConversationModel = (function() { + + /** + * Properties of a ConversationModel. + * @memberof google.cloud.dialogflow.v2 + * @interface IConversationModel + * @property {string|null} [name] ConversationModel name + * @property {string|null} [displayName] ConversationModel displayName + * @property {google.protobuf.ITimestamp|null} [createTime] ConversationModel createTime + * @property {Array.|null} [datasets] ConversationModel datasets + * @property {google.cloud.dialogflow.v2.ConversationModel.State|null} [state] ConversationModel state + * @property {string|null} [languageCode] ConversationModel languageCode + * @property {google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata|null} [articleSuggestionModelMetadata] ConversationModel articleSuggestionModelMetadata + * @property {google.cloud.dialogflow.v2.ISmartReplyModelMetadata|null} [smartReplyModelMetadata] ConversationModel smartReplyModelMetadata + */ + + /** + * Constructs a new ConversationModel. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationModel. + * @implements IConversationModel + * @constructor + * @param {google.cloud.dialogflow.v2.IConversationModel=} [properties] Properties to set + */ + function ConversationModel(properties) { + this.datasets = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationModel name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + */ + ConversationModel.prototype.name = ""; + + /** + * ConversationModel displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + */ + ConversationModel.prototype.displayName = ""; + + /** + * ConversationModel createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + */ + ConversationModel.prototype.createTime = null; + + /** + * ConversationModel datasets. + * @member {Array.} datasets + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + */ + ConversationModel.prototype.datasets = $util.emptyArray; + + /** + * ConversationModel state. + * @member {google.cloud.dialogflow.v2.ConversationModel.State} state + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + */ + ConversationModel.prototype.state = 0; + + /** + * ConversationModel languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + */ + ConversationModel.prototype.languageCode = ""; + + /** + * ConversationModel articleSuggestionModelMetadata. + * @member {google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata|null|undefined} articleSuggestionModelMetadata + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + */ + ConversationModel.prototype.articleSuggestionModelMetadata = null; + + /** + * ConversationModel smartReplyModelMetadata. + * @member {google.cloud.dialogflow.v2.ISmartReplyModelMetadata|null|undefined} smartReplyModelMetadata + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + */ + ConversationModel.prototype.smartReplyModelMetadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ConversationModel modelMetadata. + * @member {"articleSuggestionModelMetadata"|"smartReplyModelMetadata"|undefined} modelMetadata + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + */ + Object.defineProperty(ConversationModel.prototype, "modelMetadata", { + get: $util.oneOfGetter($oneOfFields = ["articleSuggestionModelMetadata", "smartReplyModelMetadata"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConversationModel instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @static + * @param {google.cloud.dialogflow.v2.IConversationModel=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ConversationModel} ConversationModel instance + */ + ConversationModel.create = function create(properties) { + return new ConversationModel(properties); + }; + + /** + * Encodes the specified ConversationModel message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationModel.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @static + * @param {google.cloud.dialogflow.v2.IConversationModel} message ConversationModel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationModel.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.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.datasets != null && message.datasets.length) + for (var i = 0; i < message.datasets.length; ++i) + $root.google.cloud.dialogflow.v2.InputDataset.encode(message.datasets[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.state); + if (message.articleSuggestionModelMetadata != null && Object.hasOwnProperty.call(message, "articleSuggestionModelMetadata")) + $root.google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata.encode(message.articleSuggestionModelMetadata, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.smartReplyModelMetadata != null && Object.hasOwnProperty.call(message, "smartReplyModelMetadata")) + $root.google.cloud.dialogflow.v2.SmartReplyModelMetadata.encode(message.smartReplyModelMetadata, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 19, wireType 2 =*/154).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified ConversationModel message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationModel.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @static + * @param {google.cloud.dialogflow.v2.IConversationModel} message ConversationModel message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationModel.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationModel message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ConversationModel} ConversationModel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationModel.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ConversationModel(); + 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.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.datasets && message.datasets.length)) + message.datasets = []; + message.datasets.push($root.google.cloud.dialogflow.v2.InputDataset.decode(reader, reader.uint32())); + break; + } + case 7: { + message.state = reader.int32(); + break; + } + case 19: { + message.languageCode = reader.string(); + break; + } + case 8: { + message.articleSuggestionModelMetadata = $root.google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata.decode(reader, reader.uint32()); + break; + } + case 9: { + message.smartReplyModelMetadata = $root.google.cloud.dialogflow.v2.SmartReplyModelMetadata.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationModel message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ConversationModel} ConversationModel + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationModel.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationModel message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationModel.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.datasets != null && message.hasOwnProperty("datasets")) { + if (!Array.isArray(message.datasets)) + return "datasets: array expected"; + for (var i = 0; i < message.datasets.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.InputDataset.verify(message.datasets[i]); + if (error) + return "datasets." + error; + } + } + 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: + case 5: + case 6: + case 7: + case 8: + break; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.articleSuggestionModelMetadata != null && message.hasOwnProperty("articleSuggestionModelMetadata")) { + properties.modelMetadata = 1; + { + var error = $root.google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata.verify(message.articleSuggestionModelMetadata); + if (error) + return "articleSuggestionModelMetadata." + error; + } + } + if (message.smartReplyModelMetadata != null && message.hasOwnProperty("smartReplyModelMetadata")) { + if (properties.modelMetadata === 1) + return "modelMetadata: multiple values"; + properties.modelMetadata = 1; + { + var error = $root.google.cloud.dialogflow.v2.SmartReplyModelMetadata.verify(message.smartReplyModelMetadata); + if (error) + return "smartReplyModelMetadata." + error; + } + } + return null; + }; + + /** + * Creates a ConversationModel message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ConversationModel} ConversationModel + */ + ConversationModel.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ConversationModel) + return object; + var message = new $root.google.cloud.dialogflow.v2.ConversationModel(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationModel.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.datasets) { + if (!Array.isArray(object.datasets)) + throw TypeError(".google.cloud.dialogflow.v2.ConversationModel.datasets: array expected"); + message.datasets = []; + for (var i = 0; i < object.datasets.length; ++i) { + if (typeof object.datasets[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationModel.datasets: object expected"); + message.datasets[i] = $root.google.cloud.dialogflow.v2.InputDataset.fromObject(object.datasets[i]); + } + } + 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 "CREATING": + case 1: + message.state = 1; + break; + case "UNDEPLOYED": + case 2: + message.state = 2; + break; + case "DEPLOYING": + case 3: + message.state = 3; + break; + case "DEPLOYED": + case 4: + message.state = 4; + break; + case "UNDEPLOYING": + case 5: + message.state = 5; + break; + case "DELETING": + case 6: + message.state = 6; + break; + case "FAILED": + case 7: + message.state = 7; + break; + case "PENDING": + case 8: + message.state = 8; + break; + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.articleSuggestionModelMetadata != null) { + if (typeof object.articleSuggestionModelMetadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationModel.articleSuggestionModelMetadata: object expected"); + message.articleSuggestionModelMetadata = $root.google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata.fromObject(object.articleSuggestionModelMetadata); + } + if (object.smartReplyModelMetadata != null) { + if (typeof object.smartReplyModelMetadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationModel.smartReplyModelMetadata: object expected"); + message.smartReplyModelMetadata = $root.google.cloud.dialogflow.v2.SmartReplyModelMetadata.fromObject(object.smartReplyModelMetadata); + } + return message; + }; + + /** + * Creates a plain object from a ConversationModel message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @static + * @param {google.cloud.dialogflow.v2.ConversationModel} message ConversationModel + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationModel.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.datasets = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.createTime = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.datasets && message.datasets.length) { + object.datasets = []; + for (var j = 0; j < message.datasets.length; ++j) + object.datasets[j] = $root.google.cloud.dialogflow.v2.InputDataset.toObject(message.datasets[j], options); + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.v2.ConversationModel.State[message.state] === undefined ? message.state : $root.google.cloud.dialogflow.v2.ConversationModel.State[message.state] : message.state; + if (message.articleSuggestionModelMetadata != null && message.hasOwnProperty("articleSuggestionModelMetadata")) { + object.articleSuggestionModelMetadata = $root.google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata.toObject(message.articleSuggestionModelMetadata, options); + if (options.oneofs) + object.modelMetadata = "articleSuggestionModelMetadata"; + } + if (message.smartReplyModelMetadata != null && message.hasOwnProperty("smartReplyModelMetadata")) { + object.smartReplyModelMetadata = $root.google.cloud.dialogflow.v2.SmartReplyModelMetadata.toObject(message.smartReplyModelMetadata, options); + if (options.oneofs) + object.modelMetadata = "smartReplyModelMetadata"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this ConversationModel to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @instance + * @returns {Object.} JSON object + */ + ConversationModel.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationModel + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ConversationModel + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationModel.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ConversationModel"; + }; + + /** + * State enum. + * @name google.cloud.dialogflow.v2.ConversationModel.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} UNDEPLOYED=2 UNDEPLOYED value + * @property {number} DEPLOYING=3 DEPLOYING value + * @property {number} DEPLOYED=4 DEPLOYED value + * @property {number} UNDEPLOYING=5 UNDEPLOYING value + * @property {number} DELETING=6 DELETING value + * @property {number} FAILED=7 FAILED value + * @property {number} PENDING=8 PENDING value + */ + ConversationModel.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "UNDEPLOYED"] = 2; + values[valuesById[3] = "DEPLOYING"] = 3; + values[valuesById[4] = "DEPLOYED"] = 4; + values[valuesById[5] = "UNDEPLOYING"] = 5; + values[valuesById[6] = "DELETING"] = 6; + values[valuesById[7] = "FAILED"] = 7; + values[valuesById[8] = "PENDING"] = 8; + return values; + })(); + + /** + * ModelType enum. + * @name google.cloud.dialogflow.v2.ConversationModel.ModelType + * @enum {number} + * @property {number} MODEL_TYPE_UNSPECIFIED=0 MODEL_TYPE_UNSPECIFIED value + * @property {number} SMART_REPLY_DUAL_ENCODER_MODEL=2 SMART_REPLY_DUAL_ENCODER_MODEL value + * @property {number} SMART_REPLY_BERT_MODEL=6 SMART_REPLY_BERT_MODEL value + */ + ConversationModel.ModelType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MODEL_TYPE_UNSPECIFIED"] = 0; + values[valuesById[2] = "SMART_REPLY_DUAL_ENCODER_MODEL"] = 2; + values[valuesById[6] = "SMART_REPLY_BERT_MODEL"] = 6; + return values; + })(); + + return ConversationModel; + })(); + + v2.ConversationModelEvaluation = (function() { + + /** + * Properties of a ConversationModelEvaluation. + * @memberof google.cloud.dialogflow.v2 + * @interface IConversationModelEvaluation + * @property {string|null} [name] ConversationModelEvaluation name + * @property {string|null} [displayName] ConversationModelEvaluation displayName + * @property {google.cloud.dialogflow.v2.IEvaluationConfig|null} [evaluationConfig] ConversationModelEvaluation evaluationConfig + * @property {google.protobuf.ITimestamp|null} [createTime] ConversationModelEvaluation createTime + * @property {google.cloud.dialogflow.v2.ISmartReplyMetrics|null} [smartReplyMetrics] ConversationModelEvaluation smartReplyMetrics + */ + + /** + * Constructs a new ConversationModelEvaluation. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationModelEvaluation. + * @implements IConversationModelEvaluation + * @constructor + * @param {google.cloud.dialogflow.v2.IConversationModelEvaluation=} [properties] Properties to set + */ + function ConversationModelEvaluation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationModelEvaluation name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @instance + */ + ConversationModelEvaluation.prototype.name = ""; + + /** + * ConversationModelEvaluation displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @instance + */ + ConversationModelEvaluation.prototype.displayName = ""; + + /** + * ConversationModelEvaluation evaluationConfig. + * @member {google.cloud.dialogflow.v2.IEvaluationConfig|null|undefined} evaluationConfig + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @instance + */ + ConversationModelEvaluation.prototype.evaluationConfig = null; + + /** + * ConversationModelEvaluation createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @instance + */ + ConversationModelEvaluation.prototype.createTime = null; + + /** + * ConversationModelEvaluation smartReplyMetrics. + * @member {google.cloud.dialogflow.v2.ISmartReplyMetrics|null|undefined} smartReplyMetrics + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @instance + */ + ConversationModelEvaluation.prototype.smartReplyMetrics = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ConversationModelEvaluation metrics. + * @member {"smartReplyMetrics"|undefined} metrics + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @instance + */ + Object.defineProperty(ConversationModelEvaluation.prototype, "metrics", { + get: $util.oneOfGetter($oneOfFields = ["smartReplyMetrics"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConversationModelEvaluation instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @static + * @param {google.cloud.dialogflow.v2.IConversationModelEvaluation=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ConversationModelEvaluation} ConversationModelEvaluation instance + */ + ConversationModelEvaluation.create = function create(properties) { + return new ConversationModelEvaluation(properties); + }; + + /** + * Encodes the specified ConversationModelEvaluation message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationModelEvaluation.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @static + * @param {google.cloud.dialogflow.v2.IConversationModelEvaluation} message ConversationModelEvaluation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationModelEvaluation.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.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.smartReplyMetrics != null && Object.hasOwnProperty.call(message, "smartReplyMetrics")) + $root.google.cloud.dialogflow.v2.SmartReplyMetrics.encode(message.smartReplyMetrics, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.evaluationConfig != null && Object.hasOwnProperty.call(message, "evaluationConfig")) + $root.google.cloud.dialogflow.v2.EvaluationConfig.encode(message.evaluationConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConversationModelEvaluation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationModelEvaluation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @static + * @param {google.cloud.dialogflow.v2.IConversationModelEvaluation} message ConversationModelEvaluation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationModelEvaluation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationModelEvaluation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ConversationModelEvaluation} ConversationModelEvaluation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationModelEvaluation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ConversationModelEvaluation(); + 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 6: { + message.evaluationConfig = $root.google.cloud.dialogflow.v2.EvaluationConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.smartReplyMetrics = $root.google.cloud.dialogflow.v2.SmartReplyMetrics.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationModelEvaluation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ConversationModelEvaluation} ConversationModelEvaluation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationModelEvaluation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationModelEvaluation message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationModelEvaluation.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.evaluationConfig != null && message.hasOwnProperty("evaluationConfig")) { + var error = $root.google.cloud.dialogflow.v2.EvaluationConfig.verify(message.evaluationConfig); + if (error) + return "evaluationConfig." + error; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.smartReplyMetrics != null && message.hasOwnProperty("smartReplyMetrics")) { + properties.metrics = 1; + { + var error = $root.google.cloud.dialogflow.v2.SmartReplyMetrics.verify(message.smartReplyMetrics); + if (error) + return "smartReplyMetrics." + error; + } + } + return null; + }; + + /** + * Creates a ConversationModelEvaluation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ConversationModelEvaluation} ConversationModelEvaluation + */ + ConversationModelEvaluation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ConversationModelEvaluation) + return object; + var message = new $root.google.cloud.dialogflow.v2.ConversationModelEvaluation(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.evaluationConfig != null) { + if (typeof object.evaluationConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationModelEvaluation.evaluationConfig: object expected"); + message.evaluationConfig = $root.google.cloud.dialogflow.v2.EvaluationConfig.fromObject(object.evaluationConfig); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationModelEvaluation.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.smartReplyMetrics != null) { + if (typeof object.smartReplyMetrics !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationModelEvaluation.smartReplyMetrics: object expected"); + message.smartReplyMetrics = $root.google.cloud.dialogflow.v2.SmartReplyMetrics.fromObject(object.smartReplyMetrics); + } + return message; + }; + + /** + * Creates a plain object from a ConversationModelEvaluation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @static + * @param {google.cloud.dialogflow.v2.ConversationModelEvaluation} message ConversationModelEvaluation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationModelEvaluation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.createTime = null; + object.evaluationConfig = 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.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.smartReplyMetrics != null && message.hasOwnProperty("smartReplyMetrics")) { + object.smartReplyMetrics = $root.google.cloud.dialogflow.v2.SmartReplyMetrics.toObject(message.smartReplyMetrics, options); + if (options.oneofs) + object.metrics = "smartReplyMetrics"; + } + if (message.evaluationConfig != null && message.hasOwnProperty("evaluationConfig")) + object.evaluationConfig = $root.google.cloud.dialogflow.v2.EvaluationConfig.toObject(message.evaluationConfig, options); + return object; + }; + + /** + * Converts this ConversationModelEvaluation to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @instance + * @returns {Object.} JSON object + */ + ConversationModelEvaluation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationModelEvaluation + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ConversationModelEvaluation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationModelEvaluation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ConversationModelEvaluation"; + }; + + return ConversationModelEvaluation; + })(); + + v2.EvaluationConfig = (function() { + + /** + * Properties of an EvaluationConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface IEvaluationConfig + * @property {Array.|null} [datasets] EvaluationConfig datasets + * @property {google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig|null} [smartReplyConfig] EvaluationConfig smartReplyConfig + * @property {google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig|null} [smartComposeConfig] EvaluationConfig smartComposeConfig + */ + + /** + * Constructs a new EvaluationConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an EvaluationConfig. + * @implements IEvaluationConfig + * @constructor + * @param {google.cloud.dialogflow.v2.IEvaluationConfig=} [properties] Properties to set + */ + function EvaluationConfig(properties) { + this.datasets = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EvaluationConfig datasets. + * @member {Array.} datasets + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @instance + */ + EvaluationConfig.prototype.datasets = $util.emptyArray; + + /** + * EvaluationConfig smartReplyConfig. + * @member {google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig|null|undefined} smartReplyConfig + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @instance + */ + EvaluationConfig.prototype.smartReplyConfig = null; + + /** + * EvaluationConfig smartComposeConfig. + * @member {google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig|null|undefined} smartComposeConfig + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @instance + */ + EvaluationConfig.prototype.smartComposeConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * EvaluationConfig modelSpecificConfig. + * @member {"smartReplyConfig"|"smartComposeConfig"|undefined} modelSpecificConfig + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @instance + */ + Object.defineProperty(EvaluationConfig.prototype, "modelSpecificConfig", { + get: $util.oneOfGetter($oneOfFields = ["smartReplyConfig", "smartComposeConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new EvaluationConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @static + * @param {google.cloud.dialogflow.v2.IEvaluationConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.EvaluationConfig} EvaluationConfig instance + */ + EvaluationConfig.create = function create(properties) { + return new EvaluationConfig(properties); + }; + + /** + * Encodes the specified EvaluationConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @static + * @param {google.cloud.dialogflow.v2.IEvaluationConfig} message EvaluationConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvaluationConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.smartReplyConfig != null && Object.hasOwnProperty.call(message, "smartReplyConfig")) + $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig.encode(message.smartReplyConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.datasets != null && message.datasets.length) + for (var i = 0; i < message.datasets.length; ++i) + $root.google.cloud.dialogflow.v2.InputDataset.encode(message.datasets[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.smartComposeConfig != null && Object.hasOwnProperty.call(message, "smartComposeConfig")) + $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig.encode(message.smartComposeConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EvaluationConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @static + * @param {google.cloud.dialogflow.v2.IEvaluationConfig} message EvaluationConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EvaluationConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EvaluationConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.EvaluationConfig} EvaluationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvaluationConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.EvaluationConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + if (!(message.datasets && message.datasets.length)) + message.datasets = []; + message.datasets.push($root.google.cloud.dialogflow.v2.InputDataset.decode(reader, reader.uint32())); + break; + } + case 2: { + message.smartReplyConfig = $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.smartComposeConfig = $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EvaluationConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.EvaluationConfig} EvaluationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EvaluationConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EvaluationConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EvaluationConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.datasets != null && message.hasOwnProperty("datasets")) { + if (!Array.isArray(message.datasets)) + return "datasets: array expected"; + for (var i = 0; i < message.datasets.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.InputDataset.verify(message.datasets[i]); + if (error) + return "datasets." + error; + } + } + if (message.smartReplyConfig != null && message.hasOwnProperty("smartReplyConfig")) { + properties.modelSpecificConfig = 1; + { + var error = $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig.verify(message.smartReplyConfig); + if (error) + return "smartReplyConfig." + error; + } + } + if (message.smartComposeConfig != null && message.hasOwnProperty("smartComposeConfig")) { + if (properties.modelSpecificConfig === 1) + return "modelSpecificConfig: multiple values"; + properties.modelSpecificConfig = 1; + { + var error = $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig.verify(message.smartComposeConfig); + if (error) + return "smartComposeConfig." + error; + } + } + return null; + }; + + /** + * Creates an EvaluationConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.EvaluationConfig} EvaluationConfig + */ + EvaluationConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.EvaluationConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.EvaluationConfig(); + if (object.datasets) { + if (!Array.isArray(object.datasets)) + throw TypeError(".google.cloud.dialogflow.v2.EvaluationConfig.datasets: array expected"); + message.datasets = []; + for (var i = 0; i < object.datasets.length; ++i) { + if (typeof object.datasets[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.EvaluationConfig.datasets: object expected"); + message.datasets[i] = $root.google.cloud.dialogflow.v2.InputDataset.fromObject(object.datasets[i]); + } + } + if (object.smartReplyConfig != null) { + if (typeof object.smartReplyConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.EvaluationConfig.smartReplyConfig: object expected"); + message.smartReplyConfig = $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig.fromObject(object.smartReplyConfig); + } + if (object.smartComposeConfig != null) { + if (typeof object.smartComposeConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.EvaluationConfig.smartComposeConfig: object expected"); + message.smartComposeConfig = $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig.fromObject(object.smartComposeConfig); + } + return message; + }; + + /** + * Creates a plain object from an EvaluationConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @static + * @param {google.cloud.dialogflow.v2.EvaluationConfig} message EvaluationConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EvaluationConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.datasets = []; + if (message.smartReplyConfig != null && message.hasOwnProperty("smartReplyConfig")) { + object.smartReplyConfig = $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig.toObject(message.smartReplyConfig, options); + if (options.oneofs) + object.modelSpecificConfig = "smartReplyConfig"; + } + if (message.datasets && message.datasets.length) { + object.datasets = []; + for (var j = 0; j < message.datasets.length; ++j) + object.datasets[j] = $root.google.cloud.dialogflow.v2.InputDataset.toObject(message.datasets[j], options); + } + if (message.smartComposeConfig != null && message.hasOwnProperty("smartComposeConfig")) { + object.smartComposeConfig = $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig.toObject(message.smartComposeConfig, options); + if (options.oneofs) + object.modelSpecificConfig = "smartComposeConfig"; + } + return object; + }; + + /** + * Converts this EvaluationConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @instance + * @returns {Object.} JSON object + */ + EvaluationConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EvaluationConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EvaluationConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.EvaluationConfig"; + }; + + EvaluationConfig.SmartReplyConfig = (function() { + + /** + * Properties of a SmartReplyConfig. + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @interface ISmartReplyConfig + * @property {string|null} [allowlistDocument] SmartReplyConfig allowlistDocument + * @property {number|null} [maxResultCount] SmartReplyConfig maxResultCount + */ + + /** + * Constructs a new SmartReplyConfig. + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @classdesc Represents a SmartReplyConfig. + * @implements ISmartReplyConfig + * @constructor + * @param {google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig=} [properties] Properties to set + */ + function SmartReplyConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SmartReplyConfig allowlistDocument. + * @member {string} allowlistDocument + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @instance + */ + SmartReplyConfig.prototype.allowlistDocument = ""; + + /** + * SmartReplyConfig maxResultCount. + * @member {number} maxResultCount + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @instance + */ + SmartReplyConfig.prototype.maxResultCount = 0; + + /** + * Creates a new SmartReplyConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @static + * @param {google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig} SmartReplyConfig instance + */ + SmartReplyConfig.create = function create(properties) { + return new SmartReplyConfig(properties); + }; + + /** + * Encodes the specified SmartReplyConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @static + * @param {google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig} message SmartReplyConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowlistDocument != null && Object.hasOwnProperty.call(message, "allowlistDocument")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowlistDocument); + if (message.maxResultCount != null && Object.hasOwnProperty.call(message, "maxResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResultCount); + return writer; + }; + + /** + * Encodes the specified SmartReplyConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @static + * @param {google.cloud.dialogflow.v2.EvaluationConfig.ISmartReplyConfig} message SmartReplyConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SmartReplyConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig} SmartReplyConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.allowlistDocument = reader.string(); + break; + } + case 2: { + message.maxResultCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SmartReplyConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig} SmartReplyConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SmartReplyConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SmartReplyConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowlistDocument != null && message.hasOwnProperty("allowlistDocument")) + if (!$util.isString(message.allowlistDocument)) + return "allowlistDocument: string expected"; + if (message.maxResultCount != null && message.hasOwnProperty("maxResultCount")) + if (!$util.isInteger(message.maxResultCount)) + return "maxResultCount: integer expected"; + return null; + }; + + /** + * Creates a SmartReplyConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig} SmartReplyConfig + */ + SmartReplyConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig(); + if (object.allowlistDocument != null) + message.allowlistDocument = String(object.allowlistDocument); + if (object.maxResultCount != null) + message.maxResultCount = object.maxResultCount | 0; + return message; + }; + + /** + * Creates a plain object from a SmartReplyConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @static + * @param {google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig} message SmartReplyConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SmartReplyConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.allowlistDocument = ""; + object.maxResultCount = 0; + } + if (message.allowlistDocument != null && message.hasOwnProperty("allowlistDocument")) + object.allowlistDocument = message.allowlistDocument; + if (message.maxResultCount != null && message.hasOwnProperty("maxResultCount")) + object.maxResultCount = message.maxResultCount; + return object; + }; + + /** + * Converts this SmartReplyConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @instance + * @returns {Object.} JSON object + */ + SmartReplyConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SmartReplyConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SmartReplyConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.EvaluationConfig.SmartReplyConfig"; + }; + + return SmartReplyConfig; + })(); + + EvaluationConfig.SmartComposeConfig = (function() { + + /** + * Properties of a SmartComposeConfig. + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @interface ISmartComposeConfig + * @property {string|null} [allowlistDocument] SmartComposeConfig allowlistDocument + * @property {number|null} [maxResultCount] SmartComposeConfig maxResultCount + */ + + /** + * Constructs a new SmartComposeConfig. + * @memberof google.cloud.dialogflow.v2.EvaluationConfig + * @classdesc Represents a SmartComposeConfig. + * @implements ISmartComposeConfig + * @constructor + * @param {google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig=} [properties] Properties to set + */ + function SmartComposeConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SmartComposeConfig allowlistDocument. + * @member {string} allowlistDocument + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @instance + */ + SmartComposeConfig.prototype.allowlistDocument = ""; + + /** + * SmartComposeConfig maxResultCount. + * @member {number} maxResultCount + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @instance + */ + SmartComposeConfig.prototype.maxResultCount = 0; + + /** + * Creates a new SmartComposeConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @static + * @param {google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig} SmartComposeConfig instance + */ + SmartComposeConfig.create = function create(properties) { + return new SmartComposeConfig(properties); + }; + + /** + * Encodes the specified SmartComposeConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @static + * @param {google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig} message SmartComposeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartComposeConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowlistDocument != null && Object.hasOwnProperty.call(message, "allowlistDocument")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.allowlistDocument); + if (message.maxResultCount != null && Object.hasOwnProperty.call(message, "maxResultCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResultCount); + return writer; + }; + + /** + * Encodes the specified SmartComposeConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @static + * @param {google.cloud.dialogflow.v2.EvaluationConfig.ISmartComposeConfig} message SmartComposeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartComposeConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SmartComposeConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig} SmartComposeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartComposeConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.allowlistDocument = reader.string(); + break; + } + case 2: { + message.maxResultCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SmartComposeConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig} SmartComposeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartComposeConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SmartComposeConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SmartComposeConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowlistDocument != null && message.hasOwnProperty("allowlistDocument")) + if (!$util.isString(message.allowlistDocument)) + return "allowlistDocument: string expected"; + if (message.maxResultCount != null && message.hasOwnProperty("maxResultCount")) + if (!$util.isInteger(message.maxResultCount)) + return "maxResultCount: integer expected"; + return null; + }; + + /** + * Creates a SmartComposeConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig} SmartComposeConfig + */ + SmartComposeConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig(); + if (object.allowlistDocument != null) + message.allowlistDocument = String(object.allowlistDocument); + if (object.maxResultCount != null) + message.maxResultCount = object.maxResultCount | 0; + return message; + }; + + /** + * Creates a plain object from a SmartComposeConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @static + * @param {google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig} message SmartComposeConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SmartComposeConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.allowlistDocument = ""; + object.maxResultCount = 0; + } + if (message.allowlistDocument != null && message.hasOwnProperty("allowlistDocument")) + object.allowlistDocument = message.allowlistDocument; + if (message.maxResultCount != null && message.hasOwnProperty("maxResultCount")) + object.maxResultCount = message.maxResultCount; + return object; + }; + + /** + * Converts this SmartComposeConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @instance + * @returns {Object.} JSON object + */ + SmartComposeConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SmartComposeConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SmartComposeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.EvaluationConfig.SmartComposeConfig"; + }; + + return SmartComposeConfig; + })(); + + return EvaluationConfig; + })(); + + v2.InputDataset = (function() { + + /** + * Properties of an InputDataset. + * @memberof google.cloud.dialogflow.v2 + * @interface IInputDataset + * @property {string|null} [dataset] InputDataset dataset + */ + + /** + * Constructs a new InputDataset. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an InputDataset. + * @implements IInputDataset + * @constructor + * @param {google.cloud.dialogflow.v2.IInputDataset=} [properties] Properties to set + */ + function InputDataset(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InputDataset dataset. + * @member {string} dataset + * @memberof google.cloud.dialogflow.v2.InputDataset + * @instance + */ + InputDataset.prototype.dataset = ""; + + /** + * Creates a new InputDataset instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.InputDataset + * @static + * @param {google.cloud.dialogflow.v2.IInputDataset=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.InputDataset} InputDataset instance + */ + InputDataset.create = function create(properties) { + return new InputDataset(properties); + }; + + /** + * Encodes the specified InputDataset message. Does not implicitly {@link google.cloud.dialogflow.v2.InputDataset.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.InputDataset + * @static + * @param {google.cloud.dialogflow.v2.IInputDataset} message InputDataset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputDataset.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dataset != null && Object.hasOwnProperty.call(message, "dataset")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.dataset); + return writer; + }; + + /** + * Encodes the specified InputDataset message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.InputDataset.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.InputDataset + * @static + * @param {google.cloud.dialogflow.v2.IInputDataset} message InputDataset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputDataset.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InputDataset message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.InputDataset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.InputDataset} InputDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputDataset.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.InputDataset(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.dataset = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InputDataset message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.InputDataset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.InputDataset} InputDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputDataset.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InputDataset message. + * @function verify + * @memberof google.cloud.dialogflow.v2.InputDataset + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InputDataset.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dataset != null && message.hasOwnProperty("dataset")) + if (!$util.isString(message.dataset)) + return "dataset: string expected"; + return null; + }; + + /** + * Creates an InputDataset message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.InputDataset + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.InputDataset} InputDataset + */ + InputDataset.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.InputDataset) + return object; + var message = new $root.google.cloud.dialogflow.v2.InputDataset(); + if (object.dataset != null) + message.dataset = String(object.dataset); + return message; + }; + + /** + * Creates a plain object from an InputDataset message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.InputDataset + * @static + * @param {google.cloud.dialogflow.v2.InputDataset} message InputDataset + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InputDataset.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.dataset = ""; + if (message.dataset != null && message.hasOwnProperty("dataset")) + object.dataset = message.dataset; + return object; + }; + + /** + * Converts this InputDataset to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.InputDataset + * @instance + * @returns {Object.} JSON object + */ + InputDataset.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InputDataset + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.InputDataset + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputDataset.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.InputDataset"; + }; + + return InputDataset; + })(); + + v2.ArticleSuggestionModelMetadata = (function() { + + /** + * Properties of an ArticleSuggestionModelMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface IArticleSuggestionModelMetadata + * @property {google.cloud.dialogflow.v2.ConversationModel.ModelType|null} [trainingModelType] ArticleSuggestionModelMetadata trainingModelType + */ + + /** + * Constructs a new ArticleSuggestionModelMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ArticleSuggestionModelMetadata. + * @implements IArticleSuggestionModelMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata=} [properties] Properties to set + */ + function ArticleSuggestionModelMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ArticleSuggestionModelMetadata trainingModelType. + * @member {google.cloud.dialogflow.v2.ConversationModel.ModelType} trainingModelType + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @instance + */ + ArticleSuggestionModelMetadata.prototype.trainingModelType = 0; + + /** + * Creates a new ArticleSuggestionModelMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @static + * @param {google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata} ArticleSuggestionModelMetadata instance + */ + ArticleSuggestionModelMetadata.create = function create(properties) { + return new ArticleSuggestionModelMetadata(properties); + }; + + /** + * Encodes the specified ArticleSuggestionModelMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @static + * @param {google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata} message ArticleSuggestionModelMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArticleSuggestionModelMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.trainingModelType != null && Object.hasOwnProperty.call(message, "trainingModelType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.trainingModelType); + return writer; + }; + + /** + * Encodes the specified ArticleSuggestionModelMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @static + * @param {google.cloud.dialogflow.v2.IArticleSuggestionModelMetadata} message ArticleSuggestionModelMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArticleSuggestionModelMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ArticleSuggestionModelMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata} ArticleSuggestionModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArticleSuggestionModelMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.trainingModelType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ArticleSuggestionModelMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata} ArticleSuggestionModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArticleSuggestionModelMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ArticleSuggestionModelMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ArticleSuggestionModelMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.trainingModelType != null && message.hasOwnProperty("trainingModelType")) + switch (message.trainingModelType) { + default: + return "trainingModelType: enum value expected"; + case 0: + case 2: + case 6: + break; + } + return null; + }; + + /** + * Creates an ArticleSuggestionModelMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata} ArticleSuggestionModelMetadata + */ + ArticleSuggestionModelMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata(); + switch (object.trainingModelType) { + default: + if (typeof object.trainingModelType === "number") { + message.trainingModelType = object.trainingModelType; + break; + } + break; + case "MODEL_TYPE_UNSPECIFIED": + case 0: + message.trainingModelType = 0; + break; + case "SMART_REPLY_DUAL_ENCODER_MODEL": + case 2: + message.trainingModelType = 2; + break; + case "SMART_REPLY_BERT_MODEL": + case 6: + message.trainingModelType = 6; + break; + } + return message; + }; + + /** + * Creates a plain object from an ArticleSuggestionModelMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @static + * @param {google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata} message ArticleSuggestionModelMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ArticleSuggestionModelMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.trainingModelType = options.enums === String ? "MODEL_TYPE_UNSPECIFIED" : 0; + if (message.trainingModelType != null && message.hasOwnProperty("trainingModelType")) + object.trainingModelType = options.enums === String ? $root.google.cloud.dialogflow.v2.ConversationModel.ModelType[message.trainingModelType] === undefined ? message.trainingModelType : $root.google.cloud.dialogflow.v2.ConversationModel.ModelType[message.trainingModelType] : message.trainingModelType; + return object; + }; + + /** + * Converts this ArticleSuggestionModelMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @instance + * @returns {Object.} JSON object + */ + ArticleSuggestionModelMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ArticleSuggestionModelMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ArticleSuggestionModelMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ArticleSuggestionModelMetadata"; + }; + + return ArticleSuggestionModelMetadata; + })(); + + v2.SmartReplyModelMetadata = (function() { + + /** + * Properties of a SmartReplyModelMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface ISmartReplyModelMetadata + * @property {google.cloud.dialogflow.v2.ConversationModel.ModelType|null} [trainingModelType] SmartReplyModelMetadata trainingModelType + */ + + /** + * Constructs a new SmartReplyModelMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SmartReplyModelMetadata. + * @implements ISmartReplyModelMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.ISmartReplyModelMetadata=} [properties] Properties to set + */ + function SmartReplyModelMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SmartReplyModelMetadata trainingModelType. + * @member {google.cloud.dialogflow.v2.ConversationModel.ModelType} trainingModelType + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @instance + */ + SmartReplyModelMetadata.prototype.trainingModelType = 0; + + /** + * Creates a new SmartReplyModelMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @static + * @param {google.cloud.dialogflow.v2.ISmartReplyModelMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SmartReplyModelMetadata} SmartReplyModelMetadata instance + */ + SmartReplyModelMetadata.create = function create(properties) { + return new SmartReplyModelMetadata(properties); + }; + + /** + * Encodes the specified SmartReplyModelMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyModelMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @static + * @param {google.cloud.dialogflow.v2.ISmartReplyModelMetadata} message SmartReplyModelMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyModelMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.trainingModelType != null && Object.hasOwnProperty.call(message, "trainingModelType")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.trainingModelType); + return writer; + }; + + /** + * Encodes the specified SmartReplyModelMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyModelMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @static + * @param {google.cloud.dialogflow.v2.ISmartReplyModelMetadata} message SmartReplyModelMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyModelMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SmartReplyModelMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SmartReplyModelMetadata} SmartReplyModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyModelMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SmartReplyModelMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 6: { + message.trainingModelType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SmartReplyModelMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SmartReplyModelMetadata} SmartReplyModelMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyModelMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SmartReplyModelMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SmartReplyModelMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.trainingModelType != null && message.hasOwnProperty("trainingModelType")) + switch (message.trainingModelType) { + default: + return "trainingModelType: enum value expected"; + case 0: + case 2: + case 6: + break; + } + return null; + }; + + /** + * Creates a SmartReplyModelMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SmartReplyModelMetadata} SmartReplyModelMetadata + */ + SmartReplyModelMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SmartReplyModelMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.SmartReplyModelMetadata(); + switch (object.trainingModelType) { + default: + if (typeof object.trainingModelType === "number") { + message.trainingModelType = object.trainingModelType; + break; + } + break; + case "MODEL_TYPE_UNSPECIFIED": + case 0: + message.trainingModelType = 0; + break; + case "SMART_REPLY_DUAL_ENCODER_MODEL": + case 2: + message.trainingModelType = 2; + break; + case "SMART_REPLY_BERT_MODEL": + case 6: + message.trainingModelType = 6; + break; + } + return message; + }; + + /** + * Creates a plain object from a SmartReplyModelMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @static + * @param {google.cloud.dialogflow.v2.SmartReplyModelMetadata} message SmartReplyModelMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SmartReplyModelMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.trainingModelType = options.enums === String ? "MODEL_TYPE_UNSPECIFIED" : 0; + if (message.trainingModelType != null && message.hasOwnProperty("trainingModelType")) + object.trainingModelType = options.enums === String ? $root.google.cloud.dialogflow.v2.ConversationModel.ModelType[message.trainingModelType] === undefined ? message.trainingModelType : $root.google.cloud.dialogflow.v2.ConversationModel.ModelType[message.trainingModelType] : message.trainingModelType; + return object; + }; + + /** + * Converts this SmartReplyModelMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @instance + * @returns {Object.} JSON object + */ + SmartReplyModelMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SmartReplyModelMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SmartReplyModelMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SmartReplyModelMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SmartReplyModelMetadata"; + }; + + return SmartReplyModelMetadata; + })(); + + v2.SmartReplyMetrics = (function() { + + /** + * Properties of a SmartReplyMetrics. + * @memberof google.cloud.dialogflow.v2 + * @interface ISmartReplyMetrics + * @property {number|null} [allowlistCoverage] SmartReplyMetrics allowlistCoverage + * @property {Array.|null} [topNMetrics] SmartReplyMetrics topNMetrics + * @property {number|Long|null} [conversationCount] SmartReplyMetrics conversationCount + */ + + /** + * Constructs a new SmartReplyMetrics. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SmartReplyMetrics. + * @implements ISmartReplyMetrics + * @constructor + * @param {google.cloud.dialogflow.v2.ISmartReplyMetrics=} [properties] Properties to set + */ + function SmartReplyMetrics(properties) { + this.topNMetrics = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SmartReplyMetrics allowlistCoverage. + * @member {number} allowlistCoverage + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @instance + */ + SmartReplyMetrics.prototype.allowlistCoverage = 0; + + /** + * SmartReplyMetrics topNMetrics. + * @member {Array.} topNMetrics + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @instance + */ + SmartReplyMetrics.prototype.topNMetrics = $util.emptyArray; + + /** + * SmartReplyMetrics conversationCount. + * @member {number|Long} conversationCount + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @instance + */ + SmartReplyMetrics.prototype.conversationCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new SmartReplyMetrics instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @static + * @param {google.cloud.dialogflow.v2.ISmartReplyMetrics=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SmartReplyMetrics} SmartReplyMetrics instance + */ + SmartReplyMetrics.create = function create(properties) { + return new SmartReplyMetrics(properties); + }; + + /** + * Encodes the specified SmartReplyMetrics message. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyMetrics.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @static + * @param {google.cloud.dialogflow.v2.ISmartReplyMetrics} message SmartReplyMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyMetrics.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowlistCoverage != null && Object.hasOwnProperty.call(message, "allowlistCoverage")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.allowlistCoverage); + if (message.topNMetrics != null && message.topNMetrics.length) + for (var i = 0; i < message.topNMetrics.length; ++i) + $root.google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics.encode(message.topNMetrics[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.conversationCount != null && Object.hasOwnProperty.call(message, "conversationCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.conversationCount); + return writer; + }; + + /** + * Encodes the specified SmartReplyMetrics message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyMetrics.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @static + * @param {google.cloud.dialogflow.v2.ISmartReplyMetrics} message SmartReplyMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyMetrics.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SmartReplyMetrics message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SmartReplyMetrics} SmartReplyMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyMetrics.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SmartReplyMetrics(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.allowlistCoverage = reader.float(); + break; + } + case 2: { + if (!(message.topNMetrics && message.topNMetrics.length)) + message.topNMetrics = []; + message.topNMetrics.push($root.google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics.decode(reader, reader.uint32())); + break; + } + case 3: { + message.conversationCount = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SmartReplyMetrics message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SmartReplyMetrics} SmartReplyMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyMetrics.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SmartReplyMetrics message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SmartReplyMetrics.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowlistCoverage != null && message.hasOwnProperty("allowlistCoverage")) + if (typeof message.allowlistCoverage !== "number") + return "allowlistCoverage: number expected"; + if (message.topNMetrics != null && message.hasOwnProperty("topNMetrics")) { + if (!Array.isArray(message.topNMetrics)) + return "topNMetrics: array expected"; + for (var i = 0; i < message.topNMetrics.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics.verify(message.topNMetrics[i]); + if (error) + return "topNMetrics." + error; + } + } + if (message.conversationCount != null && message.hasOwnProperty("conversationCount")) + if (!$util.isInteger(message.conversationCount) && !(message.conversationCount && $util.isInteger(message.conversationCount.low) && $util.isInteger(message.conversationCount.high))) + return "conversationCount: integer|Long expected"; + return null; + }; + + /** + * Creates a SmartReplyMetrics message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SmartReplyMetrics} SmartReplyMetrics + */ + SmartReplyMetrics.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SmartReplyMetrics) + return object; + var message = new $root.google.cloud.dialogflow.v2.SmartReplyMetrics(); + if (object.allowlistCoverage != null) + message.allowlistCoverage = Number(object.allowlistCoverage); + if (object.topNMetrics) { + if (!Array.isArray(object.topNMetrics)) + throw TypeError(".google.cloud.dialogflow.v2.SmartReplyMetrics.topNMetrics: array expected"); + message.topNMetrics = []; + for (var i = 0; i < object.topNMetrics.length; ++i) { + if (typeof object.topNMetrics[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SmartReplyMetrics.topNMetrics: object expected"); + message.topNMetrics[i] = $root.google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics.fromObject(object.topNMetrics[i]); + } + } + if (object.conversationCount != null) + if ($util.Long) + (message.conversationCount = $util.Long.fromValue(object.conversationCount)).unsigned = false; + else if (typeof object.conversationCount === "string") + message.conversationCount = parseInt(object.conversationCount, 10); + else if (typeof object.conversationCount === "number") + message.conversationCount = object.conversationCount; + else if (typeof object.conversationCount === "object") + message.conversationCount = new $util.LongBits(object.conversationCount.low >>> 0, object.conversationCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a SmartReplyMetrics message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @static + * @param {google.cloud.dialogflow.v2.SmartReplyMetrics} message SmartReplyMetrics + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SmartReplyMetrics.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.topNMetrics = []; + if (options.defaults) { + object.allowlistCoverage = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.conversationCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.conversationCount = options.longs === String ? "0" : 0; + } + if (message.allowlistCoverage != null && message.hasOwnProperty("allowlistCoverage")) + object.allowlistCoverage = options.json && !isFinite(message.allowlistCoverage) ? String(message.allowlistCoverage) : message.allowlistCoverage; + if (message.topNMetrics && message.topNMetrics.length) { + object.topNMetrics = []; + for (var j = 0; j < message.topNMetrics.length; ++j) + object.topNMetrics[j] = $root.google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics.toObject(message.topNMetrics[j], options); + } + if (message.conversationCount != null && message.hasOwnProperty("conversationCount")) + if (typeof message.conversationCount === "number") + object.conversationCount = options.longs === String ? String(message.conversationCount) : message.conversationCount; + else + object.conversationCount = options.longs === String ? $util.Long.prototype.toString.call(message.conversationCount) : options.longs === Number ? new $util.LongBits(message.conversationCount.low >>> 0, message.conversationCount.high >>> 0).toNumber() : message.conversationCount; + return object; + }; + + /** + * Converts this SmartReplyMetrics to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @instance + * @returns {Object.} JSON object + */ + SmartReplyMetrics.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SmartReplyMetrics + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SmartReplyMetrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SmartReplyMetrics"; + }; + + SmartReplyMetrics.TopNMetrics = (function() { + + /** + * Properties of a TopNMetrics. + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @interface ITopNMetrics + * @property {number|null} [n] TopNMetrics n + * @property {number|null} [recall] TopNMetrics recall + */ + + /** + * Constructs a new TopNMetrics. + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics + * @classdesc Represents a TopNMetrics. + * @implements ITopNMetrics + * @constructor + * @param {google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics=} [properties] Properties to set + */ + function TopNMetrics(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TopNMetrics n. + * @member {number} n + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @instance + */ + TopNMetrics.prototype.n = 0; + + /** + * TopNMetrics recall. + * @member {number} recall + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @instance + */ + TopNMetrics.prototype.recall = 0; + + /** + * Creates a new TopNMetrics instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @static + * @param {google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics} TopNMetrics instance + */ + TopNMetrics.create = function create(properties) { + return new TopNMetrics(properties); + }; + + /** + * Encodes the specified TopNMetrics message. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @static + * @param {google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics} message TopNMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TopNMetrics.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.n != null && Object.hasOwnProperty.call(message, "n")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.n); + if (message.recall != null && Object.hasOwnProperty.call(message, "recall")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.recall); + return writer; + }; + + /** + * Encodes the specified TopNMetrics message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @static + * @param {google.cloud.dialogflow.v2.SmartReplyMetrics.ITopNMetrics} message TopNMetrics message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TopNMetrics.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TopNMetrics message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics} TopNMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TopNMetrics.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.n = reader.int32(); + break; + } + case 2: { + message.recall = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TopNMetrics message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics} TopNMetrics + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TopNMetrics.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TopNMetrics message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TopNMetrics.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.n != null && message.hasOwnProperty("n")) + if (!$util.isInteger(message.n)) + return "n: integer expected"; + if (message.recall != null && message.hasOwnProperty("recall")) + if (typeof message.recall !== "number") + return "recall: number expected"; + return null; + }; + + /** + * Creates a TopNMetrics message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics} TopNMetrics + */ + TopNMetrics.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics) + return object; + var message = new $root.google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics(); + if (object.n != null) + message.n = object.n | 0; + if (object.recall != null) + message.recall = Number(object.recall); + return message; + }; + + /** + * Creates a plain object from a TopNMetrics message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @static + * @param {google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics} message TopNMetrics + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TopNMetrics.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.n = 0; + object.recall = 0; + } + if (message.n != null && message.hasOwnProperty("n")) + object.n = message.n; + if (message.recall != null && message.hasOwnProperty("recall")) + object.recall = options.json && !isFinite(message.recall) ? String(message.recall) : message.recall; + return object; + }; + + /** + * Converts this TopNMetrics to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @instance + * @returns {Object.} JSON object + */ + TopNMetrics.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TopNMetrics + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TopNMetrics.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SmartReplyMetrics.TopNMetrics"; + }; + + return TopNMetrics; + })(); + + return SmartReplyMetrics; + })(); + + v2.CreateConversationModelRequest = (function() { + + /** + * Properties of a CreateConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateConversationModelRequest + * @property {string|null} [parent] CreateConversationModelRequest parent + * @property {google.cloud.dialogflow.v2.IConversationModel|null} [conversationModel] CreateConversationModelRequest conversationModel + */ + + /** + * Constructs a new CreateConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateConversationModelRequest. + * @implements ICreateConversationModelRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateConversationModelRequest=} [properties] Properties to set + */ + function CreateConversationModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationModelRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @instance + */ + CreateConversationModelRequest.prototype.parent = ""; + + /** + * CreateConversationModelRequest conversationModel. + * @member {google.cloud.dialogflow.v2.IConversationModel|null|undefined} conversationModel + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @instance + */ + CreateConversationModelRequest.prototype.conversationModel = null; + + /** + * Creates a new CreateConversationModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateConversationModelRequest} CreateConversationModelRequest instance + */ + CreateConversationModelRequest.create = function create(properties) { + return new CreateConversationModelRequest(properties); + }; + + /** + * Encodes the specified CreateConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelRequest} message CreateConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationModelRequest.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.conversationModel != null && Object.hasOwnProperty.call(message, "conversationModel")) + $root.google.cloud.dialogflow.v2.ConversationModel.encode(message.conversationModel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelRequest} message CreateConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateConversationModelRequest} CreateConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateConversationModelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.conversationModel = $root.google.cloud.dialogflow.v2.ConversationModel.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateConversationModelRequest} CreateConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationModelRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationModelRequest.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.conversationModel != null && message.hasOwnProperty("conversationModel")) { + var error = $root.google.cloud.dialogflow.v2.ConversationModel.verify(message.conversationModel); + if (error) + return "conversationModel." + error; + } + return null; + }; + + /** + * Creates a CreateConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateConversationModelRequest} CreateConversationModelRequest + */ + CreateConversationModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateConversationModelRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateConversationModelRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.conversationModel != null) { + if (typeof object.conversationModel !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateConversationModelRequest.conversationModel: object expected"); + message.conversationModel = $root.google.cloud.dialogflow.v2.ConversationModel.fromObject(object.conversationModel); + } + return message; + }; + + /** + * Creates a plain object from a CreateConversationModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateConversationModelRequest} message CreateConversationModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationModelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.conversationModel = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + object.conversationModel = $root.google.cloud.dialogflow.v2.ConversationModel.toObject(message.conversationModel, options); + return object; + }; + + /** + * Converts this CreateConversationModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @instance + * @returns {Object.} JSON object + */ + CreateConversationModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationModelRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateConversationModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateConversationModelRequest"; + }; + + return CreateConversationModelRequest; + })(); + + v2.GetConversationModelRequest = (function() { + + /** + * Properties of a GetConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetConversationModelRequest + * @property {string|null} [name] GetConversationModelRequest name + */ + + /** + * Constructs a new GetConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetConversationModelRequest. + * @implements IGetConversationModelRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetConversationModelRequest=} [properties] Properties to set + */ + function GetConversationModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConversationModelRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @instance + */ + GetConversationModelRequest.prototype.name = ""; + + /** + * Creates a new GetConversationModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationModelRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetConversationModelRequest} GetConversationModelRequest instance + */ + GetConversationModelRequest.create = function create(properties) { + return new GetConversationModelRequest(properties); + }; + + /** + * Encodes the specified GetConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationModelRequest} message GetConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationModelRequest.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 GetConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationModelRequest} message GetConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConversationModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetConversationModelRequest} GetConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetConversationModelRequest(); + 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 GetConversationModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetConversationModelRequest} GetConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConversationModelRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConversationModelRequest.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 GetConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetConversationModelRequest} GetConversationModelRequest + */ + GetConversationModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetConversationModelRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetConversationModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetConversationModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.GetConversationModelRequest} message GetConversationModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConversationModelRequest.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 GetConversationModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @instance + * @returns {Object.} JSON object + */ + GetConversationModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetConversationModelRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetConversationModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetConversationModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetConversationModelRequest"; + }; + + return GetConversationModelRequest; + })(); + + v2.ListConversationModelsRequest = (function() { + + /** + * Properties of a ListConversationModelsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationModelsRequest + * @property {string|null} [parent] ListConversationModelsRequest parent + * @property {number|null} [pageSize] ListConversationModelsRequest pageSize + * @property {string|null} [pageToken] ListConversationModelsRequest pageToken + */ + + /** + * Constructs a new ListConversationModelsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationModelsRequest. + * @implements IListConversationModelsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationModelsRequest=} [properties] Properties to set + */ + function ListConversationModelsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationModelsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @instance + */ + ListConversationModelsRequest.prototype.parent = ""; + + /** + * ListConversationModelsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @instance + */ + ListConversationModelsRequest.prototype.pageSize = 0; + + /** + * ListConversationModelsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @instance + */ + ListConversationModelsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListConversationModelsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationModelsRequest} ListConversationModelsRequest instance + */ + ListConversationModelsRequest.create = function create(properties) { + return new ListConversationModelsRequest(properties); + }; + + /** + * Encodes the specified ListConversationModelsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelsRequest} message ListConversationModelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationModelsRequest.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 ListConversationModelsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelsRequest} message ListConversationModelsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationModelsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationModelsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationModelsRequest} ListConversationModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationModelsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationModelsRequest(); + 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 ListConversationModelsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationModelsRequest} ListConversationModelsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationModelsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationModelsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationModelsRequest.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 ListConversationModelsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationModelsRequest} ListConversationModelsRequest + */ + ListConversationModelsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationModelsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationModelsRequest(); + 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 ListConversationModelsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListConversationModelsRequest} message ListConversationModelsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationModelsRequest.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 ListConversationModelsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @instance + * @returns {Object.} JSON object + */ + ListConversationModelsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationModelsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationModelsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationModelsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationModelsRequest"; + }; + + return ListConversationModelsRequest; + })(); + + v2.ListConversationModelsResponse = (function() { + + /** + * Properties of a ListConversationModelsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationModelsResponse + * @property {Array.|null} [conversationModels] ListConversationModelsResponse conversationModels + * @property {string|null} [nextPageToken] ListConversationModelsResponse nextPageToken + */ + + /** + * Constructs a new ListConversationModelsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationModelsResponse. + * @implements IListConversationModelsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationModelsResponse=} [properties] Properties to set + */ + function ListConversationModelsResponse(properties) { + this.conversationModels = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationModelsResponse conversationModels. + * @member {Array.} conversationModels + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @instance + */ + ListConversationModelsResponse.prototype.conversationModels = $util.emptyArray; + + /** + * ListConversationModelsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @instance + */ + ListConversationModelsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListConversationModelsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationModelsResponse} ListConversationModelsResponse instance + */ + ListConversationModelsResponse.create = function create(properties) { + return new ListConversationModelsResponse(properties); + }; + + /** + * Encodes the specified ListConversationModelsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelsResponse} message ListConversationModelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationModelsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationModels != null && message.conversationModels.length) + for (var i = 0; i < message.conversationModels.length; ++i) + $root.google.cloud.dialogflow.v2.ConversationModel.encode(message.conversationModels[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 ListConversationModelsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelsResponse} message ListConversationModelsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationModelsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationModelsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationModelsResponse} ListConversationModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationModelsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationModelsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.conversationModels && message.conversationModels.length)) + message.conversationModels = []; + message.conversationModels.push($root.google.cloud.dialogflow.v2.ConversationModel.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListConversationModelsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationModelsResponse} ListConversationModelsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationModelsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationModelsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationModelsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationModels != null && message.hasOwnProperty("conversationModels")) { + if (!Array.isArray(message.conversationModels)) + return "conversationModels: array expected"; + for (var i = 0; i < message.conversationModels.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.ConversationModel.verify(message.conversationModels[i]); + if (error) + return "conversationModels." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListConversationModelsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationModelsResponse} ListConversationModelsResponse + */ + ListConversationModelsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationModelsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationModelsResponse(); + if (object.conversationModels) { + if (!Array.isArray(object.conversationModels)) + throw TypeError(".google.cloud.dialogflow.v2.ListConversationModelsResponse.conversationModels: array expected"); + message.conversationModels = []; + for (var i = 0; i < object.conversationModels.length; ++i) { + if (typeof object.conversationModels[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListConversationModelsResponse.conversationModels: object expected"); + message.conversationModels[i] = $root.google.cloud.dialogflow.v2.ConversationModel.fromObject(object.conversationModels[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListConversationModelsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListConversationModelsResponse} message ListConversationModelsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationModelsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conversationModels = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.conversationModels && message.conversationModels.length) { + object.conversationModels = []; + for (var j = 0; j < message.conversationModels.length; ++j) + object.conversationModels[j] = $root.google.cloud.dialogflow.v2.ConversationModel.toObject(message.conversationModels[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListConversationModelsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @instance + * @returns {Object.} JSON object + */ + ListConversationModelsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationModelsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationModelsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationModelsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationModelsResponse"; + }; + + return ListConversationModelsResponse; + })(); + + v2.DeleteConversationModelRequest = (function() { + + /** + * Properties of a DeleteConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteConversationModelRequest + * @property {string|null} [name] DeleteConversationModelRequest name + */ + + /** + * Constructs a new DeleteConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteConversationModelRequest. + * @implements IDeleteConversationModelRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelRequest=} [properties] Properties to set + */ + function DeleteConversationModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteConversationModelRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @instance + */ + DeleteConversationModelRequest.prototype.name = ""; + + /** + * Creates a new DeleteConversationModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteConversationModelRequest} DeleteConversationModelRequest instance + */ + DeleteConversationModelRequest.create = function create(properties) { + return new DeleteConversationModelRequest(properties); + }; + + /** + * Encodes the specified DeleteConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelRequest} message DeleteConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationModelRequest.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 DeleteConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelRequest} message DeleteConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteConversationModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteConversationModelRequest} DeleteConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteConversationModelRequest(); + 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 DeleteConversationModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteConversationModelRequest} DeleteConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteConversationModelRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteConversationModelRequest.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 DeleteConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteConversationModelRequest} DeleteConversationModelRequest + */ + DeleteConversationModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteConversationModelRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteConversationModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteConversationModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteConversationModelRequest} message DeleteConversationModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteConversationModelRequest.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 DeleteConversationModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteConversationModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteConversationModelRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteConversationModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteConversationModelRequest"; + }; + + return DeleteConversationModelRequest; + })(); + + v2.DeployConversationModelRequest = (function() { + + /** + * Properties of a DeployConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeployConversationModelRequest + * @property {string|null} [name] DeployConversationModelRequest name + */ + + /** + * Constructs a new DeployConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeployConversationModelRequest. + * @implements IDeployConversationModelRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeployConversationModelRequest=} [properties] Properties to set + */ + function DeployConversationModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeployConversationModelRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @instance + */ + DeployConversationModelRequest.prototype.name = ""; + + /** + * Creates a new DeployConversationModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeployConversationModelRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeployConversationModelRequest} DeployConversationModelRequest instance + */ + DeployConversationModelRequest.create = function create(properties) { + return new DeployConversationModelRequest(properties); + }; + + /** + * Encodes the specified DeployConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeployConversationModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeployConversationModelRequest} message DeployConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployConversationModelRequest.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 DeployConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeployConversationModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeployConversationModelRequest} message DeployConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployConversationModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeployConversationModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeployConversationModelRequest} DeployConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployConversationModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeployConversationModelRequest(); + 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 DeployConversationModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeployConversationModelRequest} DeployConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployConversationModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeployConversationModelRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeployConversationModelRequest.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 DeployConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeployConversationModelRequest} DeployConversationModelRequest + */ + DeployConversationModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeployConversationModelRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeployConversationModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeployConversationModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.DeployConversationModelRequest} message DeployConversationModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeployConversationModelRequest.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 DeployConversationModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @instance + * @returns {Object.} JSON object + */ + DeployConversationModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeployConversationModelRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeployConversationModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeployConversationModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeployConversationModelRequest"; + }; + + return DeployConversationModelRequest; + })(); + + v2.UndeployConversationModelRequest = (function() { + + /** + * Properties of an UndeployConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUndeployConversationModelRequest + * @property {string|null} [name] UndeployConversationModelRequest name + */ + + /** + * Constructs a new UndeployConversationModelRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UndeployConversationModelRequest. + * @implements IUndeployConversationModelRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelRequest=} [properties] Properties to set + */ + function UndeployConversationModelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UndeployConversationModelRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @instance + */ + UndeployConversationModelRequest.prototype.name = ""; + + /** + * Creates a new UndeployConversationModelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UndeployConversationModelRequest} UndeployConversationModelRequest instance + */ + UndeployConversationModelRequest.create = function create(properties) { + return new UndeployConversationModelRequest(properties); + }; + + /** + * Encodes the specified UndeployConversationModelRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UndeployConversationModelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelRequest} message UndeployConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployConversationModelRequest.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 UndeployConversationModelRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UndeployConversationModelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelRequest} message UndeployConversationModelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployConversationModelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeployConversationModelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UndeployConversationModelRequest} UndeployConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployConversationModelRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UndeployConversationModelRequest(); + 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 an UndeployConversationModelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UndeployConversationModelRequest} UndeployConversationModelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployConversationModelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeployConversationModelRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeployConversationModelRequest.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 an UndeployConversationModelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UndeployConversationModelRequest} UndeployConversationModelRequest + */ + UndeployConversationModelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UndeployConversationModelRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UndeployConversationModelRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an UndeployConversationModelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @static + * @param {google.cloud.dialogflow.v2.UndeployConversationModelRequest} message UndeployConversationModelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployConversationModelRequest.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 UndeployConversationModelRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @instance + * @returns {Object.} JSON object + */ + UndeployConversationModelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UndeployConversationModelRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeployConversationModelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UndeployConversationModelRequest"; + }; + + return UndeployConversationModelRequest; + })(); + + v2.GetConversationModelEvaluationRequest = (function() { + + /** + * Properties of a GetConversationModelEvaluationRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetConversationModelEvaluationRequest + * @property {string|null} [name] GetConversationModelEvaluationRequest name + */ + + /** + * Constructs a new GetConversationModelEvaluationRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetConversationModelEvaluationRequest. + * @implements IGetConversationModelEvaluationRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest=} [properties] Properties to set + */ + function GetConversationModelEvaluationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConversationModelEvaluationRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @instance + */ + GetConversationModelEvaluationRequest.prototype.name = ""; + + /** + * Creates a new GetConversationModelEvaluationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest} GetConversationModelEvaluationRequest instance + */ + GetConversationModelEvaluationRequest.create = function create(properties) { + return new GetConversationModelEvaluationRequest(properties); + }; + + /** + * Encodes the specified GetConversationModelEvaluationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest} message GetConversationModelEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationModelEvaluationRequest.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 GetConversationModelEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest} message GetConversationModelEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationModelEvaluationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConversationModelEvaluationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest} GetConversationModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationModelEvaluationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest(); + 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 GetConversationModelEvaluationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest} GetConversationModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationModelEvaluationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConversationModelEvaluationRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConversationModelEvaluationRequest.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 GetConversationModelEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest} GetConversationModelEvaluationRequest + */ + GetConversationModelEvaluationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetConversationModelEvaluationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @static + * @param {google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest} message GetConversationModelEvaluationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConversationModelEvaluationRequest.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 GetConversationModelEvaluationRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @instance + * @returns {Object.} JSON object + */ + GetConversationModelEvaluationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetConversationModelEvaluationRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetConversationModelEvaluationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest"; + }; + + return GetConversationModelEvaluationRequest; + })(); + + v2.ListConversationModelEvaluationsRequest = (function() { + + /** + * Properties of a ListConversationModelEvaluationsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationModelEvaluationsRequest + * @property {string|null} [parent] ListConversationModelEvaluationsRequest parent + * @property {number|null} [pageSize] ListConversationModelEvaluationsRequest pageSize + * @property {string|null} [pageToken] ListConversationModelEvaluationsRequest pageToken + */ + + /** + * Constructs a new ListConversationModelEvaluationsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationModelEvaluationsRequest. + * @implements IListConversationModelEvaluationsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest=} [properties] Properties to set + */ + function ListConversationModelEvaluationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationModelEvaluationsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @instance + */ + ListConversationModelEvaluationsRequest.prototype.parent = ""; + + /** + * ListConversationModelEvaluationsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @instance + */ + ListConversationModelEvaluationsRequest.prototype.pageSize = 0; + + /** + * ListConversationModelEvaluationsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @instance + */ + ListConversationModelEvaluationsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListConversationModelEvaluationsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest} ListConversationModelEvaluationsRequest instance + */ + ListConversationModelEvaluationsRequest.create = function create(properties) { + return new ListConversationModelEvaluationsRequest(properties); + }; + + /** + * Encodes the specified ListConversationModelEvaluationsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest} message ListConversationModelEvaluationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationModelEvaluationsRequest.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 ListConversationModelEvaluationsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest} message ListConversationModelEvaluationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationModelEvaluationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationModelEvaluationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest} ListConversationModelEvaluationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationModelEvaluationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest(); + 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 ListConversationModelEvaluationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest} ListConversationModelEvaluationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationModelEvaluationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationModelEvaluationsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationModelEvaluationsRequest.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 ListConversationModelEvaluationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest} ListConversationModelEvaluationsRequest + */ + ListConversationModelEvaluationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest(); + 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 ListConversationModelEvaluationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest} message ListConversationModelEvaluationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationModelEvaluationsRequest.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 ListConversationModelEvaluationsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListConversationModelEvaluationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationModelEvaluationsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationModelEvaluationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest"; + }; + + return ListConversationModelEvaluationsRequest; + })(); + + v2.ListConversationModelEvaluationsResponse = (function() { + + /** + * Properties of a ListConversationModelEvaluationsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationModelEvaluationsResponse + * @property {Array.|null} [conversationModelEvaluations] ListConversationModelEvaluationsResponse conversationModelEvaluations + * @property {string|null} [nextPageToken] ListConversationModelEvaluationsResponse nextPageToken + */ + + /** + * Constructs a new ListConversationModelEvaluationsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationModelEvaluationsResponse. + * @implements IListConversationModelEvaluationsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse=} [properties] Properties to set + */ + function ListConversationModelEvaluationsResponse(properties) { + this.conversationModelEvaluations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationModelEvaluationsResponse conversationModelEvaluations. + * @member {Array.} conversationModelEvaluations + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @instance + */ + ListConversationModelEvaluationsResponse.prototype.conversationModelEvaluations = $util.emptyArray; + + /** + * ListConversationModelEvaluationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @instance + */ + ListConversationModelEvaluationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListConversationModelEvaluationsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse} ListConversationModelEvaluationsResponse instance + */ + ListConversationModelEvaluationsResponse.create = function create(properties) { + return new ListConversationModelEvaluationsResponse(properties); + }; + + /** + * Encodes the specified ListConversationModelEvaluationsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse} message ListConversationModelEvaluationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationModelEvaluationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationModelEvaluations != null && message.conversationModelEvaluations.length) + for (var i = 0; i < message.conversationModelEvaluations.length; ++i) + $root.google.cloud.dialogflow.v2.ConversationModelEvaluation.encode(message.conversationModelEvaluations[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 ListConversationModelEvaluationsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse} message ListConversationModelEvaluationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationModelEvaluationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationModelEvaluationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse} ListConversationModelEvaluationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationModelEvaluationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.conversationModelEvaluations && message.conversationModelEvaluations.length)) + message.conversationModelEvaluations = []; + message.conversationModelEvaluations.push($root.google.cloud.dialogflow.v2.ConversationModelEvaluation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListConversationModelEvaluationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse} ListConversationModelEvaluationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationModelEvaluationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationModelEvaluationsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationModelEvaluationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationModelEvaluations != null && message.hasOwnProperty("conversationModelEvaluations")) { + if (!Array.isArray(message.conversationModelEvaluations)) + return "conversationModelEvaluations: array expected"; + for (var i = 0; i < message.conversationModelEvaluations.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.ConversationModelEvaluation.verify(message.conversationModelEvaluations[i]); + if (error) + return "conversationModelEvaluations." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListConversationModelEvaluationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse} ListConversationModelEvaluationsResponse + */ + ListConversationModelEvaluationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse(); + if (object.conversationModelEvaluations) { + if (!Array.isArray(object.conversationModelEvaluations)) + throw TypeError(".google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse.conversationModelEvaluations: array expected"); + message.conversationModelEvaluations = []; + for (var i = 0; i < object.conversationModelEvaluations.length; ++i) { + if (typeof object.conversationModelEvaluations[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse.conversationModelEvaluations: object expected"); + message.conversationModelEvaluations[i] = $root.google.cloud.dialogflow.v2.ConversationModelEvaluation.fromObject(object.conversationModelEvaluations[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListConversationModelEvaluationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse} message ListConversationModelEvaluationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationModelEvaluationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conversationModelEvaluations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.conversationModelEvaluations && message.conversationModelEvaluations.length) { + object.conversationModelEvaluations = []; + for (var j = 0; j < message.conversationModelEvaluations.length; ++j) + object.conversationModelEvaluations[j] = $root.google.cloud.dialogflow.v2.ConversationModelEvaluation.toObject(message.conversationModelEvaluations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListConversationModelEvaluationsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListConversationModelEvaluationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationModelEvaluationsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationModelEvaluationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse"; + }; + + return ListConversationModelEvaluationsResponse; + })(); + + v2.CreateConversationModelEvaluationRequest = (function() { + + /** + * Properties of a CreateConversationModelEvaluationRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateConversationModelEvaluationRequest + * @property {string|null} [parent] CreateConversationModelEvaluationRequest parent + * @property {google.cloud.dialogflow.v2.IConversationModelEvaluation|null} [conversationModelEvaluation] CreateConversationModelEvaluationRequest conversationModelEvaluation + */ + + /** + * Constructs a new CreateConversationModelEvaluationRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateConversationModelEvaluationRequest. + * @implements ICreateConversationModelEvaluationRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest=} [properties] Properties to set + */ + function CreateConversationModelEvaluationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationModelEvaluationRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @instance + */ + CreateConversationModelEvaluationRequest.prototype.parent = ""; + + /** + * CreateConversationModelEvaluationRequest conversationModelEvaluation. + * @member {google.cloud.dialogflow.v2.IConversationModelEvaluation|null|undefined} conversationModelEvaluation + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @instance + */ + CreateConversationModelEvaluationRequest.prototype.conversationModelEvaluation = null; + + /** + * Creates a new CreateConversationModelEvaluationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest} CreateConversationModelEvaluationRequest instance + */ + CreateConversationModelEvaluationRequest.create = function create(properties) { + return new CreateConversationModelEvaluationRequest(properties); + }; + + /** + * Encodes the specified CreateConversationModelEvaluationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest} message CreateConversationModelEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationModelEvaluationRequest.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.conversationModelEvaluation != null && Object.hasOwnProperty.call(message, "conversationModelEvaluation")) + $root.google.cloud.dialogflow.v2.ConversationModelEvaluation.encode(message.conversationModelEvaluation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateConversationModelEvaluationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest} message CreateConversationModelEvaluationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationModelEvaluationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationModelEvaluationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest} CreateConversationModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationModelEvaluationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.conversationModelEvaluation = $root.google.cloud.dialogflow.v2.ConversationModelEvaluation.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationModelEvaluationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest} CreateConversationModelEvaluationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationModelEvaluationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationModelEvaluationRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationModelEvaluationRequest.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.conversationModelEvaluation != null && message.hasOwnProperty("conversationModelEvaluation")) { + var error = $root.google.cloud.dialogflow.v2.ConversationModelEvaluation.verify(message.conversationModelEvaluation); + if (error) + return "conversationModelEvaluation." + error; + } + return null; + }; + + /** + * Creates a CreateConversationModelEvaluationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest} CreateConversationModelEvaluationRequest + */ + CreateConversationModelEvaluationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.conversationModelEvaluation != null) { + if (typeof object.conversationModelEvaluation !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest.conversationModelEvaluation: object expected"); + message.conversationModelEvaluation = $root.google.cloud.dialogflow.v2.ConversationModelEvaluation.fromObject(object.conversationModelEvaluation); + } + return message; + }; + + /** + * Creates a plain object from a CreateConversationModelEvaluationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest} message CreateConversationModelEvaluationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationModelEvaluationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.conversationModelEvaluation = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.conversationModelEvaluation != null && message.hasOwnProperty("conversationModelEvaluation")) + object.conversationModelEvaluation = $root.google.cloud.dialogflow.v2.ConversationModelEvaluation.toObject(message.conversationModelEvaluation, options); + return object; + }; + + /** + * Converts this CreateConversationModelEvaluationRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @instance + * @returns {Object.} JSON object + */ + CreateConversationModelEvaluationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationModelEvaluationRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationModelEvaluationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest"; + }; + + return CreateConversationModelEvaluationRequest; + })(); + + v2.CreateConversationModelOperationMetadata = (function() { + + /** + * Properties of a CreateConversationModelOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateConversationModelOperationMetadata + * @property {string|null} [conversationModel] CreateConversationModelOperationMetadata conversationModel + * @property {google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.State|null} [state] CreateConversationModelOperationMetadata state + * @property {google.protobuf.ITimestamp|null} [createTime] CreateConversationModelOperationMetadata createTime + */ + + /** + * Constructs a new CreateConversationModelOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateConversationModelOperationMetadata. + * @implements ICreateConversationModelOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata=} [properties] Properties to set + */ + function CreateConversationModelOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationModelOperationMetadata conversationModel. + * @member {string} conversationModel + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @instance + */ + CreateConversationModelOperationMetadata.prototype.conversationModel = ""; + + /** + * CreateConversationModelOperationMetadata state. + * @member {google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.State} state + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @instance + */ + CreateConversationModelOperationMetadata.prototype.state = 0; + + /** + * CreateConversationModelOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @instance + */ + CreateConversationModelOperationMetadata.prototype.createTime = null; + + /** + * Creates a new CreateConversationModelOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata} CreateConversationModelOperationMetadata instance + */ + CreateConversationModelOperationMetadata.create = function create(properties) { + return new CreateConversationModelOperationMetadata(properties); + }; + + /** + * Encodes the specified CreateConversationModelOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata} message CreateConversationModelOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationModelOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationModel != null && Object.hasOwnProperty.call(message, "conversationModel")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationModel); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateConversationModelOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata} message CreateConversationModelOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationModelOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationModelOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata} CreateConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationModelOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationModel = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationModelOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata} CreateConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationModelOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationModelOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationModelOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + if (!$util.isString(message.conversationModel)) + return "conversationModel: string 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: + case 5: + case 6: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a CreateConversationModelOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata} CreateConversationModelOperationMetadata + */ + CreateConversationModelOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata(); + if (object.conversationModel != null) + message.conversationModel = String(object.conversationModel); + 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 "PENDING": + case 1: + message.state = 1; + break; + case "SUCCEEDED": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "CANCELLED": + case 4: + message.state = 4; + break; + case "CANCELLING": + case 5: + message.state = 5; + break; + case "TRAINING": + case 6: + message.state = 6; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a CreateConversationModelOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata} message CreateConversationModelOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationModelOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationModel = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.createTime = null; + } + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + object.conversationModel = message.conversationModel; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.State[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this CreateConversationModelOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateConversationModelOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationModelOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationModelOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata"; + }; + + /** + * State enum. + * @name google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} PENDING=1 PENDING value + * @property {number} SUCCEEDED=2 SUCCEEDED value + * @property {number} FAILED=3 FAILED value + * @property {number} CANCELLED=4 CANCELLED value + * @property {number} CANCELLING=5 CANCELLING value + * @property {number} TRAINING=6 TRAINING value + */ + CreateConversationModelOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PENDING"] = 1; + values[valuesById[2] = "SUCCEEDED"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "CANCELLED"] = 4; + values[valuesById[5] = "CANCELLING"] = 5; + values[valuesById[6] = "TRAINING"] = 6; + return values; + })(); + + return CreateConversationModelOperationMetadata; + })(); + + v2.DeployConversationModelOperationMetadata = (function() { + + /** + * Properties of a DeployConversationModelOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeployConversationModelOperationMetadata + * @property {string|null} [conversationModel] DeployConversationModelOperationMetadata conversationModel + * @property {google.protobuf.ITimestamp|null} [createTime] DeployConversationModelOperationMetadata createTime + */ + + /** + * Constructs a new DeployConversationModelOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeployConversationModelOperationMetadata. + * @implements IDeployConversationModelOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata=} [properties] Properties to set + */ + function DeployConversationModelOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeployConversationModelOperationMetadata conversationModel. + * @member {string} conversationModel + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @instance + */ + DeployConversationModelOperationMetadata.prototype.conversationModel = ""; + + /** + * DeployConversationModelOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @instance + */ + DeployConversationModelOperationMetadata.prototype.createTime = null; + + /** + * Creates a new DeployConversationModelOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata} DeployConversationModelOperationMetadata instance + */ + DeployConversationModelOperationMetadata.create = function create(properties) { + return new DeployConversationModelOperationMetadata(properties); + }; + + /** + * Encodes the specified DeployConversationModelOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata} message DeployConversationModelOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployConversationModelOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationModel != null && Object.hasOwnProperty.call(message, "conversationModel")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationModel); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeployConversationModelOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata} message DeployConversationModelOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeployConversationModelOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeployConversationModelOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata} DeployConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployConversationModelOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationModel = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeployConversationModelOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata} DeployConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeployConversationModelOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeployConversationModelOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeployConversationModelOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + if (!$util.isString(message.conversationModel)) + return "conversationModel: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a DeployConversationModelOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata} DeployConversationModelOperationMetadata + */ + DeployConversationModelOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata(); + if (object.conversationModel != null) + message.conversationModel = String(object.conversationModel); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a DeployConversationModelOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata} message DeployConversationModelOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeployConversationModelOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationModel = ""; + object.createTime = null; + } + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + object.conversationModel = message.conversationModel; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this DeployConversationModelOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + DeployConversationModelOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeployConversationModelOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeployConversationModelOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata"; + }; + + return DeployConversationModelOperationMetadata; + })(); + + v2.UndeployConversationModelOperationMetadata = (function() { + + /** + * Properties of an UndeployConversationModelOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface IUndeployConversationModelOperationMetadata + * @property {string|null} [conversationModel] UndeployConversationModelOperationMetadata conversationModel + * @property {google.protobuf.ITimestamp|null} [createTime] UndeployConversationModelOperationMetadata createTime + */ + + /** + * Constructs a new UndeployConversationModelOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UndeployConversationModelOperationMetadata. + * @implements IUndeployConversationModelOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata=} [properties] Properties to set + */ + function UndeployConversationModelOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UndeployConversationModelOperationMetadata conversationModel. + * @member {string} conversationModel + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @instance + */ + UndeployConversationModelOperationMetadata.prototype.conversationModel = ""; + + /** + * UndeployConversationModelOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @instance + */ + UndeployConversationModelOperationMetadata.prototype.createTime = null; + + /** + * Creates a new UndeployConversationModelOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata} UndeployConversationModelOperationMetadata instance + */ + UndeployConversationModelOperationMetadata.create = function create(properties) { + return new UndeployConversationModelOperationMetadata(properties); + }; + + /** + * Encodes the specified UndeployConversationModelOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata} message UndeployConversationModelOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployConversationModelOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationModel != null && Object.hasOwnProperty.call(message, "conversationModel")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationModel); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UndeployConversationModelOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata} message UndeployConversationModelOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeployConversationModelOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeployConversationModelOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata} UndeployConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployConversationModelOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationModel = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UndeployConversationModelOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata} UndeployConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeployConversationModelOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeployConversationModelOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeployConversationModelOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + if (!$util.isString(message.conversationModel)) + return "conversationModel: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates an UndeployConversationModelOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata} UndeployConversationModelOperationMetadata + */ + UndeployConversationModelOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata(); + if (object.conversationModel != null) + message.conversationModel = String(object.conversationModel); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from an UndeployConversationModelOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata} message UndeployConversationModelOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeployConversationModelOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationModel = ""; + object.createTime = null; + } + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + object.conversationModel = message.conversationModel; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this UndeployConversationModelOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + UndeployConversationModelOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UndeployConversationModelOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeployConversationModelOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata"; + }; + + return UndeployConversationModelOperationMetadata; + })(); + + v2.DeleteConversationModelOperationMetadata = (function() { + + /** + * Properties of a DeleteConversationModelOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteConversationModelOperationMetadata + * @property {string|null} [conversationModel] DeleteConversationModelOperationMetadata conversationModel + * @property {google.protobuf.ITimestamp|null} [createTime] DeleteConversationModelOperationMetadata createTime + */ + + /** + * Constructs a new DeleteConversationModelOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteConversationModelOperationMetadata. + * @implements IDeleteConversationModelOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata=} [properties] Properties to set + */ + function DeleteConversationModelOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteConversationModelOperationMetadata conversationModel. + * @member {string} conversationModel + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @instance + */ + DeleteConversationModelOperationMetadata.prototype.conversationModel = ""; + + /** + * DeleteConversationModelOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @instance + */ + DeleteConversationModelOperationMetadata.prototype.createTime = null; + + /** + * Creates a new DeleteConversationModelOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata} DeleteConversationModelOperationMetadata instance + */ + DeleteConversationModelOperationMetadata.create = function create(properties) { + return new DeleteConversationModelOperationMetadata(properties); + }; + + /** + * Encodes the specified DeleteConversationModelOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata} message DeleteConversationModelOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationModelOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationModel != null && Object.hasOwnProperty.call(message, "conversationModel")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationModel); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DeleteConversationModelOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata} message DeleteConversationModelOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationModelOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteConversationModelOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata} DeleteConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationModelOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationModel = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteConversationModelOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata} DeleteConversationModelOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationModelOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteConversationModelOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteConversationModelOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + if (!$util.isString(message.conversationModel)) + return "conversationModel: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a DeleteConversationModelOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata} DeleteConversationModelOperationMetadata + */ + DeleteConversationModelOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata(); + if (object.conversationModel != null) + message.conversationModel = String(object.conversationModel); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a DeleteConversationModelOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata} message DeleteConversationModelOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteConversationModelOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationModel = ""; + object.createTime = null; + } + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + object.conversationModel = message.conversationModel; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this DeleteConversationModelOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteConversationModelOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteConversationModelOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteConversationModelOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata"; + }; + + return DeleteConversationModelOperationMetadata; + })(); + + v2.CreateConversationModelEvaluationOperationMetadata = (function() { + + /** + * Properties of a CreateConversationModelEvaluationOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateConversationModelEvaluationOperationMetadata + * @property {string|null} [conversationModelEvaluation] CreateConversationModelEvaluationOperationMetadata conversationModelEvaluation + * @property {string|null} [conversationModel] CreateConversationModelEvaluationOperationMetadata conversationModel + * @property {google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State|null} [state] CreateConversationModelEvaluationOperationMetadata state + * @property {google.protobuf.ITimestamp|null} [createTime] CreateConversationModelEvaluationOperationMetadata createTime + */ + + /** + * Constructs a new CreateConversationModelEvaluationOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateConversationModelEvaluationOperationMetadata. + * @implements ICreateConversationModelEvaluationOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata=} [properties] Properties to set + */ + function CreateConversationModelEvaluationOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationModelEvaluationOperationMetadata conversationModelEvaluation. + * @member {string} conversationModelEvaluation + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @instance + */ + CreateConversationModelEvaluationOperationMetadata.prototype.conversationModelEvaluation = ""; + + /** + * CreateConversationModelEvaluationOperationMetadata conversationModel. + * @member {string} conversationModel + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @instance + */ + CreateConversationModelEvaluationOperationMetadata.prototype.conversationModel = ""; + + /** + * CreateConversationModelEvaluationOperationMetadata state. + * @member {google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State} state + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @instance + */ + CreateConversationModelEvaluationOperationMetadata.prototype.state = 0; + + /** + * CreateConversationModelEvaluationOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @instance + */ + CreateConversationModelEvaluationOperationMetadata.prototype.createTime = null; + + /** + * Creates a new CreateConversationModelEvaluationOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata} CreateConversationModelEvaluationOperationMetadata instance + */ + CreateConversationModelEvaluationOperationMetadata.create = function create(properties) { + return new CreateConversationModelEvaluationOperationMetadata(properties); + }; + + /** + * Encodes the specified CreateConversationModelEvaluationOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata} message CreateConversationModelEvaluationOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationModelEvaluationOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationModelEvaluation != null && Object.hasOwnProperty.call(message, "conversationModelEvaluation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationModelEvaluation); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.conversationModel != null && Object.hasOwnProperty.call(message, "conversationModel")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.conversationModel); + return writer; + }; + + /** + * Encodes the specified CreateConversationModelEvaluationOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata} message CreateConversationModelEvaluationOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationModelEvaluationOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationModelEvaluationOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata} CreateConversationModelEvaluationOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationModelEvaluationOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationModelEvaluation = reader.string(); + break; + } + case 4: { + message.conversationModel = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationModelEvaluationOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata} CreateConversationModelEvaluationOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationModelEvaluationOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationModelEvaluationOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationModelEvaluationOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationModelEvaluation != null && message.hasOwnProperty("conversationModelEvaluation")) + if (!$util.isString(message.conversationModelEvaluation)) + return "conversationModelEvaluation: string expected"; + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + if (!$util.isString(message.conversationModel)) + return "conversationModel: string 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: + case 5: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a CreateConversationModelEvaluationOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata} CreateConversationModelEvaluationOperationMetadata + */ + CreateConversationModelEvaluationOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata(); + if (object.conversationModelEvaluation != null) + message.conversationModelEvaluation = String(object.conversationModelEvaluation); + if (object.conversationModel != null) + message.conversationModel = String(object.conversationModel); + 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 "INITIALIZING": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "CANCELLED": + case 3: + message.state = 3; + break; + case "SUCCEEDED": + case 4: + message.state = 4; + break; + case "FAILED": + case 5: + message.state = 5; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a CreateConversationModelEvaluationOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata} message CreateConversationModelEvaluationOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationModelEvaluationOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationModelEvaluation = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.createTime = null; + object.conversationModel = ""; + } + if (message.conversationModelEvaluation != null && message.hasOwnProperty("conversationModelEvaluation")) + object.conversationModelEvaluation = message.conversationModelEvaluation; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State[message.state] : message.state; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.conversationModel != null && message.hasOwnProperty("conversationModel")) + object.conversationModel = message.conversationModel; + return object; + }; + + /** + * Converts this CreateConversationModelEvaluationOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateConversationModelEvaluationOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationModelEvaluationOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationModelEvaluationOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata"; + }; + + /** + * State enum. + * @name google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} INITIALIZING=1 INITIALIZING value + * @property {number} RUNNING=2 RUNNING value + * @property {number} CANCELLED=3 CANCELLED value + * @property {number} SUCCEEDED=4 SUCCEEDED value + * @property {number} FAILED=5 FAILED value + */ + CreateConversationModelEvaluationOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INITIALIZING"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "CANCELLED"] = 3; + values[valuesById[4] = "SUCCEEDED"] = 4; + values[valuesById[5] = "FAILED"] = 5; + return values; + })(); + + return CreateConversationModelEvaluationOperationMetadata; + })(); + + v2.ConversationProfiles = (function() { + + /** + * Constructs a new ConversationProfiles service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationProfiles + * @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 ConversationProfiles(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ConversationProfiles.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ConversationProfiles; + + /** + * Creates new ConversationProfiles service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @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 {ConversationProfiles} RPC service. Useful where requests and/or responses are streamed. + */ + ConversationProfiles.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|listConversationProfiles}. + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @typedef ListConversationProfilesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListConversationProfilesResponse} [response] ListConversationProfilesResponse + */ + + /** + * Calls ListConversationProfiles. + * @function listConversationProfiles + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationProfilesRequest} request ListConversationProfilesRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfilesCallback} callback Node-style callback called with the error, if any, and ListConversationProfilesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.listConversationProfiles = function listConversationProfiles(request, callback) { + return this.rpcCall(listConversationProfiles, $root.google.cloud.dialogflow.v2.ListConversationProfilesRequest, $root.google.cloud.dialogflow.v2.ListConversationProfilesResponse, request, callback); + }, "name", { value: "ListConversationProfiles" }); + + /** + * Calls ListConversationProfiles. + * @function listConversationProfiles + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IListConversationProfilesRequest} request ListConversationProfilesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|getConversationProfile}. + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @typedef GetConversationProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ConversationProfile} [response] ConversationProfile + */ + + /** + * Calls GetConversationProfile. + * @function getConversationProfile + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationProfileRequest} request GetConversationProfileRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfileCallback} callback Node-style callback called with the error, if any, and ConversationProfile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.getConversationProfile = function getConversationProfile(request, callback) { + return this.rpcCall(getConversationProfile, $root.google.cloud.dialogflow.v2.GetConversationProfileRequest, $root.google.cloud.dialogflow.v2.ConversationProfile, request, callback); + }, "name", { value: "GetConversationProfile" }); + + /** + * Calls GetConversationProfile. + * @function getConversationProfile + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IGetConversationProfileRequest} request GetConversationProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|createConversationProfile}. + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @typedef CreateConversationProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ConversationProfile} [response] ConversationProfile + */ + + /** + * Calls CreateConversationProfile. + * @function createConversationProfile + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationProfileRequest} request CreateConversationProfileRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfileCallback} callback Node-style callback called with the error, if any, and ConversationProfile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.createConversationProfile = function createConversationProfile(request, callback) { + return this.rpcCall(createConversationProfile, $root.google.cloud.dialogflow.v2.CreateConversationProfileRequest, $root.google.cloud.dialogflow.v2.ConversationProfile, request, callback); + }, "name", { value: "CreateConversationProfile" }); + + /** + * Calls CreateConversationProfile. + * @function createConversationProfile + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.ICreateConversationProfileRequest} request CreateConversationProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|updateConversationProfile}. + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @typedef UpdateConversationProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ConversationProfile} [response] ConversationProfile + */ + + /** + * Calls UpdateConversationProfile. + * @function updateConversationProfile + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateConversationProfileRequest} request UpdateConversationProfileRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfileCallback} callback Node-style callback called with the error, if any, and ConversationProfile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.updateConversationProfile = function updateConversationProfile(request, callback) { + return this.rpcCall(updateConversationProfile, $root.google.cloud.dialogflow.v2.UpdateConversationProfileRequest, $root.google.cloud.dialogflow.v2.ConversationProfile, request, callback); + }, "name", { value: "UpdateConversationProfile" }); + + /** + * Calls UpdateConversationProfile. + * @function updateConversationProfile + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateConversationProfileRequest} request UpdateConversationProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|deleteConversationProfile}. + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @typedef DeleteConversationProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteConversationProfile. + * @function deleteConversationProfile + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteConversationProfileRequest} request DeleteConversationProfileRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfileCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.deleteConversationProfile = function deleteConversationProfile(request, callback) { + return this.rpcCall(deleteConversationProfile, $root.google.cloud.dialogflow.v2.DeleteConversationProfileRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteConversationProfile" }); + + /** + * Calls DeleteConversationProfile. + * @function deleteConversationProfile + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteConversationProfileRequest} request DeleteConversationProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|setSuggestionFeatureConfig}. + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @typedef SetSuggestionFeatureConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetSuggestionFeatureConfig. + * @function setSuggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest} request SetSuggestionFeatureConfigRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfigCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.setSuggestionFeatureConfig = function setSuggestionFeatureConfig(request, callback) { + return this.rpcCall(setSuggestionFeatureConfig, $root.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetSuggestionFeatureConfig" }); + + /** + * Calls SetSuggestionFeatureConfig. + * @function setSuggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest} request SetSuggestionFeatureConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.ConversationProfiles|clearSuggestionFeatureConfig}. + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @typedef ClearSuggestionFeatureConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ClearSuggestionFeatureConfig. + * @function clearSuggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest} request ClearSuggestionFeatureConfigRequest message or plain object + * @param {google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfigCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.clearSuggestionFeatureConfig = function clearSuggestionFeatureConfig(request, callback) { + return this.rpcCall(clearSuggestionFeatureConfig, $root.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ClearSuggestionFeatureConfig" }); + + /** + * Calls ClearSuggestionFeatureConfig. + * @function clearSuggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest} request ClearSuggestionFeatureConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ConversationProfiles; + })(); + + v2.ConversationProfile = (function() { + + /** + * Properties of a ConversationProfile. + * @memberof google.cloud.dialogflow.v2 + * @interface IConversationProfile + * @property {string|null} [name] ConversationProfile name + * @property {string|null} [displayName] ConversationProfile displayName + * @property {google.protobuf.ITimestamp|null} [createTime] ConversationProfile createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ConversationProfile updateTime + * @property {google.cloud.dialogflow.v2.IAutomatedAgentConfig|null} [automatedAgentConfig] ConversationProfile automatedAgentConfig + * @property {google.cloud.dialogflow.v2.IHumanAgentAssistantConfig|null} [humanAgentAssistantConfig] ConversationProfile humanAgentAssistantConfig + * @property {google.cloud.dialogflow.v2.IHumanAgentHandoffConfig|null} [humanAgentHandoffConfig] ConversationProfile humanAgentHandoffConfig + * @property {google.cloud.dialogflow.v2.INotificationConfig|null} [notificationConfig] ConversationProfile notificationConfig + * @property {google.cloud.dialogflow.v2.ILoggingConfig|null} [loggingConfig] ConversationProfile loggingConfig + * @property {google.cloud.dialogflow.v2.INotificationConfig|null} [newMessageEventNotificationConfig] ConversationProfile newMessageEventNotificationConfig + * @property {google.cloud.dialogflow.v2.ISpeechToTextConfig|null} [sttConfig] ConversationProfile sttConfig + * @property {string|null} [languageCode] ConversationProfile languageCode + * @property {string|null} [timeZone] ConversationProfile timeZone + * @property {string|null} [securitySettings] ConversationProfile securitySettings + */ + + /** + * Constructs a new ConversationProfile. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ConversationProfile. + * @implements IConversationProfile + * @constructor + * @param {google.cloud.dialogflow.v2.IConversationProfile=} [properties] Properties to set + */ + function ConversationProfile(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationProfile name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.name = ""; + + /** + * ConversationProfile displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.displayName = ""; + + /** + * ConversationProfile createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.createTime = null; + + /** + * ConversationProfile updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.updateTime = null; + + /** + * ConversationProfile automatedAgentConfig. + * @member {google.cloud.dialogflow.v2.IAutomatedAgentConfig|null|undefined} automatedAgentConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.automatedAgentConfig = null; + + /** + * ConversationProfile humanAgentAssistantConfig. + * @member {google.cloud.dialogflow.v2.IHumanAgentAssistantConfig|null|undefined} humanAgentAssistantConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.humanAgentAssistantConfig = null; + + /** + * ConversationProfile humanAgentHandoffConfig. + * @member {google.cloud.dialogflow.v2.IHumanAgentHandoffConfig|null|undefined} humanAgentHandoffConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.humanAgentHandoffConfig = null; + + /** + * ConversationProfile notificationConfig. + * @member {google.cloud.dialogflow.v2.INotificationConfig|null|undefined} notificationConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.notificationConfig = null; + + /** + * ConversationProfile loggingConfig. + * @member {google.cloud.dialogflow.v2.ILoggingConfig|null|undefined} loggingConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.loggingConfig = null; + + /** + * ConversationProfile newMessageEventNotificationConfig. + * @member {google.cloud.dialogflow.v2.INotificationConfig|null|undefined} newMessageEventNotificationConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.newMessageEventNotificationConfig = null; + + /** + * ConversationProfile sttConfig. + * @member {google.cloud.dialogflow.v2.ISpeechToTextConfig|null|undefined} sttConfig + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.sttConfig = null; + + /** + * ConversationProfile languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.languageCode = ""; + + /** + * ConversationProfile timeZone. + * @member {string} timeZone + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.timeZone = ""; + + /** + * ConversationProfile securitySettings. + * @member {string} securitySettings + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + */ + ConversationProfile.prototype.securitySettings = ""; + + /** + * Creates a new ConversationProfile instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @static + * @param {google.cloud.dialogflow.v2.IConversationProfile=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ConversationProfile} ConversationProfile instance + */ + ConversationProfile.create = function create(properties) { + return new ConversationProfile(properties); + }; + + /** + * Encodes the specified ConversationProfile message. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationProfile.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @static + * @param {google.cloud.dialogflow.v2.IConversationProfile} message ConversationProfile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationProfile.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.automatedAgentConfig != null && Object.hasOwnProperty.call(message, "automatedAgentConfig")) + $root.google.cloud.dialogflow.v2.AutomatedAgentConfig.encode(message.automatedAgentConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.humanAgentAssistantConfig != null && Object.hasOwnProperty.call(message, "humanAgentAssistantConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.encode(message.humanAgentAssistantConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.humanAgentHandoffConfig != null && Object.hasOwnProperty.call(message, "humanAgentHandoffConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.encode(message.humanAgentHandoffConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.notificationConfig != null && Object.hasOwnProperty.call(message, "notificationConfig")) + $root.google.cloud.dialogflow.v2.NotificationConfig.encode(message.notificationConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.loggingConfig != null && Object.hasOwnProperty.call(message, "loggingConfig")) + $root.google.cloud.dialogflow.v2.LoggingConfig.encode(message.loggingConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.newMessageEventNotificationConfig != null && Object.hasOwnProperty.call(message, "newMessageEventNotificationConfig")) + $root.google.cloud.dialogflow.v2.NotificationConfig.encode(message.newMessageEventNotificationConfig, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sttConfig != null && Object.hasOwnProperty.call(message, "sttConfig")) + $root.google.cloud.dialogflow.v2.SpeechToTextConfig.encode(message.sttConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.languageCode); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.securitySettings != null && Object.hasOwnProperty.call(message, "securitySettings")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.securitySettings); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.timeZone); + return writer; + }; + + /** + * Encodes the specified ConversationProfile message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ConversationProfile.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @static + * @param {google.cloud.dialogflow.v2.IConversationProfile} message ConversationProfile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationProfile.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationProfile message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ConversationProfile} ConversationProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationProfile.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ConversationProfile(); + 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 11: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 12: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.automatedAgentConfig = $root.google.cloud.dialogflow.v2.AutomatedAgentConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.humanAgentAssistantConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.humanAgentHandoffConfig = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.notificationConfig = $root.google.cloud.dialogflow.v2.NotificationConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.loggingConfig = $root.google.cloud.dialogflow.v2.LoggingConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + message.newMessageEventNotificationConfig = $root.google.cloud.dialogflow.v2.NotificationConfig.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sttConfig = $root.google.cloud.dialogflow.v2.SpeechToTextConfig.decode(reader, reader.uint32()); + break; + } + case 10: { + message.languageCode = reader.string(); + break; + } + case 14: { + message.timeZone = reader.string(); + break; + } + case 13: { + message.securitySettings = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationProfile message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ConversationProfile} ConversationProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationProfile.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationProfile message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationProfile.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.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; + } + if (message.automatedAgentConfig != null && message.hasOwnProperty("automatedAgentConfig")) { + var error = $root.google.cloud.dialogflow.v2.AutomatedAgentConfig.verify(message.automatedAgentConfig); + if (error) + return "automatedAgentConfig." + error; + } + if (message.humanAgentAssistantConfig != null && message.hasOwnProperty("humanAgentAssistantConfig")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.verify(message.humanAgentAssistantConfig); + if (error) + return "humanAgentAssistantConfig." + error; + } + if (message.humanAgentHandoffConfig != null && message.hasOwnProperty("humanAgentHandoffConfig")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.verify(message.humanAgentHandoffConfig); + if (error) + return "humanAgentHandoffConfig." + error; + } + if (message.notificationConfig != null && message.hasOwnProperty("notificationConfig")) { + var error = $root.google.cloud.dialogflow.v2.NotificationConfig.verify(message.notificationConfig); + if (error) + return "notificationConfig." + error; + } + if (message.loggingConfig != null && message.hasOwnProperty("loggingConfig")) { + var error = $root.google.cloud.dialogflow.v2.LoggingConfig.verify(message.loggingConfig); + if (error) + return "loggingConfig." + error; + } + if (message.newMessageEventNotificationConfig != null && message.hasOwnProperty("newMessageEventNotificationConfig")) { + var error = $root.google.cloud.dialogflow.v2.NotificationConfig.verify(message.newMessageEventNotificationConfig); + if (error) + return "newMessageEventNotificationConfig." + error; + } + if (message.sttConfig != null && message.hasOwnProperty("sttConfig")) { + var error = $root.google.cloud.dialogflow.v2.SpeechToTextConfig.verify(message.sttConfig); + if (error) + return "sttConfig." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.securitySettings != null && message.hasOwnProperty("securitySettings")) + if (!$util.isString(message.securitySettings)) + return "securitySettings: string expected"; + return null; + }; + + /** + * Creates a ConversationProfile message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ConversationProfile} ConversationProfile + */ + ConversationProfile.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ConversationProfile) + return object; + var message = new $root.google.cloud.dialogflow.v2.ConversationProfile(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationProfile.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.dialogflow.v2.ConversationProfile.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.automatedAgentConfig != null) { + if (typeof object.automatedAgentConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationProfile.automatedAgentConfig: object expected"); + message.automatedAgentConfig = $root.google.cloud.dialogflow.v2.AutomatedAgentConfig.fromObject(object.automatedAgentConfig); + } + if (object.humanAgentAssistantConfig != null) { + if (typeof object.humanAgentAssistantConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationProfile.humanAgentAssistantConfig: object expected"); + message.humanAgentAssistantConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.fromObject(object.humanAgentAssistantConfig); + } + if (object.humanAgentHandoffConfig != null) { + if (typeof object.humanAgentHandoffConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationProfile.humanAgentHandoffConfig: object expected"); + message.humanAgentHandoffConfig = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.fromObject(object.humanAgentHandoffConfig); + } + if (object.notificationConfig != null) { + if (typeof object.notificationConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationProfile.notificationConfig: object expected"); + message.notificationConfig = $root.google.cloud.dialogflow.v2.NotificationConfig.fromObject(object.notificationConfig); + } + if (object.loggingConfig != null) { + if (typeof object.loggingConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationProfile.loggingConfig: object expected"); + message.loggingConfig = $root.google.cloud.dialogflow.v2.LoggingConfig.fromObject(object.loggingConfig); + } + if (object.newMessageEventNotificationConfig != null) { + if (typeof object.newMessageEventNotificationConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationProfile.newMessageEventNotificationConfig: object expected"); + message.newMessageEventNotificationConfig = $root.google.cloud.dialogflow.v2.NotificationConfig.fromObject(object.newMessageEventNotificationConfig); + } + if (object.sttConfig != null) { + if (typeof object.sttConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ConversationProfile.sttConfig: object expected"); + message.sttConfig = $root.google.cloud.dialogflow.v2.SpeechToTextConfig.fromObject(object.sttConfig); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.securitySettings != null) + message.securitySettings = String(object.securitySettings); + return message; + }; + + /** + * Creates a plain object from a ConversationProfile message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @static + * @param {google.cloud.dialogflow.v2.ConversationProfile} message ConversationProfile + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationProfile.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.automatedAgentConfig = null; + object.humanAgentAssistantConfig = null; + object.humanAgentHandoffConfig = null; + object.notificationConfig = null; + object.loggingConfig = null; + object.newMessageEventNotificationConfig = null; + object.sttConfig = null; + object.languageCode = ""; + object.createTime = null; + object.updateTime = null; + object.securitySettings = ""; + object.timeZone = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.automatedAgentConfig != null && message.hasOwnProperty("automatedAgentConfig")) + object.automatedAgentConfig = $root.google.cloud.dialogflow.v2.AutomatedAgentConfig.toObject(message.automatedAgentConfig, options); + if (message.humanAgentAssistantConfig != null && message.hasOwnProperty("humanAgentAssistantConfig")) + object.humanAgentAssistantConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.toObject(message.humanAgentAssistantConfig, options); + if (message.humanAgentHandoffConfig != null && message.hasOwnProperty("humanAgentHandoffConfig")) + object.humanAgentHandoffConfig = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.toObject(message.humanAgentHandoffConfig, options); + if (message.notificationConfig != null && message.hasOwnProperty("notificationConfig")) + object.notificationConfig = $root.google.cloud.dialogflow.v2.NotificationConfig.toObject(message.notificationConfig, options); + if (message.loggingConfig != null && message.hasOwnProperty("loggingConfig")) + object.loggingConfig = $root.google.cloud.dialogflow.v2.LoggingConfig.toObject(message.loggingConfig, options); + if (message.newMessageEventNotificationConfig != null && message.hasOwnProperty("newMessageEventNotificationConfig")) + object.newMessageEventNotificationConfig = $root.google.cloud.dialogflow.v2.NotificationConfig.toObject(message.newMessageEventNotificationConfig, options); + if (message.sttConfig != null && message.hasOwnProperty("sttConfig")) + object.sttConfig = $root.google.cloud.dialogflow.v2.SpeechToTextConfig.toObject(message.sttConfig, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.securitySettings != null && message.hasOwnProperty("securitySettings")) + object.securitySettings = message.securitySettings; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + return object; + }; + + /** + * Converts this ConversationProfile to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @instance + * @returns {Object.} JSON object + */ + ConversationProfile.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationProfile + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ConversationProfile + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationProfile.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ConversationProfile"; + }; + + return ConversationProfile; + })(); + + v2.ListConversationProfilesRequest = (function() { + + /** + * Properties of a ListConversationProfilesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationProfilesRequest + * @property {string|null} [parent] ListConversationProfilesRequest parent + * @property {number|null} [pageSize] ListConversationProfilesRequest pageSize + * @property {string|null} [pageToken] ListConversationProfilesRequest pageToken + */ + + /** + * Constructs a new ListConversationProfilesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationProfilesRequest. + * @implements IListConversationProfilesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationProfilesRequest=} [properties] Properties to set + */ + function ListConversationProfilesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationProfilesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @instance + */ + ListConversationProfilesRequest.prototype.parent = ""; + + /** + * ListConversationProfilesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @instance + */ + ListConversationProfilesRequest.prototype.pageSize = 0; + + /** + * ListConversationProfilesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @instance + */ + ListConversationProfilesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListConversationProfilesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationProfilesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationProfilesRequest} ListConversationProfilesRequest instance + */ + ListConversationProfilesRequest.create = function create(properties) { + return new ListConversationProfilesRequest(properties); + }; + + /** + * Encodes the specified ListConversationProfilesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationProfilesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationProfilesRequest} message ListConversationProfilesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationProfilesRequest.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 ListConversationProfilesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationProfilesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListConversationProfilesRequest} message ListConversationProfilesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationProfilesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationProfilesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationProfilesRequest} ListConversationProfilesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationProfilesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationProfilesRequest(); + 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 ListConversationProfilesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationProfilesRequest} ListConversationProfilesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationProfilesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationProfilesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationProfilesRequest.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 ListConversationProfilesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationProfilesRequest} ListConversationProfilesRequest + */ + ListConversationProfilesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationProfilesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationProfilesRequest(); + 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 ListConversationProfilesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @static + * @param {google.cloud.dialogflow.v2.ListConversationProfilesRequest} message ListConversationProfilesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationProfilesRequest.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 ListConversationProfilesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @instance + * @returns {Object.} JSON object + */ + ListConversationProfilesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationProfilesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationProfilesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationProfilesRequest"; + }; + + return ListConversationProfilesRequest; + })(); + + v2.ListConversationProfilesResponse = (function() { + + /** + * Properties of a ListConversationProfilesResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListConversationProfilesResponse + * @property {Array.|null} [conversationProfiles] ListConversationProfilesResponse conversationProfiles + * @property {string|null} [nextPageToken] ListConversationProfilesResponse nextPageToken + */ + + /** + * Constructs a new ListConversationProfilesResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListConversationProfilesResponse. + * @implements IListConversationProfilesResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListConversationProfilesResponse=} [properties] Properties to set + */ + function ListConversationProfilesResponse(properties) { + this.conversationProfiles = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationProfilesResponse conversationProfiles. + * @member {Array.} conversationProfiles + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @instance + */ + ListConversationProfilesResponse.prototype.conversationProfiles = $util.emptyArray; + + /** + * ListConversationProfilesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @instance + */ + ListConversationProfilesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListConversationProfilesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationProfilesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListConversationProfilesResponse} ListConversationProfilesResponse instance + */ + ListConversationProfilesResponse.create = function create(properties) { + return new ListConversationProfilesResponse(properties); + }; + + /** + * Encodes the specified ListConversationProfilesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationProfilesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationProfilesResponse} message ListConversationProfilesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationProfilesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfiles != null && message.conversationProfiles.length) + for (var i = 0; i < message.conversationProfiles.length; ++i) + $root.google.cloud.dialogflow.v2.ConversationProfile.encode(message.conversationProfiles[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 ListConversationProfilesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListConversationProfilesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListConversationProfilesResponse} message ListConversationProfilesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationProfilesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationProfilesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListConversationProfilesResponse} ListConversationProfilesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationProfilesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListConversationProfilesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.conversationProfiles && message.conversationProfiles.length)) + message.conversationProfiles = []; + message.conversationProfiles.push($root.google.cloud.dialogflow.v2.ConversationProfile.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListConversationProfilesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListConversationProfilesResponse} ListConversationProfilesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationProfilesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationProfilesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationProfilesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfiles != null && message.hasOwnProperty("conversationProfiles")) { + if (!Array.isArray(message.conversationProfiles)) + return "conversationProfiles: array expected"; + for (var i = 0; i < message.conversationProfiles.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.ConversationProfile.verify(message.conversationProfiles[i]); + if (error) + return "conversationProfiles." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListConversationProfilesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListConversationProfilesResponse} ListConversationProfilesResponse + */ + ListConversationProfilesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListConversationProfilesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListConversationProfilesResponse(); + if (object.conversationProfiles) { + if (!Array.isArray(object.conversationProfiles)) + throw TypeError(".google.cloud.dialogflow.v2.ListConversationProfilesResponse.conversationProfiles: array expected"); + message.conversationProfiles = []; + for (var i = 0; i < object.conversationProfiles.length; ++i) { + if (typeof object.conversationProfiles[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListConversationProfilesResponse.conversationProfiles: object expected"); + message.conversationProfiles[i] = $root.google.cloud.dialogflow.v2.ConversationProfile.fromObject(object.conversationProfiles[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListConversationProfilesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @static + * @param {google.cloud.dialogflow.v2.ListConversationProfilesResponse} message ListConversationProfilesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationProfilesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conversationProfiles = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.conversationProfiles && message.conversationProfiles.length) { + object.conversationProfiles = []; + for (var j = 0; j < message.conversationProfiles.length; ++j) + object.conversationProfiles[j] = $root.google.cloud.dialogflow.v2.ConversationProfile.toObject(message.conversationProfiles[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListConversationProfilesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @instance + * @returns {Object.} JSON object + */ + ListConversationProfilesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationProfilesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListConversationProfilesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationProfilesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListConversationProfilesResponse"; + }; + + return ListConversationProfilesResponse; + })(); + + v2.GetConversationProfileRequest = (function() { + + /** + * Properties of a GetConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetConversationProfileRequest + * @property {string|null} [name] GetConversationProfileRequest name + */ + + /** + * Constructs a new GetConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetConversationProfileRequest. + * @implements IGetConversationProfileRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetConversationProfileRequest=} [properties] Properties to set + */ + function GetConversationProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConversationProfileRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @instance + */ + GetConversationProfileRequest.prototype.name = ""; + + /** + * Creates a new GetConversationProfileRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationProfileRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetConversationProfileRequest} GetConversationProfileRequest instance + */ + GetConversationProfileRequest.create = function create(properties) { + return new GetConversationProfileRequest(properties); + }; + + /** + * Encodes the specified GetConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationProfileRequest} message GetConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationProfileRequest.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 GetConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetConversationProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetConversationProfileRequest} message GetConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConversationProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetConversationProfileRequest} GetConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetConversationProfileRequest(); + 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 GetConversationProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetConversationProfileRequest} GetConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConversationProfileRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConversationProfileRequest.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 GetConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetConversationProfileRequest} GetConversationProfileRequest + */ + GetConversationProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetConversationProfileRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetConversationProfileRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetConversationProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.GetConversationProfileRequest} message GetConversationProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConversationProfileRequest.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 GetConversationProfileRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @instance + * @returns {Object.} JSON object + */ + GetConversationProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetConversationProfileRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetConversationProfileRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetConversationProfileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetConversationProfileRequest"; + }; + + return GetConversationProfileRequest; + })(); + + v2.CreateConversationProfileRequest = (function() { + + /** + * Properties of a CreateConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateConversationProfileRequest + * @property {string|null} [parent] CreateConversationProfileRequest parent + * @property {google.cloud.dialogflow.v2.IConversationProfile|null} [conversationProfile] CreateConversationProfileRequest conversationProfile + */ + + /** + * Constructs a new CreateConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateConversationProfileRequest. + * @implements ICreateConversationProfileRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateConversationProfileRequest=} [properties] Properties to set + */ + function CreateConversationProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationProfileRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @instance + */ + CreateConversationProfileRequest.prototype.parent = ""; + + /** + * CreateConversationProfileRequest conversationProfile. + * @member {google.cloud.dialogflow.v2.IConversationProfile|null|undefined} conversationProfile + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @instance + */ + CreateConversationProfileRequest.prototype.conversationProfile = null; + + /** + * Creates a new CreateConversationProfileRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationProfileRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateConversationProfileRequest} CreateConversationProfileRequest instance + */ + CreateConversationProfileRequest.create = function create(properties) { + return new CreateConversationProfileRequest(properties); + }; + + /** + * Encodes the specified CreateConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationProfileRequest} message CreateConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationProfileRequest.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.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + $root.google.cloud.dialogflow.v2.ConversationProfile.encode(message.conversationProfile, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateConversationProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateConversationProfileRequest} message CreateConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateConversationProfileRequest} CreateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateConversationProfileRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.conversationProfile = $root.google.cloud.dialogflow.v2.ConversationProfile.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateConversationProfileRequest} CreateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationProfileRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationProfileRequest.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.conversationProfile != null && message.hasOwnProperty("conversationProfile")) { + var error = $root.google.cloud.dialogflow.v2.ConversationProfile.verify(message.conversationProfile); + if (error) + return "conversationProfile." + error; + } + return null; + }; + + /** + * Creates a CreateConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateConversationProfileRequest} CreateConversationProfileRequest + */ + CreateConversationProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateConversationProfileRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateConversationProfileRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.conversationProfile != null) { + if (typeof object.conversationProfile !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateConversationProfileRequest.conversationProfile: object expected"); + message.conversationProfile = $root.google.cloud.dialogflow.v2.ConversationProfile.fromObject(object.conversationProfile); + } + return message; + }; + + /** + * Creates a plain object from a CreateConversationProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateConversationProfileRequest} message CreateConversationProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationProfileRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.conversationProfile = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = $root.google.cloud.dialogflow.v2.ConversationProfile.toObject(message.conversationProfile, options); + return object; + }; + + /** + * Converts this CreateConversationProfileRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @instance + * @returns {Object.} JSON object + */ + CreateConversationProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationProfileRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateConversationProfileRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationProfileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateConversationProfileRequest"; + }; + + return CreateConversationProfileRequest; + })(); + + v2.UpdateConversationProfileRequest = (function() { + + /** + * Properties of an UpdateConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateConversationProfileRequest + * @property {google.cloud.dialogflow.v2.IConversationProfile|null} [conversationProfile] UpdateConversationProfileRequest conversationProfile + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateConversationProfileRequest updateMask + */ + + /** + * Constructs a new UpdateConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateConversationProfileRequest. + * @implements IUpdateConversationProfileRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateConversationProfileRequest=} [properties] Properties to set + */ + function UpdateConversationProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateConversationProfileRequest conversationProfile. + * @member {google.cloud.dialogflow.v2.IConversationProfile|null|undefined} conversationProfile + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @instance + */ + UpdateConversationProfileRequest.prototype.conversationProfile = null; + + /** + * UpdateConversationProfileRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @instance + */ + UpdateConversationProfileRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateConversationProfileRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateConversationProfileRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateConversationProfileRequest} UpdateConversationProfileRequest instance + */ + UpdateConversationProfileRequest.create = function create(properties) { + return new UpdateConversationProfileRequest(properties); + }; + + /** + * Encodes the specified UpdateConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateConversationProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateConversationProfileRequest} message UpdateConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateConversationProfileRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + $root.google.cloud.dialogflow.v2.ConversationProfile.encode(message.conversationProfile, 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 UpdateConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateConversationProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateConversationProfileRequest} message UpdateConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateConversationProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateConversationProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateConversationProfileRequest} UpdateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateConversationProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateConversationProfileRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = $root.google.cloud.dialogflow.v2.ConversationProfile.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 UpdateConversationProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateConversationProfileRequest} UpdateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateConversationProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateConversationProfileRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateConversationProfileRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) { + var error = $root.google.cloud.dialogflow.v2.ConversationProfile.verify(message.conversationProfile); + if (error) + return "conversationProfile." + 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 UpdateConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateConversationProfileRequest} UpdateConversationProfileRequest + */ + UpdateConversationProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateConversationProfileRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateConversationProfileRequest(); + if (object.conversationProfile != null) { + if (typeof object.conversationProfile !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateConversationProfileRequest.conversationProfile: object expected"); + message.conversationProfile = $root.google.cloud.dialogflow.v2.ConversationProfile.fromObject(object.conversationProfile); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateConversationProfileRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateConversationProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateConversationProfileRequest} message UpdateConversationProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateConversationProfileRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = null; + object.updateMask = null; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = $root.google.cloud.dialogflow.v2.ConversationProfile.toObject(message.conversationProfile, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateConversationProfileRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateConversationProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateConversationProfileRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateConversationProfileRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateConversationProfileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateConversationProfileRequest"; + }; + + return UpdateConversationProfileRequest; + })(); + + v2.DeleteConversationProfileRequest = (function() { + + /** + * Properties of a DeleteConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteConversationProfileRequest + * @property {string|null} [name] DeleteConversationProfileRequest name + */ + + /** + * Constructs a new DeleteConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteConversationProfileRequest. + * @implements IDeleteConversationProfileRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteConversationProfileRequest=} [properties] Properties to set + */ + function DeleteConversationProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteConversationProfileRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @instance + */ + DeleteConversationProfileRequest.prototype.name = ""; + + /** + * Creates a new DeleteConversationProfileRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationProfileRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteConversationProfileRequest} DeleteConversationProfileRequest instance + */ + DeleteConversationProfileRequest.create = function create(properties) { + return new DeleteConversationProfileRequest(properties); + }; + + /** + * Encodes the specified DeleteConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationProfileRequest} message DeleteConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationProfileRequest.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 DeleteConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteConversationProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteConversationProfileRequest} message DeleteConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteConversationProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteConversationProfileRequest} DeleteConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteConversationProfileRequest(); + 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 DeleteConversationProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteConversationProfileRequest} DeleteConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteConversationProfileRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteConversationProfileRequest.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 DeleteConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteConversationProfileRequest} DeleteConversationProfileRequest + */ + DeleteConversationProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteConversationProfileRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteConversationProfileRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteConversationProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteConversationProfileRequest} message DeleteConversationProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteConversationProfileRequest.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 DeleteConversationProfileRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteConversationProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteConversationProfileRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteConversationProfileRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteConversationProfileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteConversationProfileRequest"; + }; + + return DeleteConversationProfileRequest; + })(); + + v2.AutomatedAgentConfig = (function() { + + /** + * Properties of an AutomatedAgentConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface IAutomatedAgentConfig + * @property {string|null} [agent] AutomatedAgentConfig agent + */ + + /** + * Constructs a new AutomatedAgentConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an AutomatedAgentConfig. + * @implements IAutomatedAgentConfig + * @constructor + * @param {google.cloud.dialogflow.v2.IAutomatedAgentConfig=} [properties] Properties to set + */ + function AutomatedAgentConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AutomatedAgentConfig agent. + * @member {string} agent + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @instance + */ + AutomatedAgentConfig.prototype.agent = ""; + + /** + * Creates a new AutomatedAgentConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @static + * @param {google.cloud.dialogflow.v2.IAutomatedAgentConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.AutomatedAgentConfig} AutomatedAgentConfig instance + */ + AutomatedAgentConfig.create = function create(properties) { + return new AutomatedAgentConfig(properties); + }; + + /** + * Encodes the specified AutomatedAgentConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.AutomatedAgentConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @static + * @param {google.cloud.dialogflow.v2.IAutomatedAgentConfig} message AutomatedAgentConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutomatedAgentConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agent != null && Object.hasOwnProperty.call(message, "agent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.agent); + return writer; + }; + + /** + * Encodes the specified AutomatedAgentConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.AutomatedAgentConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @static + * @param {google.cloud.dialogflow.v2.IAutomatedAgentConfig} message AutomatedAgentConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutomatedAgentConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AutomatedAgentConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.AutomatedAgentConfig} AutomatedAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutomatedAgentConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.AutomatedAgentConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AutomatedAgentConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.AutomatedAgentConfig} AutomatedAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutomatedAgentConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AutomatedAgentConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AutomatedAgentConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agent != null && message.hasOwnProperty("agent")) + if (!$util.isString(message.agent)) + return "agent: string expected"; + return null; + }; + + /** + * Creates an AutomatedAgentConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.AutomatedAgentConfig} AutomatedAgentConfig + */ + AutomatedAgentConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.AutomatedAgentConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.AutomatedAgentConfig(); + if (object.agent != null) + message.agent = String(object.agent); + return message; + }; + + /** + * Creates a plain object from an AutomatedAgentConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @static + * @param {google.cloud.dialogflow.v2.AutomatedAgentConfig} message AutomatedAgentConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AutomatedAgentConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.agent = ""; + if (message.agent != null && message.hasOwnProperty("agent")) + object.agent = message.agent; + return object; + }; + + /** + * Converts this AutomatedAgentConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @instance + * @returns {Object.} JSON object + */ + AutomatedAgentConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AutomatedAgentConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.AutomatedAgentConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AutomatedAgentConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.AutomatedAgentConfig"; + }; + + return AutomatedAgentConfig; + })(); + + v2.HumanAgentAssistantConfig = (function() { + + /** + * Properties of a HumanAgentAssistantConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface IHumanAgentAssistantConfig + * @property {google.cloud.dialogflow.v2.INotificationConfig|null} [notificationConfig] HumanAgentAssistantConfig notificationConfig + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig|null} [humanAgentSuggestionConfig] HumanAgentAssistantConfig humanAgentSuggestionConfig + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig|null} [endUserSuggestionConfig] HumanAgentAssistantConfig endUserSuggestionConfig + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig|null} [messageAnalysisConfig] HumanAgentAssistantConfig messageAnalysisConfig + */ + + /** + * Constructs a new HumanAgentAssistantConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a HumanAgentAssistantConfig. + * @implements IHumanAgentAssistantConfig + * @constructor + * @param {google.cloud.dialogflow.v2.IHumanAgentAssistantConfig=} [properties] Properties to set + */ + function HumanAgentAssistantConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HumanAgentAssistantConfig notificationConfig. + * @member {google.cloud.dialogflow.v2.INotificationConfig|null|undefined} notificationConfig + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @instance + */ + HumanAgentAssistantConfig.prototype.notificationConfig = null; + + /** + * HumanAgentAssistantConfig humanAgentSuggestionConfig. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig|null|undefined} humanAgentSuggestionConfig + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @instance + */ + HumanAgentAssistantConfig.prototype.humanAgentSuggestionConfig = null; + + /** + * HumanAgentAssistantConfig endUserSuggestionConfig. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig|null|undefined} endUserSuggestionConfig + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @instance + */ + HumanAgentAssistantConfig.prototype.endUserSuggestionConfig = null; + + /** + * HumanAgentAssistantConfig messageAnalysisConfig. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig|null|undefined} messageAnalysisConfig + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @instance + */ + HumanAgentAssistantConfig.prototype.messageAnalysisConfig = null; + + /** + * Creates a new HumanAgentAssistantConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @static + * @param {google.cloud.dialogflow.v2.IHumanAgentAssistantConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig} HumanAgentAssistantConfig instance + */ + HumanAgentAssistantConfig.create = function create(properties) { + return new HumanAgentAssistantConfig(properties); + }; + + /** + * Encodes the specified HumanAgentAssistantConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @static + * @param {google.cloud.dialogflow.v2.IHumanAgentAssistantConfig} message HumanAgentAssistantConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentAssistantConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.notificationConfig != null && Object.hasOwnProperty.call(message, "notificationConfig")) + $root.google.cloud.dialogflow.v2.NotificationConfig.encode(message.notificationConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.humanAgentSuggestionConfig != null && Object.hasOwnProperty.call(message, "humanAgentSuggestionConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.encode(message.humanAgentSuggestionConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.endUserSuggestionConfig != null && Object.hasOwnProperty.call(message, "endUserSuggestionConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.encode(message.endUserSuggestionConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.messageAnalysisConfig != null && Object.hasOwnProperty.call(message, "messageAnalysisConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig.encode(message.messageAnalysisConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HumanAgentAssistantConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @static + * @param {google.cloud.dialogflow.v2.IHumanAgentAssistantConfig} message HumanAgentAssistantConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentAssistantConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HumanAgentAssistantConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig} HumanAgentAssistantConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentAssistantConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.notificationConfig = $root.google.cloud.dialogflow.v2.NotificationConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.humanAgentSuggestionConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.endUserSuggestionConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.messageAnalysisConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HumanAgentAssistantConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig} HumanAgentAssistantConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentAssistantConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HumanAgentAssistantConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HumanAgentAssistantConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.notificationConfig != null && message.hasOwnProperty("notificationConfig")) { + var error = $root.google.cloud.dialogflow.v2.NotificationConfig.verify(message.notificationConfig); + if (error) + return "notificationConfig." + error; + } + if (message.humanAgentSuggestionConfig != null && message.hasOwnProperty("humanAgentSuggestionConfig")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.verify(message.humanAgentSuggestionConfig); + if (error) + return "humanAgentSuggestionConfig." + error; + } + if (message.endUserSuggestionConfig != null && message.hasOwnProperty("endUserSuggestionConfig")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.verify(message.endUserSuggestionConfig); + if (error) + return "endUserSuggestionConfig." + error; + } + if (message.messageAnalysisConfig != null && message.hasOwnProperty("messageAnalysisConfig")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig.verify(message.messageAnalysisConfig); + if (error) + return "messageAnalysisConfig." + error; + } + return null; + }; + + /** + * Creates a HumanAgentAssistantConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig} HumanAgentAssistantConfig + */ + HumanAgentAssistantConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig(); + if (object.notificationConfig != null) { + if (typeof object.notificationConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.notificationConfig: object expected"); + message.notificationConfig = $root.google.cloud.dialogflow.v2.NotificationConfig.fromObject(object.notificationConfig); + } + if (object.humanAgentSuggestionConfig != null) { + if (typeof object.humanAgentSuggestionConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.humanAgentSuggestionConfig: object expected"); + message.humanAgentSuggestionConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.fromObject(object.humanAgentSuggestionConfig); + } + if (object.endUserSuggestionConfig != null) { + if (typeof object.endUserSuggestionConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.endUserSuggestionConfig: object expected"); + message.endUserSuggestionConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.fromObject(object.endUserSuggestionConfig); + } + if (object.messageAnalysisConfig != null) { + if (typeof object.messageAnalysisConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.messageAnalysisConfig: object expected"); + message.messageAnalysisConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig.fromObject(object.messageAnalysisConfig); + } + return message; + }; + + /** + * Creates a plain object from a HumanAgentAssistantConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig} message HumanAgentAssistantConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HumanAgentAssistantConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.notificationConfig = null; + object.humanAgentSuggestionConfig = null; + object.endUserSuggestionConfig = null; + object.messageAnalysisConfig = null; + } + if (message.notificationConfig != null && message.hasOwnProperty("notificationConfig")) + object.notificationConfig = $root.google.cloud.dialogflow.v2.NotificationConfig.toObject(message.notificationConfig, options); + if (message.humanAgentSuggestionConfig != null && message.hasOwnProperty("humanAgentSuggestionConfig")) + object.humanAgentSuggestionConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.toObject(message.humanAgentSuggestionConfig, options); + if (message.endUserSuggestionConfig != null && message.hasOwnProperty("endUserSuggestionConfig")) + object.endUserSuggestionConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.toObject(message.endUserSuggestionConfig, options); + if (message.messageAnalysisConfig != null && message.hasOwnProperty("messageAnalysisConfig")) + object.messageAnalysisConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig.toObject(message.messageAnalysisConfig, options); + return object; + }; + + /** + * Converts this HumanAgentAssistantConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @instance + * @returns {Object.} JSON object + */ + HumanAgentAssistantConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HumanAgentAssistantConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanAgentAssistantConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig"; + }; + + HumanAgentAssistantConfig.SuggestionTriggerSettings = (function() { + + /** + * Properties of a SuggestionTriggerSettings. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @interface ISuggestionTriggerSettings + * @property {boolean|null} [noSmalltalk] SuggestionTriggerSettings noSmalltalk + * @property {boolean|null} [onlyEndUser] SuggestionTriggerSettings onlyEndUser + */ + + /** + * Constructs a new SuggestionTriggerSettings. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @classdesc Represents a SuggestionTriggerSettings. + * @implements ISuggestionTriggerSettings + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings=} [properties] Properties to set + */ + function SuggestionTriggerSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionTriggerSettings noSmalltalk. + * @member {boolean} noSmalltalk + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @instance + */ + SuggestionTriggerSettings.prototype.noSmalltalk = false; + + /** + * SuggestionTriggerSettings onlyEndUser. + * @member {boolean} onlyEndUser + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @instance + */ + SuggestionTriggerSettings.prototype.onlyEndUser = false; + + /** + * Creates a new SuggestionTriggerSettings instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings} SuggestionTriggerSettings instance + */ + SuggestionTriggerSettings.create = function create(properties) { + return new SuggestionTriggerSettings(properties); + }; + + /** + * Encodes the specified SuggestionTriggerSettings message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings} message SuggestionTriggerSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionTriggerSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.noSmalltalk != null && Object.hasOwnProperty.call(message, "noSmalltalk")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.noSmalltalk); + if (message.onlyEndUser != null && Object.hasOwnProperty.call(message, "onlyEndUser")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.onlyEndUser); + return writer; + }; + + /** + * Encodes the specified SuggestionTriggerSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings} message SuggestionTriggerSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionTriggerSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionTriggerSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings} SuggestionTriggerSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionTriggerSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.noSmalltalk = reader.bool(); + break; + } + case 2: { + message.onlyEndUser = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionTriggerSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings} SuggestionTriggerSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionTriggerSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionTriggerSettings message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionTriggerSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.noSmalltalk != null && message.hasOwnProperty("noSmalltalk")) + if (typeof message.noSmalltalk !== "boolean") + return "noSmalltalk: boolean expected"; + if (message.onlyEndUser != null && message.hasOwnProperty("onlyEndUser")) + if (typeof message.onlyEndUser !== "boolean") + return "onlyEndUser: boolean expected"; + return null; + }; + + /** + * Creates a SuggestionTriggerSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings} SuggestionTriggerSettings + */ + SuggestionTriggerSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings(); + if (object.noSmalltalk != null) + message.noSmalltalk = Boolean(object.noSmalltalk); + if (object.onlyEndUser != null) + message.onlyEndUser = Boolean(object.onlyEndUser); + return message; + }; + + /** + * Creates a plain object from a SuggestionTriggerSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings} message SuggestionTriggerSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionTriggerSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.noSmalltalk = false; + object.onlyEndUser = false; + } + if (message.noSmalltalk != null && message.hasOwnProperty("noSmalltalk")) + object.noSmalltalk = message.noSmalltalk; + if (message.onlyEndUser != null && message.hasOwnProperty("onlyEndUser")) + object.onlyEndUser = message.onlyEndUser; + return object; + }; + + /** + * Converts this SuggestionTriggerSettings to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @instance + * @returns {Object.} JSON object + */ + SuggestionTriggerSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionTriggerSettings + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionTriggerSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings"; + }; + + return SuggestionTriggerSettings; + })(); + + HumanAgentAssistantConfig.SuggestionFeatureConfig = (function() { + + /** + * Properties of a SuggestionFeatureConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @interface ISuggestionFeatureConfig + * @property {google.cloud.dialogflow.v2.ISuggestionFeature|null} [suggestionFeature] SuggestionFeatureConfig suggestionFeature + * @property {boolean|null} [enableEventBasedSuggestion] SuggestionFeatureConfig enableEventBasedSuggestion + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings|null} [suggestionTriggerSettings] SuggestionFeatureConfig suggestionTriggerSettings + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig|null} [queryConfig] SuggestionFeatureConfig queryConfig + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig|null} [conversationModelConfig] SuggestionFeatureConfig conversationModelConfig + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig|null} [conversationProcessConfig] SuggestionFeatureConfig conversationProcessConfig + */ + + /** + * Constructs a new SuggestionFeatureConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @classdesc Represents a SuggestionFeatureConfig. + * @implements ISuggestionFeatureConfig + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig=} [properties] Properties to set + */ + function SuggestionFeatureConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionFeatureConfig suggestionFeature. + * @member {google.cloud.dialogflow.v2.ISuggestionFeature|null|undefined} suggestionFeature + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.suggestionFeature = null; + + /** + * SuggestionFeatureConfig enableEventBasedSuggestion. + * @member {boolean} enableEventBasedSuggestion + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.enableEventBasedSuggestion = false; + + /** + * SuggestionFeatureConfig suggestionTriggerSettings. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionTriggerSettings|null|undefined} suggestionTriggerSettings + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.suggestionTriggerSettings = null; + + /** + * SuggestionFeatureConfig queryConfig. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig|null|undefined} queryConfig + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.queryConfig = null; + + /** + * SuggestionFeatureConfig conversationModelConfig. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig|null|undefined} conversationModelConfig + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.conversationModelConfig = null; + + /** + * SuggestionFeatureConfig conversationProcessConfig. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig|null|undefined} conversationProcessConfig + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.conversationProcessConfig = null; + + /** + * Creates a new SuggestionFeatureConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig} SuggestionFeatureConfig instance + */ + SuggestionFeatureConfig.create = function create(properties) { + return new SuggestionFeatureConfig(properties); + }; + + /** + * Encodes the specified SuggestionFeatureConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig} message SuggestionFeatureConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionFeatureConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableEventBasedSuggestion != null && Object.hasOwnProperty.call(message, "enableEventBasedSuggestion")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableEventBasedSuggestion); + if (message.suggestionFeature != null && Object.hasOwnProperty.call(message, "suggestionFeature")) + $root.google.cloud.dialogflow.v2.SuggestionFeature.encode(message.suggestionFeature, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.queryConfig != null && Object.hasOwnProperty.call(message, "queryConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.encode(message.queryConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.conversationModelConfig != null && Object.hasOwnProperty.call(message, "conversationModelConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.encode(message.conversationModelConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.conversationProcessConfig != null && Object.hasOwnProperty.call(message, "conversationProcessConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig.encode(message.conversationProcessConfig, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.suggestionTriggerSettings != null && Object.hasOwnProperty.call(message, "suggestionTriggerSettings")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings.encode(message.suggestionTriggerSettings, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestionFeatureConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig} message SuggestionFeatureConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionFeatureConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionFeatureConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig} SuggestionFeatureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionFeatureConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.suggestionFeature = $root.google.cloud.dialogflow.v2.SuggestionFeature.decode(reader, reader.uint32()); + break; + } + case 3: { + message.enableEventBasedSuggestion = reader.bool(); + break; + } + case 10: { + message.suggestionTriggerSettings = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings.decode(reader, reader.uint32()); + break; + } + case 6: { + message.queryConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.conversationModelConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + message.conversationProcessConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionFeatureConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig} SuggestionFeatureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionFeatureConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionFeatureConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionFeatureConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestionFeature != null && message.hasOwnProperty("suggestionFeature")) { + var error = $root.google.cloud.dialogflow.v2.SuggestionFeature.verify(message.suggestionFeature); + if (error) + return "suggestionFeature." + error; + } + if (message.enableEventBasedSuggestion != null && message.hasOwnProperty("enableEventBasedSuggestion")) + if (typeof message.enableEventBasedSuggestion !== "boolean") + return "enableEventBasedSuggestion: boolean expected"; + if (message.suggestionTriggerSettings != null && message.hasOwnProperty("suggestionTriggerSettings")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify(message.suggestionTriggerSettings); + if (error) + return "suggestionTriggerSettings." + error; + } + if (message.queryConfig != null && message.hasOwnProperty("queryConfig")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.verify(message.queryConfig); + if (error) + return "queryConfig." + error; + } + if (message.conversationModelConfig != null && message.hasOwnProperty("conversationModelConfig")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.verify(message.conversationModelConfig); + if (error) + return "conversationModelConfig." + error; + } + if (message.conversationProcessConfig != null && message.hasOwnProperty("conversationProcessConfig")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig.verify(message.conversationProcessConfig); + if (error) + return "conversationProcessConfig." + error; + } + return null; + }; + + /** + * Creates a SuggestionFeatureConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig} SuggestionFeatureConfig + */ + SuggestionFeatureConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig(); + if (object.suggestionFeature != null) { + if (typeof object.suggestionFeature !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.suggestionFeature: object expected"); + message.suggestionFeature = $root.google.cloud.dialogflow.v2.SuggestionFeature.fromObject(object.suggestionFeature); + } + if (object.enableEventBasedSuggestion != null) + message.enableEventBasedSuggestion = Boolean(object.enableEventBasedSuggestion); + if (object.suggestionTriggerSettings != null) { + if (typeof object.suggestionTriggerSettings !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.suggestionTriggerSettings: object expected"); + message.suggestionTriggerSettings = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings.fromObject(object.suggestionTriggerSettings); + } + if (object.queryConfig != null) { + if (typeof object.queryConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.queryConfig: object expected"); + message.queryConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.fromObject(object.queryConfig); + } + if (object.conversationModelConfig != null) { + if (typeof object.conversationModelConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.conversationModelConfig: object expected"); + message.conversationModelConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.fromObject(object.conversationModelConfig); + } + if (object.conversationProcessConfig != null) { + if (typeof object.conversationProcessConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.conversationProcessConfig: object expected"); + message.conversationProcessConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig.fromObject(object.conversationProcessConfig); + } + return message; + }; + + /** + * Creates a plain object from a SuggestionFeatureConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig} message SuggestionFeatureConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionFeatureConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.enableEventBasedSuggestion = false; + object.suggestionFeature = null; + object.queryConfig = null; + object.conversationModelConfig = null; + object.conversationProcessConfig = null; + object.suggestionTriggerSettings = null; + } + if (message.enableEventBasedSuggestion != null && message.hasOwnProperty("enableEventBasedSuggestion")) + object.enableEventBasedSuggestion = message.enableEventBasedSuggestion; + if (message.suggestionFeature != null && message.hasOwnProperty("suggestionFeature")) + object.suggestionFeature = $root.google.cloud.dialogflow.v2.SuggestionFeature.toObject(message.suggestionFeature, options); + if (message.queryConfig != null && message.hasOwnProperty("queryConfig")) + object.queryConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.toObject(message.queryConfig, options); + if (message.conversationModelConfig != null && message.hasOwnProperty("conversationModelConfig")) + object.conversationModelConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.toObject(message.conversationModelConfig, options); + if (message.conversationProcessConfig != null && message.hasOwnProperty("conversationProcessConfig")) + object.conversationProcessConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig.toObject(message.conversationProcessConfig, options); + if (message.suggestionTriggerSettings != null && message.hasOwnProperty("suggestionTriggerSettings")) + object.suggestionTriggerSettings = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionTriggerSettings.toObject(message.suggestionTriggerSettings, options); + return object; + }; + + /** + * Converts this SuggestionFeatureConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + * @returns {Object.} JSON object + */ + SuggestionFeatureConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionFeatureConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionFeatureConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig"; + }; + + return SuggestionFeatureConfig; + })(); + + HumanAgentAssistantConfig.SuggestionConfig = (function() { + + /** + * Properties of a SuggestionConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @interface ISuggestionConfig + * @property {Array.|null} [featureConfigs] SuggestionConfig featureConfigs + * @property {boolean|null} [groupSuggestionResponses] SuggestionConfig groupSuggestionResponses + */ + + /** + * Constructs a new SuggestionConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @classdesc Represents a SuggestionConfig. + * @implements ISuggestionConfig + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig=} [properties] Properties to set + */ + function SuggestionConfig(properties) { + this.featureConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionConfig featureConfigs. + * @member {Array.} featureConfigs + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @instance + */ + SuggestionConfig.prototype.featureConfigs = $util.emptyArray; + + /** + * SuggestionConfig groupSuggestionResponses. + * @member {boolean} groupSuggestionResponses + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @instance + */ + SuggestionConfig.prototype.groupSuggestionResponses = false; + + /** + * Creates a new SuggestionConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig} SuggestionConfig instance + */ + SuggestionConfig.create = function create(properties) { + return new SuggestionConfig(properties); + }; + + /** + * Encodes the specified SuggestionConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig} message SuggestionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.featureConfigs != null && message.featureConfigs.length) + for (var i = 0; i < message.featureConfigs.length; ++i) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.encode(message.featureConfigs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.groupSuggestionResponses != null && Object.hasOwnProperty.call(message, "groupSuggestionResponses")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.groupSuggestionResponses); + return writer; + }; + + /** + * Encodes the specified SuggestionConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionConfig} message SuggestionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig} SuggestionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (!(message.featureConfigs && message.featureConfigs.length)) + message.featureConfigs = []; + message.featureConfigs.push($root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.decode(reader, reader.uint32())); + break; + } + case 3: { + message.groupSuggestionResponses = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig} SuggestionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.featureConfigs != null && message.hasOwnProperty("featureConfigs")) { + if (!Array.isArray(message.featureConfigs)) + return "featureConfigs: array expected"; + for (var i = 0; i < message.featureConfigs.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify(message.featureConfigs[i]); + if (error) + return "featureConfigs." + error; + } + } + if (message.groupSuggestionResponses != null && message.hasOwnProperty("groupSuggestionResponses")) + if (typeof message.groupSuggestionResponses !== "boolean") + return "groupSuggestionResponses: boolean expected"; + return null; + }; + + /** + * Creates a SuggestionConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig} SuggestionConfig + */ + SuggestionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig(); + if (object.featureConfigs) { + if (!Array.isArray(object.featureConfigs)) + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.featureConfigs: array expected"); + message.featureConfigs = []; + for (var i = 0; i < object.featureConfigs.length; ++i) { + if (typeof object.featureConfigs[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig.featureConfigs: object expected"); + message.featureConfigs[i] = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.fromObject(object.featureConfigs[i]); + } + } + if (object.groupSuggestionResponses != null) + message.groupSuggestionResponses = Boolean(object.groupSuggestionResponses); + return message; + }; + + /** + * Creates a plain object from a SuggestionConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig} message SuggestionConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.featureConfigs = []; + if (options.defaults) + object.groupSuggestionResponses = false; + if (message.featureConfigs && message.featureConfigs.length) { + object.featureConfigs = []; + for (var j = 0; j < message.featureConfigs.length; ++j) + object.featureConfigs[j] = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.toObject(message.featureConfigs[j], options); + } + if (message.groupSuggestionResponses != null && message.hasOwnProperty("groupSuggestionResponses")) + object.groupSuggestionResponses = message.groupSuggestionResponses; + return object; + }; + + /** + * Converts this SuggestionConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @instance + * @returns {Object.} JSON object + */ + SuggestionConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionConfig"; + }; + + return SuggestionConfig; + })(); + + HumanAgentAssistantConfig.SuggestionQueryConfig = (function() { + + /** + * Properties of a SuggestionQueryConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @interface ISuggestionQueryConfig + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource|null} [knowledgeBaseQuerySource] SuggestionQueryConfig knowledgeBaseQuerySource + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource|null} [documentQuerySource] SuggestionQueryConfig documentQuerySource + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource|null} [dialogflowQuerySource] SuggestionQueryConfig dialogflowQuerySource + * @property {number|null} [maxResults] SuggestionQueryConfig maxResults + * @property {number|null} [confidenceThreshold] SuggestionQueryConfig confidenceThreshold + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings|null} [contextFilterSettings] SuggestionQueryConfig contextFilterSettings + */ + + /** + * Constructs a new SuggestionQueryConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @classdesc Represents a SuggestionQueryConfig. + * @implements ISuggestionQueryConfig + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig=} [properties] Properties to set + */ + function SuggestionQueryConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionQueryConfig knowledgeBaseQuerySource. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource|null|undefined} knowledgeBaseQuerySource + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.knowledgeBaseQuerySource = null; + + /** + * SuggestionQueryConfig documentQuerySource. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource|null|undefined} documentQuerySource + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.documentQuerySource = null; + + /** + * SuggestionQueryConfig dialogflowQuerySource. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource|null|undefined} dialogflowQuerySource + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.dialogflowQuerySource = null; + + /** + * SuggestionQueryConfig maxResults. + * @member {number} maxResults + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.maxResults = 0; + + /** + * SuggestionQueryConfig confidenceThreshold. + * @member {number} confidenceThreshold + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.confidenceThreshold = 0; + + /** + * SuggestionQueryConfig contextFilterSettings. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings|null|undefined} contextFilterSettings + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.contextFilterSettings = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SuggestionQueryConfig querySource. + * @member {"knowledgeBaseQuerySource"|"documentQuerySource"|"dialogflowQuerySource"|undefined} querySource + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + Object.defineProperty(SuggestionQueryConfig.prototype, "querySource", { + get: $util.oneOfGetter($oneOfFields = ["knowledgeBaseQuerySource", "documentQuerySource", "dialogflowQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SuggestionQueryConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig} SuggestionQueryConfig instance + */ + SuggestionQueryConfig.create = function create(properties) { + return new SuggestionQueryConfig(properties); + }; + + /** + * Encodes the specified SuggestionQueryConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig} message SuggestionQueryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionQueryConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.knowledgeBaseQuerySource != null && Object.hasOwnProperty.call(message, "knowledgeBaseQuerySource")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.encode(message.knowledgeBaseQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.documentQuerySource != null && Object.hasOwnProperty.call(message, "documentQuerySource")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.encode(message.documentQuerySource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dialogflowQuerySource != null && Object.hasOwnProperty.call(message, "dialogflowQuerySource")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.encode(message.dialogflowQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.maxResults); + if (message.confidenceThreshold != null && Object.hasOwnProperty.call(message, "confidenceThreshold")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidenceThreshold); + if (message.contextFilterSettings != null && Object.hasOwnProperty.call(message, "contextFilterSettings")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.encode(message.contextFilterSettings, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestionQueryConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionQueryConfig} message SuggestionQueryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionQueryConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionQueryConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig} SuggestionQueryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionQueryConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.knowledgeBaseQuerySource = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.documentQuerySource = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.decode(reader, reader.uint32()); + break; + } + case 3: { + message.dialogflowQuerySource = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.decode(reader, reader.uint32()); + break; + } + case 4: { + message.maxResults = reader.int32(); + break; + } + case 5: { + message.confidenceThreshold = reader.float(); + break; + } + case 7: { + message.contextFilterSettings = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionQueryConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig} SuggestionQueryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionQueryConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionQueryConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionQueryConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.knowledgeBaseQuerySource != null && message.hasOwnProperty("knowledgeBaseQuerySource")) { + properties.querySource = 1; + { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify(message.knowledgeBaseQuerySource); + if (error) + return "knowledgeBaseQuerySource." + error; + } + } + if (message.documentQuerySource != null && message.hasOwnProperty("documentQuerySource")) { + if (properties.querySource === 1) + return "querySource: multiple values"; + properties.querySource = 1; + { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify(message.documentQuerySource); + if (error) + return "documentQuerySource." + error; + } + } + if (message.dialogflowQuerySource != null && message.hasOwnProperty("dialogflowQuerySource")) { + if (properties.querySource === 1) + return "querySource: multiple values"; + properties.querySource = 1; + { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify(message.dialogflowQuerySource); + if (error) + return "dialogflowQuerySource." + error; + } + } + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.confidenceThreshold != null && message.hasOwnProperty("confidenceThreshold")) + if (typeof message.confidenceThreshold !== "number") + return "confidenceThreshold: number expected"; + if (message.contextFilterSettings != null && message.hasOwnProperty("contextFilterSettings")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify(message.contextFilterSettings); + if (error) + return "contextFilterSettings." + error; + } + return null; + }; + + /** + * Creates a SuggestionQueryConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig} SuggestionQueryConfig + */ + SuggestionQueryConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig(); + if (object.knowledgeBaseQuerySource != null) { + if (typeof object.knowledgeBaseQuerySource !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.knowledgeBaseQuerySource: object expected"); + message.knowledgeBaseQuerySource = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.fromObject(object.knowledgeBaseQuerySource); + } + if (object.documentQuerySource != null) { + if (typeof object.documentQuerySource !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.documentQuerySource: object expected"); + message.documentQuerySource = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.fromObject(object.documentQuerySource); + } + if (object.dialogflowQuerySource != null) { + if (typeof object.dialogflowQuerySource !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.dialogflowQuerySource: object expected"); + message.dialogflowQuerySource = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.fromObject(object.dialogflowQuerySource); + } + if (object.maxResults != null) + message.maxResults = object.maxResults | 0; + if (object.confidenceThreshold != null) + message.confidenceThreshold = Number(object.confidenceThreshold); + if (object.contextFilterSettings != null) { + if (typeof object.contextFilterSettings !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.contextFilterSettings: object expected"); + message.contextFilterSettings = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.fromObject(object.contextFilterSettings); + } + return message; + }; + + /** + * Creates a plain object from a SuggestionQueryConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig} message SuggestionQueryConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionQueryConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.maxResults = 0; + object.confidenceThreshold = 0; + object.contextFilterSettings = null; + } + if (message.knowledgeBaseQuerySource != null && message.hasOwnProperty("knowledgeBaseQuerySource")) { + object.knowledgeBaseQuerySource = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.toObject(message.knowledgeBaseQuerySource, options); + if (options.oneofs) + object.querySource = "knowledgeBaseQuerySource"; + } + if (message.documentQuerySource != null && message.hasOwnProperty("documentQuerySource")) { + object.documentQuerySource = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.toObject(message.documentQuerySource, options); + if (options.oneofs) + object.querySource = "documentQuerySource"; + } + if (message.dialogflowQuerySource != null && message.hasOwnProperty("dialogflowQuerySource")) { + object.dialogflowQuerySource = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.toObject(message.dialogflowQuerySource, options); + if (options.oneofs) + object.querySource = "dialogflowQuerySource"; + } + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.confidenceThreshold != null && message.hasOwnProperty("confidenceThreshold")) + object.confidenceThreshold = options.json && !isFinite(message.confidenceThreshold) ? String(message.confidenceThreshold) : message.confidenceThreshold; + if (message.contextFilterSettings != null && message.hasOwnProperty("contextFilterSettings")) + object.contextFilterSettings = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.toObject(message.contextFilterSettings, options); + return object; + }; + + /** + * Converts this SuggestionQueryConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + * @returns {Object.} JSON object + */ + SuggestionQueryConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionQueryConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionQueryConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig"; + }; + + SuggestionQueryConfig.KnowledgeBaseQuerySource = (function() { + + /** + * Properties of a KnowledgeBaseQuerySource. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @interface IKnowledgeBaseQuerySource + * @property {Array.|null} [knowledgeBases] KnowledgeBaseQuerySource knowledgeBases + */ + + /** + * Constructs a new KnowledgeBaseQuerySource. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @classdesc Represents a KnowledgeBaseQuerySource. + * @implements IKnowledgeBaseQuerySource + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource=} [properties] Properties to set + */ + function KnowledgeBaseQuerySource(properties) { + this.knowledgeBases = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KnowledgeBaseQuerySource knowledgeBases. + * @member {Array.} knowledgeBases + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @instance + */ + KnowledgeBaseQuerySource.prototype.knowledgeBases = $util.emptyArray; + + /** + * Creates a new KnowledgeBaseQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} KnowledgeBaseQuerySource instance + */ + KnowledgeBaseQuerySource.create = function create(properties) { + return new KnowledgeBaseQuerySource(properties); + }; + + /** + * Encodes the specified KnowledgeBaseQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource} message KnowledgeBaseQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeBaseQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.knowledgeBases != null && message.knowledgeBases.length) + for (var i = 0; i < message.knowledgeBases.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.knowledgeBases[i]); + return writer; + }; + + /** + * Encodes the specified KnowledgeBaseQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource} message KnowledgeBaseQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeBaseQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KnowledgeBaseQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} KnowledgeBaseQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeBaseQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.knowledgeBases && message.knowledgeBases.length)) + message.knowledgeBases = []; + message.knowledgeBases.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KnowledgeBaseQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} KnowledgeBaseQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeBaseQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KnowledgeBaseQuerySource message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KnowledgeBaseQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.knowledgeBases != null && message.hasOwnProperty("knowledgeBases")) { + if (!Array.isArray(message.knowledgeBases)) + return "knowledgeBases: array expected"; + for (var i = 0; i < message.knowledgeBases.length; ++i) + if (!$util.isString(message.knowledgeBases[i])) + return "knowledgeBases: string[] expected"; + } + return null; + }; + + /** + * Creates a KnowledgeBaseQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} KnowledgeBaseQuerySource + */ + KnowledgeBaseQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource(); + if (object.knowledgeBases) { + if (!Array.isArray(object.knowledgeBases)) + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.knowledgeBases: array expected"); + message.knowledgeBases = []; + for (var i = 0; i < object.knowledgeBases.length; ++i) + message.knowledgeBases[i] = String(object.knowledgeBases[i]); + } + return message; + }; + + /** + * Creates a plain object from a KnowledgeBaseQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} message KnowledgeBaseQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KnowledgeBaseQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.knowledgeBases = []; + if (message.knowledgeBases && message.knowledgeBases.length) { + object.knowledgeBases = []; + for (var j = 0; j < message.knowledgeBases.length; ++j) + object.knowledgeBases[j] = message.knowledgeBases[j]; + } + return object; + }; + + /** + * Converts this KnowledgeBaseQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @instance + * @returns {Object.} JSON object + */ + KnowledgeBaseQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for KnowledgeBaseQuerySource + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KnowledgeBaseQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource"; + }; + + return KnowledgeBaseQuerySource; + })(); + + SuggestionQueryConfig.DocumentQuerySource = (function() { + + /** + * Properties of a DocumentQuerySource. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @interface IDocumentQuerySource + * @property {Array.|null} [documents] DocumentQuerySource documents + */ + + /** + * Constructs a new DocumentQuerySource. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @classdesc Represents a DocumentQuerySource. + * @implements IDocumentQuerySource + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource=} [properties] Properties to set + */ + function DocumentQuerySource(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentQuerySource documents. + * @member {Array.} documents + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @instance + */ + DocumentQuerySource.prototype.documents = $util.emptyArray; + + /** + * Creates a new DocumentQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} DocumentQuerySource instance + */ + DocumentQuerySource.create = function create(properties) { + return new DocumentQuerySource(properties); + }; + + /** + * Encodes the specified DocumentQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource} message DocumentQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.documents[i]); + return writer; + }; + + /** + * Encodes the specified DocumentQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource} message DocumentQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} DocumentQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} DocumentQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentQuerySource message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documents != null && message.hasOwnProperty("documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) + if (!$util.isString(message.documents[i])) + return "documents: string[] expected"; + } + return null; + }; + + /** + * Creates a DocumentQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} DocumentQuerySource + */ + DocumentQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) + message.documents[i] = String(object.documents[i]); + } + return message; + }; + + /** + * Creates a plain object from a DocumentQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} message DocumentQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = message.documents[j]; + } + return object; + }; + + /** + * Converts this DocumentQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @instance + * @returns {Object.} JSON object + */ + DocumentQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentQuerySource + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource"; + }; + + return DocumentQuerySource; + })(); + + SuggestionQueryConfig.DialogflowQuerySource = (function() { + + /** + * Properties of a DialogflowQuerySource. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @interface IDialogflowQuerySource + * @property {string|null} [agent] DialogflowQuerySource agent + */ + + /** + * Constructs a new DialogflowQuerySource. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @classdesc Represents a DialogflowQuerySource. + * @implements IDialogflowQuerySource + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource=} [properties] Properties to set + */ + function DialogflowQuerySource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DialogflowQuerySource agent. + * @member {string} agent + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @instance + */ + DialogflowQuerySource.prototype.agent = ""; + + /** + * Creates a new DialogflowQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} DialogflowQuerySource instance + */ + DialogflowQuerySource.create = function create(properties) { + return new DialogflowQuerySource(properties); + }; + + /** + * Encodes the specified DialogflowQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource} message DialogflowQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DialogflowQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agent != null && Object.hasOwnProperty.call(message, "agent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.agent); + return writer; + }; + + /** + * Encodes the specified DialogflowQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource} message DialogflowQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DialogflowQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DialogflowQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} DialogflowQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DialogflowQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DialogflowQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} DialogflowQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DialogflowQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DialogflowQuerySource message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DialogflowQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agent != null && message.hasOwnProperty("agent")) + if (!$util.isString(message.agent)) + return "agent: string expected"; + return null; + }; + + /** + * Creates a DialogflowQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} DialogflowQuerySource + */ + DialogflowQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource(); + if (object.agent != null) + message.agent = String(object.agent); + return message; + }; + + /** + * Creates a plain object from a DialogflowQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} message DialogflowQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DialogflowQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.agent = ""; + if (message.agent != null && message.hasOwnProperty("agent")) + object.agent = message.agent; + return object; + }; + + /** + * Converts this DialogflowQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @instance + * @returns {Object.} JSON object + */ + DialogflowQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DialogflowQuerySource + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DialogflowQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource"; + }; + + return DialogflowQuerySource; + })(); + + SuggestionQueryConfig.ContextFilterSettings = (function() { + + /** + * Properties of a ContextFilterSettings. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @interface IContextFilterSettings + * @property {boolean|null} [dropHandoffMessages] ContextFilterSettings dropHandoffMessages + * @property {boolean|null} [dropVirtualAgentMessages] ContextFilterSettings dropVirtualAgentMessages + * @property {boolean|null} [dropIvrMessages] ContextFilterSettings dropIvrMessages + */ + + /** + * Constructs a new ContextFilterSettings. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig + * @classdesc Represents a ContextFilterSettings. + * @implements IContextFilterSettings + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings=} [properties] Properties to set + */ + function ContextFilterSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContextFilterSettings dropHandoffMessages. + * @member {boolean} dropHandoffMessages + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @instance + */ + ContextFilterSettings.prototype.dropHandoffMessages = false; + + /** + * ContextFilterSettings dropVirtualAgentMessages. + * @member {boolean} dropVirtualAgentMessages + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @instance + */ + ContextFilterSettings.prototype.dropVirtualAgentMessages = false; + + /** + * ContextFilterSettings dropIvrMessages. + * @member {boolean} dropIvrMessages + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @instance + */ + ContextFilterSettings.prototype.dropIvrMessages = false; + + /** + * Creates a new ContextFilterSettings instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} ContextFilterSettings instance + */ + ContextFilterSettings.create = function create(properties) { + return new ContextFilterSettings(properties); + }; + + /** + * Encodes the specified ContextFilterSettings message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings} message ContextFilterSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContextFilterSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dropHandoffMessages != null && Object.hasOwnProperty.call(message, "dropHandoffMessages")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.dropHandoffMessages); + if (message.dropVirtualAgentMessages != null && Object.hasOwnProperty.call(message, "dropVirtualAgentMessages")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.dropVirtualAgentMessages); + if (message.dropIvrMessages != null && Object.hasOwnProperty.call(message, "dropIvrMessages")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dropIvrMessages); + return writer; + }; + + /** + * Encodes the specified ContextFilterSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings} message ContextFilterSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContextFilterSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContextFilterSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} ContextFilterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContextFilterSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.dropHandoffMessages = reader.bool(); + break; + } + case 2: { + message.dropVirtualAgentMessages = reader.bool(); + break; + } + case 3: { + message.dropIvrMessages = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContextFilterSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} ContextFilterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContextFilterSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContextFilterSettings message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContextFilterSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dropHandoffMessages != null && message.hasOwnProperty("dropHandoffMessages")) + if (typeof message.dropHandoffMessages !== "boolean") + return "dropHandoffMessages: boolean expected"; + if (message.dropVirtualAgentMessages != null && message.hasOwnProperty("dropVirtualAgentMessages")) + if (typeof message.dropVirtualAgentMessages !== "boolean") + return "dropVirtualAgentMessages: boolean expected"; + if (message.dropIvrMessages != null && message.hasOwnProperty("dropIvrMessages")) + if (typeof message.dropIvrMessages !== "boolean") + return "dropIvrMessages: boolean expected"; + return null; + }; + + /** + * Creates a ContextFilterSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} ContextFilterSettings + */ + ContextFilterSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings(); + if (object.dropHandoffMessages != null) + message.dropHandoffMessages = Boolean(object.dropHandoffMessages); + if (object.dropVirtualAgentMessages != null) + message.dropVirtualAgentMessages = Boolean(object.dropVirtualAgentMessages); + if (object.dropIvrMessages != null) + message.dropIvrMessages = Boolean(object.dropIvrMessages); + return message; + }; + + /** + * Creates a plain object from a ContextFilterSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} message ContextFilterSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContextFilterSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.dropHandoffMessages = false; + object.dropVirtualAgentMessages = false; + object.dropIvrMessages = false; + } + if (message.dropHandoffMessages != null && message.hasOwnProperty("dropHandoffMessages")) + object.dropHandoffMessages = message.dropHandoffMessages; + if (message.dropVirtualAgentMessages != null && message.hasOwnProperty("dropVirtualAgentMessages")) + object.dropVirtualAgentMessages = message.dropVirtualAgentMessages; + if (message.dropIvrMessages != null && message.hasOwnProperty("dropIvrMessages")) + object.dropIvrMessages = message.dropIvrMessages; + return object; + }; + + /** + * Converts this ContextFilterSettings to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @instance + * @returns {Object.} JSON object + */ + ContextFilterSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ContextFilterSettings + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ContextFilterSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings"; + }; + + return ContextFilterSettings; + })(); + + return SuggestionQueryConfig; + })(); + + HumanAgentAssistantConfig.ConversationModelConfig = (function() { + + /** + * Properties of a ConversationModelConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @interface IConversationModelConfig + * @property {string|null} [model] ConversationModelConfig model + */ + + /** + * Constructs a new ConversationModelConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @classdesc Represents a ConversationModelConfig. + * @implements IConversationModelConfig + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig=} [properties] Properties to set + */ + function ConversationModelConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationModelConfig model. + * @member {string} model + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @instance + */ + ConversationModelConfig.prototype.model = ""; + + /** + * Creates a new ConversationModelConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig} ConversationModelConfig instance + */ + ConversationModelConfig.create = function create(properties) { + return new ConversationModelConfig(properties); + }; + + /** + * Encodes the specified ConversationModelConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig} message ConversationModelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationModelConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); + return writer; + }; + + /** + * Encodes the specified ConversationModelConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationModelConfig} message ConversationModelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationModelConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationModelConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig} ConversationModelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationModelConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.model = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationModelConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig} ConversationModelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationModelConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationModelConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationModelConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates a ConversationModelConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig} ConversationModelConfig + */ + ConversationModelConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig(); + if (object.model != null) + message.model = String(object.model); + return message; + }; + + /** + * Creates a plain object from a ConversationModelConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig} message ConversationModelConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationModelConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.model = ""; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + return object; + }; + + /** + * Converts this ConversationModelConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @instance + * @returns {Object.} JSON object + */ + ConversationModelConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationModelConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationModelConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationModelConfig"; + }; + + return ConversationModelConfig; + })(); + + HumanAgentAssistantConfig.ConversationProcessConfig = (function() { + + /** + * Properties of a ConversationProcessConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @interface IConversationProcessConfig + * @property {number|null} [recentSentencesCount] ConversationProcessConfig recentSentencesCount + */ + + /** + * Constructs a new ConversationProcessConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @classdesc Represents a ConversationProcessConfig. + * @implements IConversationProcessConfig + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig=} [properties] Properties to set + */ + function ConversationProcessConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationProcessConfig recentSentencesCount. + * @member {number} recentSentencesCount + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @instance + */ + ConversationProcessConfig.prototype.recentSentencesCount = 0; + + /** + * Creates a new ConversationProcessConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig} ConversationProcessConfig instance + */ + ConversationProcessConfig.create = function create(properties) { + return new ConversationProcessConfig(properties); + }; + + /** + * Encodes the specified ConversationProcessConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig} message ConversationProcessConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationProcessConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSentencesCount != null && Object.hasOwnProperty.call(message, "recentSentencesCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.recentSentencesCount); + return writer; + }; + + /** + * Encodes the specified ConversationProcessConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IConversationProcessConfig} message ConversationProcessConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationProcessConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationProcessConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig} ConversationProcessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationProcessConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.recentSentencesCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationProcessConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig} ConversationProcessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationProcessConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationProcessConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationProcessConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSentencesCount != null && message.hasOwnProperty("recentSentencesCount")) + if (!$util.isInteger(message.recentSentencesCount)) + return "recentSentencesCount: integer expected"; + return null; + }; + + /** + * Creates a ConversationProcessConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig} ConversationProcessConfig + */ + ConversationProcessConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig(); + if (object.recentSentencesCount != null) + message.recentSentencesCount = object.recentSentencesCount | 0; + return message; + }; + + /** + * Creates a plain object from a ConversationProcessConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig} message ConversationProcessConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationProcessConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSentencesCount = 0; + if (message.recentSentencesCount != null && message.hasOwnProperty("recentSentencesCount")) + object.recentSentencesCount = message.recentSentencesCount; + return object; + }; + + /** + * Converts this ConversationProcessConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @instance + * @returns {Object.} JSON object + */ + ConversationProcessConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationProcessConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationProcessConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ConversationProcessConfig"; + }; + + return ConversationProcessConfig; + })(); + + HumanAgentAssistantConfig.MessageAnalysisConfig = (function() { + + /** + * Properties of a MessageAnalysisConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @interface IMessageAnalysisConfig + * @property {boolean|null} [enableEntityExtraction] MessageAnalysisConfig enableEntityExtraction + * @property {boolean|null} [enableSentimentAnalysis] MessageAnalysisConfig enableSentimentAnalysis + */ + + /** + * Constructs a new MessageAnalysisConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig + * @classdesc Represents a MessageAnalysisConfig. + * @implements IMessageAnalysisConfig + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig=} [properties] Properties to set + */ + function MessageAnalysisConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageAnalysisConfig enableEntityExtraction. + * @member {boolean} enableEntityExtraction + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @instance + */ + MessageAnalysisConfig.prototype.enableEntityExtraction = false; + + /** + * MessageAnalysisConfig enableSentimentAnalysis. + * @member {boolean} enableSentimentAnalysis + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @instance + */ + MessageAnalysisConfig.prototype.enableSentimentAnalysis = false; + + /** + * Creates a new MessageAnalysisConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig} MessageAnalysisConfig instance + */ + MessageAnalysisConfig.create = function create(properties) { + return new MessageAnalysisConfig(properties); + }; + + /** + * Encodes the specified MessageAnalysisConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig} message MessageAnalysisConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageAnalysisConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableEntityExtraction != null && Object.hasOwnProperty.call(message, "enableEntityExtraction")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.enableEntityExtraction); + if (message.enableSentimentAnalysis != null && Object.hasOwnProperty.call(message, "enableSentimentAnalysis")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSentimentAnalysis); + return writer; + }; + + /** + * Encodes the specified MessageAnalysisConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.IMessageAnalysisConfig} message MessageAnalysisConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageAnalysisConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageAnalysisConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig} MessageAnalysisConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageAnalysisConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.enableEntityExtraction = reader.bool(); + break; + } + case 3: { + message.enableSentimentAnalysis = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageAnalysisConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig} MessageAnalysisConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageAnalysisConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageAnalysisConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageAnalysisConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enableEntityExtraction != null && message.hasOwnProperty("enableEntityExtraction")) + if (typeof message.enableEntityExtraction !== "boolean") + return "enableEntityExtraction: boolean expected"; + if (message.enableSentimentAnalysis != null && message.hasOwnProperty("enableSentimentAnalysis")) + if (typeof message.enableSentimentAnalysis !== "boolean") + return "enableSentimentAnalysis: boolean expected"; + return null; + }; + + /** + * Creates a MessageAnalysisConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig} MessageAnalysisConfig + */ + MessageAnalysisConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig(); + if (object.enableEntityExtraction != null) + message.enableEntityExtraction = Boolean(object.enableEntityExtraction); + if (object.enableSentimentAnalysis != null) + message.enableSentimentAnalysis = Boolean(object.enableSentimentAnalysis); + return message; + }; + + /** + * Creates a plain object from a MessageAnalysisConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig} message MessageAnalysisConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageAnalysisConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.enableEntityExtraction = false; + object.enableSentimentAnalysis = false; + } + if (message.enableEntityExtraction != null && message.hasOwnProperty("enableEntityExtraction")) + object.enableEntityExtraction = message.enableEntityExtraction; + if (message.enableSentimentAnalysis != null && message.hasOwnProperty("enableSentimentAnalysis")) + object.enableSentimentAnalysis = message.enableSentimentAnalysis; + return object; + }; + + /** + * Converts this MessageAnalysisConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @instance + * @returns {Object.} JSON object + */ + MessageAnalysisConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageAnalysisConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageAnalysisConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantConfig.MessageAnalysisConfig"; + }; + + return MessageAnalysisConfig; + })(); + + return HumanAgentAssistantConfig; + })(); + + v2.HumanAgentHandoffConfig = (function() { + + /** + * Properties of a HumanAgentHandoffConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface IHumanAgentHandoffConfig + * @property {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig|null} [livePersonConfig] HumanAgentHandoffConfig livePersonConfig + * @property {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig|null} [salesforceLiveAgentConfig] HumanAgentHandoffConfig salesforceLiveAgentConfig + */ + + /** + * Constructs a new HumanAgentHandoffConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a HumanAgentHandoffConfig. + * @implements IHumanAgentHandoffConfig + * @constructor + * @param {google.cloud.dialogflow.v2.IHumanAgentHandoffConfig=} [properties] Properties to set + */ + function HumanAgentHandoffConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HumanAgentHandoffConfig livePersonConfig. + * @member {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig|null|undefined} livePersonConfig + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @instance + */ + HumanAgentHandoffConfig.prototype.livePersonConfig = null; + + /** + * HumanAgentHandoffConfig salesforceLiveAgentConfig. + * @member {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig|null|undefined} salesforceLiveAgentConfig + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @instance + */ + HumanAgentHandoffConfig.prototype.salesforceLiveAgentConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HumanAgentHandoffConfig agentService. + * @member {"livePersonConfig"|"salesforceLiveAgentConfig"|undefined} agentService + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @instance + */ + Object.defineProperty(HumanAgentHandoffConfig.prototype, "agentService", { + get: $util.oneOfGetter($oneOfFields = ["livePersonConfig", "salesforceLiveAgentConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HumanAgentHandoffConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @static + * @param {google.cloud.dialogflow.v2.IHumanAgentHandoffConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig} HumanAgentHandoffConfig instance + */ + HumanAgentHandoffConfig.create = function create(properties) { + return new HumanAgentHandoffConfig(properties); + }; + + /** + * Encodes the specified HumanAgentHandoffConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @static + * @param {google.cloud.dialogflow.v2.IHumanAgentHandoffConfig} message HumanAgentHandoffConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentHandoffConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.livePersonConfig != null && Object.hasOwnProperty.call(message, "livePersonConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig.encode(message.livePersonConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.salesforceLiveAgentConfig != null && Object.hasOwnProperty.call(message, "salesforceLiveAgentConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.encode(message.salesforceLiveAgentConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HumanAgentHandoffConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @static + * @param {google.cloud.dialogflow.v2.IHumanAgentHandoffConfig} message HumanAgentHandoffConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentHandoffConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HumanAgentHandoffConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig} HumanAgentHandoffConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentHandoffConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.livePersonConfig = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.salesforceLiveAgentConfig = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HumanAgentHandoffConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig} HumanAgentHandoffConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentHandoffConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HumanAgentHandoffConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HumanAgentHandoffConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.livePersonConfig != null && message.hasOwnProperty("livePersonConfig")) { + properties.agentService = 1; + { + var error = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig.verify(message.livePersonConfig); + if (error) + return "livePersonConfig." + error; + } + } + if (message.salesforceLiveAgentConfig != null && message.hasOwnProperty("salesforceLiveAgentConfig")) { + if (properties.agentService === 1) + return "agentService: multiple values"; + properties.agentService = 1; + { + var error = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify(message.salesforceLiveAgentConfig); + if (error) + return "salesforceLiveAgentConfig." + error; + } + } + return null; + }; + + /** + * Creates a HumanAgentHandoffConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig} HumanAgentHandoffConfig + */ + HumanAgentHandoffConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig(); + if (object.livePersonConfig != null) { + if (typeof object.livePersonConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentHandoffConfig.livePersonConfig: object expected"); + message.livePersonConfig = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig.fromObject(object.livePersonConfig); + } + if (object.salesforceLiveAgentConfig != null) { + if (typeof object.salesforceLiveAgentConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentHandoffConfig.salesforceLiveAgentConfig: object expected"); + message.salesforceLiveAgentConfig = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.fromObject(object.salesforceLiveAgentConfig); + } + return message; + }; + + /** + * Creates a plain object from a HumanAgentHandoffConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig} message HumanAgentHandoffConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HumanAgentHandoffConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.livePersonConfig != null && message.hasOwnProperty("livePersonConfig")) { + object.livePersonConfig = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig.toObject(message.livePersonConfig, options); + if (options.oneofs) + object.agentService = "livePersonConfig"; + } + if (message.salesforceLiveAgentConfig != null && message.hasOwnProperty("salesforceLiveAgentConfig")) { + object.salesforceLiveAgentConfig = $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.toObject(message.salesforceLiveAgentConfig, options); + if (options.oneofs) + object.agentService = "salesforceLiveAgentConfig"; + } + return object; + }; + + /** + * Converts this HumanAgentHandoffConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @instance + * @returns {Object.} JSON object + */ + HumanAgentHandoffConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HumanAgentHandoffConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanAgentHandoffConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentHandoffConfig"; + }; + + HumanAgentHandoffConfig.LivePersonConfig = (function() { + + /** + * Properties of a LivePersonConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @interface ILivePersonConfig + * @property {string|null} [accountNumber] LivePersonConfig accountNumber + */ + + /** + * Constructs a new LivePersonConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @classdesc Represents a LivePersonConfig. + * @implements ILivePersonConfig + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig=} [properties] Properties to set + */ + function LivePersonConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LivePersonConfig accountNumber. + * @member {string} accountNumber + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @instance + */ + LivePersonConfig.prototype.accountNumber = ""; + + /** + * Creates a new LivePersonConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig} LivePersonConfig instance + */ + LivePersonConfig.create = function create(properties) { + return new LivePersonConfig(properties); + }; + + /** + * Encodes the specified LivePersonConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig} message LivePersonConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LivePersonConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.accountNumber != null && Object.hasOwnProperty.call(message, "accountNumber")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.accountNumber); + return writer; + }; + + /** + * Encodes the specified LivePersonConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ILivePersonConfig} message LivePersonConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LivePersonConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LivePersonConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig} LivePersonConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LivePersonConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.accountNumber = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LivePersonConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig} LivePersonConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LivePersonConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LivePersonConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LivePersonConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.accountNumber != null && message.hasOwnProperty("accountNumber")) + if (!$util.isString(message.accountNumber)) + return "accountNumber: string expected"; + return null; + }; + + /** + * Creates a LivePersonConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig} LivePersonConfig + */ + LivePersonConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig(); + if (object.accountNumber != null) + message.accountNumber = String(object.accountNumber); + return message; + }; + + /** + * Creates a plain object from a LivePersonConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig} message LivePersonConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LivePersonConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.accountNumber = ""; + if (message.accountNumber != null && message.hasOwnProperty("accountNumber")) + object.accountNumber = message.accountNumber; + return object; + }; + + /** + * Converts this LivePersonConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @instance + * @returns {Object.} JSON object + */ + LivePersonConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LivePersonConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LivePersonConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentHandoffConfig.LivePersonConfig"; + }; + + return LivePersonConfig; + })(); + + HumanAgentHandoffConfig.SalesforceLiveAgentConfig = (function() { + + /** + * Properties of a SalesforceLiveAgentConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @interface ISalesforceLiveAgentConfig + * @property {string|null} [organizationId] SalesforceLiveAgentConfig organizationId + * @property {string|null} [deploymentId] SalesforceLiveAgentConfig deploymentId + * @property {string|null} [buttonId] SalesforceLiveAgentConfig buttonId + * @property {string|null} [endpointDomain] SalesforceLiveAgentConfig endpointDomain + */ + + /** + * Constructs a new SalesforceLiveAgentConfig. + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig + * @classdesc Represents a SalesforceLiveAgentConfig. + * @implements ISalesforceLiveAgentConfig + * @constructor + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig=} [properties] Properties to set + */ + function SalesforceLiveAgentConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SalesforceLiveAgentConfig organizationId. + * @member {string} organizationId + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + */ + SalesforceLiveAgentConfig.prototype.organizationId = ""; + + /** + * SalesforceLiveAgentConfig deploymentId. + * @member {string} deploymentId + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + */ + SalesforceLiveAgentConfig.prototype.deploymentId = ""; + + /** + * SalesforceLiveAgentConfig buttonId. + * @member {string} buttonId + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + */ + SalesforceLiveAgentConfig.prototype.buttonId = ""; + + /** + * SalesforceLiveAgentConfig endpointDomain. + * @member {string} endpointDomain + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + */ + SalesforceLiveAgentConfig.prototype.endpointDomain = ""; + + /** + * Creates a new SalesforceLiveAgentConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} SalesforceLiveAgentConfig instance + */ + SalesforceLiveAgentConfig.create = function create(properties) { + return new SalesforceLiveAgentConfig(properties); + }; + + /** + * Encodes the specified SalesforceLiveAgentConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig} message SalesforceLiveAgentConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SalesforceLiveAgentConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.organizationId != null && Object.hasOwnProperty.call(message, "organizationId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.organizationId); + if (message.deploymentId != null && Object.hasOwnProperty.call(message, "deploymentId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.deploymentId); + if (message.buttonId != null && Object.hasOwnProperty.call(message, "buttonId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.buttonId); + if (message.endpointDomain != null && Object.hasOwnProperty.call(message, "endpointDomain")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.endpointDomain); + return writer; + }; + + /** + * Encodes the specified SalesforceLiveAgentConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig} message SalesforceLiveAgentConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SalesforceLiveAgentConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SalesforceLiveAgentConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} SalesforceLiveAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SalesforceLiveAgentConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.organizationId = reader.string(); + break; + } + case 2: { + message.deploymentId = reader.string(); + break; + } + case 3: { + message.buttonId = reader.string(); + break; + } + case 4: { + message.endpointDomain = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SalesforceLiveAgentConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} SalesforceLiveAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SalesforceLiveAgentConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SalesforceLiveAgentConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SalesforceLiveAgentConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.organizationId != null && message.hasOwnProperty("organizationId")) + if (!$util.isString(message.organizationId)) + return "organizationId: string expected"; + if (message.deploymentId != null && message.hasOwnProperty("deploymentId")) + if (!$util.isString(message.deploymentId)) + return "deploymentId: string expected"; + if (message.buttonId != null && message.hasOwnProperty("buttonId")) + if (!$util.isString(message.buttonId)) + return "buttonId: string expected"; + if (message.endpointDomain != null && message.hasOwnProperty("endpointDomain")) + if (!$util.isString(message.endpointDomain)) + return "endpointDomain: string expected"; + return null; + }; + + /** + * Creates a SalesforceLiveAgentConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} SalesforceLiveAgentConfig + */ + SalesforceLiveAgentConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig(); + if (object.organizationId != null) + message.organizationId = String(object.organizationId); + if (object.deploymentId != null) + message.deploymentId = String(object.deploymentId); + if (object.buttonId != null) + message.buttonId = String(object.buttonId); + if (object.endpointDomain != null) + message.endpointDomain = String(object.endpointDomain); + return message; + }; + + /** + * Creates a plain object from a SalesforceLiveAgentConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} message SalesforceLiveAgentConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SalesforceLiveAgentConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.organizationId = ""; + object.deploymentId = ""; + object.buttonId = ""; + object.endpointDomain = ""; + } + if (message.organizationId != null && message.hasOwnProperty("organizationId")) + object.organizationId = message.organizationId; + if (message.deploymentId != null && message.hasOwnProperty("deploymentId")) + object.deploymentId = message.deploymentId; + if (message.buttonId != null && message.hasOwnProperty("buttonId")) + object.buttonId = message.buttonId; + if (message.endpointDomain != null && message.hasOwnProperty("endpointDomain")) + object.endpointDomain = message.endpointDomain; + return object; + }; + + /** + * Converts this SalesforceLiveAgentConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + * @returns {Object.} JSON object + */ + SalesforceLiveAgentConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SalesforceLiveAgentConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SalesforceLiveAgentConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentHandoffConfig.SalesforceLiveAgentConfig"; + }; + + return SalesforceLiveAgentConfig; + })(); + + return HumanAgentHandoffConfig; + })(); + + v2.NotificationConfig = (function() { + + /** + * Properties of a NotificationConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface INotificationConfig + * @property {string|null} [topic] NotificationConfig topic + * @property {google.cloud.dialogflow.v2.NotificationConfig.MessageFormat|null} [messageFormat] NotificationConfig messageFormat + */ + + /** + * Constructs a new NotificationConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a NotificationConfig. + * @implements INotificationConfig + * @constructor + * @param {google.cloud.dialogflow.v2.INotificationConfig=} [properties] Properties to set + */ + function NotificationConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NotificationConfig topic. + * @member {string} topic + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @instance + */ + NotificationConfig.prototype.topic = ""; + + /** + * NotificationConfig messageFormat. + * @member {google.cloud.dialogflow.v2.NotificationConfig.MessageFormat} messageFormat + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @instance + */ + NotificationConfig.prototype.messageFormat = 0; + + /** + * Creates a new NotificationConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @static + * @param {google.cloud.dialogflow.v2.INotificationConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.NotificationConfig} NotificationConfig instance + */ + NotificationConfig.create = function create(properties) { + return new NotificationConfig(properties); + }; + + /** + * Encodes the specified NotificationConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.NotificationConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @static + * @param {google.cloud.dialogflow.v2.INotificationConfig} message NotificationConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.topic); + if (message.messageFormat != null && Object.hasOwnProperty.call(message, "messageFormat")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.messageFormat); + return writer; + }; + + /** + * Encodes the specified NotificationConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.NotificationConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @static + * @param {google.cloud.dialogflow.v2.INotificationConfig} message NotificationConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NotificationConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.NotificationConfig} NotificationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.NotificationConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.topic = reader.string(); + break; + } + case 2: { + message.messageFormat = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NotificationConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.NotificationConfig} NotificationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NotificationConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NotificationConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.topic != null && message.hasOwnProperty("topic")) + if (!$util.isString(message.topic)) + return "topic: string expected"; + if (message.messageFormat != null && message.hasOwnProperty("messageFormat")) + switch (message.messageFormat) { + default: + return "messageFormat: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a NotificationConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.NotificationConfig} NotificationConfig + */ + NotificationConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.NotificationConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.NotificationConfig(); + if (object.topic != null) + message.topic = String(object.topic); + switch (object.messageFormat) { + default: + if (typeof object.messageFormat === "number") { + message.messageFormat = object.messageFormat; + break; + } + break; + case "MESSAGE_FORMAT_UNSPECIFIED": + case 0: + message.messageFormat = 0; + break; + case "PROTO": + case 1: + message.messageFormat = 1; + break; + case "JSON": + case 2: + message.messageFormat = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a NotificationConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @static + * @param {google.cloud.dialogflow.v2.NotificationConfig} message NotificationConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NotificationConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.topic = ""; + object.messageFormat = options.enums === String ? "MESSAGE_FORMAT_UNSPECIFIED" : 0; + } + if (message.topic != null && message.hasOwnProperty("topic")) + object.topic = message.topic; + if (message.messageFormat != null && message.hasOwnProperty("messageFormat")) + object.messageFormat = options.enums === String ? $root.google.cloud.dialogflow.v2.NotificationConfig.MessageFormat[message.messageFormat] === undefined ? message.messageFormat : $root.google.cloud.dialogflow.v2.NotificationConfig.MessageFormat[message.messageFormat] : message.messageFormat; + return object; + }; + + /** + * Converts this NotificationConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @instance + * @returns {Object.} JSON object + */ + NotificationConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NotificationConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.NotificationConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NotificationConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.NotificationConfig"; + }; + + /** + * MessageFormat enum. + * @name google.cloud.dialogflow.v2.NotificationConfig.MessageFormat + * @enum {number} + * @property {number} MESSAGE_FORMAT_UNSPECIFIED=0 MESSAGE_FORMAT_UNSPECIFIED value + * @property {number} PROTO=1 PROTO value + * @property {number} JSON=2 JSON value + */ + NotificationConfig.MessageFormat = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_FORMAT_UNSPECIFIED"] = 0; + values[valuesById[1] = "PROTO"] = 1; + values[valuesById[2] = "JSON"] = 2; + return values; + })(); + + return NotificationConfig; + })(); + + v2.LoggingConfig = (function() { + + /** + * Properties of a LoggingConfig. + * @memberof google.cloud.dialogflow.v2 + * @interface ILoggingConfig + * @property {boolean|null} [enableStackdriverLogging] LoggingConfig enableStackdriverLogging + */ + + /** + * Constructs a new LoggingConfig. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a LoggingConfig. + * @implements ILoggingConfig + * @constructor + * @param {google.cloud.dialogflow.v2.ILoggingConfig=} [properties] Properties to set + */ + function LoggingConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LoggingConfig enableStackdriverLogging. + * @member {boolean} enableStackdriverLogging + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @instance + */ + LoggingConfig.prototype.enableStackdriverLogging = false; + + /** + * Creates a new LoggingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @static + * @param {google.cloud.dialogflow.v2.ILoggingConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.LoggingConfig} LoggingConfig instance + */ + LoggingConfig.create = function create(properties) { + return new LoggingConfig(properties); + }; + + /** + * Encodes the specified LoggingConfig message. Does not implicitly {@link google.cloud.dialogflow.v2.LoggingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @static + * @param {google.cloud.dialogflow.v2.ILoggingConfig} message LoggingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LoggingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableStackdriverLogging != null && Object.hasOwnProperty.call(message, "enableStackdriverLogging")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableStackdriverLogging); + return writer; + }; + + /** + * Encodes the specified LoggingConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.LoggingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @static + * @param {google.cloud.dialogflow.v2.ILoggingConfig} message LoggingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LoggingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LoggingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.LoggingConfig} LoggingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LoggingConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.LoggingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.enableStackdriverLogging = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LoggingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.LoggingConfig} LoggingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LoggingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LoggingConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LoggingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enableStackdriverLogging != null && message.hasOwnProperty("enableStackdriverLogging")) + if (typeof message.enableStackdriverLogging !== "boolean") + return "enableStackdriverLogging: boolean expected"; + return null; + }; + + /** + * Creates a LoggingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.LoggingConfig} LoggingConfig + */ + LoggingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.LoggingConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2.LoggingConfig(); + if (object.enableStackdriverLogging != null) + message.enableStackdriverLogging = Boolean(object.enableStackdriverLogging); + return message; + }; + + /** + * Creates a plain object from a LoggingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @static + * @param {google.cloud.dialogflow.v2.LoggingConfig} message LoggingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LoggingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.enableStackdriverLogging = false; + if (message.enableStackdriverLogging != null && message.hasOwnProperty("enableStackdriverLogging")) + object.enableStackdriverLogging = message.enableStackdriverLogging; + return object; + }; + + /** + * Converts this LoggingConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @instance + * @returns {Object.} JSON object + */ + LoggingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LoggingConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.LoggingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LoggingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.LoggingConfig"; + }; + + return LoggingConfig; + })(); + + v2.SuggestionFeature = (function() { + + /** + * Properties of a SuggestionFeature. + * @memberof google.cloud.dialogflow.v2 + * @interface ISuggestionFeature + * @property {google.cloud.dialogflow.v2.SuggestionFeature.Type|null} [type] SuggestionFeature type + */ + + /** + * Constructs a new SuggestionFeature. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SuggestionFeature. + * @implements ISuggestionFeature + * @constructor + * @param {google.cloud.dialogflow.v2.ISuggestionFeature=} [properties] Properties to set + */ + function SuggestionFeature(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionFeature type. + * @member {google.cloud.dialogflow.v2.SuggestionFeature.Type} type + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @instance + */ + SuggestionFeature.prototype.type = 0; + + /** + * Creates a new SuggestionFeature instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @static + * @param {google.cloud.dialogflow.v2.ISuggestionFeature=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SuggestionFeature} SuggestionFeature instance + */ + SuggestionFeature.create = function create(properties) { + return new SuggestionFeature(properties); + }; + + /** + * Encodes the specified SuggestionFeature message. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestionFeature.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @static + * @param {google.cloud.dialogflow.v2.ISuggestionFeature} message SuggestionFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionFeature.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); + return writer; + }; + + /** + * Encodes the specified SuggestionFeature message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SuggestionFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @static + * @param {google.cloud.dialogflow.v2.ISuggestionFeature} message SuggestionFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionFeature message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SuggestionFeature} SuggestionFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionFeature.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SuggestionFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SuggestionFeature} SuggestionFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionFeature message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionFeature.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: + break; + } + return null; + }; + + /** + * Creates a SuggestionFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SuggestionFeature} SuggestionFeature + */ + SuggestionFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SuggestionFeature) + return object; + var message = new $root.google.cloud.dialogflow.v2.SuggestionFeature(); + 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 "ARTICLE_SUGGESTION": + case 1: + message.type = 1; + break; + case "FAQ": + case 2: + message.type = 2; + break; + case "SMART_REPLY": + case 3: + message.type = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a SuggestionFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @static + * @param {google.cloud.dialogflow.v2.SuggestionFeature} message SuggestionFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionFeature.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.dialogflow.v2.SuggestionFeature.Type[message.type] === undefined ? message.type : $root.google.cloud.dialogflow.v2.SuggestionFeature.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this SuggestionFeature to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @instance + * @returns {Object.} JSON object + */ + SuggestionFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionFeature + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SuggestionFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SuggestionFeature"; + }; + + /** + * Type enum. + * @name google.cloud.dialogflow.v2.SuggestionFeature.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} ARTICLE_SUGGESTION=1 ARTICLE_SUGGESTION value + * @property {number} FAQ=2 FAQ value + * @property {number} SMART_REPLY=3 SMART_REPLY value + */ + SuggestionFeature.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ARTICLE_SUGGESTION"] = 1; + values[valuesById[2] = "FAQ"] = 2; + values[valuesById[3] = "SMART_REPLY"] = 3; + return values; + })(); + + return SuggestionFeature; + })(); + + v2.SetSuggestionFeatureConfigRequest = (function() { + + /** + * Properties of a SetSuggestionFeatureConfigRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ISetSuggestionFeatureConfigRequest + * @property {string|null} [conversationProfile] SetSuggestionFeatureConfigRequest conversationProfile + * @property {google.cloud.dialogflow.v2.Participant.Role|null} [participantRole] SetSuggestionFeatureConfigRequest participantRole + * @property {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig|null} [suggestionFeatureConfig] SetSuggestionFeatureConfigRequest suggestionFeatureConfig + */ + + /** + * Constructs a new SetSuggestionFeatureConfigRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SetSuggestionFeatureConfigRequest. + * @implements ISetSuggestionFeatureConfigRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest=} [properties] Properties to set + */ + function SetSuggestionFeatureConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetSuggestionFeatureConfigRequest conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @instance + */ + SetSuggestionFeatureConfigRequest.prototype.conversationProfile = ""; + + /** + * SetSuggestionFeatureConfigRequest participantRole. + * @member {google.cloud.dialogflow.v2.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @instance + */ + SetSuggestionFeatureConfigRequest.prototype.participantRole = 0; + + /** + * SetSuggestionFeatureConfigRequest suggestionFeatureConfig. + * @member {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.ISuggestionFeatureConfig|null|undefined} suggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @instance + */ + SetSuggestionFeatureConfigRequest.prototype.suggestionFeatureConfig = null; + + /** + * Creates a new SetSuggestionFeatureConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest} SetSuggestionFeatureConfigRequest instance + */ + SetSuggestionFeatureConfigRequest.create = function create(properties) { + return new SetSuggestionFeatureConfigRequest(properties); + }; + + /** + * Encodes the specified SetSuggestionFeatureConfigRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest} message SetSuggestionFeatureConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetSuggestionFeatureConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationProfile); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.participantRole); + if (message.suggestionFeatureConfig != null && Object.hasOwnProperty.call(message, "suggestionFeatureConfig")) + $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.encode(message.suggestionFeatureConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetSuggestionFeatureConfigRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest} message SetSuggestionFeatureConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetSuggestionFeatureConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetSuggestionFeatureConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest} SetSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetSuggestionFeatureConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = reader.string(); + break; + } + case 2: { + message.participantRole = reader.int32(); + break; + } + case 3: { + message.suggestionFeatureConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetSuggestionFeatureConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest} SetSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetSuggestionFeatureConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetSuggestionFeatureConfigRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetSuggestionFeatureConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.suggestionFeatureConfig != null && message.hasOwnProperty("suggestionFeatureConfig")) { + var error = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify(message.suggestionFeatureConfig); + if (error) + return "suggestionFeatureConfig." + error; + } + return null; + }; + + /** + * Creates a SetSuggestionFeatureConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest} SetSuggestionFeatureConfigRequest + */ + SetSuggestionFeatureConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest(); + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + if (object.suggestionFeatureConfig != null) { + if (typeof object.suggestionFeatureConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest.suggestionFeatureConfig: object expected"); + message.suggestionFeatureConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.fromObject(object.suggestionFeatureConfig); + } + return message; + }; + + /** + * Creates a plain object from a SetSuggestionFeatureConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest} message SetSuggestionFeatureConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetSuggestionFeatureConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.suggestionFeatureConfig = null; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] : message.participantRole; + if (message.suggestionFeatureConfig != null && message.hasOwnProperty("suggestionFeatureConfig")) + object.suggestionFeatureConfig = $root.google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig.toObject(message.suggestionFeatureConfig, options); + return object; + }; + + /** + * Converts this SetSuggestionFeatureConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @instance + * @returns {Object.} JSON object + */ + SetSuggestionFeatureConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SetSuggestionFeatureConfigRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetSuggestionFeatureConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest"; + }; + + return SetSuggestionFeatureConfigRequest; + })(); + + v2.ClearSuggestionFeatureConfigRequest = (function() { + + /** + * Properties of a ClearSuggestionFeatureConfigRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IClearSuggestionFeatureConfigRequest + * @property {string|null} [conversationProfile] ClearSuggestionFeatureConfigRequest conversationProfile + * @property {google.cloud.dialogflow.v2.Participant.Role|null} [participantRole] ClearSuggestionFeatureConfigRequest participantRole + * @property {google.cloud.dialogflow.v2.SuggestionFeature.Type|null} [suggestionFeatureType] ClearSuggestionFeatureConfigRequest suggestionFeatureType + */ + + /** + * Constructs a new ClearSuggestionFeatureConfigRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ClearSuggestionFeatureConfigRequest. + * @implements IClearSuggestionFeatureConfigRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest=} [properties] Properties to set + */ + function ClearSuggestionFeatureConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClearSuggestionFeatureConfigRequest conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @instance + */ + ClearSuggestionFeatureConfigRequest.prototype.conversationProfile = ""; + + /** + * ClearSuggestionFeatureConfigRequest participantRole. + * @member {google.cloud.dialogflow.v2.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @instance + */ + ClearSuggestionFeatureConfigRequest.prototype.participantRole = 0; + + /** + * ClearSuggestionFeatureConfigRequest suggestionFeatureType. + * @member {google.cloud.dialogflow.v2.SuggestionFeature.Type} suggestionFeatureType + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @instance + */ + ClearSuggestionFeatureConfigRequest.prototype.suggestionFeatureType = 0; + + /** + * Creates a new ClearSuggestionFeatureConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest} ClearSuggestionFeatureConfigRequest instance + */ + ClearSuggestionFeatureConfigRequest.create = function create(properties) { + return new ClearSuggestionFeatureConfigRequest(properties); + }; + + /** + * Encodes the specified ClearSuggestionFeatureConfigRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest} message ClearSuggestionFeatureConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearSuggestionFeatureConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationProfile); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.participantRole); + if (message.suggestionFeatureType != null && Object.hasOwnProperty.call(message, "suggestionFeatureType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.suggestionFeatureType); + return writer; + }; + + /** + * Encodes the specified ClearSuggestionFeatureConfigRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest} message ClearSuggestionFeatureConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearSuggestionFeatureConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClearSuggestionFeatureConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest} ClearSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearSuggestionFeatureConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = reader.string(); + break; + } + case 2: { + message.participantRole = reader.int32(); + break; + } + case 3: { + message.suggestionFeatureType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClearSuggestionFeatureConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest} ClearSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearSuggestionFeatureConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClearSuggestionFeatureConfigRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClearSuggestionFeatureConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + switch (message.suggestionFeatureType) { + default: + return "suggestionFeatureType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a ClearSuggestionFeatureConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest} ClearSuggestionFeatureConfigRequest + */ + ClearSuggestionFeatureConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest(); + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + switch (object.suggestionFeatureType) { + default: + if (typeof object.suggestionFeatureType === "number") { + message.suggestionFeatureType = object.suggestionFeatureType; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.suggestionFeatureType = 0; + break; + case "ARTICLE_SUGGESTION": + case 1: + message.suggestionFeatureType = 1; + break; + case "FAQ": + case 2: + message.suggestionFeatureType = 2; + break; + case "SMART_REPLY": + case 3: + message.suggestionFeatureType = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a ClearSuggestionFeatureConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest} message ClearSuggestionFeatureConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClearSuggestionFeatureConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.suggestionFeatureType = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] : message.participantRole; + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + object.suggestionFeatureType = options.enums === String ? $root.google.cloud.dialogflow.v2.SuggestionFeature.Type[message.suggestionFeatureType] === undefined ? message.suggestionFeatureType : $root.google.cloud.dialogflow.v2.SuggestionFeature.Type[message.suggestionFeatureType] : message.suggestionFeatureType; + return object; + }; + + /** + * Converts this ClearSuggestionFeatureConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @instance + * @returns {Object.} JSON object + */ + ClearSuggestionFeatureConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ClearSuggestionFeatureConfigRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClearSuggestionFeatureConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest"; + }; + + return ClearSuggestionFeatureConfigRequest; + })(); + + v2.SetSuggestionFeatureConfigOperationMetadata = (function() { + + /** + * Properties of a SetSuggestionFeatureConfigOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface ISetSuggestionFeatureConfigOperationMetadata + * @property {string|null} [conversationProfile] SetSuggestionFeatureConfigOperationMetadata conversationProfile + * @property {google.cloud.dialogflow.v2.Participant.Role|null} [participantRole] SetSuggestionFeatureConfigOperationMetadata participantRole + * @property {google.cloud.dialogflow.v2.SuggestionFeature.Type|null} [suggestionFeatureType] SetSuggestionFeatureConfigOperationMetadata suggestionFeatureType + * @property {google.protobuf.ITimestamp|null} [createTime] SetSuggestionFeatureConfigOperationMetadata createTime + */ + + /** + * Constructs a new SetSuggestionFeatureConfigOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a SetSuggestionFeatureConfigOperationMetadata. + * @implements ISetSuggestionFeatureConfigOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata=} [properties] Properties to set + */ + function SetSuggestionFeatureConfigOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetSuggestionFeatureConfigOperationMetadata conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @instance + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.conversationProfile = ""; + + /** + * SetSuggestionFeatureConfigOperationMetadata participantRole. + * @member {google.cloud.dialogflow.v2.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @instance + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.participantRole = 0; + + /** + * SetSuggestionFeatureConfigOperationMetadata suggestionFeatureType. + * @member {google.cloud.dialogflow.v2.SuggestionFeature.Type} suggestionFeatureType + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @instance + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.suggestionFeatureType = 0; + + /** + * SetSuggestionFeatureConfigOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @instance + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.createTime = null; + + /** + * Creates a new SetSuggestionFeatureConfigOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata} SetSuggestionFeatureConfigOperationMetadata instance + */ + SetSuggestionFeatureConfigOperationMetadata.create = function create(properties) { + return new SetSuggestionFeatureConfigOperationMetadata(properties); + }; + + /** + * Encodes the specified SetSuggestionFeatureConfigOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata} message SetSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetSuggestionFeatureConfigOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationProfile); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.participantRole); + if (message.suggestionFeatureType != null && Object.hasOwnProperty.call(message, "suggestionFeatureType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.suggestionFeatureType); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetSuggestionFeatureConfigOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata} message SetSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetSuggestionFeatureConfigOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata} SetSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetSuggestionFeatureConfigOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = reader.string(); + break; + } + case 2: { + message.participantRole = reader.int32(); + break; + } + case 3: { + message.suggestionFeatureType = reader.int32(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata} SetSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetSuggestionFeatureConfigOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetSuggestionFeatureConfigOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetSuggestionFeatureConfigOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + switch (message.suggestionFeatureType) { + default: + return "suggestionFeatureType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a SetSuggestionFeatureConfigOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata} SetSuggestionFeatureConfigOperationMetadata + */ + SetSuggestionFeatureConfigOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata(); + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + switch (object.suggestionFeatureType) { + default: + if (typeof object.suggestionFeatureType === "number") { + message.suggestionFeatureType = object.suggestionFeatureType; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.suggestionFeatureType = 0; + break; + case "ARTICLE_SUGGESTION": + case 1: + message.suggestionFeatureType = 1; + break; + case "FAQ": + case 2: + message.suggestionFeatureType = 2; + break; + case "SMART_REPLY": + case 3: + message.suggestionFeatureType = 3; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a SetSuggestionFeatureConfigOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata} message SetSuggestionFeatureConfigOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetSuggestionFeatureConfigOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.suggestionFeatureType = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.createTime = null; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] : message.participantRole; + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + object.suggestionFeatureType = options.enums === String ? $root.google.cloud.dialogflow.v2.SuggestionFeature.Type[message.suggestionFeatureType] === undefined ? message.suggestionFeatureType : $root.google.cloud.dialogflow.v2.SuggestionFeature.Type[message.suggestionFeatureType] : message.suggestionFeatureType; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this SetSuggestionFeatureConfigOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SetSuggestionFeatureConfigOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetSuggestionFeatureConfigOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata"; + }; + + return SetSuggestionFeatureConfigOperationMetadata; + })(); + + v2.ClearSuggestionFeatureConfigOperationMetadata = (function() { + + /** + * Properties of a ClearSuggestionFeatureConfigOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface IClearSuggestionFeatureConfigOperationMetadata + * @property {string|null} [conversationProfile] ClearSuggestionFeatureConfigOperationMetadata conversationProfile + * @property {google.cloud.dialogflow.v2.Participant.Role|null} [participantRole] ClearSuggestionFeatureConfigOperationMetadata participantRole + * @property {google.cloud.dialogflow.v2.SuggestionFeature.Type|null} [suggestionFeatureType] ClearSuggestionFeatureConfigOperationMetadata suggestionFeatureType + * @property {google.protobuf.ITimestamp|null} [createTime] ClearSuggestionFeatureConfigOperationMetadata createTime + */ + + /** + * Constructs a new ClearSuggestionFeatureConfigOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ClearSuggestionFeatureConfigOperationMetadata. + * @implements IClearSuggestionFeatureConfigOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata=} [properties] Properties to set + */ + function ClearSuggestionFeatureConfigOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClearSuggestionFeatureConfigOperationMetadata conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @instance + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.conversationProfile = ""; + + /** + * ClearSuggestionFeatureConfigOperationMetadata participantRole. + * @member {google.cloud.dialogflow.v2.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @instance + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.participantRole = 0; + + /** + * ClearSuggestionFeatureConfigOperationMetadata suggestionFeatureType. + * @member {google.cloud.dialogflow.v2.SuggestionFeature.Type} suggestionFeatureType + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @instance + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.suggestionFeatureType = 0; + + /** + * ClearSuggestionFeatureConfigOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @instance + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.createTime = null; + + /** + * Creates a new ClearSuggestionFeatureConfigOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata} ClearSuggestionFeatureConfigOperationMetadata instance + */ + ClearSuggestionFeatureConfigOperationMetadata.create = function create(properties) { + return new ClearSuggestionFeatureConfigOperationMetadata(properties); + }; + + /** + * Encodes the specified ClearSuggestionFeatureConfigOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata} message ClearSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearSuggestionFeatureConfigOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationProfile); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.participantRole); + if (message.suggestionFeatureType != null && Object.hasOwnProperty.call(message, "suggestionFeatureType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.suggestionFeatureType); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClearSuggestionFeatureConfigOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata} message ClearSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearSuggestionFeatureConfigOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClearSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata} ClearSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearSuggestionFeatureConfigOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = reader.string(); + break; + } + case 2: { + message.participantRole = reader.int32(); + break; + } + case 3: { + message.suggestionFeatureType = reader.int32(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClearSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata} ClearSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearSuggestionFeatureConfigOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClearSuggestionFeatureConfigOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClearSuggestionFeatureConfigOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + switch (message.suggestionFeatureType) { + default: + return "suggestionFeatureType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a ClearSuggestionFeatureConfigOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata} ClearSuggestionFeatureConfigOperationMetadata + */ + ClearSuggestionFeatureConfigOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata(); + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + switch (object.suggestionFeatureType) { + default: + if (typeof object.suggestionFeatureType === "number") { + message.suggestionFeatureType = object.suggestionFeatureType; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.suggestionFeatureType = 0; + break; + case "ARTICLE_SUGGESTION": + case 1: + message.suggestionFeatureType = 1; + break; + case "FAQ": + case 2: + message.suggestionFeatureType = 2; + break; + case "SMART_REPLY": + case 3: + message.suggestionFeatureType = 3; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a ClearSuggestionFeatureConfigOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata} message ClearSuggestionFeatureConfigOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClearSuggestionFeatureConfigOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.suggestionFeatureType = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.createTime = null; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2.Participant.Role[message.participantRole] : message.participantRole; + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + object.suggestionFeatureType = options.enums === String ? $root.google.cloud.dialogflow.v2.SuggestionFeature.Type[message.suggestionFeatureType] === undefined ? message.suggestionFeatureType : $root.google.cloud.dialogflow.v2.SuggestionFeature.Type[message.suggestionFeatureType] : message.suggestionFeatureType; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this ClearSuggestionFeatureConfigOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ClearSuggestionFeatureConfigOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClearSuggestionFeatureConfigOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata"; + }; + + return ClearSuggestionFeatureConfigOperationMetadata; + })(); + + v2.Documents = (function() { + + /** + * Constructs a new Documents service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Documents + * @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 Documents(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Documents.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Documents; + + /** + * Creates new Documents service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Documents + * @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 {Documents} RPC service. Useful where requests and/or responses are streamed. + */ + Documents.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|listDocuments}. + * @memberof google.cloud.dialogflow.v2.Documents + * @typedef ListDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListDocumentsResponse} [response] ListDocumentsResponse + */ + + /** + * Calls ListDocuments. + * @function listDocuments + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IListDocumentsRequest} request ListDocumentsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Documents.ListDocumentsCallback} callback Node-style callback called with the error, if any, and ListDocumentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.listDocuments = function listDocuments(request, callback) { + return this.rpcCall(listDocuments, $root.google.cloud.dialogflow.v2.ListDocumentsRequest, $root.google.cloud.dialogflow.v2.ListDocumentsResponse, request, callback); + }, "name", { value: "ListDocuments" }); + + /** + * Calls ListDocuments. + * @function listDocuments + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IListDocumentsRequest} request ListDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|getDocument}. + * @memberof google.cloud.dialogflow.v2.Documents + * @typedef GetDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Document} [response] Document + */ + + /** + * Calls GetDocument. + * @function getDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IGetDocumentRequest} request GetDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Documents.GetDocumentCallback} callback Node-style callback called with the error, if any, and Document + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.getDocument = function getDocument(request, callback) { + return this.rpcCall(getDocument, $root.google.cloud.dialogflow.v2.GetDocumentRequest, $root.google.cloud.dialogflow.v2.Document, request, callback); + }, "name", { value: "GetDocument" }); + + /** + * Calls GetDocument. + * @function getDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IGetDocumentRequest} request GetDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|createDocument}. + * @memberof google.cloud.dialogflow.v2.Documents + * @typedef CreateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateDocument. + * @function createDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.ICreateDocumentRequest} request CreateDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Documents.CreateDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.createDocument = function createDocument(request, callback) { + return this.rpcCall(createDocument, $root.google.cloud.dialogflow.v2.CreateDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateDocument" }); + + /** + * Calls CreateDocument. + * @function createDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.ICreateDocumentRequest} request CreateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|importDocuments}. + * @memberof google.cloud.dialogflow.v2.Documents + * @typedef ImportDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportDocuments. + * @function importDocuments + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IImportDocumentsRequest} request ImportDocumentsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Documents.ImportDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.importDocuments = function importDocuments(request, callback) { + return this.rpcCall(importDocuments, $root.google.cloud.dialogflow.v2.ImportDocumentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportDocuments" }); + + /** + * Calls ImportDocuments. + * @function importDocuments + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IImportDocumentsRequest} request ImportDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|deleteDocument}. + * @memberof google.cloud.dialogflow.v2.Documents + * @typedef DeleteDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteDocument. + * @function deleteDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteDocumentRequest} request DeleteDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Documents.DeleteDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.deleteDocument = function deleteDocument(request, callback) { + return this.rpcCall(deleteDocument, $root.google.cloud.dialogflow.v2.DeleteDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteDocument" }); + + /** + * Calls DeleteDocument. + * @function deleteDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteDocumentRequest} request DeleteDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|updateDocument}. + * @memberof google.cloud.dialogflow.v2.Documents + * @typedef UpdateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateDocument. + * @function updateDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateDocumentRequest} request UpdateDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Documents.UpdateDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.updateDocument = function updateDocument(request, callback) { + return this.rpcCall(updateDocument, $root.google.cloud.dialogflow.v2.UpdateDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateDocument" }); + + /** + * Calls UpdateDocument. + * @function updateDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateDocumentRequest} request UpdateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|reloadDocument}. + * @memberof google.cloud.dialogflow.v2.Documents + * @typedef ReloadDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ReloadDocument. + * @function reloadDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IReloadDocumentRequest} request ReloadDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Documents.ReloadDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.reloadDocument = function reloadDocument(request, callback) { + return this.rpcCall(reloadDocument, $root.google.cloud.dialogflow.v2.ReloadDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ReloadDocument" }); + + /** + * Calls ReloadDocument. + * @function reloadDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IReloadDocumentRequest} request ReloadDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Documents|exportDocument}. + * @memberof google.cloud.dialogflow.v2.Documents + * @typedef ExportDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ExportDocument. + * @function exportDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest} request ExportDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Documents.ExportDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.exportDocument = function exportDocument(request, callback) { + return this.rpcCall(exportDocument, $root.google.cloud.dialogflow.v2.ExportDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ExportDocument" }); + + /** + * Calls ExportDocument. + * @function exportDocument + * @memberof google.cloud.dialogflow.v2.Documents + * @instance + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest} request ExportDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Documents; + })(); + + v2.Document = (function() { + + /** + * Properties of a Document. + * @memberof google.cloud.dialogflow.v2 + * @interface IDocument + * @property {string|null} [name] Document name + * @property {string|null} [displayName] Document displayName + * @property {string|null} [mimeType] Document mimeType + * @property {Array.|null} [knowledgeTypes] Document knowledgeTypes + * @property {string|null} [contentUri] Document contentUri + * @property {Uint8Array|null} [rawContent] Document rawContent + * @property {boolean|null} [enableAutoReload] Document enableAutoReload + * @property {google.cloud.dialogflow.v2.Document.IReloadStatus|null} [latestReloadStatus] Document latestReloadStatus + * @property {Object.|null} [metadata] Document metadata + * @property {google.cloud.dialogflow.v2.Document.State|null} [state] Document state + */ + + /** + * Constructs a new Document. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Document. + * @implements IDocument + * @constructor + * @param {google.cloud.dialogflow.v2.IDocument=} [properties] Properties to set + */ + function Document(properties) { + this.knowledgeTypes = []; + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Document name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.name = ""; + + /** + * Document displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.displayName = ""; + + /** + * Document mimeType. + * @member {string} mimeType + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.mimeType = ""; + + /** + * Document knowledgeTypes. + * @member {Array.} knowledgeTypes + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.knowledgeTypes = $util.emptyArray; + + /** + * Document contentUri. + * @member {string|null|undefined} contentUri + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.contentUri = null; + + /** + * Document rawContent. + * @member {Uint8Array|null|undefined} rawContent + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.rawContent = null; + + /** + * Document enableAutoReload. + * @member {boolean} enableAutoReload + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.enableAutoReload = false; + + /** + * Document latestReloadStatus. + * @member {google.cloud.dialogflow.v2.Document.IReloadStatus|null|undefined} latestReloadStatus + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.latestReloadStatus = null; + + /** + * Document metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.metadata = $util.emptyObject; + + /** + * Document state. + * @member {google.cloud.dialogflow.v2.Document.State} state + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Document.prototype.state = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Document source. + * @member {"contentUri"|"rawContent"|undefined} source + * @memberof google.cloud.dialogflow.v2.Document + * @instance + */ + Object.defineProperty(Document.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["contentUri", "rawContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Document instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Document + * @static + * @param {google.cloud.dialogflow.v2.IDocument=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Document} Document instance + */ + Document.create = function create(properties) { + return new Document(properties); + }; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.dialogflow.v2.Document.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Document + * @static + * @param {google.cloud.dialogflow.v2.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.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.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.knowledgeTypes != null && message.knowledgeTypes.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (var i = 0; i < message.knowledgeTypes.length; ++i) + writer.int32(message.knowledgeTypes[i]); + writer.ldelim(); + } + if (message.contentUri != null && Object.hasOwnProperty.call(message, "contentUri")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.contentUri); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.rawContent != null && Object.hasOwnProperty.call(message, "rawContent")) + writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.rawContent); + if (message.enableAutoReload != null && Object.hasOwnProperty.call(message, "enableAutoReload")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.enableAutoReload); + if (message.latestReloadStatus != null && Object.hasOwnProperty.call(message, "latestReloadStatus")) + $root.google.cloud.dialogflow.v2.Document.ReloadStatus.encode(message.latestReloadStatus, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.state); + return writer; + }; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Document.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Document + * @static + * @param {google.cloud.dialogflow.v2.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Document message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Document(), key, value; + 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.mimeType = reader.string(); + break; + } + case 4: { + if (!(message.knowledgeTypes && message.knowledgeTypes.length)) + message.knowledgeTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.knowledgeTypes.push(reader.int32()); + } else + message.knowledgeTypes.push(reader.int32()); + break; + } + case 5: { + message.contentUri = reader.string(); + break; + } + case 9: { + message.rawContent = reader.bytes(); + break; + } + case 11: { + message.enableAutoReload = reader.bool(); + break; + } + case 12: { + message.latestReloadStatus = $root.google.cloud.dialogflow.v2.Document.ReloadStatus.decode(reader, reader.uint32()); + break; + } + case 7: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 13: { + message.state = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Document message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Document + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Document.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.knowledgeTypes != null && message.hasOwnProperty("knowledgeTypes")) { + if (!Array.isArray(message.knowledgeTypes)) + return "knowledgeTypes: array expected"; + for (var i = 0; i < message.knowledgeTypes.length; ++i) + switch (message.knowledgeTypes[i]) { + default: + return "knowledgeTypes: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + } + if (message.contentUri != null && message.hasOwnProperty("contentUri")) { + properties.source = 1; + if (!$util.isString(message.contentUri)) + return "contentUri: string expected"; + } + if (message.rawContent != null && message.hasOwnProperty("rawContent")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!(message.rawContent && typeof message.rawContent.length === "number" || $util.isString(message.rawContent))) + return "rawContent: buffer expected"; + } + if (message.enableAutoReload != null && message.hasOwnProperty("enableAutoReload")) + if (typeof message.enableAutoReload !== "boolean") + return "enableAutoReload: boolean expected"; + if (message.latestReloadStatus != null && message.hasOwnProperty("latestReloadStatus")) { + var error = $root.google.cloud.dialogflow.v2.Document.ReloadStatus.verify(message.latestReloadStatus); + if (error) + return "latestReloadStatus." + error; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} 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: + case 5: + break; + } + return null; + }; + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Document + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Document} Document + */ + Document.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Document) + return object; + var message = new $root.google.cloud.dialogflow.v2.Document(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.knowledgeTypes) { + if (!Array.isArray(object.knowledgeTypes)) + throw TypeError(".google.cloud.dialogflow.v2.Document.knowledgeTypes: array expected"); + message.knowledgeTypes = []; + for (var i = 0; i < object.knowledgeTypes.length; ++i) + switch (object.knowledgeTypes[i]) { + default: + if (typeof object.knowledgeTypes[i] === "number") { + message.knowledgeTypes[i] = object.knowledgeTypes[i]; + break; + } + case "KNOWLEDGE_TYPE_UNSPECIFIED": + case 0: + message.knowledgeTypes[i] = 0; + break; + case "FAQ": + case 1: + message.knowledgeTypes[i] = 1; + break; + case "EXTRACTIVE_QA": + case 2: + message.knowledgeTypes[i] = 2; + break; + case "ARTICLE_SUGGESTION": + case 3: + message.knowledgeTypes[i] = 3; + break; + case "AGENT_FACING_SMART_REPLY": + case 4: + message.knowledgeTypes[i] = 4; + break; + } + } + if (object.contentUri != null) + message.contentUri = String(object.contentUri); + if (object.rawContent != null) + if (typeof object.rawContent === "string") + $util.base64.decode(object.rawContent, message.rawContent = $util.newBuffer($util.base64.length(object.rawContent)), 0); + else if (object.rawContent.length >= 0) + message.rawContent = object.rawContent; + if (object.enableAutoReload != null) + message.enableAutoReload = Boolean(object.enableAutoReload); + if (object.latestReloadStatus != null) { + if (typeof object.latestReloadStatus !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Document.latestReloadStatus: object expected"); + message.latestReloadStatus = $root.google.cloud.dialogflow.v2.Document.ReloadStatus.fromObject(object.latestReloadStatus); + } + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Document.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + 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 "CREATING": + case 1: + message.state = 1; + break; + case "ACTIVE": + case 2: + message.state = 2; + break; + case "UPDATING": + case 3: + message.state = 3; + break; + case "RELOADING": + case 4: + message.state = 4; + break; + case "DELETING": + case 5: + message.state = 5; + break; + } + return message; + }; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Document + * @static + * @param {google.cloud.dialogflow.v2.Document} message Document + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Document.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.knowledgeTypes = []; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.mimeType = ""; + object.enableAutoReload = false; + object.latestReloadStatus = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.knowledgeTypes && message.knowledgeTypes.length) { + object.knowledgeTypes = []; + for (var j = 0; j < message.knowledgeTypes.length; ++j) + object.knowledgeTypes[j] = options.enums === String ? $root.google.cloud.dialogflow.v2.Document.KnowledgeType[message.knowledgeTypes[j]] === undefined ? message.knowledgeTypes[j] : $root.google.cloud.dialogflow.v2.Document.KnowledgeType[message.knowledgeTypes[j]] : message.knowledgeTypes[j]; + } + if (message.contentUri != null && message.hasOwnProperty("contentUri")) { + object.contentUri = message.contentUri; + if (options.oneofs) + object.source = "contentUri"; + } + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.rawContent != null && message.hasOwnProperty("rawContent")) { + object.rawContent = options.bytes === String ? $util.base64.encode(message.rawContent, 0, message.rawContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.rawContent) : message.rawContent; + if (options.oneofs) + object.source = "rawContent"; + } + if (message.enableAutoReload != null && message.hasOwnProperty("enableAutoReload")) + object.enableAutoReload = message.enableAutoReload; + if (message.latestReloadStatus != null && message.hasOwnProperty("latestReloadStatus")) + object.latestReloadStatus = $root.google.cloud.dialogflow.v2.Document.ReloadStatus.toObject(message.latestReloadStatus, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.v2.Document.State[message.state] === undefined ? message.state : $root.google.cloud.dialogflow.v2.Document.State[message.state] : message.state; + return object; + }; + + /** + * Converts this Document to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Document + * @instance + * @returns {Object.} JSON object + */ + Document.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Document + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Document + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Document"; + }; + + /** + * KnowledgeType enum. + * @name google.cloud.dialogflow.v2.Document.KnowledgeType + * @enum {number} + * @property {number} KNOWLEDGE_TYPE_UNSPECIFIED=0 KNOWLEDGE_TYPE_UNSPECIFIED value + * @property {number} FAQ=1 FAQ value + * @property {number} EXTRACTIVE_QA=2 EXTRACTIVE_QA value + * @property {number} ARTICLE_SUGGESTION=3 ARTICLE_SUGGESTION value + * @property {number} AGENT_FACING_SMART_REPLY=4 AGENT_FACING_SMART_REPLY value + */ + Document.KnowledgeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "KNOWLEDGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FAQ"] = 1; + values[valuesById[2] = "EXTRACTIVE_QA"] = 2; + values[valuesById[3] = "ARTICLE_SUGGESTION"] = 3; + values[valuesById[4] = "AGENT_FACING_SMART_REPLY"] = 4; + return values; + })(); + + Document.ReloadStatus = (function() { + + /** + * Properties of a ReloadStatus. + * @memberof google.cloud.dialogflow.v2.Document + * @interface IReloadStatus + * @property {google.protobuf.ITimestamp|null} [time] ReloadStatus time + * @property {google.rpc.IStatus|null} [status] ReloadStatus status + */ + + /** + * Constructs a new ReloadStatus. + * @memberof google.cloud.dialogflow.v2.Document + * @classdesc Represents a ReloadStatus. + * @implements IReloadStatus + * @constructor + * @param {google.cloud.dialogflow.v2.Document.IReloadStatus=} [properties] Properties to set + */ + function ReloadStatus(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReloadStatus time. + * @member {google.protobuf.ITimestamp|null|undefined} time + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @instance + */ + ReloadStatus.prototype.time = null; + + /** + * ReloadStatus status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @instance + */ + ReloadStatus.prototype.status = null; + + /** + * Creates a new ReloadStatus instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @static + * @param {google.cloud.dialogflow.v2.Document.IReloadStatus=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Document.ReloadStatus} ReloadStatus instance + */ + ReloadStatus.create = function create(properties) { + return new ReloadStatus(properties); + }; + + /** + * Encodes the specified ReloadStatus message. Does not implicitly {@link google.cloud.dialogflow.v2.Document.ReloadStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @static + * @param {google.cloud.dialogflow.v2.Document.IReloadStatus} message ReloadStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReloadStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReloadStatus message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Document.ReloadStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @static + * @param {google.cloud.dialogflow.v2.Document.IReloadStatus} message ReloadStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReloadStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReloadStatus message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Document.ReloadStatus} ReloadStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReloadStatus.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Document.ReloadStatus(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReloadStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Document.ReloadStatus} ReloadStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReloadStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReloadStatus message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReloadStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.time != null && message.hasOwnProperty("time")) { + var error = $root.google.protobuf.Timestamp.verify(message.time); + if (error) + return "time." + error; + } + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + return null; + }; + + /** + * Creates a ReloadStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Document.ReloadStatus} ReloadStatus + */ + ReloadStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Document.ReloadStatus) + return object; + var message = new $root.google.cloud.dialogflow.v2.Document.ReloadStatus(); + if (object.time != null) { + if (typeof object.time !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Document.ReloadStatus.time: object expected"); + message.time = $root.google.protobuf.Timestamp.fromObject(object.time); + } + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Document.ReloadStatus.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + return message; + }; + + /** + * Creates a plain object from a ReloadStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @static + * @param {google.cloud.dialogflow.v2.Document.ReloadStatus} message ReloadStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReloadStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.time = null; + object.status = null; + } + if (message.time != null && message.hasOwnProperty("time")) + object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + return object; + }; + + /** + * Converts this ReloadStatus to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @instance + * @returns {Object.} JSON object + */ + ReloadStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReloadStatus + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Document.ReloadStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReloadStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Document.ReloadStatus"; + }; + + return ReloadStatus; + })(); + + /** + * State enum. + * @name google.cloud.dialogflow.v2.Document.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} ACTIVE=2 ACTIVE value + * @property {number} UPDATING=3 UPDATING value + * @property {number} RELOADING=4 RELOADING value + * @property {number} DELETING=5 DELETING value + */ + Document.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + values[valuesById[3] = "UPDATING"] = 3; + values[valuesById[4] = "RELOADING"] = 4; + values[valuesById[5] = "DELETING"] = 5; + return values; + })(); + + return Document; + })(); + + v2.GetDocumentRequest = (function() { + + /** + * Properties of a GetDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetDocumentRequest + * @property {string|null} [name] GetDocumentRequest name + */ + + /** + * Constructs a new GetDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetDocumentRequest. + * @implements IGetDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetDocumentRequest=} [properties] Properties to set + */ + function GetDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDocumentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.name = ""; + + /** + * Creates a new GetDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetDocumentRequest} GetDocumentRequest instance + */ + GetDocumentRequest.create = function create(properties) { + return new GetDocumentRequest(properties); + }; + + /** + * Encodes the specified GetDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetDocumentRequest} message GetDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentRequest.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 GetDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetDocumentRequest} message GetDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetDocumentRequest} GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetDocumentRequest(); + 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 GetDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetDocumentRequest} GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDocumentRequest.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 GetDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetDocumentRequest} GetDocumentRequest + */ + GetDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.GetDocumentRequest} message GetDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDocumentRequest.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 GetDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + GetDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetDocumentRequest"; + }; + + return GetDocumentRequest; + })(); + + v2.ListDocumentsRequest = (function() { + + /** + * Properties of a ListDocumentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListDocumentsRequest + * @property {string|null} [parent] ListDocumentsRequest parent + * @property {number|null} [pageSize] ListDocumentsRequest pageSize + * @property {string|null} [pageToken] ListDocumentsRequest pageToken + * @property {string|null} [filter] ListDocumentsRequest filter + */ + + /** + * Constructs a new ListDocumentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListDocumentsRequest. + * @implements IListDocumentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListDocumentsRequest=} [properties] Properties to set + */ + function ListDocumentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDocumentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.parent = ""; + + /** + * ListDocumentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.pageSize = 0; + + /** + * ListDocumentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.pageToken = ""; + + /** + * ListDocumentsRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.filter = ""; + + /** + * Creates a new ListDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListDocumentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListDocumentsRequest} ListDocumentsRequest instance + */ + ListDocumentsRequest.create = function create(properties) { + return new ListDocumentsRequest(properties); + }; + + /** + * Encodes the specified ListDocumentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListDocumentsRequest} message ListDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsRequest.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); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListDocumentsRequest} message ListDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListDocumentsRequest} ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListDocumentsRequest(); + 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; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListDocumentsRequest} ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDocumentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDocumentsRequest.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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListDocumentsRequest} ListDocumentsRequest + */ + ListDocumentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListDocumentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListDocumentsRequest(); + 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); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListDocumentsRequest} message ListDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDocumentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + 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; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListDocumentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDocumentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListDocumentsRequest"; + }; + + return ListDocumentsRequest; + })(); + + v2.ListDocumentsResponse = (function() { + + /** + * Properties of a ListDocumentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListDocumentsResponse + * @property {Array.|null} [documents] ListDocumentsResponse documents + * @property {string|null} [nextPageToken] ListDocumentsResponse nextPageToken + */ + + /** + * Constructs a new ListDocumentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListDocumentsResponse. + * @implements IListDocumentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListDocumentsResponse=} [properties] Properties to set + */ + function ListDocumentsResponse(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDocumentsResponse documents. + * @member {Array.} documents + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @instance + */ + ListDocumentsResponse.prototype.documents = $util.emptyArray; + + /** + * ListDocumentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @instance + */ + ListDocumentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListDocumentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListDocumentsResponse} ListDocumentsResponse instance + */ + ListDocumentsResponse.create = function create(properties) { + return new ListDocumentsResponse(properties); + }; + + /** + * Encodes the specified ListDocumentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListDocumentsResponse} message ListDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + $root.google.cloud.dialogflow.v2.Document.encode(message.documents[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 ListDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListDocumentsResponse} message ListDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListDocumentsResponse} ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push($root.google.cloud.dialogflow.v2.Document.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListDocumentsResponse} ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDocumentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDocumentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documents != null && message.hasOwnProperty("documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Document.verify(message.documents[i]); + if (error) + return "documents." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListDocumentsResponse} ListDocumentsResponse + */ + ListDocumentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListDocumentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListDocumentsResponse(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.cloud.dialogflow.v2.ListDocumentsResponse.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) { + if (typeof object.documents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListDocumentsResponse.documents: object expected"); + message.documents[i] = $root.google.cloud.dialogflow.v2.Document.fromObject(object.documents[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListDocumentsResponse} message ListDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDocumentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = $root.google.cloud.dialogflow.v2.Document.toObject(message.documents[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListDocumentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDocumentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListDocumentsResponse"; + }; + + return ListDocumentsResponse; + })(); + + v2.CreateDocumentRequest = (function() { + + /** + * Properties of a CreateDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateDocumentRequest + * @property {string|null} [parent] CreateDocumentRequest parent + * @property {google.cloud.dialogflow.v2.IDocument|null} [document] CreateDocumentRequest document + */ + + /** + * Constructs a new CreateDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateDocumentRequest. + * @implements ICreateDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateDocumentRequest=} [properties] Properties to set + */ + function CreateDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateDocumentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.parent = ""; + + /** + * CreateDocumentRequest document. + * @member {google.cloud.dialogflow.v2.IDocument|null|undefined} document + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.document = null; + + /** + * Creates a new CreateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateDocumentRequest} CreateDocumentRequest instance + */ + CreateDocumentRequest.create = function create(properties) { + return new CreateDocumentRequest(properties); + }; + + /** + * Encodes the specified CreateDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateDocumentRequest} message CreateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDocumentRequest.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.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.dialogflow.v2.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateDocumentRequest} message CreateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateDocumentRequest} CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.document = $root.google.cloud.dialogflow.v2.Document.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateDocumentRequest} CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateDocumentRequest.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.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.dialogflow.v2.Document.verify(message.document); + if (error) + return "document." + error; + } + return null; + }; + + /** + * Creates a CreateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateDocumentRequest} CreateDocumentRequest + */ + CreateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateDocumentRequest.document: object expected"); + message.document = $root.google.cloud.dialogflow.v2.Document.fromObject(object.document); + } + return message; + }; + + /** + * Creates a plain object from a CreateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateDocumentRequest} message CreateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.document = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.dialogflow.v2.Document.toObject(message.document, options); + return object; + }; + + /** + * Converts this CreateDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateDocumentRequest"; + }; + + return CreateDocumentRequest; + })(); + + v2.ImportDocumentsRequest = (function() { + + /** + * Properties of an ImportDocumentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IImportDocumentsRequest + * @property {string|null} [parent] ImportDocumentsRequest parent + * @property {google.cloud.dialogflow.v2.IGcsSources|null} [gcsSource] ImportDocumentsRequest gcsSource + * @property {google.cloud.dialogflow.v2.IImportDocumentTemplate|null} [documentTemplate] ImportDocumentsRequest documentTemplate + * @property {boolean|null} [importGcsCustomMetadata] ImportDocumentsRequest importGcsCustomMetadata + */ + + /** + * Constructs a new ImportDocumentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ImportDocumentsRequest. + * @implements IImportDocumentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IImportDocumentsRequest=} [properties] Properties to set + */ + function ImportDocumentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportDocumentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.parent = ""; + + /** + * ImportDocumentsRequest gcsSource. + * @member {google.cloud.dialogflow.v2.IGcsSources|null|undefined} gcsSource + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.gcsSource = null; + + /** + * ImportDocumentsRequest documentTemplate. + * @member {google.cloud.dialogflow.v2.IImportDocumentTemplate|null|undefined} documentTemplate + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.documentTemplate = null; + + /** + * ImportDocumentsRequest importGcsCustomMetadata. + * @member {boolean} importGcsCustomMetadata + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.importGcsCustomMetadata = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportDocumentsRequest source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @instance + */ + Object.defineProperty(ImportDocumentsRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IImportDocumentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ImportDocumentsRequest} ImportDocumentsRequest instance + */ + ImportDocumentsRequest.create = function create(properties) { + return new ImportDocumentsRequest(properties); + }; + + /** + * Encodes the specified ImportDocumentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IImportDocumentsRequest} message ImportDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsRequest.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.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.dialogflow.v2.GcsSources.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.documentTemplate != null && Object.hasOwnProperty.call(message, "documentTemplate")) + $root.google.cloud.dialogflow.v2.ImportDocumentTemplate.encode(message.documentTemplate, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.importGcsCustomMetadata != null && Object.hasOwnProperty.call(message, "importGcsCustomMetadata")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.importGcsCustomMetadata); + return writer; + }; + + /** + * Encodes the specified ImportDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IImportDocumentsRequest} message ImportDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ImportDocumentsRequest} ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ImportDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.dialogflow.v2.GcsSources.decode(reader, reader.uint32()); + break; + } + case 3: { + message.documentTemplate = $root.google.cloud.dialogflow.v2.ImportDocumentTemplate.decode(reader, reader.uint32()); + break; + } + case 4: { + message.importGcsCustomMetadata = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ImportDocumentsRequest} ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportDocumentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportDocumentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.dialogflow.v2.GcsSources.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.documentTemplate != null && message.hasOwnProperty("documentTemplate")) { + var error = $root.google.cloud.dialogflow.v2.ImportDocumentTemplate.verify(message.documentTemplate); + if (error) + return "documentTemplate." + error; + } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + if (typeof message.importGcsCustomMetadata !== "boolean") + return "importGcsCustomMetadata: boolean expected"; + return null; + }; + + /** + * Creates an ImportDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ImportDocumentsRequest} ImportDocumentsRequest + */ + ImportDocumentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ImportDocumentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ImportDocumentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ImportDocumentsRequest.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.dialogflow.v2.GcsSources.fromObject(object.gcsSource); + } + if (object.documentTemplate != null) { + if (typeof object.documentTemplate !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ImportDocumentsRequest.documentTemplate: object expected"); + message.documentTemplate = $root.google.cloud.dialogflow.v2.ImportDocumentTemplate.fromObject(object.documentTemplate); + } + if (object.importGcsCustomMetadata != null) + message.importGcsCustomMetadata = Boolean(object.importGcsCustomMetadata); + return message; + }; + + /** + * Creates a plain object from an ImportDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2.ImportDocumentsRequest} message ImportDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportDocumentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.documentTemplate = null; + object.importGcsCustomMetadata = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.dialogflow.v2.GcsSources.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.documentTemplate != null && message.hasOwnProperty("documentTemplate")) + object.documentTemplate = $root.google.cloud.dialogflow.v2.ImportDocumentTemplate.toObject(message.documentTemplate, options); + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + object.importGcsCustomMetadata = message.importGcsCustomMetadata; + return object; + }; + + /** + * Converts this ImportDocumentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportDocumentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ImportDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ImportDocumentsRequest"; + }; + + return ImportDocumentsRequest; + })(); + + v2.ImportDocumentTemplate = (function() { + + /** + * Properties of an ImportDocumentTemplate. + * @memberof google.cloud.dialogflow.v2 + * @interface IImportDocumentTemplate + * @property {string|null} [mimeType] ImportDocumentTemplate mimeType + * @property {Array.|null} [knowledgeTypes] ImportDocumentTemplate knowledgeTypes + * @property {Object.|null} [metadata] ImportDocumentTemplate metadata + */ + + /** + * Constructs a new ImportDocumentTemplate. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ImportDocumentTemplate. + * @implements IImportDocumentTemplate + * @constructor + * @param {google.cloud.dialogflow.v2.IImportDocumentTemplate=} [properties] Properties to set + */ + function ImportDocumentTemplate(properties) { + this.knowledgeTypes = []; + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportDocumentTemplate mimeType. + * @member {string} mimeType + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @instance + */ + ImportDocumentTemplate.prototype.mimeType = ""; + + /** + * ImportDocumentTemplate knowledgeTypes. + * @member {Array.} knowledgeTypes + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @instance + */ + ImportDocumentTemplate.prototype.knowledgeTypes = $util.emptyArray; + + /** + * ImportDocumentTemplate metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @instance + */ + ImportDocumentTemplate.prototype.metadata = $util.emptyObject; + + /** + * Creates a new ImportDocumentTemplate instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @static + * @param {google.cloud.dialogflow.v2.IImportDocumentTemplate=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ImportDocumentTemplate} ImportDocumentTemplate instance + */ + ImportDocumentTemplate.create = function create(properties) { + return new ImportDocumentTemplate(properties); + }; + + /** + * Encodes the specified ImportDocumentTemplate message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentTemplate.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @static + * @param {google.cloud.dialogflow.v2.IImportDocumentTemplate} message ImportDocumentTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentTemplate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mimeType); + if (message.knowledgeTypes != null && message.knowledgeTypes.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.knowledgeTypes.length; ++i) + writer.int32(message.knowledgeTypes[i]); + writer.ldelim(); + } + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportDocumentTemplate message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentTemplate.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @static + * @param {google.cloud.dialogflow.v2.IImportDocumentTemplate} message ImportDocumentTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentTemplate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportDocumentTemplate message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ImportDocumentTemplate} ImportDocumentTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentTemplate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ImportDocumentTemplate(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mimeType = reader.string(); + break; + } + case 2: { + if (!(message.knowledgeTypes && message.knowledgeTypes.length)) + message.knowledgeTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.knowledgeTypes.push(reader.int32()); + } else + message.knowledgeTypes.push(reader.int32()); + break; + } + case 3: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportDocumentTemplate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ImportDocumentTemplate} ImportDocumentTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentTemplate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportDocumentTemplate message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportDocumentTemplate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.knowledgeTypes != null && message.hasOwnProperty("knowledgeTypes")) { + if (!Array.isArray(message.knowledgeTypes)) + return "knowledgeTypes: array expected"; + for (var i = 0; i < message.knowledgeTypes.length; ++i) + switch (message.knowledgeTypes[i]) { + default: + return "knowledgeTypes: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + return null; + }; + + /** + * Creates an ImportDocumentTemplate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ImportDocumentTemplate} ImportDocumentTemplate + */ + ImportDocumentTemplate.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ImportDocumentTemplate) + return object; + var message = new $root.google.cloud.dialogflow.v2.ImportDocumentTemplate(); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.knowledgeTypes) { + if (!Array.isArray(object.knowledgeTypes)) + throw TypeError(".google.cloud.dialogflow.v2.ImportDocumentTemplate.knowledgeTypes: array expected"); + message.knowledgeTypes = []; + for (var i = 0; i < object.knowledgeTypes.length; ++i) + switch (object.knowledgeTypes[i]) { + default: + if (typeof object.knowledgeTypes[i] === "number") { + message.knowledgeTypes[i] = object.knowledgeTypes[i]; + break; + } + case "KNOWLEDGE_TYPE_UNSPECIFIED": + case 0: + message.knowledgeTypes[i] = 0; + break; + case "FAQ": + case 1: + message.knowledgeTypes[i] = 1; + break; + case "EXTRACTIVE_QA": + case 2: + message.knowledgeTypes[i] = 2; + break; + case "ARTICLE_SUGGESTION": + case 3: + message.knowledgeTypes[i] = 3; + break; + case "AGENT_FACING_SMART_REPLY": + case 4: + message.knowledgeTypes[i] = 4; + break; + } + } + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ImportDocumentTemplate.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from an ImportDocumentTemplate message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @static + * @param {google.cloud.dialogflow.v2.ImportDocumentTemplate} message ImportDocumentTemplate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportDocumentTemplate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.knowledgeTypes = []; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.mimeType = ""; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.knowledgeTypes && message.knowledgeTypes.length) { + object.knowledgeTypes = []; + for (var j = 0; j < message.knowledgeTypes.length; ++j) + object.knowledgeTypes[j] = options.enums === String ? $root.google.cloud.dialogflow.v2.Document.KnowledgeType[message.knowledgeTypes[j]] === undefined ? message.knowledgeTypes[j] : $root.google.cloud.dialogflow.v2.Document.KnowledgeType[message.knowledgeTypes[j]] : message.knowledgeTypes[j]; + } + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + return object; + }; + + /** + * Converts this ImportDocumentTemplate to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @instance + * @returns {Object.} JSON object + */ + ImportDocumentTemplate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportDocumentTemplate + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ImportDocumentTemplate + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportDocumentTemplate.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ImportDocumentTemplate"; + }; + + return ImportDocumentTemplate; + })(); + + v2.ImportDocumentsResponse = (function() { + + /** + * Properties of an ImportDocumentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IImportDocumentsResponse + * @property {Array.|null} [warnings] ImportDocumentsResponse warnings + */ + + /** + * Constructs a new ImportDocumentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ImportDocumentsResponse. + * @implements IImportDocumentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IImportDocumentsResponse=} [properties] Properties to set + */ + function ImportDocumentsResponse(properties) { + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportDocumentsResponse warnings. + * @member {Array.} warnings + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @instance + */ + ImportDocumentsResponse.prototype.warnings = $util.emptyArray; + + /** + * Creates a new ImportDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IImportDocumentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ImportDocumentsResponse} ImportDocumentsResponse instance + */ + ImportDocumentsResponse.create = function create(properties) { + return new ImportDocumentsResponse(properties); + }; + + /** + * Encodes the specified ImportDocumentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IImportDocumentsResponse} message ImportDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + $root.google.rpc.Status.encode(message.warnings[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ImportDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IImportDocumentsResponse} message ImportDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ImportDocumentsResponse} ImportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ImportDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ImportDocumentsResponse} ImportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportDocumentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportDocumentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) { + var error = $root.google.rpc.Status.verify(message.warnings[i]); + if (error) + return "warnings." + error; + } + } + return null; + }; + + /** + * Creates an ImportDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ImportDocumentsResponse} ImportDocumentsResponse + */ + ImportDocumentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ImportDocumentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ImportDocumentsResponse(); + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.dialogflow.v2.ImportDocumentsResponse.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) { + if (typeof object.warnings[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ImportDocumentsResponse.warnings: object expected"); + message.warnings[i] = $root.google.rpc.Status.fromObject(object.warnings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ImportDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2.ImportDocumentsResponse} message ImportDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportDocumentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.warnings = []; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = $root.google.rpc.Status.toObject(message.warnings[j], options); + } + return object; + }; + + /** + * Converts this ImportDocumentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportDocumentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ImportDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ImportDocumentsResponse"; + }; + + return ImportDocumentsResponse; + })(); + + v2.DeleteDocumentRequest = (function() { + + /** + * Properties of a DeleteDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteDocumentRequest + * @property {string|null} [name] DeleteDocumentRequest name + */ + + /** + * Constructs a new DeleteDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteDocumentRequest. + * @implements IDeleteDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteDocumentRequest=} [properties] Properties to set + */ + function DeleteDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteDocumentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @instance + */ + DeleteDocumentRequest.prototype.name = ""; + + /** + * Creates a new DeleteDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteDocumentRequest} DeleteDocumentRequest instance + */ + DeleteDocumentRequest.create = function create(properties) { + return new DeleteDocumentRequest(properties); + }; + + /** + * Encodes the specified DeleteDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteDocumentRequest} message DeleteDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDocumentRequest.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 DeleteDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteDocumentRequest} message DeleteDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteDocumentRequest} DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteDocumentRequest(); + 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 DeleteDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteDocumentRequest} DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteDocumentRequest.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 DeleteDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteDocumentRequest} DeleteDocumentRequest + */ + DeleteDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteDocumentRequest} message DeleteDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteDocumentRequest.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 DeleteDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteDocumentRequest"; + }; + + return DeleteDocumentRequest; + })(); + + v2.UpdateDocumentRequest = (function() { + + /** + * Properties of an UpdateDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateDocumentRequest + * @property {google.cloud.dialogflow.v2.IDocument|null} [document] UpdateDocumentRequest document + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateDocumentRequest updateMask + */ + + /** + * Constructs a new UpdateDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateDocumentRequest. + * @implements IUpdateDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateDocumentRequest=} [properties] Properties to set + */ + function UpdateDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateDocumentRequest document. + * @member {google.cloud.dialogflow.v2.IDocument|null|undefined} document + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.document = null; + + /** + * UpdateDocumentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateDocumentRequest} UpdateDocumentRequest instance + */ + UpdateDocumentRequest.create = function create(properties) { + return new UpdateDocumentRequest(properties); + }; + + /** + * Encodes the specified UpdateDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateDocumentRequest} message UpdateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.dialogflow.v2.Document.encode(message.document, 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 UpdateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateDocumentRequest} message UpdateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateDocumentRequest} UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.document = $root.google.cloud.dialogflow.v2.Document.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 UpdateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateDocumentRequest} UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.dialogflow.v2.Document.verify(message.document); + if (error) + return "document." + 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 UpdateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateDocumentRequest} UpdateDocumentRequest + */ + UpdateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateDocumentRequest(); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateDocumentRequest.document: object expected"); + message.document = $root.google.cloud.dialogflow.v2.Document.fromObject(object.document); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateDocumentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateDocumentRequest} message UpdateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.document = null; + object.updateMask = null; + } + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.dialogflow.v2.Document.toObject(message.document, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateDocumentRequest"; + }; + + return UpdateDocumentRequest; + })(); + + v2.ReloadDocumentRequest = (function() { + + /** + * Properties of a ReloadDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IReloadDocumentRequest + * @property {string|null} [name] ReloadDocumentRequest name + * @property {string|null} [contentUri] ReloadDocumentRequest contentUri + * @property {boolean|null} [importGcsCustomMetadata] ReloadDocumentRequest importGcsCustomMetadata + * @property {boolean|null} [smartMessagingPartialUpdate] ReloadDocumentRequest smartMessagingPartialUpdate + */ + + /** + * Constructs a new ReloadDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ReloadDocumentRequest. + * @implements IReloadDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IReloadDocumentRequest=} [properties] Properties to set + */ + function ReloadDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReloadDocumentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.name = ""; + + /** + * ReloadDocumentRequest contentUri. + * @member {string|null|undefined} contentUri + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.contentUri = null; + + /** + * ReloadDocumentRequest importGcsCustomMetadata. + * @member {boolean} importGcsCustomMetadata + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.importGcsCustomMetadata = false; + + /** + * ReloadDocumentRequest smartMessagingPartialUpdate. + * @member {boolean} smartMessagingPartialUpdate + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.smartMessagingPartialUpdate = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReloadDocumentRequest source. + * @member {"contentUri"|undefined} source + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @instance + */ + Object.defineProperty(ReloadDocumentRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["contentUri"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReloadDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IReloadDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ReloadDocumentRequest} ReloadDocumentRequest instance + */ + ReloadDocumentRequest.create = function create(properties) { + return new ReloadDocumentRequest(properties); + }; + + /** + * Encodes the specified ReloadDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ReloadDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IReloadDocumentRequest} message ReloadDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReloadDocumentRequest.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.contentUri != null && Object.hasOwnProperty.call(message, "contentUri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.contentUri); + if (message.importGcsCustomMetadata != null && Object.hasOwnProperty.call(message, "importGcsCustomMetadata")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.importGcsCustomMetadata); + if (message.smartMessagingPartialUpdate != null && Object.hasOwnProperty.call(message, "smartMessagingPartialUpdate")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.smartMessagingPartialUpdate); + return writer; + }; + + /** + * Encodes the specified ReloadDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ReloadDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IReloadDocumentRequest} message ReloadDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReloadDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReloadDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ReloadDocumentRequest} ReloadDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReloadDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ReloadDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.contentUri = reader.string(); + break; + } + case 4: { + message.importGcsCustomMetadata = reader.bool(); + break; + } + case 5: { + message.smartMessagingPartialUpdate = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReloadDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ReloadDocumentRequest} ReloadDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReloadDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReloadDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReloadDocumentRequest.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.contentUri != null && message.hasOwnProperty("contentUri")) { + properties.source = 1; + if (!$util.isString(message.contentUri)) + return "contentUri: string expected"; + } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + if (typeof message.importGcsCustomMetadata !== "boolean") + return "importGcsCustomMetadata: boolean expected"; + if (message.smartMessagingPartialUpdate != null && message.hasOwnProperty("smartMessagingPartialUpdate")) + if (typeof message.smartMessagingPartialUpdate !== "boolean") + return "smartMessagingPartialUpdate: boolean expected"; + return null; + }; + + /** + * Creates a ReloadDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ReloadDocumentRequest} ReloadDocumentRequest + */ + ReloadDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ReloadDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ReloadDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.contentUri != null) + message.contentUri = String(object.contentUri); + if (object.importGcsCustomMetadata != null) + message.importGcsCustomMetadata = Boolean(object.importGcsCustomMetadata); + if (object.smartMessagingPartialUpdate != null) + message.smartMessagingPartialUpdate = Boolean(object.smartMessagingPartialUpdate); + return message; + }; + + /** + * Creates a plain object from a ReloadDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.ReloadDocumentRequest} message ReloadDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReloadDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.importGcsCustomMetadata = false; + object.smartMessagingPartialUpdate = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.contentUri != null && message.hasOwnProperty("contentUri")) { + object.contentUri = message.contentUri; + if (options.oneofs) + object.source = "contentUri"; + } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + object.importGcsCustomMetadata = message.importGcsCustomMetadata; + if (message.smartMessagingPartialUpdate != null && message.hasOwnProperty("smartMessagingPartialUpdate")) + object.smartMessagingPartialUpdate = message.smartMessagingPartialUpdate; + return object; + }; + + /** + * Converts this ReloadDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ReloadDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReloadDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ReloadDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReloadDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ReloadDocumentRequest"; + }; + + return ReloadDocumentRequest; + })(); + + v2.ExportDocumentRequest = (function() { + + /** + * Properties of an ExportDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IExportDocumentRequest + * @property {string|null} [name] ExportDocumentRequest name + * @property {google.cloud.dialogflow.v2.IGcsDestination|null} [gcsDestination] ExportDocumentRequest gcsDestination + * @property {boolean|null} [exportFullContent] ExportDocumentRequest exportFullContent + * @property {boolean|null} [smartMessagingPartialUpdate] ExportDocumentRequest smartMessagingPartialUpdate + */ + + /** + * Constructs a new ExportDocumentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ExportDocumentRequest. + * @implements IExportDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest=} [properties] Properties to set + */ + function ExportDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportDocumentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + ExportDocumentRequest.prototype.name = ""; + + /** + * ExportDocumentRequest gcsDestination. + * @member {google.cloud.dialogflow.v2.IGcsDestination|null|undefined} gcsDestination + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + ExportDocumentRequest.prototype.gcsDestination = null; + + /** + * ExportDocumentRequest exportFullContent. + * @member {boolean} exportFullContent + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + ExportDocumentRequest.prototype.exportFullContent = false; + + /** + * ExportDocumentRequest smartMessagingPartialUpdate. + * @member {boolean} smartMessagingPartialUpdate + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + ExportDocumentRequest.prototype.smartMessagingPartialUpdate = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportDocumentRequest destination. + * @member {"gcsDestination"|undefined} destination + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + */ + Object.defineProperty(ExportDocumentRequest.prototype, "destination", { + get: $util.oneOfGetter($oneOfFields = ["gcsDestination"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ExportDocumentRequest} ExportDocumentRequest instance + */ + ExportDocumentRequest.create = function create(properties) { + return new ExportDocumentRequest(properties); + }; + + /** + * Encodes the specified ExportDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest} message ExportDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentRequest.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.gcsDestination != null && Object.hasOwnProperty.call(message, "gcsDestination")) + $root.google.cloud.dialogflow.v2.GcsDestination.encode(message.gcsDestination, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.exportFullContent != null && Object.hasOwnProperty.call(message, "exportFullContent")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.exportFullContent); + if (message.smartMessagingPartialUpdate != null && Object.hasOwnProperty.call(message, "smartMessagingPartialUpdate")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.smartMessagingPartialUpdate); + return writer; + }; + + /** + * Encodes the specified ExportDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.IExportDocumentRequest} message ExportDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ExportDocumentRequest} ExportDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ExportDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.gcsDestination = $root.google.cloud.dialogflow.v2.GcsDestination.decode(reader, reader.uint32()); + break; + } + case 3: { + message.exportFullContent = reader.bool(); + break; + } + case 5: { + message.smartMessagingPartialUpdate = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ExportDocumentRequest} ExportDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportDocumentRequest.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.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + properties.destination = 1; + { + var error = $root.google.cloud.dialogflow.v2.GcsDestination.verify(message.gcsDestination); + if (error) + return "gcsDestination." + error; + } + } + if (message.exportFullContent != null && message.hasOwnProperty("exportFullContent")) + if (typeof message.exportFullContent !== "boolean") + return "exportFullContent: boolean expected"; + if (message.smartMessagingPartialUpdate != null && message.hasOwnProperty("smartMessagingPartialUpdate")) + if (typeof message.smartMessagingPartialUpdate !== "boolean") + return "smartMessagingPartialUpdate: boolean expected"; + return null; + }; + + /** + * Creates an ExportDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ExportDocumentRequest} ExportDocumentRequest + */ + ExportDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ExportDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ExportDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.gcsDestination != null) { + if (typeof object.gcsDestination !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ExportDocumentRequest.gcsDestination: object expected"); + message.gcsDestination = $root.google.cloud.dialogflow.v2.GcsDestination.fromObject(object.gcsDestination); + } + if (object.exportFullContent != null) + message.exportFullContent = Boolean(object.exportFullContent); + if (object.smartMessagingPartialUpdate != null) + message.smartMessagingPartialUpdate = Boolean(object.smartMessagingPartialUpdate); + return message; + }; + + /** + * Creates a plain object from an ExportDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2.ExportDocumentRequest} message ExportDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.exportFullContent = false; + object.smartMessagingPartialUpdate = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.gcsDestination != null && message.hasOwnProperty("gcsDestination")) { + object.gcsDestination = $root.google.cloud.dialogflow.v2.GcsDestination.toObject(message.gcsDestination, options); + if (options.oneofs) + object.destination = "gcsDestination"; + } + if (message.exportFullContent != null && message.hasOwnProperty("exportFullContent")) + object.exportFullContent = message.exportFullContent; + if (message.smartMessagingPartialUpdate != null && message.hasOwnProperty("smartMessagingPartialUpdate")) + object.smartMessagingPartialUpdate = message.smartMessagingPartialUpdate; + return object; + }; + + /** + * Converts this ExportDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ExportDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ExportDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ExportDocumentRequest"; + }; + + return ExportDocumentRequest; + })(); + + v2.ExportOperationMetadata = (function() { + + /** + * Properties of an ExportOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface IExportOperationMetadata + * @property {google.cloud.dialogflow.v2.IGcsDestination|null} [exportedGcsDestination] ExportOperationMetadata exportedGcsDestination + */ + + /** + * Constructs a new ExportOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an ExportOperationMetadata. + * @implements IExportOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.IExportOperationMetadata=} [properties] Properties to set + */ + function ExportOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportOperationMetadata exportedGcsDestination. + * @member {google.cloud.dialogflow.v2.IGcsDestination|null|undefined} exportedGcsDestination + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @instance + */ + ExportOperationMetadata.prototype.exportedGcsDestination = null; + + /** + * Creates a new ExportOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IExportOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ExportOperationMetadata} ExportOperationMetadata instance + */ + ExportOperationMetadata.create = function create(properties) { + return new ExportOperationMetadata(properties); + }; + + /** + * Encodes the specified ExportOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.ExportOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IExportOperationMetadata} message ExportOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exportedGcsDestination != null && Object.hasOwnProperty.call(message, "exportedGcsDestination")) + $root.google.cloud.dialogflow.v2.GcsDestination.encode(message.exportedGcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ExportOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IExportOperationMetadata} message ExportOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ExportOperationMetadata} ExportOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ExportOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.exportedGcsDestination = $root.google.cloud.dialogflow.v2.GcsDestination.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ExportOperationMetadata} ExportOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.exportedGcsDestination != null && message.hasOwnProperty("exportedGcsDestination")) { + var error = $root.google.cloud.dialogflow.v2.GcsDestination.verify(message.exportedGcsDestination); + if (error) + return "exportedGcsDestination." + error; + } + return null; + }; + + /** + * Creates an ExportOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ExportOperationMetadata} ExportOperationMetadata + */ + ExportOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ExportOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.ExportOperationMetadata(); + if (object.exportedGcsDestination != null) { + if (typeof object.exportedGcsDestination !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ExportOperationMetadata.exportedGcsDestination: object expected"); + message.exportedGcsDestination = $root.google.cloud.dialogflow.v2.GcsDestination.fromObject(object.exportedGcsDestination); + } + return message; + }; + + /** + * Creates a plain object from an ExportOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.ExportOperationMetadata} message ExportOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.exportedGcsDestination = null; + if (message.exportedGcsDestination != null && message.hasOwnProperty("exportedGcsDestination")) + object.exportedGcsDestination = $root.google.cloud.dialogflow.v2.GcsDestination.toObject(message.exportedGcsDestination, options); + return object; + }; + + /** + * Converts this ExportOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ExportOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ExportOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ExportOperationMetadata"; + }; + + return ExportOperationMetadata; + })(); + + v2.KnowledgeOperationMetadata = (function() { + + /** + * Properties of a KnowledgeOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @interface IKnowledgeOperationMetadata + * @property {google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State|null} [state] KnowledgeOperationMetadata state + * @property {string|null} [knowledgeBase] KnowledgeOperationMetadata knowledgeBase + * @property {google.cloud.dialogflow.v2.IExportOperationMetadata|null} [exportOperationMetadata] KnowledgeOperationMetadata exportOperationMetadata + */ + + /** + * Constructs a new KnowledgeOperationMetadata. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a KnowledgeOperationMetadata. + * @implements IKnowledgeOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2.IKnowledgeOperationMetadata=} [properties] Properties to set + */ + function KnowledgeOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KnowledgeOperationMetadata state. + * @member {google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State} state + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @instance + */ + KnowledgeOperationMetadata.prototype.state = 0; + + /** + * KnowledgeOperationMetadata knowledgeBase. + * @member {string} knowledgeBase + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @instance + */ + KnowledgeOperationMetadata.prototype.knowledgeBase = ""; + + /** + * KnowledgeOperationMetadata exportOperationMetadata. + * @member {google.cloud.dialogflow.v2.IExportOperationMetadata|null|undefined} exportOperationMetadata + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @instance + */ + KnowledgeOperationMetadata.prototype.exportOperationMetadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * KnowledgeOperationMetadata operationMetadata. + * @member {"exportOperationMetadata"|undefined} operationMetadata + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @instance + */ + Object.defineProperty(KnowledgeOperationMetadata.prototype, "operationMetadata", { + get: $util.oneOfGetter($oneOfFields = ["exportOperationMetadata"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new KnowledgeOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IKnowledgeOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.KnowledgeOperationMetadata} KnowledgeOperationMetadata instance + */ + KnowledgeOperationMetadata.create = function create(properties) { + return new KnowledgeOperationMetadata(properties); + }; + + /** + * Encodes the specified KnowledgeOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IKnowledgeOperationMetadata} message KnowledgeOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeOperationMetadata.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.knowledgeBase != null && Object.hasOwnProperty.call(message, "knowledgeBase")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.knowledgeBase); + if (message.exportOperationMetadata != null && Object.hasOwnProperty.call(message, "exportOperationMetadata")) + $root.google.cloud.dialogflow.v2.ExportOperationMetadata.encode(message.exportOperationMetadata, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified KnowledgeOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.IKnowledgeOperationMetadata} message KnowledgeOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KnowledgeOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.KnowledgeOperationMetadata} KnowledgeOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.KnowledgeOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 3: { + message.knowledgeBase = reader.string(); + break; + } + case 4: { + message.exportOperationMetadata = $root.google.cloud.dialogflow.v2.ExportOperationMetadata.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KnowledgeOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.KnowledgeOperationMetadata} KnowledgeOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KnowledgeOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KnowledgeOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + if (!$util.isString(message.knowledgeBase)) + return "knowledgeBase: string expected"; + if (message.exportOperationMetadata != null && message.hasOwnProperty("exportOperationMetadata")) { + properties.operationMetadata = 1; + { + var error = $root.google.cloud.dialogflow.v2.ExportOperationMetadata.verify(message.exportOperationMetadata); + if (error) + return "exportOperationMetadata." + error; + } + } + return null; + }; + + /** + * Creates a KnowledgeOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.KnowledgeOperationMetadata} KnowledgeOperationMetadata + */ + KnowledgeOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.KnowledgeOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2.KnowledgeOperationMetadata(); + 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 "PENDING": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "DONE": + case 3: + message.state = 3; + break; + } + if (object.knowledgeBase != null) + message.knowledgeBase = String(object.knowledgeBase); + if (object.exportOperationMetadata != null) { + if (typeof object.exportOperationMetadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2.KnowledgeOperationMetadata.exportOperationMetadata: object expected"); + message.exportOperationMetadata = $root.google.cloud.dialogflow.v2.ExportOperationMetadata.fromObject(object.exportOperationMetadata); + } + return message; + }; + + /** + * Creates a plain object from a KnowledgeOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2.KnowledgeOperationMetadata} message KnowledgeOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KnowledgeOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.knowledgeBase = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State[message.state] : message.state; + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + object.knowledgeBase = message.knowledgeBase; + if (message.exportOperationMetadata != null && message.hasOwnProperty("exportOperationMetadata")) { + object.exportOperationMetadata = $root.google.cloud.dialogflow.v2.ExportOperationMetadata.toObject(message.exportOperationMetadata, options); + if (options.oneofs) + object.operationMetadata = "exportOperationMetadata"; + } + return object; + }; + + /** + * Converts this KnowledgeOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + KnowledgeOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for KnowledgeOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.KnowledgeOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KnowledgeOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.KnowledgeOperationMetadata"; + }; + + /** + * State enum. + * @name google.cloud.dialogflow.v2.KnowledgeOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} PENDING=1 PENDING value + * @property {number} RUNNING=2 RUNNING value + * @property {number} DONE=3 DONE value + */ + KnowledgeOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PENDING"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "DONE"] = 3; + return values; + })(); + + return KnowledgeOperationMetadata; + })(); + + v2.Environments = (function() { + + /** + * Constructs a new Environments service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an Environments + * @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 Environments(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Environments.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Environments; + + /** + * Creates new Environments service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Environments + * @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 {Environments} RPC service. Useful where requests and/or responses are streamed. + */ + Environments.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|listEnvironments}. + * @memberof google.cloud.dialogflow.v2.Environments + * @typedef ListEnvironmentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListEnvironmentsResponse} [response] ListEnvironmentsResponse + */ + + /** + * Calls ListEnvironments. + * @function listEnvironments + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IListEnvironmentsRequest} request ListEnvironmentsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Environments.ListEnvironmentsCallback} callback Node-style callback called with the error, if any, and ListEnvironmentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.listEnvironments = function listEnvironments(request, callback) { + return this.rpcCall(listEnvironments, $root.google.cloud.dialogflow.v2.ListEnvironmentsRequest, $root.google.cloud.dialogflow.v2.ListEnvironmentsResponse, request, callback); + }, "name", { value: "ListEnvironments" }); + + /** + * Calls ListEnvironments. + * @function listEnvironments + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IListEnvironmentsRequest} request ListEnvironmentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|getEnvironment}. + * @memberof google.cloud.dialogflow.v2.Environments + * @typedef GetEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Environment} [response] Environment + */ + + /** + * Calls GetEnvironment. + * @function getEnvironment + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IGetEnvironmentRequest} request GetEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Environments.GetEnvironmentCallback} callback Node-style callback called with the error, if any, and Environment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.getEnvironment = function getEnvironment(request, callback) { + return this.rpcCall(getEnvironment, $root.google.cloud.dialogflow.v2.GetEnvironmentRequest, $root.google.cloud.dialogflow.v2.Environment, request, callback); + }, "name", { value: "GetEnvironment" }); + + /** + * Calls GetEnvironment. + * @function getEnvironment + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IGetEnvironmentRequest} request GetEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|createEnvironment}. + * @memberof google.cloud.dialogflow.v2.Environments + * @typedef CreateEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Environment} [response] Environment + */ + + /** + * Calls CreateEnvironment. + * @function createEnvironment + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.ICreateEnvironmentRequest} request CreateEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Environments.CreateEnvironmentCallback} callback Node-style callback called with the error, if any, and Environment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.createEnvironment = function createEnvironment(request, callback) { + return this.rpcCall(createEnvironment, $root.google.cloud.dialogflow.v2.CreateEnvironmentRequest, $root.google.cloud.dialogflow.v2.Environment, request, callback); + }, "name", { value: "CreateEnvironment" }); + + /** + * Calls CreateEnvironment. + * @function createEnvironment + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.ICreateEnvironmentRequest} request CreateEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|updateEnvironment}. + * @memberof google.cloud.dialogflow.v2.Environments + * @typedef UpdateEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Environment} [response] Environment + */ + + /** + * Calls UpdateEnvironment. + * @function updateEnvironment + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateEnvironmentRequest} request UpdateEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Environments.UpdateEnvironmentCallback} callback Node-style callback called with the error, if any, and Environment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.updateEnvironment = function updateEnvironment(request, callback) { + return this.rpcCall(updateEnvironment, $root.google.cloud.dialogflow.v2.UpdateEnvironmentRequest, $root.google.cloud.dialogflow.v2.Environment, request, callback); + }, "name", { value: "UpdateEnvironment" }); + + /** + * Calls UpdateEnvironment. + * @function updateEnvironment + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateEnvironmentRequest} request UpdateEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|deleteEnvironment}. + * @memberof google.cloud.dialogflow.v2.Environments + * @typedef DeleteEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteEnvironment. + * @function deleteEnvironment + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteEnvironmentRequest} request DeleteEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Environments.DeleteEnvironmentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.deleteEnvironment = function deleteEnvironment(request, callback) { + return this.rpcCall(deleteEnvironment, $root.google.cloud.dialogflow.v2.DeleteEnvironmentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteEnvironment" }); + + /** + * Calls DeleteEnvironment. + * @function deleteEnvironment + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteEnvironmentRequest} request DeleteEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Environments|getEnvironmentHistory}. + * @memberof google.cloud.dialogflow.v2.Environments + * @typedef GetEnvironmentHistoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.EnvironmentHistory} [response] EnvironmentHistory + */ + + /** + * Calls GetEnvironmentHistory. + * @function getEnvironmentHistory + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest} request GetEnvironmentHistoryRequest message or plain object + * @param {google.cloud.dialogflow.v2.Environments.GetEnvironmentHistoryCallback} callback Node-style callback called with the error, if any, and EnvironmentHistory + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.getEnvironmentHistory = function getEnvironmentHistory(request, callback) { + return this.rpcCall(getEnvironmentHistory, $root.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest, $root.google.cloud.dialogflow.v2.EnvironmentHistory, request, callback); + }, "name", { value: "GetEnvironmentHistory" }); + + /** + * Calls GetEnvironmentHistory. + * @function getEnvironmentHistory + * @memberof google.cloud.dialogflow.v2.Environments + * @instance + * @param {google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest} request GetEnvironmentHistoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Environments; + })(); + + v2.Environment = (function() { + + /** + * Properties of an Environment. + * @memberof google.cloud.dialogflow.v2 + * @interface IEnvironment + * @property {string|null} [name] Environment name + * @property {string|null} [description] Environment description + * @property {string|null} [agentVersion] Environment agentVersion + * @property {google.cloud.dialogflow.v2.Environment.State|null} [state] Environment state + * @property {google.protobuf.ITimestamp|null} [updateTime] Environment updateTime + * @property {google.cloud.dialogflow.v2.ITextToSpeechSettings|null} [textToSpeechSettings] Environment textToSpeechSettings + * @property {google.cloud.dialogflow.v2.IFulfillment|null} [fulfillment] Environment fulfillment + */ + + /** + * Constructs a new Environment. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an Environment. + * @implements IEnvironment + * @constructor + * @param {google.cloud.dialogflow.v2.IEnvironment=} [properties] Properties to set + */ + function Environment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Environment name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Environment + * @instance + */ + Environment.prototype.name = ""; + + /** + * Environment description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2.Environment + * @instance + */ + Environment.prototype.description = ""; + + /** + * Environment agentVersion. + * @member {string} agentVersion + * @memberof google.cloud.dialogflow.v2.Environment + * @instance + */ + Environment.prototype.agentVersion = ""; + + /** + * Environment state. + * @member {google.cloud.dialogflow.v2.Environment.State} state + * @memberof google.cloud.dialogflow.v2.Environment + * @instance + */ + Environment.prototype.state = 0; + + /** + * Environment updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.dialogflow.v2.Environment + * @instance + */ + Environment.prototype.updateTime = null; + + /** + * Environment textToSpeechSettings. + * @member {google.cloud.dialogflow.v2.ITextToSpeechSettings|null|undefined} textToSpeechSettings + * @memberof google.cloud.dialogflow.v2.Environment + * @instance + */ + Environment.prototype.textToSpeechSettings = null; + + /** + * Environment fulfillment. + * @member {google.cloud.dialogflow.v2.IFulfillment|null|undefined} fulfillment + * @memberof google.cloud.dialogflow.v2.Environment + * @instance + */ + Environment.prototype.fulfillment = null; + + /** + * Creates a new Environment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Environment + * @static + * @param {google.cloud.dialogflow.v2.IEnvironment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Environment} Environment instance + */ + Environment.create = function create(properties) { + return new Environment(properties); + }; + + /** + * Encodes the specified Environment message. Does not implicitly {@link google.cloud.dialogflow.v2.Environment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Environment + * @static + * @param {google.cloud.dialogflow.v2.IEnvironment} message Environment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Environment.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.agentVersion != null && Object.hasOwnProperty.call(message, "agentVersion")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.agentVersion); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.textToSpeechSettings != null && Object.hasOwnProperty.call(message, "textToSpeechSettings")) + $root.google.cloud.dialogflow.v2.TextToSpeechSettings.encode(message.textToSpeechSettings, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.fulfillment != null && Object.hasOwnProperty.call(message, "fulfillment")) + $root.google.cloud.dialogflow.v2.Fulfillment.encode(message.fulfillment, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Environment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Environment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Environment + * @static + * @param {google.cloud.dialogflow.v2.IEnvironment} message Environment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Environment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Environment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Environment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Environment} Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Environment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Environment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.agentVersion = reader.string(); + break; + } + case 4: { + message.state = reader.int32(); + break; + } + case 5: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.textToSpeechSettings = $root.google.cloud.dialogflow.v2.TextToSpeechSettings.decode(reader, reader.uint32()); + break; + } + case 8: { + message.fulfillment = $root.google.cloud.dialogflow.v2.Fulfillment.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Environment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Environment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Environment} Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Environment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Environment message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Environment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Environment.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.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.agentVersion != null && message.hasOwnProperty("agentVersion")) + if (!$util.isString(message.agentVersion)) + return "agentVersion: string 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: + break; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.textToSpeechSettings != null && message.hasOwnProperty("textToSpeechSettings")) { + var error = $root.google.cloud.dialogflow.v2.TextToSpeechSettings.verify(message.textToSpeechSettings); + if (error) + return "textToSpeechSettings." + error; + } + if (message.fulfillment != null && message.hasOwnProperty("fulfillment")) { + var error = $root.google.cloud.dialogflow.v2.Fulfillment.verify(message.fulfillment); + if (error) + return "fulfillment." + error; + } + return null; + }; + + /** + * Creates an Environment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Environment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Environment} Environment + */ + Environment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Environment) + return object; + var message = new $root.google.cloud.dialogflow.v2.Environment(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.agentVersion != null) + message.agentVersion = String(object.agentVersion); + 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 "STOPPED": + case 1: + message.state = 1; + break; + case "LOADING": + case 2: + message.state = 2; + break; + case "RUNNING": + case 3: + message.state = 3; + break; + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Environment.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.textToSpeechSettings != null) { + if (typeof object.textToSpeechSettings !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Environment.textToSpeechSettings: object expected"); + message.textToSpeechSettings = $root.google.cloud.dialogflow.v2.TextToSpeechSettings.fromObject(object.textToSpeechSettings); + } + if (object.fulfillment != null) { + if (typeof object.fulfillment !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Environment.fulfillment: object expected"); + message.fulfillment = $root.google.cloud.dialogflow.v2.Fulfillment.fromObject(object.fulfillment); + } + return message; + }; + + /** + * Creates a plain object from an Environment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Environment + * @static + * @param {google.cloud.dialogflow.v2.Environment} message Environment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Environment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.agentVersion = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.updateTime = null; + object.textToSpeechSettings = null; + object.fulfillment = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.agentVersion != null && message.hasOwnProperty("agentVersion")) + object.agentVersion = message.agentVersion; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.v2.Environment.State[message.state] === undefined ? message.state : $root.google.cloud.dialogflow.v2.Environment.State[message.state] : message.state; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.textToSpeechSettings != null && message.hasOwnProperty("textToSpeechSettings")) + object.textToSpeechSettings = $root.google.cloud.dialogflow.v2.TextToSpeechSettings.toObject(message.textToSpeechSettings, options); + if (message.fulfillment != null && message.hasOwnProperty("fulfillment")) + object.fulfillment = $root.google.cloud.dialogflow.v2.Fulfillment.toObject(message.fulfillment, options); + return object; + }; + + /** + * Converts this Environment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Environment + * @instance + * @returns {Object.} JSON object + */ + Environment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Environment + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Environment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Environment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Environment"; + }; + + /** + * State enum. + * @name google.cloud.dialogflow.v2.Environment.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} STOPPED=1 STOPPED value + * @property {number} LOADING=2 LOADING value + * @property {number} RUNNING=3 RUNNING value + */ + Environment.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "STOPPED"] = 1; + values[valuesById[2] = "LOADING"] = 2; + values[valuesById[3] = "RUNNING"] = 3; + return values; + })(); + + return Environment; + })(); + + v2.TextToSpeechSettings = (function() { + + /** + * Properties of a TextToSpeechSettings. + * @memberof google.cloud.dialogflow.v2 + * @interface ITextToSpeechSettings + * @property {boolean|null} [enableTextToSpeech] TextToSpeechSettings enableTextToSpeech + * @property {google.cloud.dialogflow.v2.OutputAudioEncoding|null} [outputAudioEncoding] TextToSpeechSettings outputAudioEncoding + * @property {number|null} [sampleRateHertz] TextToSpeechSettings sampleRateHertz + * @property {Object.|null} [synthesizeSpeechConfigs] TextToSpeechSettings synthesizeSpeechConfigs + */ + + /** + * Constructs a new TextToSpeechSettings. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a TextToSpeechSettings. + * @implements ITextToSpeechSettings + * @constructor + * @param {google.cloud.dialogflow.v2.ITextToSpeechSettings=} [properties] Properties to set + */ + function TextToSpeechSettings(properties) { + this.synthesizeSpeechConfigs = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextToSpeechSettings enableTextToSpeech. + * @member {boolean} enableTextToSpeech + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @instance + */ + TextToSpeechSettings.prototype.enableTextToSpeech = false; + + /** + * TextToSpeechSettings outputAudioEncoding. + * @member {google.cloud.dialogflow.v2.OutputAudioEncoding} outputAudioEncoding + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @instance + */ + TextToSpeechSettings.prototype.outputAudioEncoding = 0; + + /** + * TextToSpeechSettings sampleRateHertz. + * @member {number} sampleRateHertz + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @instance + */ + TextToSpeechSettings.prototype.sampleRateHertz = 0; + + /** + * TextToSpeechSettings synthesizeSpeechConfigs. + * @member {Object.} synthesizeSpeechConfigs + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @instance + */ + TextToSpeechSettings.prototype.synthesizeSpeechConfigs = $util.emptyObject; + + /** + * Creates a new TextToSpeechSettings instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @static + * @param {google.cloud.dialogflow.v2.ITextToSpeechSettings=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.TextToSpeechSettings} TextToSpeechSettings instance + */ + TextToSpeechSettings.create = function create(properties) { + return new TextToSpeechSettings(properties); + }; + + /** + * Encodes the specified TextToSpeechSettings message. Does not implicitly {@link google.cloud.dialogflow.v2.TextToSpeechSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @static + * @param {google.cloud.dialogflow.v2.ITextToSpeechSettings} message TextToSpeechSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextToSpeechSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableTextToSpeech != null && Object.hasOwnProperty.call(message, "enableTextToSpeech")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enableTextToSpeech); + if (message.outputAudioEncoding != null && Object.hasOwnProperty.call(message, "outputAudioEncoding")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.outputAudioEncoding); + if (message.sampleRateHertz != null && Object.hasOwnProperty.call(message, "sampleRateHertz")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.sampleRateHertz); + if (message.synthesizeSpeechConfigs != null && Object.hasOwnProperty.call(message, "synthesizeSpeechConfigs")) + for (var keys = Object.keys(message.synthesizeSpeechConfigs), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.encode(message.synthesizeSpeechConfigs[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified TextToSpeechSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.TextToSpeechSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @static + * @param {google.cloud.dialogflow.v2.ITextToSpeechSettings} message TextToSpeechSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextToSpeechSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextToSpeechSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.TextToSpeechSettings} TextToSpeechSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextToSpeechSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.TextToSpeechSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.enableTextToSpeech = reader.bool(); + break; + } + case 2: { + message.outputAudioEncoding = reader.int32(); + break; + } + case 3: { + message.sampleRateHertz = reader.int32(); + break; + } + case 4: { + if (message.synthesizeSpeechConfigs === $util.emptyObject) + message.synthesizeSpeechConfigs = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.synthesizeSpeechConfigs[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextToSpeechSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.TextToSpeechSettings} TextToSpeechSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextToSpeechSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextToSpeechSettings message. + * @function verify + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextToSpeechSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enableTextToSpeech != null && message.hasOwnProperty("enableTextToSpeech")) + if (typeof message.enableTextToSpeech !== "boolean") + return "enableTextToSpeech: boolean expected"; + if (message.outputAudioEncoding != null && message.hasOwnProperty("outputAudioEncoding")) + switch (message.outputAudioEncoding) { + default: + return "outputAudioEncoding: enum value expected"; + case 0: + case 1: + case 2: + case 4: + case 3: + case 5: + break; + } + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + if (!$util.isInteger(message.sampleRateHertz)) + return "sampleRateHertz: integer expected"; + if (message.synthesizeSpeechConfigs != null && message.hasOwnProperty("synthesizeSpeechConfigs")) { + if (!$util.isObject(message.synthesizeSpeechConfigs)) + return "synthesizeSpeechConfigs: object expected"; + var key = Object.keys(message.synthesizeSpeechConfigs); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.verify(message.synthesizeSpeechConfigs[key[i]]); + if (error) + return "synthesizeSpeechConfigs." + error; + } + } + return null; + }; + + /** + * Creates a TextToSpeechSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.TextToSpeechSettings} TextToSpeechSettings + */ + TextToSpeechSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.TextToSpeechSettings) + return object; + var message = new $root.google.cloud.dialogflow.v2.TextToSpeechSettings(); + if (object.enableTextToSpeech != null) + message.enableTextToSpeech = Boolean(object.enableTextToSpeech); + switch (object.outputAudioEncoding) { + default: + if (typeof object.outputAudioEncoding === "number") { + message.outputAudioEncoding = object.outputAudioEncoding; + break; + } + break; + case "OUTPUT_AUDIO_ENCODING_UNSPECIFIED": + case 0: + message.outputAudioEncoding = 0; + break; + case "OUTPUT_AUDIO_ENCODING_LINEAR_16": + case 1: + message.outputAudioEncoding = 1; + break; + case "OUTPUT_AUDIO_ENCODING_MP3": + case 2: + message.outputAudioEncoding = 2; + break; + case "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS": + case 4: + message.outputAudioEncoding = 4; + break; + case "OUTPUT_AUDIO_ENCODING_OGG_OPUS": + case 3: + message.outputAudioEncoding = 3; + break; + case "OUTPUT_AUDIO_ENCODING_MULAW": + case 5: + message.outputAudioEncoding = 5; + break; + } + if (object.sampleRateHertz != null) + message.sampleRateHertz = object.sampleRateHertz | 0; + if (object.synthesizeSpeechConfigs) { + if (typeof object.synthesizeSpeechConfigs !== "object") + throw TypeError(".google.cloud.dialogflow.v2.TextToSpeechSettings.synthesizeSpeechConfigs: object expected"); + message.synthesizeSpeechConfigs = {}; + for (var keys = Object.keys(object.synthesizeSpeechConfigs), i = 0; i < keys.length; ++i) { + if (typeof object.synthesizeSpeechConfigs[keys[i]] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.TextToSpeechSettings.synthesizeSpeechConfigs: object expected"); + message.synthesizeSpeechConfigs[keys[i]] = $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.fromObject(object.synthesizeSpeechConfigs[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a TextToSpeechSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @static + * @param {google.cloud.dialogflow.v2.TextToSpeechSettings} message TextToSpeechSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextToSpeechSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.synthesizeSpeechConfigs = {}; + if (options.defaults) { + object.enableTextToSpeech = false; + object.outputAudioEncoding = options.enums === String ? "OUTPUT_AUDIO_ENCODING_UNSPECIFIED" : 0; + object.sampleRateHertz = 0; + } + if (message.enableTextToSpeech != null && message.hasOwnProperty("enableTextToSpeech")) + object.enableTextToSpeech = message.enableTextToSpeech; + if (message.outputAudioEncoding != null && message.hasOwnProperty("outputAudioEncoding")) + object.outputAudioEncoding = options.enums === String ? $root.google.cloud.dialogflow.v2.OutputAudioEncoding[message.outputAudioEncoding] === undefined ? message.outputAudioEncoding : $root.google.cloud.dialogflow.v2.OutputAudioEncoding[message.outputAudioEncoding] : message.outputAudioEncoding; + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + object.sampleRateHertz = message.sampleRateHertz; + var keys2; + if (message.synthesizeSpeechConfigs && (keys2 = Object.keys(message.synthesizeSpeechConfigs)).length) { + object.synthesizeSpeechConfigs = {}; + for (var j = 0; j < keys2.length; ++j) + object.synthesizeSpeechConfigs[keys2[j]] = $root.google.cloud.dialogflow.v2.SynthesizeSpeechConfig.toObject(message.synthesizeSpeechConfigs[keys2[j]], options); + } + return object; + }; + + /** + * Converts this TextToSpeechSettings to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @instance + * @returns {Object.} JSON object + */ + TextToSpeechSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TextToSpeechSettings + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.TextToSpeechSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextToSpeechSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.TextToSpeechSettings"; + }; + + return TextToSpeechSettings; + })(); + + v2.ListEnvironmentsRequest = (function() { + + /** + * Properties of a ListEnvironmentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListEnvironmentsRequest + * @property {string|null} [parent] ListEnvironmentsRequest parent + * @property {number|null} [pageSize] ListEnvironmentsRequest pageSize + * @property {string|null} [pageToken] ListEnvironmentsRequest pageToken + */ + + /** + * Constructs a new ListEnvironmentsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListEnvironmentsRequest. + * @implements IListEnvironmentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListEnvironmentsRequest=} [properties] Properties to set + */ + function ListEnvironmentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEnvironmentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @instance + */ + ListEnvironmentsRequest.prototype.parent = ""; + + /** + * ListEnvironmentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @instance + */ + ListEnvironmentsRequest.prototype.pageSize = 0; + + /** + * ListEnvironmentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @instance + */ + ListEnvironmentsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListEnvironmentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListEnvironmentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListEnvironmentsRequest} ListEnvironmentsRequest instance + */ + ListEnvironmentsRequest.create = function create(properties) { + return new ListEnvironmentsRequest(properties); + }; + + /** + * Encodes the specified ListEnvironmentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListEnvironmentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListEnvironmentsRequest} message ListEnvironmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsRequest.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 ListEnvironmentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListEnvironmentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListEnvironmentsRequest} message ListEnvironmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListEnvironmentsRequest} ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListEnvironmentsRequest(); + 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 ListEnvironmentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListEnvironmentsRequest} ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEnvironmentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEnvironmentsRequest.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 ListEnvironmentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListEnvironmentsRequest} ListEnvironmentsRequest + */ + ListEnvironmentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListEnvironmentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListEnvironmentsRequest(); + 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 ListEnvironmentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListEnvironmentsRequest} message ListEnvironmentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEnvironmentsRequest.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 ListEnvironmentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListEnvironmentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEnvironmentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEnvironmentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListEnvironmentsRequest"; + }; + + return ListEnvironmentsRequest; + })(); + + v2.ListEnvironmentsResponse = (function() { + + /** + * Properties of a ListEnvironmentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListEnvironmentsResponse + * @property {Array.|null} [environments] ListEnvironmentsResponse environments + * @property {string|null} [nextPageToken] ListEnvironmentsResponse nextPageToken + */ + + /** + * Constructs a new ListEnvironmentsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListEnvironmentsResponse. + * @implements IListEnvironmentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListEnvironmentsResponse=} [properties] Properties to set + */ + function ListEnvironmentsResponse(properties) { + this.environments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEnvironmentsResponse environments. + * @member {Array.} environments + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @instance + */ + ListEnvironmentsResponse.prototype.environments = $util.emptyArray; + + /** + * ListEnvironmentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @instance + */ + ListEnvironmentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListEnvironmentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListEnvironmentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListEnvironmentsResponse} ListEnvironmentsResponse instance + */ + ListEnvironmentsResponse.create = function create(properties) { + return new ListEnvironmentsResponse(properties); + }; + + /** + * Encodes the specified ListEnvironmentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListEnvironmentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListEnvironmentsResponse} message ListEnvironmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.environments != null && message.environments.length) + for (var i = 0; i < message.environments.length; ++i) + $root.google.cloud.dialogflow.v2.Environment.encode(message.environments[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 ListEnvironmentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListEnvironmentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListEnvironmentsResponse} message ListEnvironmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListEnvironmentsResponse} ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListEnvironmentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.environments && message.environments.length)) + message.environments = []; + message.environments.push($root.google.cloud.dialogflow.v2.Environment.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListEnvironmentsResponse} ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEnvironmentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEnvironmentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.environments != null && message.hasOwnProperty("environments")) { + if (!Array.isArray(message.environments)) + return "environments: array expected"; + for (var i = 0; i < message.environments.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Environment.verify(message.environments[i]); + if (error) + return "environments." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListEnvironmentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListEnvironmentsResponse} ListEnvironmentsResponse + */ + ListEnvironmentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListEnvironmentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListEnvironmentsResponse(); + if (object.environments) { + if (!Array.isArray(object.environments)) + throw TypeError(".google.cloud.dialogflow.v2.ListEnvironmentsResponse.environments: array expected"); + message.environments = []; + for (var i = 0; i < object.environments.length; ++i) { + if (typeof object.environments[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListEnvironmentsResponse.environments: object expected"); + message.environments[i] = $root.google.cloud.dialogflow.v2.Environment.fromObject(object.environments[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListEnvironmentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListEnvironmentsResponse} message ListEnvironmentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEnvironmentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.environments = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.environments && message.environments.length) { + object.environments = []; + for (var j = 0; j < message.environments.length; ++j) + object.environments[j] = $root.google.cloud.dialogflow.v2.Environment.toObject(message.environments[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListEnvironmentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListEnvironmentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEnvironmentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListEnvironmentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEnvironmentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListEnvironmentsResponse"; + }; + + return ListEnvironmentsResponse; + })(); + + v2.GetEnvironmentRequest = (function() { + + /** + * Properties of a GetEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetEnvironmentRequest + * @property {string|null} [name] GetEnvironmentRequest name + */ + + /** + * Constructs a new GetEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetEnvironmentRequest. + * @implements IGetEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetEnvironmentRequest=} [properties] Properties to set + */ + function GetEnvironmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEnvironmentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @instance + */ + GetEnvironmentRequest.prototype.name = ""; + + /** + * Creates a new GetEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetEnvironmentRequest} GetEnvironmentRequest instance + */ + GetEnvironmentRequest.create = function create(properties) { + return new GetEnvironmentRequest(properties); + }; + + /** + * Encodes the specified GetEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetEnvironmentRequest} message GetEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentRequest.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 GetEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetEnvironmentRequest} message GetEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetEnvironmentRequest} GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetEnvironmentRequest(); + 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 GetEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetEnvironmentRequest} GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEnvironmentRequest.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 GetEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetEnvironmentRequest} GetEnvironmentRequest + */ + GetEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetEnvironmentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.GetEnvironmentRequest} message GetEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEnvironmentRequest.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 GetEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + GetEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetEnvironmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetEnvironmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetEnvironmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetEnvironmentRequest"; + }; + + return GetEnvironmentRequest; + })(); + + v2.CreateEnvironmentRequest = (function() { + + /** + * Properties of a CreateEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateEnvironmentRequest + * @property {string|null} [parent] CreateEnvironmentRequest parent + * @property {google.cloud.dialogflow.v2.IEnvironment|null} [environment] CreateEnvironmentRequest environment + * @property {string|null} [environmentId] CreateEnvironmentRequest environmentId + */ + + /** + * Constructs a new CreateEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateEnvironmentRequest. + * @implements ICreateEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateEnvironmentRequest=} [properties] Properties to set + */ + function CreateEnvironmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateEnvironmentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @instance + */ + CreateEnvironmentRequest.prototype.parent = ""; + + /** + * CreateEnvironmentRequest environment. + * @member {google.cloud.dialogflow.v2.IEnvironment|null|undefined} environment + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @instance + */ + CreateEnvironmentRequest.prototype.environment = null; + + /** + * CreateEnvironmentRequest environmentId. + * @member {string} environmentId + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @instance + */ + CreateEnvironmentRequest.prototype.environmentId = ""; + + /** + * Creates a new CreateEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateEnvironmentRequest} CreateEnvironmentRequest instance + */ + CreateEnvironmentRequest.create = function create(properties) { + return new CreateEnvironmentRequest(properties); + }; + + /** + * Encodes the specified CreateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateEnvironmentRequest} message CreateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEnvironmentRequest.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.environment != null && Object.hasOwnProperty.call(message, "environment")) + $root.google.cloud.dialogflow.v2.Environment.encode(message.environment, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.environmentId != null && Object.hasOwnProperty.call(message, "environmentId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.environmentId); + return writer; + }; + + /** + * Encodes the specified CreateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateEnvironmentRequest} message CreateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateEnvironmentRequest} CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEnvironmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateEnvironmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.environment = $root.google.cloud.dialogflow.v2.Environment.decode(reader, reader.uint32()); + break; + } + case 3: { + message.environmentId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateEnvironmentRequest} CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateEnvironmentRequest.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.environment != null && message.hasOwnProperty("environment")) { + var error = $root.google.cloud.dialogflow.v2.Environment.verify(message.environment); + if (error) + return "environment." + error; + } + if (message.environmentId != null && message.hasOwnProperty("environmentId")) + if (!$util.isString(message.environmentId)) + return "environmentId: string expected"; + return null; + }; + + /** + * Creates a CreateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateEnvironmentRequest} CreateEnvironmentRequest + */ + CreateEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateEnvironmentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.environment != null) { + if (typeof object.environment !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateEnvironmentRequest.environment: object expected"); + message.environment = $root.google.cloud.dialogflow.v2.Environment.fromObject(object.environment); + } + if (object.environmentId != null) + message.environmentId = String(object.environmentId); + return message; + }; + + /** + * Creates a plain object from a CreateEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateEnvironmentRequest} message CreateEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateEnvironmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.environment = null; + object.environmentId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = $root.google.cloud.dialogflow.v2.Environment.toObject(message.environment, options); + if (message.environmentId != null && message.hasOwnProperty("environmentId")) + object.environmentId = message.environmentId; + return object; + }; + + /** + * Converts this CreateEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateEnvironmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateEnvironmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateEnvironmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateEnvironmentRequest"; + }; + + return CreateEnvironmentRequest; + })(); + + v2.UpdateEnvironmentRequest = (function() { + + /** + * Properties of an UpdateEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateEnvironmentRequest + * @property {google.cloud.dialogflow.v2.IEnvironment|null} [environment] UpdateEnvironmentRequest environment + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateEnvironmentRequest updateMask + * @property {boolean|null} [allowLoadToDraftAndDiscardChanges] UpdateEnvironmentRequest allowLoadToDraftAndDiscardChanges + */ + + /** + * Constructs a new UpdateEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateEnvironmentRequest. + * @implements IUpdateEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateEnvironmentRequest=} [properties] Properties to set + */ + function UpdateEnvironmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateEnvironmentRequest environment. + * @member {google.cloud.dialogflow.v2.IEnvironment|null|undefined} environment + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @instance + */ + UpdateEnvironmentRequest.prototype.environment = null; + + /** + * UpdateEnvironmentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @instance + */ + UpdateEnvironmentRequest.prototype.updateMask = null; + + /** + * UpdateEnvironmentRequest allowLoadToDraftAndDiscardChanges. + * @member {boolean} allowLoadToDraftAndDiscardChanges + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @instance + */ + UpdateEnvironmentRequest.prototype.allowLoadToDraftAndDiscardChanges = false; + + /** + * Creates a new UpdateEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateEnvironmentRequest} UpdateEnvironmentRequest instance + */ + UpdateEnvironmentRequest.create = function create(properties) { + return new UpdateEnvironmentRequest(properties); + }; + + /** + * Encodes the specified UpdateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateEnvironmentRequest} message UpdateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEnvironmentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + $root.google.cloud.dialogflow.v2.Environment.encode(message.environment, 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(); + if (message.allowLoadToDraftAndDiscardChanges != null && Object.hasOwnProperty.call(message, "allowLoadToDraftAndDiscardChanges")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowLoadToDraftAndDiscardChanges); + return writer; + }; + + /** + * Encodes the specified UpdateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateEnvironmentRequest} message UpdateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateEnvironmentRequest} UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEnvironmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateEnvironmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.environment = $root.google.cloud.dialogflow.v2.Environment.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowLoadToDraftAndDiscardChanges = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateEnvironmentRequest} UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateEnvironmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.environment != null && message.hasOwnProperty("environment")) { + var error = $root.google.cloud.dialogflow.v2.Environment.verify(message.environment); + if (error) + return "environment." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.allowLoadToDraftAndDiscardChanges != null && message.hasOwnProperty("allowLoadToDraftAndDiscardChanges")) + if (typeof message.allowLoadToDraftAndDiscardChanges !== "boolean") + return "allowLoadToDraftAndDiscardChanges: boolean expected"; + return null; + }; + + /** + * Creates an UpdateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateEnvironmentRequest} UpdateEnvironmentRequest + */ + UpdateEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateEnvironmentRequest(); + if (object.environment != null) { + if (typeof object.environment !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateEnvironmentRequest.environment: object expected"); + message.environment = $root.google.cloud.dialogflow.v2.Environment.fromObject(object.environment); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateEnvironmentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.allowLoadToDraftAndDiscardChanges != null) + message.allowLoadToDraftAndDiscardChanges = Boolean(object.allowLoadToDraftAndDiscardChanges); + return message; + }; + + /** + * Creates a plain object from an UpdateEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateEnvironmentRequest} message UpdateEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateEnvironmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.environment = null; + object.updateMask = null; + object.allowLoadToDraftAndDiscardChanges = false; + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = $root.google.cloud.dialogflow.v2.Environment.toObject(message.environment, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.allowLoadToDraftAndDiscardChanges != null && message.hasOwnProperty("allowLoadToDraftAndDiscardChanges")) + object.allowLoadToDraftAndDiscardChanges = message.allowLoadToDraftAndDiscardChanges; + return object; + }; + + /** + * Converts this UpdateEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateEnvironmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateEnvironmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateEnvironmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateEnvironmentRequest"; + }; + + return UpdateEnvironmentRequest; + })(); + + v2.DeleteEnvironmentRequest = (function() { + + /** + * Properties of a DeleteEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteEnvironmentRequest + * @property {string|null} [name] DeleteEnvironmentRequest name + */ + + /** + * Constructs a new DeleteEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteEnvironmentRequest. + * @implements IDeleteEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteEnvironmentRequest=} [properties] Properties to set + */ + function DeleteEnvironmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteEnvironmentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @instance + */ + DeleteEnvironmentRequest.prototype.name = ""; + + /** + * Creates a new DeleteEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteEnvironmentRequest} DeleteEnvironmentRequest instance + */ + DeleteEnvironmentRequest.create = function create(properties) { + return new DeleteEnvironmentRequest(properties); + }; + + /** + * Encodes the specified DeleteEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteEnvironmentRequest} message DeleteEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEnvironmentRequest.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 DeleteEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteEnvironmentRequest} message DeleteEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteEnvironmentRequest} DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEnvironmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteEnvironmentRequest(); + 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 DeleteEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteEnvironmentRequest} DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteEnvironmentRequest.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 DeleteEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteEnvironmentRequest} DeleteEnvironmentRequest + */ + DeleteEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteEnvironmentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteEnvironmentRequest} message DeleteEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteEnvironmentRequest.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 DeleteEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteEnvironmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteEnvironmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteEnvironmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteEnvironmentRequest"; + }; + + return DeleteEnvironmentRequest; + })(); + + v2.GetEnvironmentHistoryRequest = (function() { + + /** + * Properties of a GetEnvironmentHistoryRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetEnvironmentHistoryRequest + * @property {string|null} [parent] GetEnvironmentHistoryRequest parent + * @property {number|null} [pageSize] GetEnvironmentHistoryRequest pageSize + * @property {string|null} [pageToken] GetEnvironmentHistoryRequest pageToken + */ + + /** + * Constructs a new GetEnvironmentHistoryRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetEnvironmentHistoryRequest. + * @implements IGetEnvironmentHistoryRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest=} [properties] Properties to set + */ + function GetEnvironmentHistoryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEnvironmentHistoryRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @instance + */ + GetEnvironmentHistoryRequest.prototype.parent = ""; + + /** + * GetEnvironmentHistoryRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @instance + */ + GetEnvironmentHistoryRequest.prototype.pageSize = 0; + + /** + * GetEnvironmentHistoryRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @instance + */ + GetEnvironmentHistoryRequest.prototype.pageToken = ""; + + /** + * Creates a new GetEnvironmentHistoryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest} GetEnvironmentHistoryRequest instance + */ + GetEnvironmentHistoryRequest.create = function create(properties) { + return new GetEnvironmentHistoryRequest(properties); + }; + + /** + * Encodes the specified GetEnvironmentHistoryRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest} message GetEnvironmentHistoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentHistoryRequest.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 GetEnvironmentHistoryRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest} message GetEnvironmentHistoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentHistoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEnvironmentHistoryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest} GetEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentHistoryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest(); + 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 GetEnvironmentHistoryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest} GetEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentHistoryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEnvironmentHistoryRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEnvironmentHistoryRequest.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 GetEnvironmentHistoryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest} GetEnvironmentHistoryRequest + */ + GetEnvironmentHistoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest(); + 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 GetEnvironmentHistoryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest} message GetEnvironmentHistoryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEnvironmentHistoryRequest.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 GetEnvironmentHistoryRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @instance + * @returns {Object.} JSON object + */ + GetEnvironmentHistoryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetEnvironmentHistoryRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetEnvironmentHistoryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest"; + }; + + return GetEnvironmentHistoryRequest; + })(); + + v2.EnvironmentHistory = (function() { + + /** + * Properties of an EnvironmentHistory. + * @memberof google.cloud.dialogflow.v2 + * @interface IEnvironmentHistory + * @property {string|null} [parent] EnvironmentHistory parent + * @property {Array.|null} [entries] EnvironmentHistory entries + * @property {string|null} [nextPageToken] EnvironmentHistory nextPageToken + */ + + /** + * Constructs a new EnvironmentHistory. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an EnvironmentHistory. + * @implements IEnvironmentHistory + * @constructor + * @param {google.cloud.dialogflow.v2.IEnvironmentHistory=} [properties] Properties to set + */ + function EnvironmentHistory(properties) { + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnvironmentHistory parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @instance + */ + EnvironmentHistory.prototype.parent = ""; + + /** + * EnvironmentHistory entries. + * @member {Array.} entries + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @instance + */ + EnvironmentHistory.prototype.entries = $util.emptyArray; + + /** + * EnvironmentHistory nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @instance + */ + EnvironmentHistory.prototype.nextPageToken = ""; + + /** + * Creates a new EnvironmentHistory instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @static + * @param {google.cloud.dialogflow.v2.IEnvironmentHistory=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.EnvironmentHistory} EnvironmentHistory instance + */ + EnvironmentHistory.create = function create(properties) { + return new EnvironmentHistory(properties); + }; + + /** + * Encodes the specified EnvironmentHistory message. Does not implicitly {@link google.cloud.dialogflow.v2.EnvironmentHistory.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @static + * @param {google.cloud.dialogflow.v2.IEnvironmentHistory} message EnvironmentHistory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnvironmentHistory.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.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.google.cloud.dialogflow.v2.EnvironmentHistory.Entry.encode(message.entries[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified EnvironmentHistory message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EnvironmentHistory.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @static + * @param {google.cloud.dialogflow.v2.IEnvironmentHistory} message EnvironmentHistory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnvironmentHistory.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnvironmentHistory message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.EnvironmentHistory} EnvironmentHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnvironmentHistory.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.EnvironmentHistory(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.google.cloud.dialogflow.v2.EnvironmentHistory.Entry.decode(reader, reader.uint32())); + break; + } + case 3: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnvironmentHistory message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.EnvironmentHistory} EnvironmentHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnvironmentHistory.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnvironmentHistory message. + * @function verify + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnvironmentHistory.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.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.EnvironmentHistory.Entry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates an EnvironmentHistory message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.EnvironmentHistory} EnvironmentHistory + */ + EnvironmentHistory.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.EnvironmentHistory) + return object; + var message = new $root.google.cloud.dialogflow.v2.EnvironmentHistory(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".google.cloud.dialogflow.v2.EnvironmentHistory.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.EnvironmentHistory.entries: object expected"); + message.entries[i] = $root.google.cloud.dialogflow.v2.EnvironmentHistory.Entry.fromObject(object.entries[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from an EnvironmentHistory message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @static + * @param {google.cloud.dialogflow.v2.EnvironmentHistory} message EnvironmentHistory + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnvironmentHistory.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (options.defaults) { + object.parent = ""; + object.nextPageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.google.cloud.dialogflow.v2.EnvironmentHistory.Entry.toObject(message.entries[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this EnvironmentHistory to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @instance + * @returns {Object.} JSON object + */ + EnvironmentHistory.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnvironmentHistory + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnvironmentHistory.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.EnvironmentHistory"; + }; + + EnvironmentHistory.Entry = (function() { + + /** + * Properties of an Entry. + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @interface IEntry + * @property {string|null} [agentVersion] Entry agentVersion + * @property {string|null} [description] Entry description + * @property {google.protobuf.ITimestamp|null} [createTime] Entry createTime + */ + + /** + * Constructs a new Entry. + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory + * @classdesc Represents an Entry. + * @implements IEntry + * @constructor + * @param {google.cloud.dialogflow.v2.EnvironmentHistory.IEntry=} [properties] Properties to set + */ + function Entry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entry agentVersion. + * @member {string} agentVersion + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @instance + */ + Entry.prototype.agentVersion = ""; + + /** + * Entry description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @instance + */ + Entry.prototype.description = ""; + + /** + * Entry createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @instance + */ + Entry.prototype.createTime = null; + + /** + * Creates a new Entry instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @static + * @param {google.cloud.dialogflow.v2.EnvironmentHistory.IEntry=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.EnvironmentHistory.Entry} Entry instance + */ + Entry.create = function create(properties) { + return new Entry(properties); + }; + + /** + * Encodes the specified Entry message. Does not implicitly {@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @static + * @param {google.cloud.dialogflow.v2.EnvironmentHistory.IEntry} message Entry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agentVersion != null && Object.hasOwnProperty.call(message, "agentVersion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.agentVersion); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Entry message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @static + * @param {google.cloud.dialogflow.v2.EnvironmentHistory.IEntry} message Entry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.EnvironmentHistory.Entry} Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.EnvironmentHistory.Entry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agentVersion = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.EnvironmentHistory.Entry} Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entry message. + * @function verify + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agentVersion != null && message.hasOwnProperty("agentVersion")) + if (!$util.isString(message.agentVersion)) + return "agentVersion: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates an Entry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.EnvironmentHistory.Entry} Entry + */ + Entry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.EnvironmentHistory.Entry) + return object; + var message = new $root.google.cloud.dialogflow.v2.EnvironmentHistory.Entry(); + if (object.agentVersion != null) + message.agentVersion = String(object.agentVersion); + if (object.description != null) + message.description = String(object.description); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.EnvironmentHistory.Entry.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from an Entry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @static + * @param {google.cloud.dialogflow.v2.EnvironmentHistory.Entry} message Entry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.agentVersion = ""; + object.description = ""; + object.createTime = null; + } + if (message.agentVersion != null && message.hasOwnProperty("agentVersion")) + object.agentVersion = message.agentVersion; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this Entry to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @instance + * @returns {Object.} JSON object + */ + Entry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Entry + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.EnvironmentHistory.Entry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.EnvironmentHistory.Entry"; + }; + + return Entry; + })(); + + return EnvironmentHistory; + })(); + + v2.Fulfillments = (function() { + + /** + * Constructs a new Fulfillments service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Fulfillments + * @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 Fulfillments(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Fulfillments.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Fulfillments; + + /** + * Creates new Fulfillments service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Fulfillments + * @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 {Fulfillments} RPC service. Useful where requests and/or responses are streamed. + */ + Fulfillments.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Fulfillments|getFulfillment}. + * @memberof google.cloud.dialogflow.v2.Fulfillments + * @typedef GetFulfillmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Fulfillment} [response] Fulfillment + */ + + /** + * Calls GetFulfillment. + * @function getFulfillment + * @memberof google.cloud.dialogflow.v2.Fulfillments + * @instance + * @param {google.cloud.dialogflow.v2.IGetFulfillmentRequest} request GetFulfillmentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Fulfillments.GetFulfillmentCallback} callback Node-style callback called with the error, if any, and Fulfillment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Fulfillments.prototype.getFulfillment = function getFulfillment(request, callback) { + return this.rpcCall(getFulfillment, $root.google.cloud.dialogflow.v2.GetFulfillmentRequest, $root.google.cloud.dialogflow.v2.Fulfillment, request, callback); + }, "name", { value: "GetFulfillment" }); + + /** + * Calls GetFulfillment. + * @function getFulfillment + * @memberof google.cloud.dialogflow.v2.Fulfillments + * @instance + * @param {google.cloud.dialogflow.v2.IGetFulfillmentRequest} request GetFulfillmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Fulfillments|updateFulfillment}. + * @memberof google.cloud.dialogflow.v2.Fulfillments + * @typedef UpdateFulfillmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Fulfillment} [response] Fulfillment + */ + + /** + * Calls UpdateFulfillment. + * @function updateFulfillment + * @memberof google.cloud.dialogflow.v2.Fulfillments + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateFulfillmentRequest} request UpdateFulfillmentRequest message or plain object + * @param {google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillmentCallback} callback Node-style callback called with the error, if any, and Fulfillment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Fulfillments.prototype.updateFulfillment = function updateFulfillment(request, callback) { + return this.rpcCall(updateFulfillment, $root.google.cloud.dialogflow.v2.UpdateFulfillmentRequest, $root.google.cloud.dialogflow.v2.Fulfillment, request, callback); + }, "name", { value: "UpdateFulfillment" }); + + /** + * Calls UpdateFulfillment. + * @function updateFulfillment + * @memberof google.cloud.dialogflow.v2.Fulfillments + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateFulfillmentRequest} request UpdateFulfillmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Fulfillments; + })(); + + v2.Fulfillment = (function() { + + /** + * Properties of a Fulfillment. + * @memberof google.cloud.dialogflow.v2 + * @interface IFulfillment + * @property {string|null} [name] Fulfillment name + * @property {string|null} [displayName] Fulfillment displayName + * @property {google.cloud.dialogflow.v2.Fulfillment.IGenericWebService|null} [genericWebService] Fulfillment genericWebService + * @property {boolean|null} [enabled] Fulfillment enabled + * @property {Array.|null} [features] Fulfillment features + */ + + /** + * Constructs a new Fulfillment. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Fulfillment. + * @implements IFulfillment + * @constructor + * @param {google.cloud.dialogflow.v2.IFulfillment=} [properties] Properties to set + */ + function Fulfillment(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]]; + } + + /** + * Fulfillment name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @instance + */ + Fulfillment.prototype.name = ""; + + /** + * Fulfillment displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @instance + */ + Fulfillment.prototype.displayName = ""; + + /** + * Fulfillment genericWebService. + * @member {google.cloud.dialogflow.v2.Fulfillment.IGenericWebService|null|undefined} genericWebService + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @instance + */ + Fulfillment.prototype.genericWebService = null; + + /** + * Fulfillment enabled. + * @member {boolean} enabled + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @instance + */ + Fulfillment.prototype.enabled = false; + + /** + * Fulfillment features. + * @member {Array.} features + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @instance + */ + Fulfillment.prototype.features = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Fulfillment fulfillment. + * @member {"genericWebService"|undefined} fulfillment + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @instance + */ + Object.defineProperty(Fulfillment.prototype, "fulfillment", { + get: $util.oneOfGetter($oneOfFields = ["genericWebService"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Fulfillment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @static + * @param {google.cloud.dialogflow.v2.IFulfillment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Fulfillment} Fulfillment instance + */ + Fulfillment.create = function create(properties) { + return new Fulfillment(properties); + }; + + /** + * Encodes the specified Fulfillment message. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @static + * @param {google.cloud.dialogflow.v2.IFulfillment} message Fulfillment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fulfillment.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.genericWebService != null && Object.hasOwnProperty.call(message, "genericWebService")) + $root.google.cloud.dialogflow.v2.Fulfillment.GenericWebService.encode(message.genericWebService, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enabled); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.dialogflow.v2.Fulfillment.Feature.encode(message.features[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Fulfillment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @static + * @param {google.cloud.dialogflow.v2.IFulfillment} message Fulfillment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fulfillment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Fulfillment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Fulfillment} Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fulfillment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Fulfillment(); + 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.genericWebService = $root.google.cloud.dialogflow.v2.Fulfillment.GenericWebService.decode(reader, reader.uint32()); + break; + } + case 4: { + message.enabled = reader.bool(); + break; + } + case 5: { + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.dialogflow.v2.Fulfillment.Feature.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Fulfillment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Fulfillment} Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fulfillment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Fulfillment message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Fulfillment.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.genericWebService != null && message.hasOwnProperty("genericWebService")) { + properties.fulfillment = 1; + { + var error = $root.google.cloud.dialogflow.v2.Fulfillment.GenericWebService.verify(message.genericWebService); + if (error) + return "genericWebService." + error; + } + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + 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.dialogflow.v2.Fulfillment.Feature.verify(message.features[i]); + if (error) + return "features." + error; + } + } + return null; + }; + + /** + * Creates a Fulfillment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Fulfillment} Fulfillment + */ + Fulfillment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Fulfillment) + return object; + var message = new $root.google.cloud.dialogflow.v2.Fulfillment(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.genericWebService != null) { + if (typeof object.genericWebService !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Fulfillment.genericWebService: object expected"); + message.genericWebService = $root.google.cloud.dialogflow.v2.Fulfillment.GenericWebService.fromObject(object.genericWebService); + } + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.dialogflow.v2.Fulfillment.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Fulfillment.features: object expected"); + message.features[i] = $root.google.cloud.dialogflow.v2.Fulfillment.Feature.fromObject(object.features[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Fulfillment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @static + * @param {google.cloud.dialogflow.v2.Fulfillment} message Fulfillment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Fulfillment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.features = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.enabled = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.genericWebService != null && message.hasOwnProperty("genericWebService")) { + object.genericWebService = $root.google.cloud.dialogflow.v2.Fulfillment.GenericWebService.toObject(message.genericWebService, options); + if (options.oneofs) + object.fulfillment = "genericWebService"; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.dialogflow.v2.Fulfillment.Feature.toObject(message.features[j], options); + } + return object; + }; + + /** + * Converts this Fulfillment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @instance + * @returns {Object.} JSON object + */ + Fulfillment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Fulfillment + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Fulfillment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Fulfillment"; + }; + + Fulfillment.GenericWebService = (function() { + + /** + * Properties of a GenericWebService. + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @interface IGenericWebService + * @property {string|null} [uri] GenericWebService uri + * @property {string|null} [username] GenericWebService username + * @property {string|null} [password] GenericWebService password + * @property {Object.|null} [requestHeaders] GenericWebService requestHeaders + * @property {boolean|null} [isCloudFunction] GenericWebService isCloudFunction + */ + + /** + * Constructs a new GenericWebService. + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @classdesc Represents a GenericWebService. + * @implements IGenericWebService + * @constructor + * @param {google.cloud.dialogflow.v2.Fulfillment.IGenericWebService=} [properties] Properties to set + */ + function GenericWebService(properties) { + this.requestHeaders = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenericWebService uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.uri = ""; + + /** + * GenericWebService username. + * @member {string} username + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.username = ""; + + /** + * GenericWebService password. + * @member {string} password + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.password = ""; + + /** + * GenericWebService requestHeaders. + * @member {Object.} requestHeaders + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.requestHeaders = $util.emptyObject; + + /** + * GenericWebService isCloudFunction. + * @member {boolean} isCloudFunction + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.isCloudFunction = false; + + /** + * Creates a new GenericWebService instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @static + * @param {google.cloud.dialogflow.v2.Fulfillment.IGenericWebService=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Fulfillment.GenericWebService} GenericWebService instance + */ + GenericWebService.create = function create(properties) { + return new GenericWebService(properties); + }; + + /** + * Encodes the specified GenericWebService message. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.GenericWebService.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @static + * @param {google.cloud.dialogflow.v2.Fulfillment.IGenericWebService} message GenericWebService message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenericWebService.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.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); + if (message.requestHeaders != null && Object.hasOwnProperty.call(message, "requestHeaders")) + for (var keys = Object.keys(message.requestHeaders), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.requestHeaders[keys[i]]).ldelim(); + if (message.isCloudFunction != null && Object.hasOwnProperty.call(message, "isCloudFunction")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.isCloudFunction); + return writer; + }; + + /** + * Encodes the specified GenericWebService message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.GenericWebService.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @static + * @param {google.cloud.dialogflow.v2.Fulfillment.IGenericWebService} message GenericWebService message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenericWebService.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenericWebService message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Fulfillment.GenericWebService} GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenericWebService.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Fulfillment.GenericWebService(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.username = reader.string(); + break; + } + case 3: { + message.password = reader.string(); + break; + } + case 4: { + if (message.requestHeaders === $util.emptyObject) + message.requestHeaders = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.requestHeaders[key] = value; + break; + } + case 5: { + message.isCloudFunction = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenericWebService message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Fulfillment.GenericWebService} GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenericWebService.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenericWebService message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenericWebService.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.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.requestHeaders != null && message.hasOwnProperty("requestHeaders")) { + if (!$util.isObject(message.requestHeaders)) + return "requestHeaders: object expected"; + var key = Object.keys(message.requestHeaders); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.requestHeaders[key[i]])) + return "requestHeaders: string{k:string} expected"; + } + if (message.isCloudFunction != null && message.hasOwnProperty("isCloudFunction")) + if (typeof message.isCloudFunction !== "boolean") + return "isCloudFunction: boolean expected"; + return null; + }; + + /** + * Creates a GenericWebService message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Fulfillment.GenericWebService} GenericWebService + */ + GenericWebService.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Fulfillment.GenericWebService) + return object; + var message = new $root.google.cloud.dialogflow.v2.Fulfillment.GenericWebService(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + if (object.requestHeaders) { + if (typeof object.requestHeaders !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Fulfillment.GenericWebService.requestHeaders: object expected"); + message.requestHeaders = {}; + for (var keys = Object.keys(object.requestHeaders), i = 0; i < keys.length; ++i) + message.requestHeaders[keys[i]] = String(object.requestHeaders[keys[i]]); + } + if (object.isCloudFunction != null) + message.isCloudFunction = Boolean(object.isCloudFunction); + return message; + }; + + /** + * Creates a plain object from a GenericWebService message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @static + * @param {google.cloud.dialogflow.v2.Fulfillment.GenericWebService} message GenericWebService + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenericWebService.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.requestHeaders = {}; + if (options.defaults) { + object.uri = ""; + object.username = ""; + object.password = ""; + object.isCloudFunction = false; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + var keys2; + if (message.requestHeaders && (keys2 = Object.keys(message.requestHeaders)).length) { + object.requestHeaders = {}; + for (var j = 0; j < keys2.length; ++j) + object.requestHeaders[keys2[j]] = message.requestHeaders[keys2[j]]; + } + if (message.isCloudFunction != null && message.hasOwnProperty("isCloudFunction")) + object.isCloudFunction = message.isCloudFunction; + return object; + }; + + /** + * Converts this GenericWebService to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @instance + * @returns {Object.} JSON object + */ + GenericWebService.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenericWebService + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Fulfillment.GenericWebService + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenericWebService.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Fulfillment.GenericWebService"; + }; + + return GenericWebService; + })(); + + Fulfillment.Feature = (function() { + + /** + * Properties of a Feature. + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @interface IFeature + * @property {google.cloud.dialogflow.v2.Fulfillment.Feature.Type|null} [type] Feature type + */ + + /** + * Constructs a new Feature. + * @memberof google.cloud.dialogflow.v2.Fulfillment + * @classdesc Represents a Feature. + * @implements IFeature + * @constructor + * @param {google.cloud.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.Feature.Type} type + * @memberof google.cloud.dialogflow.v2.Fulfillment.Feature + * @instance + */ + Feature.prototype.type = 0; + + /** + * Creates a new Feature instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Fulfillment.Feature + * @static + * @param {google.cloud.dialogflow.v2.Fulfillment.IFeature=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Fulfillment.Feature} Feature instance + */ + Feature.create = function create(properties) { + return new Feature(properties); + }; + + /** + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.Feature.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Fulfillment.Feature + * @static + * @param {google.cloud.dialogflow.v2.Fulfillment.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); + return writer; + }; + + /** + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Fulfillment.Feature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Fulfillment.Feature + * @static + * @param {google.cloud.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.Feature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.Feature(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.int32(); + 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.dialogflow.v2.Fulfillment.Feature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.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: + break; + } + return null; + }; + + /** + * Creates a Feature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Fulfillment.Feature + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Fulfillment.Feature} Feature + */ + Feature.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Fulfillment.Feature) + return object; + var message = new $root.google.cloud.dialogflow.v2.Fulfillment.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 "SMALLTALK": + case 1: + message.type = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a Feature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Fulfillment.Feature + * @static + * @param {google.cloud.dialogflow.v2.Fulfillment.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; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.dialogflow.v2.Fulfillment.Feature.Type[message.type] === undefined ? message.type : $root.google.cloud.dialogflow.v2.Fulfillment.Feature.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this Feature to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.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.dialogflow.v2.Fulfillment.Feature"; + }; + + /** + * Type enum. + * @name google.cloud.dialogflow.v2.Fulfillment.Feature.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} SMALLTALK=1 SMALLTALK value + */ + Feature.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SMALLTALK"] = 1; + return values; + })(); + + return Feature; + })(); + + return Fulfillment; + })(); + + v2.GetFulfillmentRequest = (function() { + + /** + * Properties of a GetFulfillmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetFulfillmentRequest + * @property {string|null} [name] GetFulfillmentRequest name + */ + + /** + * Constructs a new GetFulfillmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetFulfillmentRequest. + * @implements IGetFulfillmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetFulfillmentRequest=} [properties] Properties to set + */ + function GetFulfillmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetFulfillmentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @instance + */ + GetFulfillmentRequest.prototype.name = ""; + + /** + * Creates a new GetFulfillmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetFulfillmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetFulfillmentRequest} GetFulfillmentRequest instance + */ + GetFulfillmentRequest.create = function create(properties) { + return new GetFulfillmentRequest(properties); + }; + + /** + * Encodes the specified GetFulfillmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetFulfillmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetFulfillmentRequest} message GetFulfillmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFulfillmentRequest.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 GetFulfillmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetFulfillmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetFulfillmentRequest} message GetFulfillmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFulfillmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetFulfillmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetFulfillmentRequest} GetFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFulfillmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetFulfillmentRequest(); + 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 GetFulfillmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetFulfillmentRequest} GetFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFulfillmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetFulfillmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetFulfillmentRequest.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 GetFulfillmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetFulfillmentRequest} GetFulfillmentRequest + */ + GetFulfillmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetFulfillmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetFulfillmentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetFulfillmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2.GetFulfillmentRequest} message GetFulfillmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetFulfillmentRequest.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 GetFulfillmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @instance + * @returns {Object.} JSON object + */ + GetFulfillmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetFulfillmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetFulfillmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetFulfillmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetFulfillmentRequest"; + }; + + return GetFulfillmentRequest; + })(); + + v2.UpdateFulfillmentRequest = (function() { + + /** + * Properties of an UpdateFulfillmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateFulfillmentRequest + * @property {google.cloud.dialogflow.v2.IFulfillment|null} [fulfillment] UpdateFulfillmentRequest fulfillment + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateFulfillmentRequest updateMask + */ + + /** + * Constructs a new UpdateFulfillmentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateFulfillmentRequest. + * @implements IUpdateFulfillmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateFulfillmentRequest=} [properties] Properties to set + */ + function UpdateFulfillmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateFulfillmentRequest fulfillment. + * @member {google.cloud.dialogflow.v2.IFulfillment|null|undefined} fulfillment + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @instance + */ + UpdateFulfillmentRequest.prototype.fulfillment = null; + + /** + * UpdateFulfillmentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @instance + */ + UpdateFulfillmentRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateFulfillmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateFulfillmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateFulfillmentRequest} UpdateFulfillmentRequest instance + */ + UpdateFulfillmentRequest.create = function create(properties) { + return new UpdateFulfillmentRequest(properties); + }; + + /** + * Encodes the specified UpdateFulfillmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateFulfillmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateFulfillmentRequest} message UpdateFulfillmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFulfillmentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fulfillment != null && Object.hasOwnProperty.call(message, "fulfillment")) + $root.google.cloud.dialogflow.v2.Fulfillment.encode(message.fulfillment, 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 UpdateFulfillmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateFulfillmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateFulfillmentRequest} message UpdateFulfillmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFulfillmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateFulfillmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateFulfillmentRequest} UpdateFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFulfillmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateFulfillmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.fulfillment = $root.google.cloud.dialogflow.v2.Fulfillment.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 UpdateFulfillmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateFulfillmentRequest} UpdateFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFulfillmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateFulfillmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateFulfillmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fulfillment != null && message.hasOwnProperty("fulfillment")) { + var error = $root.google.cloud.dialogflow.v2.Fulfillment.verify(message.fulfillment); + if (error) + return "fulfillment." + 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 UpdateFulfillmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateFulfillmentRequest} UpdateFulfillmentRequest + */ + UpdateFulfillmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateFulfillmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateFulfillmentRequest(); + if (object.fulfillment != null) { + if (typeof object.fulfillment !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateFulfillmentRequest.fulfillment: object expected"); + message.fulfillment = $root.google.cloud.dialogflow.v2.Fulfillment.fromObject(object.fulfillment); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateFulfillmentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateFulfillmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateFulfillmentRequest} message UpdateFulfillmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateFulfillmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fulfillment = null; + object.updateMask = null; + } + if (message.fulfillment != null && message.hasOwnProperty("fulfillment")) + object.fulfillment = $root.google.cloud.dialogflow.v2.Fulfillment.toObject(message.fulfillment, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateFulfillmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateFulfillmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateFulfillmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateFulfillmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateFulfillmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateFulfillmentRequest"; + }; + + return UpdateFulfillmentRequest; + })(); + + v2.HumanAgentAssistantEvent = (function() { + + /** + * Properties of a HumanAgentAssistantEvent. + * @memberof google.cloud.dialogflow.v2 + * @interface IHumanAgentAssistantEvent + * @property {string|null} [conversation] HumanAgentAssistantEvent conversation + * @property {string|null} [participant] HumanAgentAssistantEvent participant + * @property {Array.|null} [suggestionResults] HumanAgentAssistantEvent suggestionResults + */ + + /** + * Constructs a new HumanAgentAssistantEvent. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a HumanAgentAssistantEvent. + * @implements IHumanAgentAssistantEvent + * @constructor + * @param {google.cloud.dialogflow.v2.IHumanAgentAssistantEvent=} [properties] Properties to set + */ + function HumanAgentAssistantEvent(properties) { + this.suggestionResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HumanAgentAssistantEvent conversation. + * @member {string} conversation + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @instance + */ + HumanAgentAssistantEvent.prototype.conversation = ""; + + /** + * HumanAgentAssistantEvent participant. + * @member {string} participant + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @instance + */ + HumanAgentAssistantEvent.prototype.participant = ""; + + /** + * HumanAgentAssistantEvent suggestionResults. + * @member {Array.} suggestionResults + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @instance + */ + HumanAgentAssistantEvent.prototype.suggestionResults = $util.emptyArray; + + /** + * Creates a new HumanAgentAssistantEvent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @static + * @param {google.cloud.dialogflow.v2.IHumanAgentAssistantEvent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantEvent} HumanAgentAssistantEvent instance + */ + HumanAgentAssistantEvent.create = function create(properties) { + return new HumanAgentAssistantEvent(properties); + }; + + /** + * Encodes the specified HumanAgentAssistantEvent message. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantEvent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @static + * @param {google.cloud.dialogflow.v2.IHumanAgentAssistantEvent} message HumanAgentAssistantEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentAssistantEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversation != null && Object.hasOwnProperty.call(message, "conversation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversation); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.participant); + if (message.suggestionResults != null && message.suggestionResults.length) + for (var i = 0; i < message.suggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2.SuggestionResult.encode(message.suggestionResults[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HumanAgentAssistantEvent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.HumanAgentAssistantEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @static + * @param {google.cloud.dialogflow.v2.IHumanAgentAssistantEvent} message HumanAgentAssistantEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentAssistantEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HumanAgentAssistantEvent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantEvent} HumanAgentAssistantEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentAssistantEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantEvent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversation = reader.string(); + break; + } + case 3: { + message.participant = reader.string(); + break; + } + case 5: { + if (!(message.suggestionResults && message.suggestionResults.length)) + message.suggestionResults = []; + message.suggestionResults.push($root.google.cloud.dialogflow.v2.SuggestionResult.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HumanAgentAssistantEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantEvent} HumanAgentAssistantEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentAssistantEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HumanAgentAssistantEvent message. + * @function verify + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HumanAgentAssistantEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversation != null && message.hasOwnProperty("conversation")) + if (!$util.isString(message.conversation)) + return "conversation: string expected"; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.suggestionResults != null && message.hasOwnProperty("suggestionResults")) { + if (!Array.isArray(message.suggestionResults)) + return "suggestionResults: array expected"; + for (var i = 0; i < message.suggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SuggestionResult.verify(message.suggestionResults[i]); + if (error) + return "suggestionResults." + error; + } + } + return null; + }; + + /** + * Creates a HumanAgentAssistantEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.HumanAgentAssistantEvent} HumanAgentAssistantEvent + */ + HumanAgentAssistantEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.HumanAgentAssistantEvent) + return object; + var message = new $root.google.cloud.dialogflow.v2.HumanAgentAssistantEvent(); + if (object.conversation != null) + message.conversation = String(object.conversation); + if (object.participant != null) + message.participant = String(object.participant); + if (object.suggestionResults) { + if (!Array.isArray(object.suggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantEvent.suggestionResults: array expected"); + message.suggestionResults = []; + for (var i = 0; i < object.suggestionResults.length; ++i) { + if (typeof object.suggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.HumanAgentAssistantEvent.suggestionResults: object expected"); + message.suggestionResults[i] = $root.google.cloud.dialogflow.v2.SuggestionResult.fromObject(object.suggestionResults[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HumanAgentAssistantEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @static + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantEvent} message HumanAgentAssistantEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HumanAgentAssistantEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.suggestionResults = []; + if (options.defaults) { + object.conversation = ""; + object.participant = ""; + } + if (message.conversation != null && message.hasOwnProperty("conversation")) + object.conversation = message.conversation; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.suggestionResults && message.suggestionResults.length) { + object.suggestionResults = []; + for (var j = 0; j < message.suggestionResults.length; ++j) + object.suggestionResults[j] = $root.google.cloud.dialogflow.v2.SuggestionResult.toObject(message.suggestionResults[j], options); + } + return object; + }; + + /** + * Converts this HumanAgentAssistantEvent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @instance + * @returns {Object.} JSON object + */ + HumanAgentAssistantEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HumanAgentAssistantEvent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.HumanAgentAssistantEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanAgentAssistantEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.HumanAgentAssistantEvent"; + }; + + return HumanAgentAssistantEvent; + })(); + + v2.KnowledgeBases = (function() { + + /** + * Constructs a new KnowledgeBases service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a KnowledgeBases + * @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 KnowledgeBases(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (KnowledgeBases.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = KnowledgeBases; + + /** + * Creates new KnowledgeBases service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @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 {KnowledgeBases} RPC service. Useful where requests and/or responses are streamed. + */ + KnowledgeBases.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|listKnowledgeBases}. + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @typedef ListKnowledgeBasesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListKnowledgeBasesResponse} [response] ListKnowledgeBasesResponse + */ + + /** + * Calls ListKnowledgeBases. + * @function listKnowledgeBases + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesRequest} request ListKnowledgeBasesRequest message or plain object + * @param {google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBasesCallback} callback Node-style callback called with the error, if any, and ListKnowledgeBasesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.listKnowledgeBases = function listKnowledgeBases(request, callback) { + return this.rpcCall(listKnowledgeBases, $root.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest, $root.google.cloud.dialogflow.v2.ListKnowledgeBasesResponse, request, callback); + }, "name", { value: "ListKnowledgeBases" }); + + /** + * Calls ListKnowledgeBases. + * @function listKnowledgeBases + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesRequest} request ListKnowledgeBasesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|getKnowledgeBase}. + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @typedef GetKnowledgeBaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.KnowledgeBase} [response] KnowledgeBase + */ + + /** + * Calls GetKnowledgeBase. + * @function getKnowledgeBase + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest} request GetKnowledgeBaseRequest message or plain object + * @param {google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBaseCallback} callback Node-style callback called with the error, if any, and KnowledgeBase + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.getKnowledgeBase = function getKnowledgeBase(request, callback) { + return this.rpcCall(getKnowledgeBase, $root.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest, $root.google.cloud.dialogflow.v2.KnowledgeBase, request, callback); + }, "name", { value: "GetKnowledgeBase" }); + + /** + * Calls GetKnowledgeBase. + * @function getKnowledgeBase + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest} request GetKnowledgeBaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|createKnowledgeBase}. + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @typedef CreateKnowledgeBaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.KnowledgeBase} [response] KnowledgeBase + */ + + /** + * Calls CreateKnowledgeBase. + * @function createKnowledgeBase + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest} request CreateKnowledgeBaseRequest message or plain object + * @param {google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBaseCallback} callback Node-style callback called with the error, if any, and KnowledgeBase + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.createKnowledgeBase = function createKnowledgeBase(request, callback) { + return this.rpcCall(createKnowledgeBase, $root.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest, $root.google.cloud.dialogflow.v2.KnowledgeBase, request, callback); + }, "name", { value: "CreateKnowledgeBase" }); + + /** + * Calls CreateKnowledgeBase. + * @function createKnowledgeBase + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest} request CreateKnowledgeBaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|deleteKnowledgeBase}. + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @typedef DeleteKnowledgeBaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteKnowledgeBase. + * @function deleteKnowledgeBase + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest} request DeleteKnowledgeBaseRequest message or plain object + * @param {google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBaseCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.deleteKnowledgeBase = function deleteKnowledgeBase(request, callback) { + return this.rpcCall(deleteKnowledgeBase, $root.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteKnowledgeBase" }); + + /** + * Calls DeleteKnowledgeBase. + * @function deleteKnowledgeBase + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest} request DeleteKnowledgeBaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.KnowledgeBases|updateKnowledgeBase}. + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @typedef UpdateKnowledgeBaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.KnowledgeBase} [response] KnowledgeBase + */ + + /** + * Calls UpdateKnowledgeBase. + * @function updateKnowledgeBase + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest} request UpdateKnowledgeBaseRequest message or plain object + * @param {google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBaseCallback} callback Node-style callback called with the error, if any, and KnowledgeBase + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.updateKnowledgeBase = function updateKnowledgeBase(request, callback) { + return this.rpcCall(updateKnowledgeBase, $root.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest, $root.google.cloud.dialogflow.v2.KnowledgeBase, request, callback); + }, "name", { value: "UpdateKnowledgeBase" }); + + /** + * Calls UpdateKnowledgeBase. + * @function updateKnowledgeBase + * @memberof google.cloud.dialogflow.v2.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest} request UpdateKnowledgeBaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return KnowledgeBases; + })(); + + v2.KnowledgeBase = (function() { + + /** + * Properties of a KnowledgeBase. + * @memberof google.cloud.dialogflow.v2 + * @interface IKnowledgeBase + * @property {string|null} [name] KnowledgeBase name + * @property {string|null} [displayName] KnowledgeBase displayName + * @property {string|null} [languageCode] KnowledgeBase languageCode + */ + + /** + * Constructs a new KnowledgeBase. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a KnowledgeBase. + * @implements IKnowledgeBase + * @constructor + * @param {google.cloud.dialogflow.v2.IKnowledgeBase=} [properties] Properties to set + */ + function KnowledgeBase(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KnowledgeBase name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @instance + */ + KnowledgeBase.prototype.name = ""; + + /** + * KnowledgeBase displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @instance + */ + KnowledgeBase.prototype.displayName = ""; + + /** + * KnowledgeBase languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @instance + */ + KnowledgeBase.prototype.languageCode = ""; + + /** + * Creates a new KnowledgeBase instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @static + * @param {google.cloud.dialogflow.v2.IKnowledgeBase=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.KnowledgeBase} KnowledgeBase instance + */ + KnowledgeBase.create = function create(properties) { + return new KnowledgeBase(properties); + }; + + /** + * Encodes the specified KnowledgeBase message. Does not implicitly {@link google.cloud.dialogflow.v2.KnowledgeBase.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @static + * @param {google.cloud.dialogflow.v2.IKnowledgeBase} message KnowledgeBase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeBase.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified KnowledgeBase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.KnowledgeBase.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @static + * @param {google.cloud.dialogflow.v2.IKnowledgeBase} message KnowledgeBase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeBase.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KnowledgeBase message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.KnowledgeBase} KnowledgeBase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeBase.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.KnowledgeBase(); + 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 4: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KnowledgeBase message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.KnowledgeBase} KnowledgeBase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeBase.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KnowledgeBase message. + * @function verify + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KnowledgeBase.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a KnowledgeBase message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.KnowledgeBase} KnowledgeBase + */ + KnowledgeBase.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.KnowledgeBase) + return object; + var message = new $root.google.cloud.dialogflow.v2.KnowledgeBase(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a KnowledgeBase message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @static + * @param {google.cloud.dialogflow.v2.KnowledgeBase} message KnowledgeBase + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KnowledgeBase.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this KnowledgeBase to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @instance + * @returns {Object.} JSON object + */ + KnowledgeBase.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for KnowledgeBase + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.KnowledgeBase + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KnowledgeBase.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.KnowledgeBase"; + }; + + return KnowledgeBase; + })(); + + v2.ListKnowledgeBasesRequest = (function() { + + /** + * Properties of a ListKnowledgeBasesRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListKnowledgeBasesRequest + * @property {string|null} [parent] ListKnowledgeBasesRequest parent + * @property {number|null} [pageSize] ListKnowledgeBasesRequest pageSize + * @property {string|null} [pageToken] ListKnowledgeBasesRequest pageToken + * @property {string|null} [filter] ListKnowledgeBasesRequest filter + */ + + /** + * Constructs a new ListKnowledgeBasesRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListKnowledgeBasesRequest. + * @implements IListKnowledgeBasesRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesRequest=} [properties] Properties to set + */ + function ListKnowledgeBasesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKnowledgeBasesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @instance + */ + ListKnowledgeBasesRequest.prototype.parent = ""; + + /** + * ListKnowledgeBasesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @instance + */ + ListKnowledgeBasesRequest.prototype.pageSize = 0; + + /** + * ListKnowledgeBasesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @instance + */ + ListKnowledgeBasesRequest.prototype.pageToken = ""; + + /** + * ListKnowledgeBasesRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @instance + */ + ListKnowledgeBasesRequest.prototype.filter = ""; + + /** + * Creates a new ListKnowledgeBasesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListKnowledgeBasesRequest} ListKnowledgeBasesRequest instance + */ + ListKnowledgeBasesRequest.create = function create(properties) { + return new ListKnowledgeBasesRequest(properties); + }; + + /** + * Encodes the specified ListKnowledgeBasesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListKnowledgeBasesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesRequest} message ListKnowledgeBasesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKnowledgeBasesRequest.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); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListKnowledgeBasesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListKnowledgeBasesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @static + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesRequest} message ListKnowledgeBasesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKnowledgeBasesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKnowledgeBasesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListKnowledgeBasesRequest} ListKnowledgeBasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKnowledgeBasesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest(); + 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; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKnowledgeBasesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListKnowledgeBasesRequest} ListKnowledgeBasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKnowledgeBasesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKnowledgeBasesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKnowledgeBasesRequest.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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListKnowledgeBasesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListKnowledgeBasesRequest} ListKnowledgeBasesRequest + */ + ListKnowledgeBasesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest(); + 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); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListKnowledgeBasesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @static + * @param {google.cloud.dialogflow.v2.ListKnowledgeBasesRequest} message ListKnowledgeBasesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKnowledgeBasesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + 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; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListKnowledgeBasesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @instance + * @returns {Object.} JSON object + */ + ListKnowledgeBasesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListKnowledgeBasesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListKnowledgeBasesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListKnowledgeBasesRequest"; + }; + + return ListKnowledgeBasesRequest; + })(); + + v2.ListKnowledgeBasesResponse = (function() { + + /** + * Properties of a ListKnowledgeBasesResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListKnowledgeBasesResponse + * @property {Array.|null} [knowledgeBases] ListKnowledgeBasesResponse knowledgeBases + * @property {string|null} [nextPageToken] ListKnowledgeBasesResponse nextPageToken + */ + + /** + * Constructs a new ListKnowledgeBasesResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListKnowledgeBasesResponse. + * @implements IListKnowledgeBasesResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesResponse=} [properties] Properties to set + */ + function ListKnowledgeBasesResponse(properties) { + this.knowledgeBases = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKnowledgeBasesResponse knowledgeBases. + * @member {Array.} knowledgeBases + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @instance + */ + ListKnowledgeBasesResponse.prototype.knowledgeBases = $util.emptyArray; + + /** + * ListKnowledgeBasesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @instance + */ + ListKnowledgeBasesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListKnowledgeBasesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListKnowledgeBasesResponse} ListKnowledgeBasesResponse instance + */ + ListKnowledgeBasesResponse.create = function create(properties) { + return new ListKnowledgeBasesResponse(properties); + }; + + /** + * Encodes the specified ListKnowledgeBasesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListKnowledgeBasesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesResponse} message ListKnowledgeBasesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKnowledgeBasesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.knowledgeBases != null && message.knowledgeBases.length) + for (var i = 0; i < message.knowledgeBases.length; ++i) + $root.google.cloud.dialogflow.v2.KnowledgeBase.encode(message.knowledgeBases[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 ListKnowledgeBasesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListKnowledgeBasesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @static + * @param {google.cloud.dialogflow.v2.IListKnowledgeBasesResponse} message ListKnowledgeBasesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKnowledgeBasesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKnowledgeBasesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListKnowledgeBasesResponse} ListKnowledgeBasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKnowledgeBasesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListKnowledgeBasesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.knowledgeBases && message.knowledgeBases.length)) + message.knowledgeBases = []; + message.knowledgeBases.push($root.google.cloud.dialogflow.v2.KnowledgeBase.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKnowledgeBasesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListKnowledgeBasesResponse} ListKnowledgeBasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKnowledgeBasesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKnowledgeBasesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKnowledgeBasesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.knowledgeBases != null && message.hasOwnProperty("knowledgeBases")) { + if (!Array.isArray(message.knowledgeBases)) + return "knowledgeBases: array expected"; + for (var i = 0; i < message.knowledgeBases.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.KnowledgeBase.verify(message.knowledgeBases[i]); + if (error) + return "knowledgeBases." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListKnowledgeBasesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListKnowledgeBasesResponse} ListKnowledgeBasesResponse + */ + ListKnowledgeBasesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListKnowledgeBasesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListKnowledgeBasesResponse(); + if (object.knowledgeBases) { + if (!Array.isArray(object.knowledgeBases)) + throw TypeError(".google.cloud.dialogflow.v2.ListKnowledgeBasesResponse.knowledgeBases: array expected"); + message.knowledgeBases = []; + for (var i = 0; i < object.knowledgeBases.length; ++i) { + if (typeof object.knowledgeBases[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListKnowledgeBasesResponse.knowledgeBases: object expected"); + message.knowledgeBases[i] = $root.google.cloud.dialogflow.v2.KnowledgeBase.fromObject(object.knowledgeBases[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListKnowledgeBasesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @static + * @param {google.cloud.dialogflow.v2.ListKnowledgeBasesResponse} message ListKnowledgeBasesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKnowledgeBasesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.knowledgeBases = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.knowledgeBases && message.knowledgeBases.length) { + object.knowledgeBases = []; + for (var j = 0; j < message.knowledgeBases.length; ++j) + object.knowledgeBases[j] = $root.google.cloud.dialogflow.v2.KnowledgeBase.toObject(message.knowledgeBases[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListKnowledgeBasesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @instance + * @returns {Object.} JSON object + */ + ListKnowledgeBasesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListKnowledgeBasesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListKnowledgeBasesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListKnowledgeBasesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListKnowledgeBasesResponse"; + }; + + return ListKnowledgeBasesResponse; + })(); + + v2.GetKnowledgeBaseRequest = (function() { + + /** + * Properties of a GetKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetKnowledgeBaseRequest + * @property {string|null} [name] GetKnowledgeBaseRequest name + */ + + /** + * Constructs a new GetKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetKnowledgeBaseRequest. + * @implements IGetKnowledgeBaseRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest=} [properties] Properties to set + */ + function GetKnowledgeBaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetKnowledgeBaseRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @instance + */ + GetKnowledgeBaseRequest.prototype.name = ""; + + /** + * Creates a new GetKnowledgeBaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetKnowledgeBaseRequest} GetKnowledgeBaseRequest instance + */ + GetKnowledgeBaseRequest.create = function create(properties) { + return new GetKnowledgeBaseRequest(properties); + }; + + /** + * Encodes the specified GetKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetKnowledgeBaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest} message GetKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKnowledgeBaseRequest.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 GetKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetKnowledgeBaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest} message GetKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKnowledgeBaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetKnowledgeBaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetKnowledgeBaseRequest} GetKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKnowledgeBaseRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest(); + 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 GetKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetKnowledgeBaseRequest} GetKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKnowledgeBaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetKnowledgeBaseRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetKnowledgeBaseRequest.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 GetKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetKnowledgeBaseRequest} GetKnowledgeBaseRequest + */ + GetKnowledgeBaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetKnowledgeBaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.GetKnowledgeBaseRequest} message GetKnowledgeBaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetKnowledgeBaseRequest.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 GetKnowledgeBaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @instance + * @returns {Object.} JSON object + */ + GetKnowledgeBaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetKnowledgeBaseRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetKnowledgeBaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetKnowledgeBaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetKnowledgeBaseRequest"; + }; + + return GetKnowledgeBaseRequest; + })(); + + v2.CreateKnowledgeBaseRequest = (function() { + + /** + * Properties of a CreateKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateKnowledgeBaseRequest + * @property {string|null} [parent] CreateKnowledgeBaseRequest parent + * @property {google.cloud.dialogflow.v2.IKnowledgeBase|null} [knowledgeBase] CreateKnowledgeBaseRequest knowledgeBase + */ + + /** + * Constructs a new CreateKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateKnowledgeBaseRequest. + * @implements ICreateKnowledgeBaseRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest=} [properties] Properties to set + */ + function CreateKnowledgeBaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateKnowledgeBaseRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @instance + */ + CreateKnowledgeBaseRequest.prototype.parent = ""; + + /** + * CreateKnowledgeBaseRequest knowledgeBase. + * @member {google.cloud.dialogflow.v2.IKnowledgeBase|null|undefined} knowledgeBase + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @instance + */ + CreateKnowledgeBaseRequest.prototype.knowledgeBase = null; + + /** + * Creates a new CreateKnowledgeBaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest} CreateKnowledgeBaseRequest instance + */ + CreateKnowledgeBaseRequest.create = function create(properties) { + return new CreateKnowledgeBaseRequest(properties); + }; + + /** + * Encodes the specified CreateKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest} message CreateKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKnowledgeBaseRequest.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.knowledgeBase != null && Object.hasOwnProperty.call(message, "knowledgeBase")) + $root.google.cloud.dialogflow.v2.KnowledgeBase.encode(message.knowledgeBase, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest} message CreateKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKnowledgeBaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateKnowledgeBaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest} CreateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKnowledgeBaseRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.knowledgeBase = $root.google.cloud.dialogflow.v2.KnowledgeBase.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest} CreateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKnowledgeBaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateKnowledgeBaseRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateKnowledgeBaseRequest.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.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) { + var error = $root.google.cloud.dialogflow.v2.KnowledgeBase.verify(message.knowledgeBase); + if (error) + return "knowledgeBase." + error; + } + return null; + }; + + /** + * Creates a CreateKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest} CreateKnowledgeBaseRequest + */ + CreateKnowledgeBaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.knowledgeBase != null) { + if (typeof object.knowledgeBase !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest.knowledgeBase: object expected"); + message.knowledgeBase = $root.google.cloud.dialogflow.v2.KnowledgeBase.fromObject(object.knowledgeBase); + } + return message; + }; + + /** + * Creates a plain object from a CreateKnowledgeBaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest} message CreateKnowledgeBaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateKnowledgeBaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.knowledgeBase = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + object.knowledgeBase = $root.google.cloud.dialogflow.v2.KnowledgeBase.toObject(message.knowledgeBase, options); + return object; + }; + + /** + * Converts this CreateKnowledgeBaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @instance + * @returns {Object.} JSON object + */ + CreateKnowledgeBaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateKnowledgeBaseRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateKnowledgeBaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest"; + }; + + return CreateKnowledgeBaseRequest; + })(); + + v2.DeleteKnowledgeBaseRequest = (function() { + + /** + * Properties of a DeleteKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteKnowledgeBaseRequest + * @property {string|null} [name] DeleteKnowledgeBaseRequest name + * @property {boolean|null} [force] DeleteKnowledgeBaseRequest force + */ + + /** + * Constructs a new DeleteKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteKnowledgeBaseRequest. + * @implements IDeleteKnowledgeBaseRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest=} [properties] Properties to set + */ + function DeleteKnowledgeBaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteKnowledgeBaseRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @instance + */ + DeleteKnowledgeBaseRequest.prototype.name = ""; + + /** + * DeleteKnowledgeBaseRequest force. + * @member {boolean} force + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @instance + */ + DeleteKnowledgeBaseRequest.prototype.force = false; + + /** + * Creates a new DeleteKnowledgeBaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest} DeleteKnowledgeBaseRequest instance + */ + DeleteKnowledgeBaseRequest.create = function create(properties) { + return new DeleteKnowledgeBaseRequest(properties); + }; + + /** + * Encodes the specified DeleteKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest} message DeleteKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteKnowledgeBaseRequest.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.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.force); + return writer; + }; + + /** + * Encodes the specified DeleteKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest} message DeleteKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteKnowledgeBaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteKnowledgeBaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest} DeleteKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteKnowledgeBaseRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.force = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest} DeleteKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteKnowledgeBaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteKnowledgeBaseRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteKnowledgeBaseRequest.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.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a DeleteKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest} DeleteKnowledgeBaseRequest + */ + DeleteKnowledgeBaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a DeleteKnowledgeBaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest} message DeleteKnowledgeBaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteKnowledgeBaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.force = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this DeleteKnowledgeBaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteKnowledgeBaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteKnowledgeBaseRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteKnowledgeBaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest"; + }; + + return DeleteKnowledgeBaseRequest; + })(); + + v2.UpdateKnowledgeBaseRequest = (function() { + + /** + * Properties of an UpdateKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateKnowledgeBaseRequest + * @property {google.cloud.dialogflow.v2.IKnowledgeBase|null} [knowledgeBase] UpdateKnowledgeBaseRequest knowledgeBase + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateKnowledgeBaseRequest updateMask + */ + + /** + * Constructs a new UpdateKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateKnowledgeBaseRequest. + * @implements IUpdateKnowledgeBaseRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest=} [properties] Properties to set + */ + function UpdateKnowledgeBaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateKnowledgeBaseRequest knowledgeBase. + * @member {google.cloud.dialogflow.v2.IKnowledgeBase|null|undefined} knowledgeBase + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @instance + */ + UpdateKnowledgeBaseRequest.prototype.knowledgeBase = null; + + /** + * UpdateKnowledgeBaseRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @instance + */ + UpdateKnowledgeBaseRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateKnowledgeBaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest} UpdateKnowledgeBaseRequest instance + */ + UpdateKnowledgeBaseRequest.create = function create(properties) { + return new UpdateKnowledgeBaseRequest(properties); + }; + + /** + * Encodes the specified UpdateKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest} message UpdateKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateKnowledgeBaseRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.knowledgeBase != null && Object.hasOwnProperty.call(message, "knowledgeBase")) + $root.google.cloud.dialogflow.v2.KnowledgeBase.encode(message.knowledgeBase, 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 UpdateKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest} message UpdateKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateKnowledgeBaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateKnowledgeBaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest} UpdateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateKnowledgeBaseRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.knowledgeBase = $root.google.cloud.dialogflow.v2.KnowledgeBase.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 UpdateKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest} UpdateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateKnowledgeBaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateKnowledgeBaseRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateKnowledgeBaseRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) { + var error = $root.google.cloud.dialogflow.v2.KnowledgeBase.verify(message.knowledgeBase); + if (error) + return "knowledgeBase." + 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 UpdateKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest} UpdateKnowledgeBaseRequest + */ + UpdateKnowledgeBaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest(); + if (object.knowledgeBase != null) { + if (typeof object.knowledgeBase !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest.knowledgeBase: object expected"); + message.knowledgeBase = $root.google.cloud.dialogflow.v2.KnowledgeBase.fromObject(object.knowledgeBase); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateKnowledgeBaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest} message UpdateKnowledgeBaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateKnowledgeBaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.knowledgeBase = null; + object.updateMask = null; + } + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + object.knowledgeBase = $root.google.cloud.dialogflow.v2.KnowledgeBase.toObject(message.knowledgeBase, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateKnowledgeBaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateKnowledgeBaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateKnowledgeBaseRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateKnowledgeBaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest"; + }; + + return UpdateKnowledgeBaseRequest; + })(); + + v2.Versions = (function() { + + /** + * Constructs a new Versions service. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Versions + * @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 Versions(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Versions.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Versions; + + /** + * Creates new Versions service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2.Versions + * @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 {Versions} RPC service. Useful where requests and/or responses are streamed. + */ + Versions.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|listVersions}. + * @memberof google.cloud.dialogflow.v2.Versions + * @typedef ListVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.ListVersionsResponse} [response] ListVersionsResponse + */ + + /** + * Calls ListVersions. + * @function listVersions + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.IListVersionsRequest} request ListVersionsRequest message or plain object + * @param {google.cloud.dialogflow.v2.Versions.ListVersionsCallback} callback Node-style callback called with the error, if any, and ListVersionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.listVersions = function listVersions(request, callback) { + return this.rpcCall(listVersions, $root.google.cloud.dialogflow.v2.ListVersionsRequest, $root.google.cloud.dialogflow.v2.ListVersionsResponse, request, callback); + }, "name", { value: "ListVersions" }); + + /** + * Calls ListVersions. + * @function listVersions + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.IListVersionsRequest} request ListVersionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|getVersion}. + * @memberof google.cloud.dialogflow.v2.Versions + * @typedef GetVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Version} [response] Version + */ + + /** + * Calls GetVersion. + * @function getVersion + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.IGetVersionRequest} request GetVersionRequest message or plain object + * @param {google.cloud.dialogflow.v2.Versions.GetVersionCallback} callback Node-style callback called with the error, if any, and Version + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.getVersion = function getVersion(request, callback) { + return this.rpcCall(getVersion, $root.google.cloud.dialogflow.v2.GetVersionRequest, $root.google.cloud.dialogflow.v2.Version, request, callback); + }, "name", { value: "GetVersion" }); + + /** + * Calls GetVersion. + * @function getVersion + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.IGetVersionRequest} request GetVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|createVersion}. + * @memberof google.cloud.dialogflow.v2.Versions + * @typedef CreateVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Version} [response] Version + */ + + /** + * Calls CreateVersion. + * @function createVersion + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.ICreateVersionRequest} request CreateVersionRequest message or plain object + * @param {google.cloud.dialogflow.v2.Versions.CreateVersionCallback} callback Node-style callback called with the error, if any, and Version + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.createVersion = function createVersion(request, callback) { + return this.rpcCall(createVersion, $root.google.cloud.dialogflow.v2.CreateVersionRequest, $root.google.cloud.dialogflow.v2.Version, request, callback); + }, "name", { value: "CreateVersion" }); + + /** + * Calls CreateVersion. + * @function createVersion + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.ICreateVersionRequest} request CreateVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|updateVersion}. + * @memberof google.cloud.dialogflow.v2.Versions + * @typedef UpdateVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2.Version} [response] Version + */ + + /** + * Calls UpdateVersion. + * @function updateVersion + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateVersionRequest} request UpdateVersionRequest message or plain object + * @param {google.cloud.dialogflow.v2.Versions.UpdateVersionCallback} callback Node-style callback called with the error, if any, and Version + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.updateVersion = function updateVersion(request, callback) { + return this.rpcCall(updateVersion, $root.google.cloud.dialogflow.v2.UpdateVersionRequest, $root.google.cloud.dialogflow.v2.Version, request, callback); + }, "name", { value: "UpdateVersion" }); + + /** + * Calls UpdateVersion. + * @function updateVersion + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.IUpdateVersionRequest} request UpdateVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2.Versions|deleteVersion}. + * @memberof google.cloud.dialogflow.v2.Versions + * @typedef DeleteVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteVersion. + * @function deleteVersion + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteVersionRequest} request DeleteVersionRequest message or plain object + * @param {google.cloud.dialogflow.v2.Versions.DeleteVersionCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.deleteVersion = function deleteVersion(request, callback) { + return this.rpcCall(deleteVersion, $root.google.cloud.dialogflow.v2.DeleteVersionRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteVersion" }); + + /** + * Calls DeleteVersion. + * @function deleteVersion + * @memberof google.cloud.dialogflow.v2.Versions + * @instance + * @param {google.cloud.dialogflow.v2.IDeleteVersionRequest} request DeleteVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Versions; + })(); + + v2.Version = (function() { + + /** + * Properties of a Version. + * @memberof google.cloud.dialogflow.v2 + * @interface IVersion + * @property {string|null} [name] Version name + * @property {string|null} [description] Version description + * @property {number|null} [versionNumber] Version versionNumber + * @property {google.protobuf.ITimestamp|null} [createTime] Version createTime + * @property {google.cloud.dialogflow.v2.Version.VersionStatus|null} [status] Version status + */ + + /** + * Constructs a new Version. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a Version. + * @implements IVersion + * @constructor + * @param {google.cloud.dialogflow.v2.IVersion=} [properties] Properties to set + */ + function Version(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Version name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.Version + * @instance + */ + Version.prototype.name = ""; + + /** + * Version description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2.Version + * @instance + */ + Version.prototype.description = ""; + + /** + * Version versionNumber. + * @member {number} versionNumber + * @memberof google.cloud.dialogflow.v2.Version + * @instance + */ + Version.prototype.versionNumber = 0; + + /** + * Version createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2.Version + * @instance + */ + Version.prototype.createTime = null; + + /** + * Version status. + * @member {google.cloud.dialogflow.v2.Version.VersionStatus} status + * @memberof google.cloud.dialogflow.v2.Version + * @instance + */ + Version.prototype.status = 0; + + /** + * Creates a new Version instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.Version + * @static + * @param {google.cloud.dialogflow.v2.IVersion=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.Version} Version instance + */ + Version.create = function create(properties) { + return new Version(properties); + }; + + /** + * Encodes the specified Version message. Does not implicitly {@link google.cloud.dialogflow.v2.Version.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.Version + * @static + * @param {google.cloud.dialogflow.v2.IVersion} message Version message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Version.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.versionNumber != null && Object.hasOwnProperty.call(message, "versionNumber")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.versionNumber); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.status); + return writer; + }; + + /** + * Encodes the specified Version message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.Version.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.Version + * @static + * @param {google.cloud.dialogflow.v2.IVersion} message Version message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Version.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Version message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.Version + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.Version} Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Version.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.Version(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.versionNumber = reader.int32(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.status = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Version message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.Version + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.Version} Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Version.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Version message. + * @function verify + * @memberof google.cloud.dialogflow.v2.Version + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Version.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.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) + if (!$util.isInteger(message.versionNumber)) + return "versionNumber: integer expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a Version message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.Version + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.Version} Version + */ + Version.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.Version) + return object; + var message = new $root.google.cloud.dialogflow.v2.Version(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.versionNumber != null) + message.versionNumber = object.versionNumber | 0; + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2.Version.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + switch (object.status) { + default: + if (typeof object.status === "number") { + message.status = object.status; + break; + } + break; + case "VERSION_STATUS_UNSPECIFIED": + case 0: + message.status = 0; + break; + case "IN_PROGRESS": + case 1: + message.status = 1; + break; + case "READY": + case 2: + message.status = 2; + break; + case "FAILED": + case 3: + message.status = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a Version message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.Version + * @static + * @param {google.cloud.dialogflow.v2.Version} message Version + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Version.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.versionNumber = 0; + object.createTime = null; + object.status = options.enums === String ? "VERSION_STATUS_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) + object.versionNumber = message.versionNumber; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.google.cloud.dialogflow.v2.Version.VersionStatus[message.status] === undefined ? message.status : $root.google.cloud.dialogflow.v2.Version.VersionStatus[message.status] : message.status; + return object; + }; + + /** + * Converts this Version to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.Version + * @instance + * @returns {Object.} JSON object + */ + Version.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Version + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.Version + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Version.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.Version"; + }; + + /** + * VersionStatus enum. + * @name google.cloud.dialogflow.v2.Version.VersionStatus + * @enum {number} + * @property {number} VERSION_STATUS_UNSPECIFIED=0 VERSION_STATUS_UNSPECIFIED value + * @property {number} IN_PROGRESS=1 IN_PROGRESS value + * @property {number} READY=2 READY value + * @property {number} FAILED=3 FAILED value + */ + Version.VersionStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VERSION_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_PROGRESS"] = 1; + values[valuesById[2] = "READY"] = 2; + values[valuesById[3] = "FAILED"] = 3; + return values; + })(); + + return Version; + })(); + + v2.ListVersionsRequest = (function() { + + /** + * Properties of a ListVersionsRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IListVersionsRequest + * @property {string|null} [parent] ListVersionsRequest parent + * @property {number|null} [pageSize] ListVersionsRequest pageSize + * @property {string|null} [pageToken] ListVersionsRequest pageToken + */ + + /** + * Constructs a new ListVersionsRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListVersionsRequest. + * @implements IListVersionsRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IListVersionsRequest=} [properties] Properties to set + */ + function ListVersionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @instance + */ + ListVersionsRequest.prototype.parent = ""; + + /** + * ListVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @instance + */ + ListVersionsRequest.prototype.pageSize = 0; + + /** + * ListVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @instance + */ + ListVersionsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListVersionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListVersionsRequest} ListVersionsRequest instance + */ + ListVersionsRequest.create = function create(properties) { + return new ListVersionsRequest(properties); + }; + + /** + * Encodes the specified ListVersionsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.ListVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListVersionsRequest} message ListVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsRequest.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 ListVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.v2.IListVersionsRequest} message ListVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListVersionsRequest} ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListVersionsRequest(); + 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 ListVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListVersionsRequest} ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListVersionsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListVersionsRequest.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 ListVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListVersionsRequest} ListVersionsRequest + */ + ListVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListVersionsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListVersionsRequest(); + 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 ListVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.v2.ListVersionsRequest} message ListVersionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListVersionsRequest.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 ListVersionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListVersionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListVersionsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListVersionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListVersionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListVersionsRequest"; + }; + + return ListVersionsRequest; + })(); + + v2.ListVersionsResponse = (function() { + + /** + * Properties of a ListVersionsResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IListVersionsResponse + * @property {Array.|null} [versions] ListVersionsResponse versions + * @property {string|null} [nextPageToken] ListVersionsResponse nextPageToken + */ + + /** + * Constructs a new ListVersionsResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a ListVersionsResponse. + * @implements IListVersionsResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IListVersionsResponse=} [properties] Properties to set + */ + function ListVersionsResponse(properties) { + this.versions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListVersionsResponse versions. + * @member {Array.} versions + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @instance + */ + ListVersionsResponse.prototype.versions = $util.emptyArray; + + /** + * ListVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @instance + */ + ListVersionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListVersionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.ListVersionsResponse} ListVersionsResponse instance + */ + ListVersionsResponse.create = function create(properties) { + return new ListVersionsResponse(properties); + }; + + /** + * Encodes the specified ListVersionsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.ListVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListVersionsResponse} message ListVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.google.cloud.dialogflow.v2.Version.encode(message.versions[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 ListVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.ListVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.v2.IListVersionsResponse} message ListVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.ListVersionsResponse} ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.ListVersionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.dialogflow.v2.Version.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.ListVersionsResponse} ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListVersionsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListVersionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Version.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.ListVersionsResponse} ListVersionsResponse + */ + ListVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.ListVersionsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.ListVersionsResponse(); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".google.cloud.dialogflow.v2.ListVersionsResponse.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.ListVersionsResponse.versions: object expected"); + message.versions[i] = $root.google.cloud.dialogflow.v2.Version.fromObject(object.versions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.v2.ListVersionsResponse} message ListVersionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListVersionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.google.cloud.dialogflow.v2.Version.toObject(message.versions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListVersionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListVersionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListVersionsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.ListVersionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListVersionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.ListVersionsResponse"; + }; + + return ListVersionsResponse; + })(); + + v2.GetVersionRequest = (function() { + + /** + * Properties of a GetVersionRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IGetVersionRequest + * @property {string|null} [name] GetVersionRequest name + */ + + /** + * Constructs a new GetVersionRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a GetVersionRequest. + * @implements IGetVersionRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IGetVersionRequest=} [properties] Properties to set + */ + function GetVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetVersionRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @instance + */ + GetVersionRequest.prototype.name = ""; + + /** + * Creates a new GetVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.GetVersionRequest} GetVersionRequest instance + */ + GetVersionRequest.create = function create(properties) { + return new GetVersionRequest(properties); + }; + + /** + * Encodes the specified GetVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.GetVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetVersionRequest} message GetVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionRequest.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 GetVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.GetVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.IGetVersionRequest} message GetVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.GetVersionRequest} GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.GetVersionRequest(); + 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 GetVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.GetVersionRequest} GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetVersionRequest.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 GetVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.GetVersionRequest} GetVersionRequest + */ + GetVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.GetVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.GetVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.GetVersionRequest} message GetVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetVersionRequest.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 GetVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetVersionRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.GetVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.GetVersionRequest"; + }; + + return GetVersionRequest; + })(); + + v2.CreateVersionRequest = (function() { + + /** + * Properties of a CreateVersionRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface ICreateVersionRequest + * @property {string|null} [parent] CreateVersionRequest parent + * @property {google.cloud.dialogflow.v2.IVersion|null} [version] CreateVersionRequest version + */ + + /** + * Constructs a new CreateVersionRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a CreateVersionRequest. + * @implements ICreateVersionRequest + * @constructor + * @param {google.cloud.dialogflow.v2.ICreateVersionRequest=} [properties] Properties to set + */ + function CreateVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateVersionRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @instance + */ + CreateVersionRequest.prototype.parent = ""; + + /** + * CreateVersionRequest version. + * @member {google.cloud.dialogflow.v2.IVersion|null|undefined} version + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @instance + */ + CreateVersionRequest.prototype.version = null; + + /** + * Creates a new CreateVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.CreateVersionRequest} CreateVersionRequest instance + */ + CreateVersionRequest.create = function create(properties) { + return new CreateVersionRequest(properties); + }; + + /** + * Encodes the specified CreateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.CreateVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateVersionRequest} message CreateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVersionRequest.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.version != null && Object.hasOwnProperty.call(message, "version")) + $root.google.cloud.dialogflow.v2.Version.encode(message.version, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.CreateVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.ICreateVersionRequest} message CreateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.CreateVersionRequest} CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.CreateVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.version = $root.google.cloud.dialogflow.v2.Version.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.CreateVersionRequest} CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateVersionRequest.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.version != null && message.hasOwnProperty("version")) { + var error = $root.google.cloud.dialogflow.v2.Version.verify(message.version); + if (error) + return "version." + error; + } + return null; + }; + + /** + * Creates a CreateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.CreateVersionRequest} CreateVersionRequest + */ + CreateVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.CreateVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.CreateVersionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".google.cloud.dialogflow.v2.CreateVersionRequest.version: object expected"); + message.version = $root.google.cloud.dialogflow.v2.Version.fromObject(object.version); + } + return message; + }; + + /** + * Creates a plain object from a CreateVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.CreateVersionRequest} message CreateVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.version = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.google.cloud.dialogflow.v2.Version.toObject(message.version, options); + return object; + }; + + /** + * Converts this CreateVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateVersionRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.CreateVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.CreateVersionRequest"; + }; + + return CreateVersionRequest; + })(); + + v2.UpdateVersionRequest = (function() { + + /** + * Properties of an UpdateVersionRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IUpdateVersionRequest + * @property {google.cloud.dialogflow.v2.IVersion|null} [version] UpdateVersionRequest version + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateVersionRequest updateMask + */ + + /** + * Constructs a new UpdateVersionRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an UpdateVersionRequest. + * @implements IUpdateVersionRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IUpdateVersionRequest=} [properties] Properties to set + */ + function UpdateVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateVersionRequest version. + * @member {google.cloud.dialogflow.v2.IVersion|null|undefined} version + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @instance + */ + UpdateVersionRequest.prototype.version = null; + + /** + * UpdateVersionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @instance + */ + UpdateVersionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.UpdateVersionRequest} UpdateVersionRequest instance + */ + UpdateVersionRequest.create = function create(properties) { + return new UpdateVersionRequest(properties); + }; + + /** + * Encodes the specified UpdateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateVersionRequest} message UpdateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.google.cloud.dialogflow.v2.Version.encode(message.version, 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 UpdateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.UpdateVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.IUpdateVersionRequest} message UpdateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.UpdateVersionRequest} UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.UpdateVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.version = $root.google.cloud.dialogflow.v2.Version.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 UpdateVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.UpdateVersionRequest} UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) { + var error = $root.google.cloud.dialogflow.v2.Version.verify(message.version); + if (error) + return "version." + 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 UpdateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.UpdateVersionRequest} UpdateVersionRequest + */ + UpdateVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.UpdateVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.UpdateVersionRequest(); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateVersionRequest.version: object expected"); + message.version = $root.google.cloud.dialogflow.v2.Version.fromObject(object.version); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2.UpdateVersionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.UpdateVersionRequest} message UpdateVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = null; + object.updateMask = null; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.google.cloud.dialogflow.v2.Version.toObject(message.version, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateVersionRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.UpdateVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.UpdateVersionRequest"; + }; + + return UpdateVersionRequest; + })(); + + v2.DeleteVersionRequest = (function() { + + /** + * Properties of a DeleteVersionRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IDeleteVersionRequest + * @property {string|null} [name] DeleteVersionRequest name + */ + + /** + * Constructs a new DeleteVersionRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a DeleteVersionRequest. + * @implements IDeleteVersionRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IDeleteVersionRequest=} [properties] Properties to set + */ + function DeleteVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteVersionRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @instance + */ + DeleteVersionRequest.prototype.name = ""; + + /** + * Creates a new DeleteVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.DeleteVersionRequest} DeleteVersionRequest instance + */ + DeleteVersionRequest.create = function create(properties) { + return new DeleteVersionRequest(properties); + }; + + /** + * Encodes the specified DeleteVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteVersionRequest} message DeleteVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteVersionRequest.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 DeleteVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.DeleteVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.IDeleteVersionRequest} message DeleteVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.DeleteVersionRequest} DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.DeleteVersionRequest(); + 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 DeleteVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.DeleteVersionRequest} DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteVersionRequest.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 DeleteVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.DeleteVersionRequest} DeleteVersionRequest + */ + DeleteVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.DeleteVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.DeleteVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.v2.DeleteVersionRequest} message DeleteVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteVersionRequest.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 DeleteVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteVersionRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.DeleteVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.DeleteVersionRequest"; + }; + + return DeleteVersionRequest; + })(); + + v2.WebhookRequest = (function() { + + /** + * Properties of a WebhookRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IWebhookRequest + * @property {string|null} [session] WebhookRequest session + * @property {string|null} [responseId] WebhookRequest responseId + * @property {google.cloud.dialogflow.v2.IQueryResult|null} [queryResult] WebhookRequest queryResult + * @property {google.cloud.dialogflow.v2.IOriginalDetectIntentRequest|null} [originalDetectIntentRequest] WebhookRequest originalDetectIntentRequest + */ + + /** + * Constructs a new WebhookRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a WebhookRequest. + * @implements IWebhookRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IWebhookRequest=} [properties] Properties to set + */ + function WebhookRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebhookRequest session. + * @member {string} session + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @instance + */ + WebhookRequest.prototype.session = ""; + + /** + * WebhookRequest responseId. + * @member {string} responseId + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @instance + */ + WebhookRequest.prototype.responseId = ""; + + /** + * WebhookRequest queryResult. + * @member {google.cloud.dialogflow.v2.IQueryResult|null|undefined} queryResult + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @instance + */ + WebhookRequest.prototype.queryResult = null; + + /** + * WebhookRequest originalDetectIntentRequest. + * @member {google.cloud.dialogflow.v2.IOriginalDetectIntentRequest|null|undefined} originalDetectIntentRequest + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @instance + */ + WebhookRequest.prototype.originalDetectIntentRequest = null; + + /** + * Creates a new WebhookRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @static + * @param {google.cloud.dialogflow.v2.IWebhookRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.WebhookRequest} WebhookRequest instance + */ + WebhookRequest.create = function create(properties) { + return new WebhookRequest(properties); + }; + + /** + * Encodes the specified WebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.WebhookRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @static + * @param {google.cloud.dialogflow.v2.IWebhookRequest} message WebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseId != null && Object.hasOwnProperty.call(message, "responseId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseId); + if (message.queryResult != null && Object.hasOwnProperty.call(message, "queryResult")) + $root.google.cloud.dialogflow.v2.QueryResult.encode(message.queryResult, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.originalDetectIntentRequest != null && Object.hasOwnProperty.call(message, "originalDetectIntentRequest")) + $root.google.cloud.dialogflow.v2.OriginalDetectIntentRequest.encode(message.originalDetectIntentRequest, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.session); + return writer; + }; + + /** + * Encodes the specified WebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.WebhookRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @static + * @param {google.cloud.dialogflow.v2.IWebhookRequest} message WebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.WebhookRequest} WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.WebhookRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.session = reader.string(); + break; + } + case 1: { + message.responseId = reader.string(); + break; + } + case 2: { + message.queryResult = $root.google.cloud.dialogflow.v2.QueryResult.decode(reader, reader.uint32()); + break; + } + case 3: { + message.originalDetectIntentRequest = $root.google.cloud.dialogflow.v2.OriginalDetectIntentRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.WebhookRequest} WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebhookRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebhookRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.responseId != null && message.hasOwnProperty("responseId")) + if (!$util.isString(message.responseId)) + return "responseId: string expected"; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + var error = $root.google.cloud.dialogflow.v2.QueryResult.verify(message.queryResult); + if (error) + return "queryResult." + error; + } + if (message.originalDetectIntentRequest != null && message.hasOwnProperty("originalDetectIntentRequest")) { + var error = $root.google.cloud.dialogflow.v2.OriginalDetectIntentRequest.verify(message.originalDetectIntentRequest); + if (error) + return "originalDetectIntentRequest." + error; + } + return null; + }; + + /** + * Creates a WebhookRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.WebhookRequest} WebhookRequest + */ + WebhookRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.WebhookRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.WebhookRequest(); + if (object.session != null) + message.session = String(object.session); + if (object.responseId != null) + message.responseId = String(object.responseId); + if (object.queryResult != null) { + if (typeof object.queryResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2.WebhookRequest.queryResult: object expected"); + message.queryResult = $root.google.cloud.dialogflow.v2.QueryResult.fromObject(object.queryResult); + } + if (object.originalDetectIntentRequest != null) { + if (typeof object.originalDetectIntentRequest !== "object") + throw TypeError(".google.cloud.dialogflow.v2.WebhookRequest.originalDetectIntentRequest: object expected"); + message.originalDetectIntentRequest = $root.google.cloud.dialogflow.v2.OriginalDetectIntentRequest.fromObject(object.originalDetectIntentRequest); + } + return message; + }; + + /** + * Creates a plain object from a WebhookRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @static + * @param {google.cloud.dialogflow.v2.WebhookRequest} message WebhookRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebhookRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.responseId = ""; + object.queryResult = null; + object.originalDetectIntentRequest = null; + object.session = ""; + } + if (message.responseId != null && message.hasOwnProperty("responseId")) + object.responseId = message.responseId; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) + object.queryResult = $root.google.cloud.dialogflow.v2.QueryResult.toObject(message.queryResult, options); + if (message.originalDetectIntentRequest != null && message.hasOwnProperty("originalDetectIntentRequest")) + object.originalDetectIntentRequest = $root.google.cloud.dialogflow.v2.OriginalDetectIntentRequest.toObject(message.originalDetectIntentRequest, options); + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + return object; + }; + + /** + * Converts this WebhookRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @instance + * @returns {Object.} JSON object + */ + WebhookRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WebhookRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.WebhookRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WebhookRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.WebhookRequest"; + }; + + return WebhookRequest; + })(); + + v2.WebhookResponse = (function() { + + /** + * Properties of a WebhookResponse. + * @memberof google.cloud.dialogflow.v2 + * @interface IWebhookResponse + * @property {string|null} [fulfillmentText] WebhookResponse fulfillmentText + * @property {Array.|null} [fulfillmentMessages] WebhookResponse fulfillmentMessages + * @property {string|null} [source] WebhookResponse source + * @property {google.protobuf.IStruct|null} [payload] WebhookResponse payload + * @property {Array.|null} [outputContexts] WebhookResponse outputContexts + * @property {google.cloud.dialogflow.v2.IEventInput|null} [followupEventInput] WebhookResponse followupEventInput + * @property {Array.|null} [sessionEntityTypes] WebhookResponse sessionEntityTypes + */ + + /** + * Constructs a new WebhookResponse. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents a WebhookResponse. + * @implements IWebhookResponse + * @constructor + * @param {google.cloud.dialogflow.v2.IWebhookResponse=} [properties] Properties to set + */ + function WebhookResponse(properties) { + this.fulfillmentMessages = []; + this.outputContexts = []; + this.sessionEntityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebhookResponse fulfillmentText. + * @member {string} fulfillmentText + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @instance + */ + WebhookResponse.prototype.fulfillmentText = ""; + + /** + * WebhookResponse fulfillmentMessages. + * @member {Array.} fulfillmentMessages + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @instance + */ + WebhookResponse.prototype.fulfillmentMessages = $util.emptyArray; + + /** + * WebhookResponse source. + * @member {string} source + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @instance + */ + WebhookResponse.prototype.source = ""; + + /** + * WebhookResponse payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @instance + */ + WebhookResponse.prototype.payload = null; + + /** + * WebhookResponse outputContexts. + * @member {Array.} outputContexts + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @instance + */ + WebhookResponse.prototype.outputContexts = $util.emptyArray; + + /** + * WebhookResponse followupEventInput. + * @member {google.cloud.dialogflow.v2.IEventInput|null|undefined} followupEventInput + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @instance + */ + WebhookResponse.prototype.followupEventInput = null; + + /** + * WebhookResponse sessionEntityTypes. + * @member {Array.} sessionEntityTypes + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @instance + */ + WebhookResponse.prototype.sessionEntityTypes = $util.emptyArray; + + /** + * Creates a new WebhookResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @static + * @param {google.cloud.dialogflow.v2.IWebhookResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.WebhookResponse} WebhookResponse instance + */ + WebhookResponse.create = function create(properties) { + return new WebhookResponse(properties); + }; + + /** + * Encodes the specified WebhookResponse message. Does not implicitly {@link google.cloud.dialogflow.v2.WebhookResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @static + * @param {google.cloud.dialogflow.v2.IWebhookResponse} message WebhookResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fulfillmentText != null && Object.hasOwnProperty.call(message, "fulfillmentText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fulfillmentText); + if (message.fulfillmentMessages != null && message.fulfillmentMessages.length) + for (var i = 0; i < message.fulfillmentMessages.length; ++i) + $root.google.cloud.dialogflow.v2.Intent.Message.encode(message.fulfillmentMessages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.source); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.outputContexts != null && message.outputContexts.length) + for (var i = 0; i < message.outputContexts.length; ++i) + $root.google.cloud.dialogflow.v2.Context.encode(message.outputContexts[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.followupEventInput != null && Object.hasOwnProperty.call(message, "followupEventInput")) + $root.google.cloud.dialogflow.v2.EventInput.encode(message.followupEventInput, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.sessionEntityTypes != null && message.sessionEntityTypes.length) + for (var i = 0; i < message.sessionEntityTypes.length; ++i) + $root.google.cloud.dialogflow.v2.SessionEntityType.encode(message.sessionEntityTypes[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WebhookResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.WebhookResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @static + * @param {google.cloud.dialogflow.v2.IWebhookResponse} message WebhookResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.WebhookResponse} WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.WebhookResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.fulfillmentText = reader.string(); + break; + } + case 2: { + if (!(message.fulfillmentMessages && message.fulfillmentMessages.length)) + message.fulfillmentMessages = []; + message.fulfillmentMessages.push($root.google.cloud.dialogflow.v2.Intent.Message.decode(reader, reader.uint32())); + break; + } + case 3: { + message.source = reader.string(); + break; + } + case 4: { + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.outputContexts && message.outputContexts.length)) + message.outputContexts = []; + message.outputContexts.push($root.google.cloud.dialogflow.v2.Context.decode(reader, reader.uint32())); + break; + } + case 6: { + message.followupEventInput = $root.google.cloud.dialogflow.v2.EventInput.decode(reader, reader.uint32()); + break; + } + case 10: { + if (!(message.sessionEntityTypes && message.sessionEntityTypes.length)) + message.sessionEntityTypes = []; + message.sessionEntityTypes.push($root.google.cloud.dialogflow.v2.SessionEntityType.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.WebhookResponse} WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebhookResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebhookResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fulfillmentText != null && message.hasOwnProperty("fulfillmentText")) + if (!$util.isString(message.fulfillmentText)) + return "fulfillmentText: string expected"; + if (message.fulfillmentMessages != null && message.hasOwnProperty("fulfillmentMessages")) { + if (!Array.isArray(message.fulfillmentMessages)) + return "fulfillmentMessages: array expected"; + for (var i = 0; i < message.fulfillmentMessages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Intent.Message.verify(message.fulfillmentMessages[i]); + if (error) + return "fulfillmentMessages." + error; + } + } + if (message.source != null && message.hasOwnProperty("source")) + if (!$util.isString(message.source)) + return "source: string expected"; + if (message.payload != null && message.hasOwnProperty("payload")) { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + if (message.outputContexts != null && message.hasOwnProperty("outputContexts")) { + if (!Array.isArray(message.outputContexts)) + return "outputContexts: array expected"; + for (var i = 0; i < message.outputContexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.Context.verify(message.outputContexts[i]); + if (error) + return "outputContexts." + error; + } + } + if (message.followupEventInput != null && message.hasOwnProperty("followupEventInput")) { + var error = $root.google.cloud.dialogflow.v2.EventInput.verify(message.followupEventInput); + if (error) + return "followupEventInput." + error; + } + if (message.sessionEntityTypes != null && message.hasOwnProperty("sessionEntityTypes")) { + if (!Array.isArray(message.sessionEntityTypes)) + return "sessionEntityTypes: array expected"; + for (var i = 0; i < message.sessionEntityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2.SessionEntityType.verify(message.sessionEntityTypes[i]); + if (error) + return "sessionEntityTypes." + error; + } + } + return null; + }; + + /** + * Creates a WebhookResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.WebhookResponse} WebhookResponse + */ + WebhookResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.WebhookResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2.WebhookResponse(); + if (object.fulfillmentText != null) + message.fulfillmentText = String(object.fulfillmentText); + if (object.fulfillmentMessages) { + if (!Array.isArray(object.fulfillmentMessages)) + throw TypeError(".google.cloud.dialogflow.v2.WebhookResponse.fulfillmentMessages: array expected"); + message.fulfillmentMessages = []; + for (var i = 0; i < object.fulfillmentMessages.length; ++i) { + if (typeof object.fulfillmentMessages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.WebhookResponse.fulfillmentMessages: object expected"); + message.fulfillmentMessages[i] = $root.google.cloud.dialogflow.v2.Intent.Message.fromObject(object.fulfillmentMessages[i]); + } + } + if (object.source != null) + message.source = String(object.source); + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.v2.WebhookResponse.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.outputContexts) { + if (!Array.isArray(object.outputContexts)) + throw TypeError(".google.cloud.dialogflow.v2.WebhookResponse.outputContexts: array expected"); + message.outputContexts = []; + for (var i = 0; i < object.outputContexts.length; ++i) { + if (typeof object.outputContexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.WebhookResponse.outputContexts: object expected"); + message.outputContexts[i] = $root.google.cloud.dialogflow.v2.Context.fromObject(object.outputContexts[i]); + } + } + if (object.followupEventInput != null) { + if (typeof object.followupEventInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2.WebhookResponse.followupEventInput: object expected"); + message.followupEventInput = $root.google.cloud.dialogflow.v2.EventInput.fromObject(object.followupEventInput); + } + if (object.sessionEntityTypes) { + if (!Array.isArray(object.sessionEntityTypes)) + throw TypeError(".google.cloud.dialogflow.v2.WebhookResponse.sessionEntityTypes: array expected"); + message.sessionEntityTypes = []; + for (var i = 0; i < object.sessionEntityTypes.length; ++i) { + if (typeof object.sessionEntityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2.WebhookResponse.sessionEntityTypes: object expected"); + message.sessionEntityTypes[i] = $root.google.cloud.dialogflow.v2.SessionEntityType.fromObject(object.sessionEntityTypes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a WebhookResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @static + * @param {google.cloud.dialogflow.v2.WebhookResponse} message WebhookResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebhookResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.fulfillmentMessages = []; + object.outputContexts = []; + object.sessionEntityTypes = []; + } + if (options.defaults) { + object.fulfillmentText = ""; + object.source = ""; + object.payload = null; + object.followupEventInput = null; + } + if (message.fulfillmentText != null && message.hasOwnProperty("fulfillmentText")) + object.fulfillmentText = message.fulfillmentText; + if (message.fulfillmentMessages && message.fulfillmentMessages.length) { + object.fulfillmentMessages = []; + for (var j = 0; j < message.fulfillmentMessages.length; ++j) + object.fulfillmentMessages[j] = $root.google.cloud.dialogflow.v2.Intent.Message.toObject(message.fulfillmentMessages[j], options); + } + if (message.source != null && message.hasOwnProperty("source")) + object.source = message.source; + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (message.outputContexts && message.outputContexts.length) { + object.outputContexts = []; + for (var j = 0; j < message.outputContexts.length; ++j) + object.outputContexts[j] = $root.google.cloud.dialogflow.v2.Context.toObject(message.outputContexts[j], options); + } + if (message.followupEventInput != null && message.hasOwnProperty("followupEventInput")) + object.followupEventInput = $root.google.cloud.dialogflow.v2.EventInput.toObject(message.followupEventInput, options); + if (message.sessionEntityTypes && message.sessionEntityTypes.length) { + object.sessionEntityTypes = []; + for (var j = 0; j < message.sessionEntityTypes.length; ++j) + object.sessionEntityTypes[j] = $root.google.cloud.dialogflow.v2.SessionEntityType.toObject(message.sessionEntityTypes[j], options); + } + return object; + }; + + /** + * Converts this WebhookResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @instance + * @returns {Object.} JSON object + */ + WebhookResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WebhookResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.WebhookResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WebhookResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.WebhookResponse"; + }; + + return WebhookResponse; + })(); + + v2.OriginalDetectIntentRequest = (function() { + + /** + * Properties of an OriginalDetectIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @interface IOriginalDetectIntentRequest + * @property {string|null} [source] OriginalDetectIntentRequest source + * @property {string|null} [version] OriginalDetectIntentRequest version + * @property {google.protobuf.IStruct|null} [payload] OriginalDetectIntentRequest payload + */ + + /** + * Constructs a new OriginalDetectIntentRequest. + * @memberof google.cloud.dialogflow.v2 + * @classdesc Represents an OriginalDetectIntentRequest. + * @implements IOriginalDetectIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2.IOriginalDetectIntentRequest=} [properties] Properties to set + */ + function OriginalDetectIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OriginalDetectIntentRequest source. + * @member {string} source + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @instance + */ + OriginalDetectIntentRequest.prototype.source = ""; + + /** + * OriginalDetectIntentRequest version. + * @member {string} version + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @instance + */ + OriginalDetectIntentRequest.prototype.version = ""; + + /** + * OriginalDetectIntentRequest payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @instance + */ + OriginalDetectIntentRequest.prototype.payload = null; + + /** + * Creates a new OriginalDetectIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IOriginalDetectIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2.OriginalDetectIntentRequest} OriginalDetectIntentRequest instance + */ + OriginalDetectIntentRequest.create = function create(properties) { + return new OriginalDetectIntentRequest(properties); + }; + + /** + * Encodes the specified OriginalDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2.OriginalDetectIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IOriginalDetectIntentRequest} message OriginalDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OriginalDetectIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.source); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OriginalDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2.OriginalDetectIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.IOriginalDetectIntentRequest} message OriginalDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OriginalDetectIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OriginalDetectIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2.OriginalDetectIntentRequest} OriginalDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OriginalDetectIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2.OriginalDetectIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.source = reader.string(); + break; + } + case 2: { + message.version = reader.string(); + break; + } + case 3: { + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OriginalDetectIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2.OriginalDetectIntentRequest} OriginalDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OriginalDetectIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OriginalDetectIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OriginalDetectIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.source != null && message.hasOwnProperty("source")) + if (!$util.isString(message.source)) + return "source: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.payload != null && message.hasOwnProperty("payload")) { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + return null; + }; + + /** + * Creates an OriginalDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2.OriginalDetectIntentRequest} OriginalDetectIntentRequest + */ + OriginalDetectIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2.OriginalDetectIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2.OriginalDetectIntentRequest(); + if (object.source != null) + message.source = String(object.source); + if (object.version != null) + message.version = String(object.version); + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.v2.OriginalDetectIntentRequest.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + return message; + }; + + /** + * Creates a plain object from an OriginalDetectIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2.OriginalDetectIntentRequest} message OriginalDetectIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OriginalDetectIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.source = ""; + object.version = ""; + object.payload = null; + } + if (message.source != null && message.hasOwnProperty("source")) + object.source = message.source; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + return object; + }; + + /** + * Converts this OriginalDetectIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @instance + * @returns {Object.} JSON object + */ + OriginalDetectIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OriginalDetectIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2.OriginalDetectIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OriginalDetectIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2.OriginalDetectIntentRequest"; + }; + + return OriginalDetectIntentRequest; + })(); + + return v2; + })(); + + dialogflow.v2beta1 = (function() { + + /** + * Namespace v2beta1. + * @memberof google.cloud.dialogflow + * @namespace + */ + var v2beta1 = {}; + + v2beta1.Agents = (function() { + + /** + * Constructs a new Agents service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an Agents + * @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 Agents(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Agents.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Agents; + + /** + * Creates new Agents service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @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 {Agents} RPC service. Useful where requests and/or responses are streamed. + */ + Agents.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|getAgent}. + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @typedef GetAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Agent} [response] Agent + */ + + /** + * Calls GetAgent. + * @function getAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetAgentRequest} request GetAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Agents.GetAgentCallback} callback Node-style callback called with the error, if any, and Agent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.getAgent = function getAgent(request, callback) { + return this.rpcCall(getAgent, $root.google.cloud.dialogflow.v2beta1.GetAgentRequest, $root.google.cloud.dialogflow.v2beta1.Agent, request, callback); + }, "name", { value: "GetAgent" }); + + /** + * Calls GetAgent. + * @function getAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetAgentRequest} request GetAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|setAgent}. + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @typedef SetAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Agent} [response] Agent + */ + + /** + * Calls SetAgent. + * @function setAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISetAgentRequest} request SetAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Agents.SetAgentCallback} callback Node-style callback called with the error, if any, and Agent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.setAgent = function setAgent(request, callback) { + return this.rpcCall(setAgent, $root.google.cloud.dialogflow.v2beta1.SetAgentRequest, $root.google.cloud.dialogflow.v2beta1.Agent, request, callback); + }, "name", { value: "SetAgent" }); + + /** + * Calls SetAgent. + * @function setAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISetAgentRequest} request SetAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|deleteAgent}. + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @typedef DeleteAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteAgent. + * @function deleteAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteAgentRequest} request DeleteAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Agents.DeleteAgentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.deleteAgent = function deleteAgent(request, callback) { + return this.rpcCall(deleteAgent, $root.google.cloud.dialogflow.v2beta1.DeleteAgentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteAgent" }); + + /** + * Calls DeleteAgent. + * @function deleteAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteAgentRequest} request DeleteAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|searchAgents}. + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @typedef SearchAgentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.SearchAgentsResponse} [response] SearchAgentsResponse + */ + + /** + * Calls SearchAgents. + * @function searchAgents + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsRequest} request SearchAgentsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Agents.SearchAgentsCallback} callback Node-style callback called with the error, if any, and SearchAgentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.searchAgents = function searchAgents(request, callback) { + return this.rpcCall(searchAgents, $root.google.cloud.dialogflow.v2beta1.SearchAgentsRequest, $root.google.cloud.dialogflow.v2beta1.SearchAgentsResponse, request, callback); + }, "name", { value: "SearchAgents" }); + + /** + * Calls SearchAgents. + * @function searchAgents + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsRequest} request SearchAgentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|trainAgent}. + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @typedef TrainAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls TrainAgent. + * @function trainAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ITrainAgentRequest} request TrainAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Agents.TrainAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.trainAgent = function trainAgent(request, callback) { + return this.rpcCall(trainAgent, $root.google.cloud.dialogflow.v2beta1.TrainAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "TrainAgent" }); + + /** + * Calls TrainAgent. + * @function trainAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ITrainAgentRequest} request TrainAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|exportAgent}. + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @typedef ExportAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ExportAgent. + * @function exportAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IExportAgentRequest} request ExportAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Agents.ExportAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.exportAgent = function exportAgent(request, callback) { + return this.rpcCall(exportAgent, $root.google.cloud.dialogflow.v2beta1.ExportAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ExportAgent" }); + + /** + * Calls ExportAgent. + * @function exportAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IExportAgentRequest} request ExportAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|importAgent}. + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @typedef ImportAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportAgent. + * @function importAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IImportAgentRequest} request ImportAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Agents.ImportAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.importAgent = function importAgent(request, callback) { + return this.rpcCall(importAgent, $root.google.cloud.dialogflow.v2beta1.ImportAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportAgent" }); + + /** + * Calls ImportAgent. + * @function importAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IImportAgentRequest} request ImportAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|restoreAgent}. + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @typedef RestoreAgentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls RestoreAgent. + * @function restoreAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IRestoreAgentRequest} request RestoreAgentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Agents.RestoreAgentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.restoreAgent = function restoreAgent(request, callback) { + return this.rpcCall(restoreAgent, $root.google.cloud.dialogflow.v2beta1.RestoreAgentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "RestoreAgent" }); + + /** + * Calls RestoreAgent. + * @function restoreAgent + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IRestoreAgentRequest} request RestoreAgentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Agents|getValidationResult}. + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @typedef GetValidationResultCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ValidationResult} [response] ValidationResult + */ + + /** + * Calls GetValidationResult. + * @function getValidationResult + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetValidationResultRequest} request GetValidationResultRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Agents.GetValidationResultCallback} callback Node-style callback called with the error, if any, and ValidationResult + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Agents.prototype.getValidationResult = function getValidationResult(request, callback) { + return this.rpcCall(getValidationResult, $root.google.cloud.dialogflow.v2beta1.GetValidationResultRequest, $root.google.cloud.dialogflow.v2beta1.ValidationResult, request, callback); + }, "name", { value: "GetValidationResult" }); + + /** + * Calls GetValidationResult. + * @function getValidationResult + * @memberof google.cloud.dialogflow.v2beta1.Agents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetValidationResultRequest} request GetValidationResultRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Agents; + })(); + + v2beta1.Agent = (function() { + + /** + * Properties of an Agent. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAgent + * @property {string|null} [parent] Agent parent + * @property {string|null} [displayName] Agent displayName + * @property {string|null} [defaultLanguageCode] Agent defaultLanguageCode + * @property {Array.|null} [supportedLanguageCodes] Agent supportedLanguageCodes + * @property {string|null} [timeZone] Agent timeZone + * @property {string|null} [description] Agent description + * @property {string|null} [avatarUri] Agent avatarUri + * @property {boolean|null} [enableLogging] Agent enableLogging + * @property {google.cloud.dialogflow.v2beta1.Agent.MatchMode|null} [matchMode] Agent matchMode + * @property {number|null} [classificationThreshold] Agent classificationThreshold + * @property {google.cloud.dialogflow.v2beta1.Agent.ApiVersion|null} [apiVersion] Agent apiVersion + * @property {google.cloud.dialogflow.v2beta1.Agent.Tier|null} [tier] Agent tier + */ + + /** + * Constructs a new Agent. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an Agent. + * @implements IAgent + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAgent=} [properties] Properties to set + */ + function Agent(properties) { + this.supportedLanguageCodes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Agent parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.parent = ""; + + /** + * Agent displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.displayName = ""; + + /** + * Agent defaultLanguageCode. + * @member {string} defaultLanguageCode + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.defaultLanguageCode = ""; + + /** + * Agent supportedLanguageCodes. + * @member {Array.} supportedLanguageCodes + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.supportedLanguageCodes = $util.emptyArray; + + /** + * Agent timeZone. + * @member {string} timeZone + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.timeZone = ""; + + /** + * Agent description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.description = ""; + + /** + * Agent avatarUri. + * @member {string} avatarUri + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.avatarUri = ""; + + /** + * Agent enableLogging. + * @member {boolean} enableLogging + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.enableLogging = false; + + /** + * Agent matchMode. + * @member {google.cloud.dialogflow.v2beta1.Agent.MatchMode} matchMode + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.matchMode = 0; + + /** + * Agent classificationThreshold. + * @member {number} classificationThreshold + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.classificationThreshold = 0; + + /** + * Agent apiVersion. + * @member {google.cloud.dialogflow.v2beta1.Agent.ApiVersion} apiVersion + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.apiVersion = 0; + + /** + * Agent tier. + * @member {google.cloud.dialogflow.v2beta1.Agent.Tier} tier + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + */ + Agent.prototype.tier = 0; + + /** + * Creates a new Agent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @static + * @param {google.cloud.dialogflow.v2beta1.IAgent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Agent} Agent instance + */ + Agent.create = function create(properties) { + return new Agent(properties); + }; + + /** + * Encodes the specified Agent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Agent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @static + * @param {google.cloud.dialogflow.v2beta1.IAgent} message Agent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Agent.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.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.defaultLanguageCode != null && Object.hasOwnProperty.call(message, "defaultLanguageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.defaultLanguageCode); + if (message.supportedLanguageCodes != null && message.supportedLanguageCodes.length) + for (var i = 0; i < message.supportedLanguageCodes.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.supportedLanguageCodes[i]); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.timeZone); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.description); + if (message.avatarUri != null && Object.hasOwnProperty.call(message, "avatarUri")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.avatarUri); + if (message.enableLogging != null && Object.hasOwnProperty.call(message, "enableLogging")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.enableLogging); + if (message.matchMode != null && Object.hasOwnProperty.call(message, "matchMode")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.matchMode); + if (message.classificationThreshold != null && Object.hasOwnProperty.call(message, "classificationThreshold")) + writer.uint32(/* id 10, wireType 5 =*/85).float(message.classificationThreshold); + if (message.apiVersion != null && Object.hasOwnProperty.call(message, "apiVersion")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.apiVersion); + if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.tier); + return writer; + }; + + /** + * Encodes the specified Agent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Agent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @static + * @param {google.cloud.dialogflow.v2beta1.IAgent} message Agent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Agent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Agent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Agent} Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Agent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Agent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.defaultLanguageCode = reader.string(); + break; + } + case 4: { + if (!(message.supportedLanguageCodes && message.supportedLanguageCodes.length)) + message.supportedLanguageCodes = []; + message.supportedLanguageCodes.push(reader.string()); + break; + } + case 5: { + message.timeZone = reader.string(); + break; + } + case 6: { + message.description = reader.string(); + break; + } + case 7: { + message.avatarUri = reader.string(); + break; + } + case 8: { + message.enableLogging = reader.bool(); + break; + } + case 9: { + message.matchMode = reader.int32(); + break; + } + case 10: { + message.classificationThreshold = reader.float(); + break; + } + case 14: { + message.apiVersion = reader.int32(); + break; + } + case 15: { + message.tier = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Agent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Agent} Agent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Agent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Agent message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Agent.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.defaultLanguageCode != null && message.hasOwnProperty("defaultLanguageCode")) + if (!$util.isString(message.defaultLanguageCode)) + return "defaultLanguageCode: string expected"; + if (message.supportedLanguageCodes != null && message.hasOwnProperty("supportedLanguageCodes")) { + if (!Array.isArray(message.supportedLanguageCodes)) + return "supportedLanguageCodes: array expected"; + for (var i = 0; i < message.supportedLanguageCodes.length; ++i) + if (!$util.isString(message.supportedLanguageCodes[i])) + return "supportedLanguageCodes: string[] expected"; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.avatarUri != null && message.hasOwnProperty("avatarUri")) + if (!$util.isString(message.avatarUri)) + return "avatarUri: string expected"; + if (message.enableLogging != null && message.hasOwnProperty("enableLogging")) + if (typeof message.enableLogging !== "boolean") + return "enableLogging: boolean expected"; + if (message.matchMode != null && message.hasOwnProperty("matchMode")) + switch (message.matchMode) { + default: + return "matchMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.classificationThreshold != null && message.hasOwnProperty("classificationThreshold")) + if (typeof message.classificationThreshold !== "number") + return "classificationThreshold: number expected"; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + switch (message.apiVersion) { + default: + return "apiVersion: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.tier != null && message.hasOwnProperty("tier")) + switch (message.tier) { + default: + return "tier: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates an Agent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Agent} Agent + */ + Agent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Agent) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Agent(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.defaultLanguageCode != null) + message.defaultLanguageCode = String(object.defaultLanguageCode); + if (object.supportedLanguageCodes) { + if (!Array.isArray(object.supportedLanguageCodes)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Agent.supportedLanguageCodes: array expected"); + message.supportedLanguageCodes = []; + for (var i = 0; i < object.supportedLanguageCodes.length; ++i) + message.supportedLanguageCodes[i] = String(object.supportedLanguageCodes[i]); + } + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.description != null) + message.description = String(object.description); + if (object.avatarUri != null) + message.avatarUri = String(object.avatarUri); + if (object.enableLogging != null) + message.enableLogging = Boolean(object.enableLogging); + switch (object.matchMode) { + default: + if (typeof object.matchMode === "number") { + message.matchMode = object.matchMode; + break; + } + break; + case "MATCH_MODE_UNSPECIFIED": + case 0: + message.matchMode = 0; + break; + case "MATCH_MODE_HYBRID": + case 1: + message.matchMode = 1; + break; + case "MATCH_MODE_ML_ONLY": + case 2: + message.matchMode = 2; + break; + } + if (object.classificationThreshold != null) + message.classificationThreshold = Number(object.classificationThreshold); + switch (object.apiVersion) { + default: + if (typeof object.apiVersion === "number") { + message.apiVersion = object.apiVersion; + break; + } + break; + case "API_VERSION_UNSPECIFIED": + case 0: + message.apiVersion = 0; + break; + case "API_VERSION_V1": + case 1: + message.apiVersion = 1; + break; + case "API_VERSION_V2": + case 2: + message.apiVersion = 2; + break; + case "API_VERSION_V2_BETA_1": + case 3: + message.apiVersion = 3; + break; + } + switch (object.tier) { + default: + if (typeof object.tier === "number") { + message.tier = object.tier; + break; + } + break; + case "TIER_UNSPECIFIED": + case 0: + message.tier = 0; + break; + case "TIER_STANDARD": + case 1: + message.tier = 1; + break; + case "TIER_ENTERPRISE": + case 2: + message.tier = 2; + break; + case "TIER_ENTERPRISE_PLUS": + case 3: + message.tier = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from an Agent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @static + * @param {google.cloud.dialogflow.v2beta1.Agent} message Agent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Agent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.supportedLanguageCodes = []; + if (options.defaults) { + object.parent = ""; + object.displayName = ""; + object.defaultLanguageCode = ""; + object.timeZone = ""; + object.description = ""; + object.avatarUri = ""; + object.enableLogging = false; + object.matchMode = options.enums === String ? "MATCH_MODE_UNSPECIFIED" : 0; + object.classificationThreshold = 0; + object.apiVersion = options.enums === String ? "API_VERSION_UNSPECIFIED" : 0; + object.tier = options.enums === String ? "TIER_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.defaultLanguageCode != null && message.hasOwnProperty("defaultLanguageCode")) + object.defaultLanguageCode = message.defaultLanguageCode; + if (message.supportedLanguageCodes && message.supportedLanguageCodes.length) { + object.supportedLanguageCodes = []; + for (var j = 0; j < message.supportedLanguageCodes.length; ++j) + object.supportedLanguageCodes[j] = message.supportedLanguageCodes[j]; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.avatarUri != null && message.hasOwnProperty("avatarUri")) + object.avatarUri = message.avatarUri; + if (message.enableLogging != null && message.hasOwnProperty("enableLogging")) + object.enableLogging = message.enableLogging; + if (message.matchMode != null && message.hasOwnProperty("matchMode")) + object.matchMode = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Agent.MatchMode[message.matchMode] === undefined ? message.matchMode : $root.google.cloud.dialogflow.v2beta1.Agent.MatchMode[message.matchMode] : message.matchMode; + if (message.classificationThreshold != null && message.hasOwnProperty("classificationThreshold")) + object.classificationThreshold = options.json && !isFinite(message.classificationThreshold) ? String(message.classificationThreshold) : message.classificationThreshold; + if (message.apiVersion != null && message.hasOwnProperty("apiVersion")) + object.apiVersion = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Agent.ApiVersion[message.apiVersion] === undefined ? message.apiVersion : $root.google.cloud.dialogflow.v2beta1.Agent.ApiVersion[message.apiVersion] : message.apiVersion; + if (message.tier != null && message.hasOwnProperty("tier")) + object.tier = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Agent.Tier[message.tier] === undefined ? message.tier : $root.google.cloud.dialogflow.v2beta1.Agent.Tier[message.tier] : message.tier; + return object; + }; + + /** + * Converts this Agent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @instance + * @returns {Object.} JSON object + */ + Agent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Agent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Agent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Agent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Agent"; + }; + + /** + * MatchMode enum. + * @name google.cloud.dialogflow.v2beta1.Agent.MatchMode + * @enum {number} + * @property {number} MATCH_MODE_UNSPECIFIED=0 MATCH_MODE_UNSPECIFIED value + * @property {number} MATCH_MODE_HYBRID=1 MATCH_MODE_HYBRID value + * @property {number} MATCH_MODE_ML_ONLY=2 MATCH_MODE_ML_ONLY value + */ + Agent.MatchMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MATCH_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "MATCH_MODE_HYBRID"] = 1; + values[valuesById[2] = "MATCH_MODE_ML_ONLY"] = 2; + return values; + })(); + + /** + * ApiVersion enum. + * @name google.cloud.dialogflow.v2beta1.Agent.ApiVersion + * @enum {number} + * @property {number} API_VERSION_UNSPECIFIED=0 API_VERSION_UNSPECIFIED value + * @property {number} API_VERSION_V1=1 API_VERSION_V1 value + * @property {number} API_VERSION_V2=2 API_VERSION_V2 value + * @property {number} API_VERSION_V2_BETA_1=3 API_VERSION_V2_BETA_1 value + */ + Agent.ApiVersion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "API_VERSION_UNSPECIFIED"] = 0; + values[valuesById[1] = "API_VERSION_V1"] = 1; + values[valuesById[2] = "API_VERSION_V2"] = 2; + values[valuesById[3] = "API_VERSION_V2_BETA_1"] = 3; + return values; + })(); + + /** + * Tier enum. + * @name google.cloud.dialogflow.v2beta1.Agent.Tier + * @enum {number} + * @property {number} TIER_UNSPECIFIED=0 TIER_UNSPECIFIED value + * @property {number} TIER_STANDARD=1 TIER_STANDARD value + * @property {number} TIER_ENTERPRISE=2 TIER_ENTERPRISE value + * @property {number} TIER_ENTERPRISE_PLUS=3 TIER_ENTERPRISE_PLUS value + */ + Agent.Tier = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TIER_UNSPECIFIED"] = 0; + values[valuesById[1] = "TIER_STANDARD"] = 1; + values[valuesById[2] = "TIER_ENTERPRISE"] = 2; + values[valuesById[3] = "TIER_ENTERPRISE_PLUS"] = 3; + return values; + })(); + + return Agent; + })(); + + v2beta1.GetAgentRequest = (function() { + + /** + * Properties of a GetAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetAgentRequest + * @property {string|null} [parent] GetAgentRequest parent + */ + + /** + * Constructs a new GetAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetAgentRequest. + * @implements IGetAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetAgentRequest=} [properties] Properties to set + */ + function GetAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @instance + */ + GetAgentRequest.prototype.parent = ""; + + /** + * Creates a new GetAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetAgentRequest} GetAgentRequest instance + */ + GetAgentRequest.create = function create(properties) { + return new GetAgentRequest(properties); + }; + + /** + * Encodes the specified GetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetAgentRequest} message GetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAgentRequest.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); + return writer; + }; + + /** + * Encodes the specified GetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetAgentRequest} message GetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetAgentRequest} GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetAgentRequest} GetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetAgentRequest.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"; + return null; + }; + + /** + * Creates a GetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetAgentRequest} GetAgentRequest + */ + GetAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a GetAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetAgentRequest} message GetAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this GetAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @instance + * @returns {Object.} JSON object + */ + GetAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetAgentRequest"; + }; + + return GetAgentRequest; + })(); + + v2beta1.SetAgentRequest = (function() { + + /** + * Properties of a SetAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISetAgentRequest + * @property {google.cloud.dialogflow.v2beta1.IAgent|null} [agent] SetAgentRequest agent + * @property {google.protobuf.IFieldMask|null} [updateMask] SetAgentRequest updateMask + */ + + /** + * Constructs a new SetAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SetAgentRequest. + * @implements ISetAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISetAgentRequest=} [properties] Properties to set + */ + function SetAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetAgentRequest agent. + * @member {google.cloud.dialogflow.v2beta1.IAgent|null|undefined} agent + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @instance + */ + SetAgentRequest.prototype.agent = null; + + /** + * SetAgentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @instance + */ + SetAgentRequest.prototype.updateMask = null; + + /** + * Creates a new SetAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISetAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SetAgentRequest} SetAgentRequest instance + */ + SetAgentRequest.create = function create(properties) { + return new SetAgentRequest(properties); + }; + + /** + * Encodes the specified SetAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISetAgentRequest} message SetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetAgentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agent != null && Object.hasOwnProperty.call(message, "agent")) + $root.google.cloud.dialogflow.v2beta1.Agent.encode(message.agent, 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 SetAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISetAgentRequest} message SetAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SetAgentRequest} SetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SetAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agent = $root.google.cloud.dialogflow.v2beta1.Agent.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 a SetAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SetAgentRequest} SetAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetAgentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agent != null && message.hasOwnProperty("agent")) { + var error = $root.google.cloud.dialogflow.v2beta1.Agent.verify(message.agent); + if (error) + return "agent." + 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 a SetAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SetAgentRequest} SetAgentRequest + */ + SetAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SetAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SetAgentRequest(); + if (object.agent != null) { + if (typeof object.agent !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SetAgentRequest.agent: object expected"); + message.agent = $root.google.cloud.dialogflow.v2beta1.Agent.fromObject(object.agent); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SetAgentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from a SetAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.SetAgentRequest} message SetAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.agent = null; + object.updateMask = null; + } + if (message.agent != null && message.hasOwnProperty("agent")) + object.agent = $root.google.cloud.dialogflow.v2beta1.Agent.toObject(message.agent, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this SetAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @instance + * @returns {Object.} JSON object + */ + SetAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SetAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SetAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SetAgentRequest"; + }; + + return SetAgentRequest; + })(); + + v2beta1.DeleteAgentRequest = (function() { + + /** + * Properties of a DeleteAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteAgentRequest + * @property {string|null} [parent] DeleteAgentRequest parent + */ + + /** + * Constructs a new DeleteAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteAgentRequest. + * @implements IDeleteAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteAgentRequest=} [properties] Properties to set + */ + function DeleteAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @instance + */ + DeleteAgentRequest.prototype.parent = ""; + + /** + * Creates a new DeleteAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteAgentRequest} DeleteAgentRequest instance + */ + DeleteAgentRequest.create = function create(properties) { + return new DeleteAgentRequest(properties); + }; + + /** + * Encodes the specified DeleteAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteAgentRequest} message DeleteAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAgentRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteAgentRequest} message DeleteAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteAgentRequest} DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteAgentRequest} DeleteAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteAgentRequest.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"; + return null; + }; + + /** + * Creates a DeleteAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteAgentRequest} DeleteAgentRequest + */ + DeleteAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a DeleteAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteAgentRequest} message DeleteAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this DeleteAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteAgentRequest"; + }; + + return DeleteAgentRequest; + })(); + + v2beta1.SubAgent = (function() { + + /** + * Properties of a SubAgent. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISubAgent + * @property {string|null} [project] SubAgent project + * @property {string|null} [environment] SubAgent environment + */ + + /** + * Constructs a new SubAgent. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SubAgent. + * @implements ISubAgent + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISubAgent=} [properties] Properties to set + */ + function SubAgent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SubAgent project. + * @member {string} project + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @instance + */ + SubAgent.prototype.project = ""; + + /** + * SubAgent environment. + * @member {string} environment + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @instance + */ + SubAgent.prototype.environment = ""; + + /** + * Creates a new SubAgent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @static + * @param {google.cloud.dialogflow.v2beta1.ISubAgent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SubAgent} SubAgent instance + */ + SubAgent.create = function create(properties) { + return new SubAgent(properties); + }; + + /** + * Encodes the specified SubAgent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SubAgent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @static + * @param {google.cloud.dialogflow.v2beta1.ISubAgent} message SubAgent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubAgent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.environment); + return writer; + }; + + /** + * Encodes the specified SubAgent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SubAgent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @static + * @param {google.cloud.dialogflow.v2beta1.ISubAgent} message SubAgent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubAgent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SubAgent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SubAgent} SubAgent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubAgent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SubAgent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.project = reader.string(); + break; + } + case 2: { + message.environment = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SubAgent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SubAgent} SubAgent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubAgent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SubAgent message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SubAgent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.environment != null && message.hasOwnProperty("environment")) + if (!$util.isString(message.environment)) + return "environment: string expected"; + return null; + }; + + /** + * Creates a SubAgent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SubAgent} SubAgent + */ + SubAgent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SubAgent) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SubAgent(); + if (object.project != null) + message.project = String(object.project); + if (object.environment != null) + message.environment = String(object.environment); + return message; + }; + + /** + * Creates a plain object from a SubAgent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @static + * @param {google.cloud.dialogflow.v2beta1.SubAgent} message SubAgent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SubAgent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.project = ""; + object.environment = ""; + } + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = message.environment; + return object; + }; + + /** + * Converts this SubAgent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @instance + * @returns {Object.} JSON object + */ + SubAgent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SubAgent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SubAgent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SubAgent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SubAgent"; + }; + + return SubAgent; + })(); + + v2beta1.SearchAgentsRequest = (function() { + + /** + * Properties of a SearchAgentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISearchAgentsRequest + * @property {string|null} [parent] SearchAgentsRequest parent + * @property {number|null} [pageSize] SearchAgentsRequest pageSize + * @property {string|null} [pageToken] SearchAgentsRequest pageToken + */ + + /** + * Constructs a new SearchAgentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SearchAgentsRequest. + * @implements ISearchAgentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsRequest=} [properties] Properties to set + */ + function SearchAgentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchAgentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @instance + */ + SearchAgentsRequest.prototype.parent = ""; + + /** + * SearchAgentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @instance + */ + SearchAgentsRequest.prototype.pageSize = 0; + + /** + * SearchAgentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @instance + */ + SearchAgentsRequest.prototype.pageToken = ""; + + /** + * Creates a new SearchAgentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SearchAgentsRequest} SearchAgentsRequest instance + */ + SearchAgentsRequest.create = function create(properties) { + return new SearchAgentsRequest(properties); + }; + + /** + * Encodes the specified SearchAgentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SearchAgentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsRequest} message SearchAgentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchAgentsRequest.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 SearchAgentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SearchAgentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsRequest} message SearchAgentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchAgentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchAgentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SearchAgentsRequest} SearchAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchAgentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SearchAgentsRequest(); + 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 SearchAgentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SearchAgentsRequest} SearchAgentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchAgentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchAgentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchAgentsRequest.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 SearchAgentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SearchAgentsRequest} SearchAgentsRequest + */ + SearchAgentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SearchAgentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SearchAgentsRequest(); + 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 SearchAgentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.SearchAgentsRequest} message SearchAgentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchAgentsRequest.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 SearchAgentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @instance + * @returns {Object.} JSON object + */ + SearchAgentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchAgentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchAgentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SearchAgentsRequest"; + }; + + return SearchAgentsRequest; + })(); + + v2beta1.SearchAgentsResponse = (function() { + + /** + * Properties of a SearchAgentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISearchAgentsResponse + * @property {Array.|null} [agents] SearchAgentsResponse agents + * @property {string|null} [nextPageToken] SearchAgentsResponse nextPageToken + */ + + /** + * Constructs a new SearchAgentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SearchAgentsResponse. + * @implements ISearchAgentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsResponse=} [properties] Properties to set + */ + function SearchAgentsResponse(properties) { + this.agents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SearchAgentsResponse agents. + * @member {Array.} agents + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @instance + */ + SearchAgentsResponse.prototype.agents = $util.emptyArray; + + /** + * SearchAgentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @instance + */ + SearchAgentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new SearchAgentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SearchAgentsResponse} SearchAgentsResponse instance + */ + SearchAgentsResponse.create = function create(properties) { + return new SearchAgentsResponse(properties); + }; + + /** + * Encodes the specified SearchAgentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SearchAgentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsResponse} message SearchAgentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchAgentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agents != null && message.agents.length) + for (var i = 0; i < message.agents.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Agent.encode(message.agents[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 SearchAgentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SearchAgentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISearchAgentsResponse} message SearchAgentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SearchAgentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SearchAgentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SearchAgentsResponse} SearchAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchAgentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SearchAgentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.agents && message.agents.length)) + message.agents = []; + message.agents.push($root.google.cloud.dialogflow.v2beta1.Agent.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SearchAgentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SearchAgentsResponse} SearchAgentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SearchAgentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SearchAgentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SearchAgentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agents != null && message.hasOwnProperty("agents")) { + if (!Array.isArray(message.agents)) + return "agents: array expected"; + for (var i = 0; i < message.agents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Agent.verify(message.agents[i]); + if (error) + return "agents." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a SearchAgentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SearchAgentsResponse} SearchAgentsResponse + */ + SearchAgentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SearchAgentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SearchAgentsResponse(); + if (object.agents) { + if (!Array.isArray(object.agents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.SearchAgentsResponse.agents: array expected"); + message.agents = []; + for (var i = 0; i < object.agents.length; ++i) { + if (typeof object.agents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SearchAgentsResponse.agents: object expected"); + message.agents[i] = $root.google.cloud.dialogflow.v2beta1.Agent.fromObject(object.agents[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a SearchAgentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.SearchAgentsResponse} message SearchAgentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SearchAgentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.agents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.agents && message.agents.length) { + object.agents = []; + for (var j = 0; j < message.agents.length; ++j) + object.agents[j] = $root.google.cloud.dialogflow.v2beta1.Agent.toObject(message.agents[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this SearchAgentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @instance + * @returns {Object.} JSON object + */ + SearchAgentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SearchAgentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SearchAgentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SearchAgentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SearchAgentsResponse"; + }; + + return SearchAgentsResponse; + })(); + + v2beta1.TrainAgentRequest = (function() { + + /** + * Properties of a TrainAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ITrainAgentRequest + * @property {string|null} [parent] TrainAgentRequest parent + */ + + /** + * Constructs a new TrainAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a TrainAgentRequest. + * @implements ITrainAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ITrainAgentRequest=} [properties] Properties to set + */ + function TrainAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TrainAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @instance + */ + TrainAgentRequest.prototype.parent = ""; + + /** + * Creates a new TrainAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ITrainAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.TrainAgentRequest} TrainAgentRequest instance + */ + TrainAgentRequest.create = function create(properties) { + return new TrainAgentRequest(properties); + }; + + /** + * Encodes the specified TrainAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TrainAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ITrainAgentRequest} message TrainAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainAgentRequest.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); + return writer; + }; + + /** + * Encodes the specified TrainAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TrainAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ITrainAgentRequest} message TrainAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TrainAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.TrainAgentRequest} TrainAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.TrainAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TrainAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.TrainAgentRequest} TrainAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TrainAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TrainAgentRequest.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"; + return null; + }; + + /** + * Creates a TrainAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.TrainAgentRequest} TrainAgentRequest + */ + TrainAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.TrainAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.TrainAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a TrainAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.TrainAgentRequest} message TrainAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TrainAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this TrainAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @instance + * @returns {Object.} JSON object + */ + TrainAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TrainAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.TrainAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TrainAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.TrainAgentRequest"; + }; + + return TrainAgentRequest; + })(); + + v2beta1.ExportAgentRequest = (function() { + + /** + * Properties of an ExportAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IExportAgentRequest + * @property {string|null} [parent] ExportAgentRequest parent + * @property {string|null} [agentUri] ExportAgentRequest agentUri + */ + + /** + * Constructs a new ExportAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an ExportAgentRequest. + * @implements IExportAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IExportAgentRequest=} [properties] Properties to set + */ + function ExportAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @instance + */ + ExportAgentRequest.prototype.parent = ""; + + /** + * ExportAgentRequest agentUri. + * @member {string} agentUri + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @instance + */ + ExportAgentRequest.prototype.agentUri = ""; + + /** + * Creates a new ExportAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IExportAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ExportAgentRequest} ExportAgentRequest instance + */ + ExportAgentRequest.create = function create(properties) { + return new ExportAgentRequest(properties); + }; + + /** + * Encodes the specified ExportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IExportAgentRequest} message ExportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentRequest.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.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.agentUri); + return writer; + }; + + /** + * Encodes the specified ExportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IExportAgentRequest} message ExportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ExportAgentRequest} ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ExportAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.agentUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ExportAgentRequest} ExportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportAgentRequest.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.agentUri != null && message.hasOwnProperty("agentUri")) + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + return null; + }; + + /** + * Creates an ExportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ExportAgentRequest} ExportAgentRequest + */ + ExportAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ExportAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ExportAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + return message; + }; + + /** + * Creates a plain object from an ExportAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ExportAgentRequest} message ExportAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.agentUri = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) + object.agentUri = message.agentUri; + return object; + }; + + /** + * Converts this ExportAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @instance + * @returns {Object.} JSON object + */ + ExportAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ExportAgentRequest"; + }; + + return ExportAgentRequest; + })(); + + v2beta1.ExportAgentResponse = (function() { + + /** + * Properties of an ExportAgentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IExportAgentResponse + * @property {string|null} [agentUri] ExportAgentResponse agentUri + * @property {Uint8Array|null} [agentContent] ExportAgentResponse agentContent + */ + + /** + * Constructs a new ExportAgentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an ExportAgentResponse. + * @implements IExportAgentResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IExportAgentResponse=} [properties] Properties to set + */ + function ExportAgentResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportAgentResponse agentUri. + * @member {string|null|undefined} agentUri + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @instance + */ + ExportAgentResponse.prototype.agentUri = null; + + /** + * ExportAgentResponse agentContent. + * @member {Uint8Array|null|undefined} agentContent + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @instance + */ + ExportAgentResponse.prototype.agentContent = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExportAgentResponse agent. + * @member {"agentUri"|"agentContent"|undefined} agent + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @instance + */ + Object.defineProperty(ExportAgentResponse.prototype, "agent", { + get: $util.oneOfGetter($oneOfFields = ["agentUri", "agentContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExportAgentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IExportAgentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ExportAgentResponse} ExportAgentResponse instance + */ + ExportAgentResponse.create = function create(properties) { + return new ExportAgentResponse(properties); + }; + + /** + * Encodes the specified ExportAgentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportAgentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IExportAgentResponse} message ExportAgentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.agentUri); + if (message.agentContent != null && Object.hasOwnProperty.call(message, "agentContent")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.agentContent); + return writer; + }; + + /** + * Encodes the specified ExportAgentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportAgentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IExportAgentResponse} message ExportAgentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportAgentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ExportAgentResponse} ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ExportAgentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agentUri = reader.string(); + break; + } + case 2: { + message.agentContent = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportAgentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ExportAgentResponse} ExportAgentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportAgentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportAgentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportAgentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + properties.agent = 1; + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + if (properties.agent === 1) + return "agent: multiple values"; + properties.agent = 1; + if (!(message.agentContent && typeof message.agentContent.length === "number" || $util.isString(message.agentContent))) + return "agentContent: buffer expected"; + } + return null; + }; + + /** + * Creates an ExportAgentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ExportAgentResponse} ExportAgentResponse + */ + ExportAgentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ExportAgentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ExportAgentResponse(); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + if (object.agentContent != null) + if (typeof object.agentContent === "string") + $util.base64.decode(object.agentContent, message.agentContent = $util.newBuffer($util.base64.length(object.agentContent)), 0); + else if (object.agentContent.length >= 0) + message.agentContent = object.agentContent; + return message; + }; + + /** + * Creates a plain object from an ExportAgentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ExportAgentResponse} message ExportAgentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportAgentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + object.agentUri = message.agentUri; + if (options.oneofs) + object.agent = "agentUri"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + object.agentContent = options.bytes === String ? $util.base64.encode(message.agentContent, 0, message.agentContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.agentContent) : message.agentContent; + if (options.oneofs) + object.agent = "agentContent"; + } + return object; + }; + + /** + * Converts this ExportAgentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @instance + * @returns {Object.} JSON object + */ + ExportAgentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportAgentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ExportAgentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportAgentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ExportAgentResponse"; + }; + + return ExportAgentResponse; + })(); + + v2beta1.ImportAgentRequest = (function() { + + /** + * Properties of an ImportAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IImportAgentRequest + * @property {string|null} [parent] ImportAgentRequest parent + * @property {string|null} [agentUri] ImportAgentRequest agentUri + * @property {Uint8Array|null} [agentContent] ImportAgentRequest agentContent + */ + + /** + * Constructs a new ImportAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an ImportAgentRequest. + * @implements IImportAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IImportAgentRequest=} [properties] Properties to set + */ + function ImportAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @instance + */ + ImportAgentRequest.prototype.parent = ""; + + /** + * ImportAgentRequest agentUri. + * @member {string|null|undefined} agentUri + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @instance + */ + ImportAgentRequest.prototype.agentUri = null; + + /** + * ImportAgentRequest agentContent. + * @member {Uint8Array|null|undefined} agentContent + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @instance + */ + ImportAgentRequest.prototype.agentContent = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportAgentRequest agent. + * @member {"agentUri"|"agentContent"|undefined} agent + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @instance + */ + Object.defineProperty(ImportAgentRequest.prototype, "agent", { + get: $util.oneOfGetter($oneOfFields = ["agentUri", "agentContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ImportAgentRequest} ImportAgentRequest instance + */ + ImportAgentRequest.create = function create(properties) { + return new ImportAgentRequest(properties); + }; + + /** + * Encodes the specified ImportAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportAgentRequest} message ImportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportAgentRequest.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.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.agentUri); + if (message.agentContent != null && Object.hasOwnProperty.call(message, "agentContent")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.agentContent); + return writer; + }; + + /** + * Encodes the specified ImportAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportAgentRequest} message ImportAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ImportAgentRequest} ImportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ImportAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.agentUri = reader.string(); + break; + } + case 3: { + message.agentContent = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ImportAgentRequest} ImportAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportAgentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + properties.agent = 1; + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + if (properties.agent === 1) + return "agent: multiple values"; + properties.agent = 1; + if (!(message.agentContent && typeof message.agentContent.length === "number" || $util.isString(message.agentContent))) + return "agentContent: buffer expected"; + } + return null; + }; + + /** + * Creates an ImportAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ImportAgentRequest} ImportAgentRequest + */ + ImportAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ImportAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ImportAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + if (object.agentContent != null) + if (typeof object.agentContent === "string") + $util.base64.decode(object.agentContent, message.agentContent = $util.newBuffer($util.base64.length(object.agentContent)), 0); + else if (object.agentContent.length >= 0) + message.agentContent = object.agentContent; + return message; + }; + + /** + * Creates a plain object from an ImportAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ImportAgentRequest} message ImportAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + object.agentUri = message.agentUri; + if (options.oneofs) + object.agent = "agentUri"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + object.agentContent = options.bytes === String ? $util.base64.encode(message.agentContent, 0, message.agentContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.agentContent) : message.agentContent; + if (options.oneofs) + object.agent = "agentContent"; + } + return object; + }; + + /** + * Converts this ImportAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @instance + * @returns {Object.} JSON object + */ + ImportAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ImportAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ImportAgentRequest"; + }; + + return ImportAgentRequest; + })(); + + v2beta1.RestoreAgentRequest = (function() { + + /** + * Properties of a RestoreAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IRestoreAgentRequest + * @property {string|null} [parent] RestoreAgentRequest parent + * @property {string|null} [agentUri] RestoreAgentRequest agentUri + * @property {Uint8Array|null} [agentContent] RestoreAgentRequest agentContent + */ + + /** + * Constructs a new RestoreAgentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a RestoreAgentRequest. + * @implements IRestoreAgentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IRestoreAgentRequest=} [properties] Properties to set + */ + function RestoreAgentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RestoreAgentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @instance + */ + RestoreAgentRequest.prototype.parent = ""; + + /** + * RestoreAgentRequest agentUri. + * @member {string|null|undefined} agentUri + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @instance + */ + RestoreAgentRequest.prototype.agentUri = null; + + /** + * RestoreAgentRequest agentContent. + * @member {Uint8Array|null|undefined} agentContent + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @instance + */ + RestoreAgentRequest.prototype.agentContent = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RestoreAgentRequest agent. + * @member {"agentUri"|"agentContent"|undefined} agent + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @instance + */ + Object.defineProperty(RestoreAgentRequest.prototype, "agent", { + get: $util.oneOfGetter($oneOfFields = ["agentUri", "agentContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RestoreAgentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IRestoreAgentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.RestoreAgentRequest} RestoreAgentRequest instance + */ + RestoreAgentRequest.create = function create(properties) { + return new RestoreAgentRequest(properties); + }; + + /** + * Encodes the specified RestoreAgentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.RestoreAgentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IRestoreAgentRequest} message RestoreAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreAgentRequest.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.agentUri != null && Object.hasOwnProperty.call(message, "agentUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.agentUri); + if (message.agentContent != null && Object.hasOwnProperty.call(message, "agentContent")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.agentContent); + return writer; + }; + + /** + * Encodes the specified RestoreAgentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.RestoreAgentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IRestoreAgentRequest} message RestoreAgentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreAgentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.RestoreAgentRequest} RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreAgentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.RestoreAgentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.agentUri = reader.string(); + break; + } + case 3: { + message.agentContent = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RestoreAgentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.RestoreAgentRequest} RestoreAgentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreAgentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RestoreAgentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RestoreAgentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + properties.agent = 1; + if (!$util.isString(message.agentUri)) + return "agentUri: string expected"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + if (properties.agent === 1) + return "agent: multiple values"; + properties.agent = 1; + if (!(message.agentContent && typeof message.agentContent.length === "number" || $util.isString(message.agentContent))) + return "agentContent: buffer expected"; + } + return null; + }; + + /** + * Creates a RestoreAgentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.RestoreAgentRequest} RestoreAgentRequest + */ + RestoreAgentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.RestoreAgentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.RestoreAgentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.agentUri != null) + message.agentUri = String(object.agentUri); + if (object.agentContent != null) + if (typeof object.agentContent === "string") + $util.base64.decode(object.agentContent, message.agentContent = $util.newBuffer($util.base64.length(object.agentContent)), 0); + else if (object.agentContent.length >= 0) + message.agentContent = object.agentContent; + return message; + }; + + /** + * Creates a plain object from a RestoreAgentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.RestoreAgentRequest} message RestoreAgentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RestoreAgentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.agentUri != null && message.hasOwnProperty("agentUri")) { + object.agentUri = message.agentUri; + if (options.oneofs) + object.agent = "agentUri"; + } + if (message.agentContent != null && message.hasOwnProperty("agentContent")) { + object.agentContent = options.bytes === String ? $util.base64.encode(message.agentContent, 0, message.agentContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.agentContent) : message.agentContent; + if (options.oneofs) + object.agent = "agentContent"; + } + return object; + }; + + /** + * Converts this RestoreAgentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @instance + * @returns {Object.} JSON object + */ + RestoreAgentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RestoreAgentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.RestoreAgentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RestoreAgentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.RestoreAgentRequest"; + }; + + return RestoreAgentRequest; + })(); + + v2beta1.GetValidationResultRequest = (function() { + + /** + * Properties of a GetValidationResultRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetValidationResultRequest + * @property {string|null} [parent] GetValidationResultRequest parent + * @property {string|null} [languageCode] GetValidationResultRequest languageCode + */ + + /** + * Constructs a new GetValidationResultRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetValidationResultRequest. + * @implements IGetValidationResultRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetValidationResultRequest=} [properties] Properties to set + */ + function GetValidationResultRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetValidationResultRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @instance + */ + GetValidationResultRequest.prototype.parent = ""; + + /** + * GetValidationResultRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @instance + */ + GetValidationResultRequest.prototype.languageCode = ""; + + /** + * Creates a new GetValidationResultRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetValidationResultRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetValidationResultRequest} GetValidationResultRequest instance + */ + GetValidationResultRequest.create = function create(properties) { + return new GetValidationResultRequest(properties); + }; + + /** + * Encodes the specified GetValidationResultRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetValidationResultRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetValidationResultRequest} message GetValidationResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetValidationResultRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified GetValidationResultRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetValidationResultRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetValidationResultRequest} message GetValidationResultRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetValidationResultRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetValidationResultRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetValidationResultRequest} GetValidationResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetValidationResultRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetValidationResultRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetValidationResultRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetValidationResultRequest} GetValidationResultRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetValidationResultRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetValidationResultRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetValidationResultRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a GetValidationResultRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetValidationResultRequest} GetValidationResultRequest + */ + GetValidationResultRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetValidationResultRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetValidationResultRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a GetValidationResultRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetValidationResultRequest} message GetValidationResultRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetValidationResultRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this GetValidationResultRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @instance + * @returns {Object.} JSON object + */ + GetValidationResultRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetValidationResultRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetValidationResultRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetValidationResultRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetValidationResultRequest"; + }; + + return GetValidationResultRequest; + })(); + + v2beta1.ValidationError = (function() { + + /** + * Properties of a ValidationError. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IValidationError + * @property {google.cloud.dialogflow.v2beta1.ValidationError.Severity|null} [severity] ValidationError severity + * @property {Array.|null} [entries] ValidationError entries + * @property {string|null} [errorMessage] ValidationError errorMessage + */ + + /** + * Constructs a new ValidationError. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ValidationError. + * @implements IValidationError + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IValidationError=} [properties] Properties to set + */ + function ValidationError(properties) { + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidationError severity. + * @member {google.cloud.dialogflow.v2beta1.ValidationError.Severity} severity + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @instance + */ + ValidationError.prototype.severity = 0; + + /** + * ValidationError entries. + * @member {Array.} entries + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @instance + */ + ValidationError.prototype.entries = $util.emptyArray; + + /** + * ValidationError errorMessage. + * @member {string} errorMessage + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @instance + */ + ValidationError.prototype.errorMessage = ""; + + /** + * Creates a new ValidationError instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @static + * @param {google.cloud.dialogflow.v2beta1.IValidationError=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ValidationError} ValidationError instance + */ + ValidationError.create = function create(properties) { + return new ValidationError(properties); + }; + + /** + * Encodes the specified ValidationError message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ValidationError.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @static + * @param {google.cloud.dialogflow.v2beta1.IValidationError} message ValidationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidationError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.severity); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.entries[i]); + if (message.errorMessage != null && Object.hasOwnProperty.call(message, "errorMessage")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.errorMessage); + return writer; + }; + + /** + * Encodes the specified ValidationError message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ValidationError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @static + * @param {google.cloud.dialogflow.v2beta1.IValidationError} message ValidationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidationError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidationError message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ValidationError} ValidationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidationError.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ValidationError(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.severity = reader.int32(); + break; + } + case 3: { + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push(reader.string()); + break; + } + case 4: { + message.errorMessage = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidationError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ValidationError} ValidationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidationError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidationError message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidationError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.severity != null && message.hasOwnProperty("severity")) + switch (message.severity) { + default: + return "severity: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) + if (!$util.isString(message.entries[i])) + return "entries: string[] expected"; + } + if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + if (!$util.isString(message.errorMessage)) + return "errorMessage: string expected"; + return null; + }; + + /** + * Creates a ValidationError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ValidationError} ValidationError + */ + ValidationError.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ValidationError) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ValidationError(); + switch (object.severity) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; + case "SEVERITY_UNSPECIFIED": + case 0: + message.severity = 0; + break; + case "INFO": + case 1: + message.severity = 1; + break; + case "WARNING": + case 2: + message.severity = 2; + break; + case "ERROR": + case 3: + message.severity = 3; + break; + case "CRITICAL": + case 4: + message.severity = 4; + break; + } + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ValidationError.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) + message.entries[i] = String(object.entries[i]); + } + if (object.errorMessage != null) + message.errorMessage = String(object.errorMessage); + return message; + }; + + /** + * Creates a plain object from a ValidationError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @static + * @param {google.cloud.dialogflow.v2beta1.ValidationError} message ValidationError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidationError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (options.defaults) { + object.severity = options.enums === String ? "SEVERITY_UNSPECIFIED" : 0; + object.errorMessage = ""; + } + if (message.severity != null && message.hasOwnProperty("severity")) + object.severity = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.ValidationError.Severity[message.severity] === undefined ? message.severity : $root.google.cloud.dialogflow.v2beta1.ValidationError.Severity[message.severity] : message.severity; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = message.entries[j]; + } + if (message.errorMessage != null && message.hasOwnProperty("errorMessage")) + object.errorMessage = message.errorMessage; + return object; + }; + + /** + * Converts this ValidationError to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @instance + * @returns {Object.} JSON object + */ + ValidationError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ValidationError + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ValidationError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ValidationError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ValidationError"; + }; + + /** + * Severity enum. + * @name google.cloud.dialogflow.v2beta1.ValidationError.Severity + * @enum {number} + * @property {number} SEVERITY_UNSPECIFIED=0 SEVERITY_UNSPECIFIED value + * @property {number} INFO=1 INFO value + * @property {number} WARNING=2 WARNING value + * @property {number} ERROR=3 ERROR value + * @property {number} CRITICAL=4 CRITICAL value + */ + ValidationError.Severity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SEVERITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "INFO"] = 1; + values[valuesById[2] = "WARNING"] = 2; + values[valuesById[3] = "ERROR"] = 3; + values[valuesById[4] = "CRITICAL"] = 4; + return values; + })(); + + return ValidationError; + })(); + + v2beta1.ValidationResult = (function() { + + /** + * Properties of a ValidationResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IValidationResult + * @property {Array.|null} [validationErrors] ValidationResult validationErrors + */ + + /** + * Constructs a new ValidationResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ValidationResult. + * @implements IValidationResult + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IValidationResult=} [properties] Properties to set + */ + function ValidationResult(properties) { + this.validationErrors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ValidationResult validationErrors. + * @member {Array.} validationErrors + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @instance + */ + ValidationResult.prototype.validationErrors = $util.emptyArray; + + /** + * Creates a new ValidationResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @static + * @param {google.cloud.dialogflow.v2beta1.IValidationResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ValidationResult} ValidationResult instance + */ + ValidationResult.create = function create(properties) { + return new ValidationResult(properties); + }; + + /** + * Encodes the specified ValidationResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ValidationResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @static + * @param {google.cloud.dialogflow.v2beta1.IValidationResult} message ValidationResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidationResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.validationErrors != null && message.validationErrors.length) + for (var i = 0; i < message.validationErrors.length; ++i) + $root.google.cloud.dialogflow.v2beta1.ValidationError.encode(message.validationErrors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ValidationResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ValidationResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @static + * @param {google.cloud.dialogflow.v2beta1.IValidationResult} message ValidationResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ValidationResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ValidationResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ValidationResult} ValidationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidationResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ValidationResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.validationErrors && message.validationErrors.length)) + message.validationErrors = []; + message.validationErrors.push($root.google.cloud.dialogflow.v2beta1.ValidationError.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ValidationResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ValidationResult} ValidationResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ValidationResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ValidationResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ValidationResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.validationErrors != null && message.hasOwnProperty("validationErrors")) { + if (!Array.isArray(message.validationErrors)) + return "validationErrors: array expected"; + for (var i = 0; i < message.validationErrors.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.ValidationError.verify(message.validationErrors[i]); + if (error) + return "validationErrors." + error; + } + } + return null; + }; + + /** + * Creates a ValidationResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ValidationResult} ValidationResult + */ + ValidationResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ValidationResult) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ValidationResult(); + if (object.validationErrors) { + if (!Array.isArray(object.validationErrors)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ValidationResult.validationErrors: array expected"); + message.validationErrors = []; + for (var i = 0; i < object.validationErrors.length; ++i) { + if (typeof object.validationErrors[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ValidationResult.validationErrors: object expected"); + message.validationErrors[i] = $root.google.cloud.dialogflow.v2beta1.ValidationError.fromObject(object.validationErrors[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ValidationResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @static + * @param {google.cloud.dialogflow.v2beta1.ValidationResult} message ValidationResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ValidationResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.validationErrors = []; + if (message.validationErrors && message.validationErrors.length) { + object.validationErrors = []; + for (var j = 0; j < message.validationErrors.length; ++j) + object.validationErrors[j] = $root.google.cloud.dialogflow.v2beta1.ValidationError.toObject(message.validationErrors[j], options); + } + return object; + }; + + /** + * Converts this ValidationResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @instance + * @returns {Object.} JSON object + */ + ValidationResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ValidationResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ValidationResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ValidationResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ValidationResult"; + }; + + return ValidationResult; + })(); + + v2beta1.AnswerRecords = (function() { + + /** + * Constructs a new AnswerRecords service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AnswerRecords + * @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 AnswerRecords(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (AnswerRecords.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = AnswerRecords; + + /** + * Creates new AnswerRecords service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @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 {AnswerRecords} RPC service. Useful where requests and/or responses are streamed. + */ + AnswerRecords.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.AnswerRecords|getAnswerRecord}. + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @typedef GetAnswerRecordCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.AnswerRecord} [response] AnswerRecord + */ + + /** + * Calls GetAnswerRecord. + * @function getAnswerRecord + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest} request GetAnswerRecordRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecordCallback} callback Node-style callback called with the error, if any, and AnswerRecord + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AnswerRecords.prototype.getAnswerRecord = function getAnswerRecord(request, callback) { + return this.rpcCall(getAnswerRecord, $root.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest, $root.google.cloud.dialogflow.v2beta1.AnswerRecord, request, callback); + }, "name", { value: "GetAnswerRecord" }); + + /** + * Calls GetAnswerRecord. + * @function getAnswerRecord + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest} request GetAnswerRecordRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.AnswerRecords|listAnswerRecords}. + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @typedef ListAnswerRecordsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse} [response] ListAnswerRecordsResponse + */ + + /** + * Calls ListAnswerRecords. + * @function listAnswerRecords + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest} request ListAnswerRecordsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecordsCallback} callback Node-style callback called with the error, if any, and ListAnswerRecordsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AnswerRecords.prototype.listAnswerRecords = function listAnswerRecords(request, callback) { + return this.rpcCall(listAnswerRecords, $root.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest, $root.google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse, request, callback); + }, "name", { value: "ListAnswerRecords" }); + + /** + * Calls ListAnswerRecords. + * @function listAnswerRecords + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest} request ListAnswerRecordsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.AnswerRecords|updateAnswerRecord}. + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @typedef UpdateAnswerRecordCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.AnswerRecord} [response] AnswerRecord + */ + + /** + * Calls UpdateAnswerRecord. + * @function updateAnswerRecord + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest} request UpdateAnswerRecordRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecordCallback} callback Node-style callback called with the error, if any, and AnswerRecord + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(AnswerRecords.prototype.updateAnswerRecord = function updateAnswerRecord(request, callback) { + return this.rpcCall(updateAnswerRecord, $root.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest, $root.google.cloud.dialogflow.v2beta1.AnswerRecord, request, callback); + }, "name", { value: "UpdateAnswerRecord" }); + + /** + * Calls UpdateAnswerRecord. + * @function updateAnswerRecord + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecords + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest} request UpdateAnswerRecordRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return AnswerRecords; + })(); + + v2beta1.AnswerRecord = (function() { + + /** + * Properties of an AnswerRecord. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAnswerRecord + * @property {string|null} [name] AnswerRecord name + * @property {google.cloud.dialogflow.v2beta1.IAnswerFeedback|null} [answerFeedback] AnswerRecord answerFeedback + * @property {google.cloud.dialogflow.v2beta1.IAgentAssistantRecord|null} [agentAssistantRecord] AnswerRecord agentAssistantRecord + */ + + /** + * Constructs a new AnswerRecord. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AnswerRecord. + * @implements IAnswerRecord + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAnswerRecord=} [properties] Properties to set + */ + function AnswerRecord(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnswerRecord name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @instance + */ + AnswerRecord.prototype.name = ""; + + /** + * AnswerRecord answerFeedback. + * @member {google.cloud.dialogflow.v2beta1.IAnswerFeedback|null|undefined} answerFeedback + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @instance + */ + AnswerRecord.prototype.answerFeedback = null; + + /** + * AnswerRecord agentAssistantRecord. + * @member {google.cloud.dialogflow.v2beta1.IAgentAssistantRecord|null|undefined} agentAssistantRecord + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @instance + */ + AnswerRecord.prototype.agentAssistantRecord = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AnswerRecord record. + * @member {"agentAssistantRecord"|undefined} record + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @instance + */ + Object.defineProperty(AnswerRecord.prototype, "record", { + get: $util.oneOfGetter($oneOfFields = ["agentAssistantRecord"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AnswerRecord instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnswerRecord=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AnswerRecord} AnswerRecord instance + */ + AnswerRecord.create = function create(properties) { + return new AnswerRecord(properties); + }; + + /** + * Encodes the specified AnswerRecord message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnswerRecord.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnswerRecord} message AnswerRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnswerRecord.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.answerFeedback != null && Object.hasOwnProperty.call(message, "answerFeedback")) + $root.google.cloud.dialogflow.v2beta1.AnswerFeedback.encode(message.answerFeedback, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.agentAssistantRecord != null && Object.hasOwnProperty.call(message, "agentAssistantRecord")) + $root.google.cloud.dialogflow.v2beta1.AgentAssistantRecord.encode(message.agentAssistantRecord, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AnswerRecord message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnswerRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnswerRecord} message AnswerRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnswerRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnswerRecord message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AnswerRecord} AnswerRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnswerRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AnswerRecord(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.answerFeedback = $root.google.cloud.dialogflow.v2beta1.AnswerFeedback.decode(reader, reader.uint32()); + break; + } + case 4: { + message.agentAssistantRecord = $root.google.cloud.dialogflow.v2beta1.AgentAssistantRecord.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnswerRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AnswerRecord} AnswerRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnswerRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnswerRecord message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnswerRecord.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.answerFeedback != null && message.hasOwnProperty("answerFeedback")) { + var error = $root.google.cloud.dialogflow.v2beta1.AnswerFeedback.verify(message.answerFeedback); + if (error) + return "answerFeedback." + error; + } + if (message.agentAssistantRecord != null && message.hasOwnProperty("agentAssistantRecord")) { + properties.record = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.AgentAssistantRecord.verify(message.agentAssistantRecord); + if (error) + return "agentAssistantRecord." + error; + } + } + return null; + }; + + /** + * Creates an AnswerRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AnswerRecord} AnswerRecord + */ + AnswerRecord.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AnswerRecord) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AnswerRecord(); + if (object.name != null) + message.name = String(object.name); + if (object.answerFeedback != null) { + if (typeof object.answerFeedback !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnswerRecord.answerFeedback: object expected"); + message.answerFeedback = $root.google.cloud.dialogflow.v2beta1.AnswerFeedback.fromObject(object.answerFeedback); + } + if (object.agentAssistantRecord != null) { + if (typeof object.agentAssistantRecord !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnswerRecord.agentAssistantRecord: object expected"); + message.agentAssistantRecord = $root.google.cloud.dialogflow.v2beta1.AgentAssistantRecord.fromObject(object.agentAssistantRecord); + } + return message; + }; + + /** + * Creates a plain object from an AnswerRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @static + * @param {google.cloud.dialogflow.v2beta1.AnswerRecord} message AnswerRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnswerRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.answerFeedback = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.answerFeedback != null && message.hasOwnProperty("answerFeedback")) + object.answerFeedback = $root.google.cloud.dialogflow.v2beta1.AnswerFeedback.toObject(message.answerFeedback, options); + if (message.agentAssistantRecord != null && message.hasOwnProperty("agentAssistantRecord")) { + object.agentAssistantRecord = $root.google.cloud.dialogflow.v2beta1.AgentAssistantRecord.toObject(message.agentAssistantRecord, options); + if (options.oneofs) + object.record = "agentAssistantRecord"; + } + return object; + }; + + /** + * Converts this AnswerRecord to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @instance + * @returns {Object.} JSON object + */ + AnswerRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnswerRecord + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AnswerRecord + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnswerRecord.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AnswerRecord"; + }; + + return AnswerRecord; + })(); + + v2beta1.AgentAssistantRecord = (function() { + + /** + * Properties of an AgentAssistantRecord. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAgentAssistantRecord + * @property {google.cloud.dialogflow.v2beta1.IArticleAnswer|null} [articleSuggestionAnswer] AgentAssistantRecord articleSuggestionAnswer + * @property {google.cloud.dialogflow.v2beta1.IFaqAnswer|null} [faqAnswer] AgentAssistantRecord faqAnswer + */ + + /** + * Constructs a new AgentAssistantRecord. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AgentAssistantRecord. + * @implements IAgentAssistantRecord + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAgentAssistantRecord=} [properties] Properties to set + */ + function AgentAssistantRecord(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AgentAssistantRecord articleSuggestionAnswer. + * @member {google.cloud.dialogflow.v2beta1.IArticleAnswer|null|undefined} articleSuggestionAnswer + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @instance + */ + AgentAssistantRecord.prototype.articleSuggestionAnswer = null; + + /** + * AgentAssistantRecord faqAnswer. + * @member {google.cloud.dialogflow.v2beta1.IFaqAnswer|null|undefined} faqAnswer + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @instance + */ + AgentAssistantRecord.prototype.faqAnswer = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AgentAssistantRecord answer. + * @member {"articleSuggestionAnswer"|"faqAnswer"|undefined} answer + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @instance + */ + Object.defineProperty(AgentAssistantRecord.prototype, "answer", { + get: $util.oneOfGetter($oneOfFields = ["articleSuggestionAnswer", "faqAnswer"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AgentAssistantRecord instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @static + * @param {google.cloud.dialogflow.v2beta1.IAgentAssistantRecord=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantRecord} AgentAssistantRecord instance + */ + AgentAssistantRecord.create = function create(properties) { + return new AgentAssistantRecord(properties); + }; + + /** + * Encodes the specified AgentAssistantRecord message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantRecord.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @static + * @param {google.cloud.dialogflow.v2beta1.IAgentAssistantRecord} message AgentAssistantRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAssistantRecord.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.articleSuggestionAnswer != null && Object.hasOwnProperty.call(message, "articleSuggestionAnswer")) + $root.google.cloud.dialogflow.v2beta1.ArticleAnswer.encode(message.articleSuggestionAnswer, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.faqAnswer != null && Object.hasOwnProperty.call(message, "faqAnswer")) + $root.google.cloud.dialogflow.v2beta1.FaqAnswer.encode(message.faqAnswer, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AgentAssistantRecord message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantRecord.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @static + * @param {google.cloud.dialogflow.v2beta1.IAgentAssistantRecord} message AgentAssistantRecord message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAssistantRecord.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AgentAssistantRecord message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantRecord} AgentAssistantRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAssistantRecord.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AgentAssistantRecord(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.articleSuggestionAnswer = $root.google.cloud.dialogflow.v2beta1.ArticleAnswer.decode(reader, reader.uint32()); + break; + } + case 6: { + message.faqAnswer = $root.google.cloud.dialogflow.v2beta1.FaqAnswer.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AgentAssistantRecord message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantRecord} AgentAssistantRecord + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAssistantRecord.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AgentAssistantRecord message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AgentAssistantRecord.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.articleSuggestionAnswer != null && message.hasOwnProperty("articleSuggestionAnswer")) { + properties.answer = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.ArticleAnswer.verify(message.articleSuggestionAnswer); + if (error) + return "articleSuggestionAnswer." + error; + } + } + if (message.faqAnswer != null && message.hasOwnProperty("faqAnswer")) { + if (properties.answer === 1) + return "answer: multiple values"; + properties.answer = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.FaqAnswer.verify(message.faqAnswer); + if (error) + return "faqAnswer." + error; + } + } + return null; + }; + + /** + * Creates an AgentAssistantRecord message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantRecord} AgentAssistantRecord + */ + AgentAssistantRecord.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AgentAssistantRecord) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AgentAssistantRecord(); + if (object.articleSuggestionAnswer != null) { + if (typeof object.articleSuggestionAnswer !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AgentAssistantRecord.articleSuggestionAnswer: object expected"); + message.articleSuggestionAnswer = $root.google.cloud.dialogflow.v2beta1.ArticleAnswer.fromObject(object.articleSuggestionAnswer); + } + if (object.faqAnswer != null) { + if (typeof object.faqAnswer !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AgentAssistantRecord.faqAnswer: object expected"); + message.faqAnswer = $root.google.cloud.dialogflow.v2beta1.FaqAnswer.fromObject(object.faqAnswer); + } + return message; + }; + + /** + * Creates a plain object from an AgentAssistantRecord message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @static + * @param {google.cloud.dialogflow.v2beta1.AgentAssistantRecord} message AgentAssistantRecord + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AgentAssistantRecord.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.articleSuggestionAnswer != null && message.hasOwnProperty("articleSuggestionAnswer")) { + object.articleSuggestionAnswer = $root.google.cloud.dialogflow.v2beta1.ArticleAnswer.toObject(message.articleSuggestionAnswer, options); + if (options.oneofs) + object.answer = "articleSuggestionAnswer"; + } + if (message.faqAnswer != null && message.hasOwnProperty("faqAnswer")) { + object.faqAnswer = $root.google.cloud.dialogflow.v2beta1.FaqAnswer.toObject(message.faqAnswer, options); + if (options.oneofs) + object.answer = "faqAnswer"; + } + return object; + }; + + /** + * Converts this AgentAssistantRecord to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @instance + * @returns {Object.} JSON object + */ + AgentAssistantRecord.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AgentAssistantRecord + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantRecord + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AgentAssistantRecord.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AgentAssistantRecord"; + }; + + return AgentAssistantRecord; + })(); + + v2beta1.AnswerFeedback = (function() { + + /** + * Properties of an AnswerFeedback. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAnswerFeedback + * @property {google.cloud.dialogflow.v2beta1.AnswerFeedback.CorrectnessLevel|null} [correctnessLevel] AnswerFeedback correctnessLevel + * @property {google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback|null} [agentAssistantDetailFeedback] AnswerFeedback agentAssistantDetailFeedback + * @property {boolean|null} [clicked] AnswerFeedback clicked + * @property {google.protobuf.ITimestamp|null} [clickTime] AnswerFeedback clickTime + * @property {boolean|null} [displayed] AnswerFeedback displayed + * @property {google.protobuf.ITimestamp|null} [displayTime] AnswerFeedback displayTime + */ + + /** + * Constructs a new AnswerFeedback. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AnswerFeedback. + * @implements IAnswerFeedback + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAnswerFeedback=} [properties] Properties to set + */ + function AnswerFeedback(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnswerFeedback correctnessLevel. + * @member {google.cloud.dialogflow.v2beta1.AnswerFeedback.CorrectnessLevel} correctnessLevel + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.correctnessLevel = 0; + + /** + * AnswerFeedback agentAssistantDetailFeedback. + * @member {google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback|null|undefined} agentAssistantDetailFeedback + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.agentAssistantDetailFeedback = null; + + /** + * AnswerFeedback clicked. + * @member {boolean} clicked + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.clicked = false; + + /** + * AnswerFeedback clickTime. + * @member {google.protobuf.ITimestamp|null|undefined} clickTime + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.clickTime = null; + + /** + * AnswerFeedback displayed. + * @member {boolean} displayed + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.displayed = false; + + /** + * AnswerFeedback displayTime. + * @member {google.protobuf.ITimestamp|null|undefined} displayTime + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @instance + */ + AnswerFeedback.prototype.displayTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AnswerFeedback detailFeedback. + * @member {"agentAssistantDetailFeedback"|undefined} detailFeedback + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @instance + */ + Object.defineProperty(AnswerFeedback.prototype, "detailFeedback", { + get: $util.oneOfGetter($oneOfFields = ["agentAssistantDetailFeedback"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AnswerFeedback instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnswerFeedback=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AnswerFeedback} AnswerFeedback instance + */ + AnswerFeedback.create = function create(properties) { + return new AnswerFeedback(properties); + }; + + /** + * Encodes the specified AnswerFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnswerFeedback.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnswerFeedback} message AnswerFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnswerFeedback.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.correctnessLevel != null && Object.hasOwnProperty.call(message, "correctnessLevel")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.correctnessLevel); + if (message.agentAssistantDetailFeedback != null && Object.hasOwnProperty.call(message, "agentAssistantDetailFeedback")) + $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.encode(message.agentAssistantDetailFeedback, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.clicked != null && Object.hasOwnProperty.call(message, "clicked")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.clicked); + if (message.displayed != null && Object.hasOwnProperty.call(message, "displayed")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.displayed); + if (message.clickTime != null && Object.hasOwnProperty.call(message, "clickTime")) + $root.google.protobuf.Timestamp.encode(message.clickTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.displayTime != null && Object.hasOwnProperty.call(message, "displayTime")) + $root.google.protobuf.Timestamp.encode(message.displayTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AnswerFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnswerFeedback.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnswerFeedback} message AnswerFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnswerFeedback.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnswerFeedback message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AnswerFeedback} AnswerFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnswerFeedback.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AnswerFeedback(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.correctnessLevel = reader.int32(); + break; + } + case 2: { + message.agentAssistantDetailFeedback = $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.decode(reader, reader.uint32()); + break; + } + case 3: { + message.clicked = reader.bool(); + break; + } + case 5: { + message.clickTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.displayed = reader.bool(); + break; + } + case 6: { + message.displayTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnswerFeedback message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AnswerFeedback} AnswerFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnswerFeedback.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnswerFeedback message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnswerFeedback.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.correctnessLevel != null && message.hasOwnProperty("correctnessLevel")) + switch (message.correctnessLevel) { + default: + return "correctnessLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.agentAssistantDetailFeedback != null && message.hasOwnProperty("agentAssistantDetailFeedback")) { + properties.detailFeedback = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.verify(message.agentAssistantDetailFeedback); + if (error) + return "agentAssistantDetailFeedback." + error; + } + } + if (message.clicked != null && message.hasOwnProperty("clicked")) + if (typeof message.clicked !== "boolean") + return "clicked: boolean expected"; + if (message.clickTime != null && message.hasOwnProperty("clickTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.clickTime); + if (error) + return "clickTime." + error; + } + if (message.displayed != null && message.hasOwnProperty("displayed")) + if (typeof message.displayed !== "boolean") + return "displayed: boolean expected"; + if (message.displayTime != null && message.hasOwnProperty("displayTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.displayTime); + if (error) + return "displayTime." + error; + } + return null; + }; + + /** + * Creates an AnswerFeedback message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AnswerFeedback} AnswerFeedback + */ + AnswerFeedback.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AnswerFeedback) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AnswerFeedback(); + switch (object.correctnessLevel) { + default: + if (typeof object.correctnessLevel === "number") { + message.correctnessLevel = object.correctnessLevel; + break; + } + break; + case "CORRECTNESS_LEVEL_UNSPECIFIED": + case 0: + message.correctnessLevel = 0; + break; + case "NOT_CORRECT": + case 1: + message.correctnessLevel = 1; + break; + case "PARTIALLY_CORRECT": + case 2: + message.correctnessLevel = 2; + break; + case "FULLY_CORRECT": + case 3: + message.correctnessLevel = 3; + break; + } + if (object.agentAssistantDetailFeedback != null) { + if (typeof object.agentAssistantDetailFeedback !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnswerFeedback.agentAssistantDetailFeedback: object expected"); + message.agentAssistantDetailFeedback = $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.fromObject(object.agentAssistantDetailFeedback); + } + if (object.clicked != null) + message.clicked = Boolean(object.clicked); + if (object.clickTime != null) { + if (typeof object.clickTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnswerFeedback.clickTime: object expected"); + message.clickTime = $root.google.protobuf.Timestamp.fromObject(object.clickTime); + } + if (object.displayed != null) + message.displayed = Boolean(object.displayed); + if (object.displayTime != null) { + if (typeof object.displayTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnswerFeedback.displayTime: object expected"); + message.displayTime = $root.google.protobuf.Timestamp.fromObject(object.displayTime); + } + return message; + }; + + /** + * Creates a plain object from an AnswerFeedback message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.AnswerFeedback} message AnswerFeedback + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnswerFeedback.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.correctnessLevel = options.enums === String ? "CORRECTNESS_LEVEL_UNSPECIFIED" : 0; + object.clicked = false; + object.displayed = false; + object.clickTime = null; + object.displayTime = null; + } + if (message.correctnessLevel != null && message.hasOwnProperty("correctnessLevel")) + object.correctnessLevel = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.AnswerFeedback.CorrectnessLevel[message.correctnessLevel] === undefined ? message.correctnessLevel : $root.google.cloud.dialogflow.v2beta1.AnswerFeedback.CorrectnessLevel[message.correctnessLevel] : message.correctnessLevel; + if (message.agentAssistantDetailFeedback != null && message.hasOwnProperty("agentAssistantDetailFeedback")) { + object.agentAssistantDetailFeedback = $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.toObject(message.agentAssistantDetailFeedback, options); + if (options.oneofs) + object.detailFeedback = "agentAssistantDetailFeedback"; + } + if (message.clicked != null && message.hasOwnProperty("clicked")) + object.clicked = message.clicked; + if (message.displayed != null && message.hasOwnProperty("displayed")) + object.displayed = message.displayed; + if (message.clickTime != null && message.hasOwnProperty("clickTime")) + object.clickTime = $root.google.protobuf.Timestamp.toObject(message.clickTime, options); + if (message.displayTime != null && message.hasOwnProperty("displayTime")) + object.displayTime = $root.google.protobuf.Timestamp.toObject(message.displayTime, options); + return object; + }; + + /** + * Converts this AnswerFeedback to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @instance + * @returns {Object.} JSON object + */ + AnswerFeedback.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnswerFeedback + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AnswerFeedback + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnswerFeedback.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AnswerFeedback"; + }; + + /** + * CorrectnessLevel enum. + * @name google.cloud.dialogflow.v2beta1.AnswerFeedback.CorrectnessLevel + * @enum {number} + * @property {number} CORRECTNESS_LEVEL_UNSPECIFIED=0 CORRECTNESS_LEVEL_UNSPECIFIED value + * @property {number} NOT_CORRECT=1 NOT_CORRECT value + * @property {number} PARTIALLY_CORRECT=2 PARTIALLY_CORRECT value + * @property {number} FULLY_CORRECT=3 FULLY_CORRECT value + */ + AnswerFeedback.CorrectnessLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CORRECTNESS_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "NOT_CORRECT"] = 1; + values[valuesById[2] = "PARTIALLY_CORRECT"] = 2; + values[valuesById[3] = "FULLY_CORRECT"] = 3; + return values; + })(); + + return AnswerFeedback; + })(); + + v2beta1.AgentAssistantFeedback = (function() { + + /** + * Properties of an AgentAssistantFeedback. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAgentAssistantFeedback + * @property {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance|null} [answerRelevance] AgentAssistantFeedback answerRelevance + * @property {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentCorrectness|null} [documentCorrectness] AgentAssistantFeedback documentCorrectness + * @property {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency|null} [documentEfficiency] AgentAssistantFeedback documentEfficiency + * @property {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback|null} [summarizationFeedback] AgentAssistantFeedback summarizationFeedback + */ + + /** + * Constructs a new AgentAssistantFeedback. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AgentAssistantFeedback. + * @implements IAgentAssistantFeedback + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback=} [properties] Properties to set + */ + function AgentAssistantFeedback(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AgentAssistantFeedback answerRelevance. + * @member {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance} answerRelevance + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @instance + */ + AgentAssistantFeedback.prototype.answerRelevance = 0; + + /** + * AgentAssistantFeedback documentCorrectness. + * @member {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentCorrectness} documentCorrectness + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @instance + */ + AgentAssistantFeedback.prototype.documentCorrectness = 0; + + /** + * AgentAssistantFeedback documentEfficiency. + * @member {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency} documentEfficiency + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @instance + */ + AgentAssistantFeedback.prototype.documentEfficiency = 0; + + /** + * AgentAssistantFeedback summarizationFeedback. + * @member {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback|null|undefined} summarizationFeedback + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @instance + */ + AgentAssistantFeedback.prototype.summarizationFeedback = null; + + /** + * Creates a new AgentAssistantFeedback instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback} AgentAssistantFeedback instance + */ + AgentAssistantFeedback.create = function create(properties) { + return new AgentAssistantFeedback(properties); + }; + + /** + * Encodes the specified AgentAssistantFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback} message AgentAssistantFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAssistantFeedback.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answerRelevance != null && Object.hasOwnProperty.call(message, "answerRelevance")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.answerRelevance); + if (message.documentCorrectness != null && Object.hasOwnProperty.call(message, "documentCorrectness")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.documentCorrectness); + if (message.documentEfficiency != null && Object.hasOwnProperty.call(message, "documentEfficiency")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.documentEfficiency); + if (message.summarizationFeedback != null && Object.hasOwnProperty.call(message, "summarizationFeedback")) + $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.encode(message.summarizationFeedback, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AgentAssistantFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.IAgentAssistantFeedback} message AgentAssistantFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AgentAssistantFeedback.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AgentAssistantFeedback message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback} AgentAssistantFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAssistantFeedback.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.answerRelevance = reader.int32(); + break; + } + case 2: { + message.documentCorrectness = reader.int32(); + break; + } + case 3: { + message.documentEfficiency = reader.int32(); + break; + } + case 4: { + message.summarizationFeedback = $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AgentAssistantFeedback message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback} AgentAssistantFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AgentAssistantFeedback.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AgentAssistantFeedback message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AgentAssistantFeedback.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answerRelevance != null && message.hasOwnProperty("answerRelevance")) + switch (message.answerRelevance) { + default: + return "answerRelevance: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.documentCorrectness != null && message.hasOwnProperty("documentCorrectness")) + switch (message.documentCorrectness) { + default: + return "documentCorrectness: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.documentEfficiency != null && message.hasOwnProperty("documentEfficiency")) + switch (message.documentEfficiency) { + default: + return "documentEfficiency: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.summarizationFeedback != null && message.hasOwnProperty("summarizationFeedback")) { + var error = $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.verify(message.summarizationFeedback); + if (error) + return "summarizationFeedback." + error; + } + return null; + }; + + /** + * Creates an AgentAssistantFeedback message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback} AgentAssistantFeedback + */ + AgentAssistantFeedback.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback(); + switch (object.answerRelevance) { + default: + if (typeof object.answerRelevance === "number") { + message.answerRelevance = object.answerRelevance; + break; + } + break; + case "ANSWER_RELEVANCE_UNSPECIFIED": + case 0: + message.answerRelevance = 0; + break; + case "IRRELEVANT": + case 1: + message.answerRelevance = 1; + break; + case "RELEVANT": + case 2: + message.answerRelevance = 2; + break; + } + switch (object.documentCorrectness) { + default: + if (typeof object.documentCorrectness === "number") { + message.documentCorrectness = object.documentCorrectness; + break; + } + break; + case "DOCUMENT_CORRECTNESS_UNSPECIFIED": + case 0: + message.documentCorrectness = 0; + break; + case "INCORRECT": + case 1: + message.documentCorrectness = 1; + break; + case "CORRECT": + case 2: + message.documentCorrectness = 2; + break; + } + switch (object.documentEfficiency) { + default: + if (typeof object.documentEfficiency === "number") { + message.documentEfficiency = object.documentEfficiency; + break; + } + break; + case "DOCUMENT_EFFICIENCY_UNSPECIFIED": + case 0: + message.documentEfficiency = 0; + break; + case "INEFFICIENT": + case 1: + message.documentEfficiency = 1; + break; + case "EFFICIENT": + case 2: + message.documentEfficiency = 2; + break; + } + if (object.summarizationFeedback != null) { + if (typeof object.summarizationFeedback !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.summarizationFeedback: object expected"); + message.summarizationFeedback = $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.fromObject(object.summarizationFeedback); + } + return message; + }; + + /** + * Creates a plain object from an AgentAssistantFeedback message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback} message AgentAssistantFeedback + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AgentAssistantFeedback.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.answerRelevance = options.enums === String ? "ANSWER_RELEVANCE_UNSPECIFIED" : 0; + object.documentCorrectness = options.enums === String ? "DOCUMENT_CORRECTNESS_UNSPECIFIED" : 0; + object.documentEfficiency = options.enums === String ? "DOCUMENT_EFFICIENCY_UNSPECIFIED" : 0; + object.summarizationFeedback = null; + } + if (message.answerRelevance != null && message.hasOwnProperty("answerRelevance")) + object.answerRelevance = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance[message.answerRelevance] === undefined ? message.answerRelevance : $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance[message.answerRelevance] : message.answerRelevance; + if (message.documentCorrectness != null && message.hasOwnProperty("documentCorrectness")) + object.documentCorrectness = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentCorrectness[message.documentCorrectness] === undefined ? message.documentCorrectness : $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentCorrectness[message.documentCorrectness] : message.documentCorrectness; + if (message.documentEfficiency != null && message.hasOwnProperty("documentEfficiency")) + object.documentEfficiency = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency[message.documentEfficiency] === undefined ? message.documentEfficiency : $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency[message.documentEfficiency] : message.documentEfficiency; + if (message.summarizationFeedback != null && message.hasOwnProperty("summarizationFeedback")) + object.summarizationFeedback = $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.toObject(message.summarizationFeedback, options); + return object; + }; + + /** + * Converts this AgentAssistantFeedback to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @instance + * @returns {Object.} JSON object + */ + AgentAssistantFeedback.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AgentAssistantFeedback + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AgentAssistantFeedback.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AgentAssistantFeedback"; + }; + + /** + * AnswerRelevance enum. + * @name google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.AnswerRelevance + * @enum {number} + * @property {number} ANSWER_RELEVANCE_UNSPECIFIED=0 ANSWER_RELEVANCE_UNSPECIFIED value + * @property {number} IRRELEVANT=1 IRRELEVANT value + * @property {number} RELEVANT=2 RELEVANT value + */ + AgentAssistantFeedback.AnswerRelevance = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ANSWER_RELEVANCE_UNSPECIFIED"] = 0; + values[valuesById[1] = "IRRELEVANT"] = 1; + values[valuesById[2] = "RELEVANT"] = 2; + return values; + })(); + + /** + * DocumentCorrectness enum. + * @name google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentCorrectness + * @enum {number} + * @property {number} DOCUMENT_CORRECTNESS_UNSPECIFIED=0 DOCUMENT_CORRECTNESS_UNSPECIFIED value + * @property {number} INCORRECT=1 INCORRECT value + * @property {number} CORRECT=2 CORRECT value + */ + AgentAssistantFeedback.DocumentCorrectness = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DOCUMENT_CORRECTNESS_UNSPECIFIED"] = 0; + values[valuesById[1] = "INCORRECT"] = 1; + values[valuesById[2] = "CORRECT"] = 2; + return values; + })(); + + /** + * DocumentEfficiency enum. + * @name google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.DocumentEfficiency + * @enum {number} + * @property {number} DOCUMENT_EFFICIENCY_UNSPECIFIED=0 DOCUMENT_EFFICIENCY_UNSPECIFIED value + * @property {number} INEFFICIENT=1 INEFFICIENT value + * @property {number} EFFICIENT=2 EFFICIENT value + */ + AgentAssistantFeedback.DocumentEfficiency = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DOCUMENT_EFFICIENCY_UNSPECIFIED"] = 0; + values[valuesById[1] = "INEFFICIENT"] = 1; + values[valuesById[2] = "EFFICIENT"] = 2; + return values; + })(); + + AgentAssistantFeedback.SummarizationFeedback = (function() { + + /** + * Properties of a SummarizationFeedback. + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @interface ISummarizationFeedback + * @property {google.protobuf.ITimestamp|null} [startTimestamp] SummarizationFeedback startTimestamp + * @property {google.protobuf.ITimestamp|null} [submitTimestamp] SummarizationFeedback submitTimestamp + * @property {string|null} [summaryText] SummarizationFeedback summaryText + */ + + /** + * Constructs a new SummarizationFeedback. + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback + * @classdesc Represents a SummarizationFeedback. + * @implements ISummarizationFeedback + * @constructor + * @param {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback=} [properties] Properties to set + */ + function SummarizationFeedback(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SummarizationFeedback startTimestamp. + * @member {google.protobuf.ITimestamp|null|undefined} startTimestamp + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @instance + */ + SummarizationFeedback.prototype.startTimestamp = null; + + /** + * SummarizationFeedback submitTimestamp. + * @member {google.protobuf.ITimestamp|null|undefined} submitTimestamp + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @instance + */ + SummarizationFeedback.prototype.submitTimestamp = null; + + /** + * SummarizationFeedback summaryText. + * @member {string} summaryText + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @instance + */ + SummarizationFeedback.prototype.summaryText = ""; + + /** + * Creates a new SummarizationFeedback instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback} SummarizationFeedback instance + */ + SummarizationFeedback.create = function create(properties) { + return new SummarizationFeedback(properties); + }; + + /** + * Encodes the specified SummarizationFeedback message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback} message SummarizationFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SummarizationFeedback.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTimestamp != null && Object.hasOwnProperty.call(message, "startTimestamp")) + $root.google.protobuf.Timestamp.encode(message.startTimestamp, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.submitTimestamp != null && Object.hasOwnProperty.call(message, "submitTimestamp")) + $root.google.protobuf.Timestamp.encode(message.submitTimestamp, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.summaryText != null && Object.hasOwnProperty.call(message, "summaryText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.summaryText); + return writer; + }; + + /** + * Encodes the specified SummarizationFeedback message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.ISummarizationFeedback} message SummarizationFeedback message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SummarizationFeedback.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SummarizationFeedback message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback} SummarizationFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SummarizationFeedback.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.startTimestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.submitTimestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.summaryText = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SummarizationFeedback message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback} SummarizationFeedback + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SummarizationFeedback.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SummarizationFeedback message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SummarizationFeedback.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTimestamp != null && message.hasOwnProperty("startTimestamp")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTimestamp); + if (error) + return "startTimestamp." + error; + } + if (message.submitTimestamp != null && message.hasOwnProperty("submitTimestamp")) { + var error = $root.google.protobuf.Timestamp.verify(message.submitTimestamp); + if (error) + return "submitTimestamp." + error; + } + if (message.summaryText != null && message.hasOwnProperty("summaryText")) + if (!$util.isString(message.summaryText)) + return "summaryText: string expected"; + return null; + }; + + /** + * Creates a SummarizationFeedback message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback} SummarizationFeedback + */ + SummarizationFeedback.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback(); + if (object.startTimestamp != null) { + if (typeof object.startTimestamp !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.startTimestamp: object expected"); + message.startTimestamp = $root.google.protobuf.Timestamp.fromObject(object.startTimestamp); + } + if (object.submitTimestamp != null) { + if (typeof object.submitTimestamp !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback.submitTimestamp: object expected"); + message.submitTimestamp = $root.google.protobuf.Timestamp.fromObject(object.submitTimestamp); + } + if (object.summaryText != null) + message.summaryText = String(object.summaryText); + return message; + }; + + /** + * Creates a plain object from a SummarizationFeedback message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @static + * @param {google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback} message SummarizationFeedback + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SummarizationFeedback.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTimestamp = null; + object.submitTimestamp = null; + object.summaryText = ""; + } + if (message.startTimestamp != null && message.hasOwnProperty("startTimestamp")) + object.startTimestamp = $root.google.protobuf.Timestamp.toObject(message.startTimestamp, options); + if (message.submitTimestamp != null && message.hasOwnProperty("submitTimestamp")) + object.submitTimestamp = $root.google.protobuf.Timestamp.toObject(message.submitTimestamp, options); + if (message.summaryText != null && message.hasOwnProperty("summaryText")) + object.summaryText = message.summaryText; + return object; + }; + + /** + * Converts this SummarizationFeedback to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @instance + * @returns {Object.} JSON object + */ + SummarizationFeedback.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SummarizationFeedback + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SummarizationFeedback.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AgentAssistantFeedback.SummarizationFeedback"; + }; + + return SummarizationFeedback; + })(); + + return AgentAssistantFeedback; + })(); + + v2beta1.GetAnswerRecordRequest = (function() { + + /** + * Properties of a GetAnswerRecordRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetAnswerRecordRequest + * @property {string|null} [name] GetAnswerRecordRequest name + */ + + /** + * Constructs a new GetAnswerRecordRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetAnswerRecordRequest. + * @implements IGetAnswerRecordRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest=} [properties] Properties to set + */ + function GetAnswerRecordRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetAnswerRecordRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @instance + */ + GetAnswerRecordRequest.prototype.name = ""; + + /** + * Creates a new GetAnswerRecordRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest} GetAnswerRecordRequest instance + */ + GetAnswerRecordRequest.create = function create(properties) { + return new GetAnswerRecordRequest(properties); + }; + + /** + * Encodes the specified GetAnswerRecordRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest} message GetAnswerRecordRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAnswerRecordRequest.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 GetAnswerRecordRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest} message GetAnswerRecordRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetAnswerRecordRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetAnswerRecordRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest} GetAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAnswerRecordRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest(); + 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 GetAnswerRecordRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest} GetAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetAnswerRecordRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetAnswerRecordRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetAnswerRecordRequest.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 GetAnswerRecordRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest} GetAnswerRecordRequest + */ + GetAnswerRecordRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetAnswerRecordRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest} message GetAnswerRecordRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetAnswerRecordRequest.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 GetAnswerRecordRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @instance + * @returns {Object.} JSON object + */ + GetAnswerRecordRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetAnswerRecordRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetAnswerRecordRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest"; + }; + + return GetAnswerRecordRequest; + })(); + + v2beta1.ListAnswerRecordsRequest = (function() { + + /** + * Properties of a ListAnswerRecordsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListAnswerRecordsRequest + * @property {string|null} [parent] ListAnswerRecordsRequest parent + * @property {string|null} [filter] ListAnswerRecordsRequest filter + * @property {number|null} [pageSize] ListAnswerRecordsRequest pageSize + * @property {string|null} [pageToken] ListAnswerRecordsRequest pageToken + */ + + /** + * Constructs a new ListAnswerRecordsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListAnswerRecordsRequest. + * @implements IListAnswerRecordsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest=} [properties] Properties to set + */ + function ListAnswerRecordsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListAnswerRecordsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @instance + */ + ListAnswerRecordsRequest.prototype.parent = ""; + + /** + * ListAnswerRecordsRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @instance + */ + ListAnswerRecordsRequest.prototype.filter = ""; + + /** + * ListAnswerRecordsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @instance + */ + ListAnswerRecordsRequest.prototype.pageSize = 0; + + /** + * ListAnswerRecordsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @instance + */ + ListAnswerRecordsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListAnswerRecordsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest} ListAnswerRecordsRequest instance + */ + ListAnswerRecordsRequest.create = function create(properties) { + return new ListAnswerRecordsRequest(properties); + }; + + /** + * Encodes the specified ListAnswerRecordsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest} message ListAnswerRecordsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAnswerRecordsRequest.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.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListAnswerRecordsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest} message ListAnswerRecordsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAnswerRecordsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAnswerRecordsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest} ListAnswerRecordsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAnswerRecordsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAnswerRecordsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest} ListAnswerRecordsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAnswerRecordsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAnswerRecordsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAnswerRecordsRequest.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.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 ListAnswerRecordsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest} ListAnswerRecordsRequest + */ + ListAnswerRecordsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + 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 ListAnswerRecordsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest} message ListAnswerRecordsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAnswerRecordsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + 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; + return object; + }; + + /** + * Converts this ListAnswerRecordsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @instance + * @returns {Object.} JSON object + */ + ListAnswerRecordsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListAnswerRecordsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListAnswerRecordsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest"; + }; + + return ListAnswerRecordsRequest; + })(); + + v2beta1.ListAnswerRecordsResponse = (function() { + + /** + * Properties of a ListAnswerRecordsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListAnswerRecordsResponse + * @property {Array.|null} [answerRecords] ListAnswerRecordsResponse answerRecords + * @property {string|null} [nextPageToken] ListAnswerRecordsResponse nextPageToken + */ + + /** + * Constructs a new ListAnswerRecordsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListAnswerRecordsResponse. + * @implements IListAnswerRecordsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse=} [properties] Properties to set + */ + function ListAnswerRecordsResponse(properties) { + this.answerRecords = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListAnswerRecordsResponse answerRecords. + * @member {Array.} answerRecords + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @instance + */ + ListAnswerRecordsResponse.prototype.answerRecords = $util.emptyArray; + + /** + * ListAnswerRecordsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @instance + */ + ListAnswerRecordsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListAnswerRecordsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse} ListAnswerRecordsResponse instance + */ + ListAnswerRecordsResponse.create = function create(properties) { + return new ListAnswerRecordsResponse(properties); + }; + + /** + * Encodes the specified ListAnswerRecordsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse} message ListAnswerRecordsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAnswerRecordsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answerRecords != null && message.answerRecords.length) + for (var i = 0; i < message.answerRecords.length; ++i) + $root.google.cloud.dialogflow.v2beta1.AnswerRecord.encode(message.answerRecords[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 ListAnswerRecordsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse} message ListAnswerRecordsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListAnswerRecordsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListAnswerRecordsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse} ListAnswerRecordsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAnswerRecordsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.answerRecords && message.answerRecords.length)) + message.answerRecords = []; + message.answerRecords.push($root.google.cloud.dialogflow.v2beta1.AnswerRecord.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListAnswerRecordsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse} ListAnswerRecordsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListAnswerRecordsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListAnswerRecordsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListAnswerRecordsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answerRecords != null && message.hasOwnProperty("answerRecords")) { + if (!Array.isArray(message.answerRecords)) + return "answerRecords: array expected"; + for (var i = 0; i < message.answerRecords.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.AnswerRecord.verify(message.answerRecords[i]); + if (error) + return "answerRecords." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListAnswerRecordsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse} ListAnswerRecordsResponse + */ + ListAnswerRecordsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse(); + if (object.answerRecords) { + if (!Array.isArray(object.answerRecords)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.answerRecords: array expected"); + message.answerRecords = []; + for (var i = 0; i < object.answerRecords.length; ++i) { + if (typeof object.answerRecords[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.answerRecords: object expected"); + message.answerRecords[i] = $root.google.cloud.dialogflow.v2beta1.AnswerRecord.fromObject(object.answerRecords[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListAnswerRecordsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse} message ListAnswerRecordsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListAnswerRecordsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.answerRecords = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.answerRecords && message.answerRecords.length) { + object.answerRecords = []; + for (var j = 0; j < message.answerRecords.length; ++j) + object.answerRecords[j] = $root.google.cloud.dialogflow.v2beta1.AnswerRecord.toObject(message.answerRecords[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListAnswerRecordsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @instance + * @returns {Object.} JSON object + */ + ListAnswerRecordsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListAnswerRecordsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListAnswerRecordsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse"; + }; + + return ListAnswerRecordsResponse; + })(); + + v2beta1.UpdateAnswerRecordRequest = (function() { + + /** + * Properties of an UpdateAnswerRecordRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateAnswerRecordRequest + * @property {google.cloud.dialogflow.v2beta1.IAnswerRecord|null} [answerRecord] UpdateAnswerRecordRequest answerRecord + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateAnswerRecordRequest updateMask + */ + + /** + * Constructs a new UpdateAnswerRecordRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateAnswerRecordRequest. + * @implements IUpdateAnswerRecordRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest=} [properties] Properties to set + */ + function UpdateAnswerRecordRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateAnswerRecordRequest answerRecord. + * @member {google.cloud.dialogflow.v2beta1.IAnswerRecord|null|undefined} answerRecord + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @instance + */ + UpdateAnswerRecordRequest.prototype.answerRecord = null; + + /** + * UpdateAnswerRecordRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @instance + */ + UpdateAnswerRecordRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateAnswerRecordRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest} UpdateAnswerRecordRequest instance + */ + UpdateAnswerRecordRequest.create = function create(properties) { + return new UpdateAnswerRecordRequest(properties); + }; + + /** + * Encodes the specified UpdateAnswerRecordRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest} message UpdateAnswerRecordRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAnswerRecordRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + $root.google.cloud.dialogflow.v2beta1.AnswerRecord.encode(message.answerRecord, 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 UpdateAnswerRecordRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest} message UpdateAnswerRecordRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateAnswerRecordRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateAnswerRecordRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest} UpdateAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAnswerRecordRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.answerRecord = $root.google.cloud.dialogflow.v2beta1.AnswerRecord.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 UpdateAnswerRecordRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest} UpdateAnswerRecordRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateAnswerRecordRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateAnswerRecordRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateAnswerRecordRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) { + var error = $root.google.cloud.dialogflow.v2beta1.AnswerRecord.verify(message.answerRecord); + if (error) + return "answerRecord." + 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 UpdateAnswerRecordRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest} UpdateAnswerRecordRequest + */ + UpdateAnswerRecordRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest(); + if (object.answerRecord != null) { + if (typeof object.answerRecord !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest.answerRecord: object expected"); + message.answerRecord = $root.google.cloud.dialogflow.v2beta1.AnswerRecord.fromObject(object.answerRecord); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateAnswerRecordRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest} message UpdateAnswerRecordRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateAnswerRecordRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.answerRecord = null; + object.updateMask = null; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = $root.google.cloud.dialogflow.v2beta1.AnswerRecord.toObject(message.answerRecord, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateAnswerRecordRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateAnswerRecordRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateAnswerRecordRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateAnswerRecordRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest"; + }; + + return UpdateAnswerRecordRequest; + })(); + + v2beta1.Participants = (function() { + + /** + * Constructs a new Participants service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Participants + * @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 Participants(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Participants.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Participants; + + /** + * Creates new Participants service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @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 {Participants} RPC service. Useful where requests and/or responses are streamed. + */ + Participants.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|createParticipant}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef CreateParticipantCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Participant} [response] Participant + */ + + /** + * Calls CreateParticipant. + * @function createParticipant + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateParticipantRequest} request CreateParticipantRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.CreateParticipantCallback} callback Node-style callback called with the error, if any, and Participant + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.createParticipant = function createParticipant(request, callback) { + return this.rpcCall(createParticipant, $root.google.cloud.dialogflow.v2beta1.CreateParticipantRequest, $root.google.cloud.dialogflow.v2beta1.Participant, request, callback); + }, "name", { value: "CreateParticipant" }); + + /** + * Calls CreateParticipant. + * @function createParticipant + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateParticipantRequest} request CreateParticipantRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|getParticipant}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef GetParticipantCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Participant} [response] Participant + */ + + /** + * Calls GetParticipant. + * @function getParticipant + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetParticipantRequest} request GetParticipantRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.GetParticipantCallback} callback Node-style callback called with the error, if any, and Participant + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.getParticipant = function getParticipant(request, callback) { + return this.rpcCall(getParticipant, $root.google.cloud.dialogflow.v2beta1.GetParticipantRequest, $root.google.cloud.dialogflow.v2beta1.Participant, request, callback); + }, "name", { value: "GetParticipant" }); + + /** + * Calls GetParticipant. + * @function getParticipant + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetParticipantRequest} request GetParticipantRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|listParticipants}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef ListParticipantsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListParticipantsResponse} [response] ListParticipantsResponse + */ + + /** + * Calls ListParticipants. + * @function listParticipants + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsRequest} request ListParticipantsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.ListParticipantsCallback} callback Node-style callback called with the error, if any, and ListParticipantsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.listParticipants = function listParticipants(request, callback) { + return this.rpcCall(listParticipants, $root.google.cloud.dialogflow.v2beta1.ListParticipantsRequest, $root.google.cloud.dialogflow.v2beta1.ListParticipantsResponse, request, callback); + }, "name", { value: "ListParticipants" }); + + /** + * Calls ListParticipants. + * @function listParticipants + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsRequest} request ListParticipantsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|updateParticipant}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef UpdateParticipantCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Participant} [response] Participant + */ + + /** + * Calls UpdateParticipant. + * @function updateParticipant + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest} request UpdateParticipantRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.UpdateParticipantCallback} callback Node-style callback called with the error, if any, and Participant + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.updateParticipant = function updateParticipant(request, callback) { + return this.rpcCall(updateParticipant, $root.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest, $root.google.cloud.dialogflow.v2beta1.Participant, request, callback); + }, "name", { value: "UpdateParticipant" }); + + /** + * Calls UpdateParticipant. + * @function updateParticipant + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest} request UpdateParticipantRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|analyzeContent}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef AnalyzeContentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.AnalyzeContentResponse} [response] AnalyzeContentResponse + */ + + /** + * Calls AnalyzeContent. + * @function analyzeContent + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest} request AnalyzeContentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.AnalyzeContentCallback} callback Node-style callback called with the error, if any, and AnalyzeContentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.analyzeContent = function analyzeContent(request, callback) { + return this.rpcCall(analyzeContent, $root.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest, $root.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse, request, callback); + }, "name", { value: "AnalyzeContent" }); + + /** + * Calls AnalyzeContent. + * @function analyzeContent + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest} request AnalyzeContentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|streamingAnalyzeContent}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef StreamingAnalyzeContentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse} [response] StreamingAnalyzeContentResponse + */ + + /** + * Calls StreamingAnalyzeContent. + * @function streamingAnalyzeContent + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest} request StreamingAnalyzeContentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContentCallback} callback Node-style callback called with the error, if any, and StreamingAnalyzeContentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.streamingAnalyzeContent = function streamingAnalyzeContent(request, callback) { + return this.rpcCall(streamingAnalyzeContent, $root.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest, $root.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse, request, callback); + }, "name", { value: "StreamingAnalyzeContent" }); + + /** + * Calls StreamingAnalyzeContent. + * @function streamingAnalyzeContent + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest} request StreamingAnalyzeContentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|suggestArticles}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef SuggestArticlesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.SuggestArticlesResponse} [response] SuggestArticlesResponse + */ + + /** + * Calls SuggestArticles. + * @function suggestArticles + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest} request SuggestArticlesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.SuggestArticlesCallback} callback Node-style callback called with the error, if any, and SuggestArticlesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.suggestArticles = function suggestArticles(request, callback) { + return this.rpcCall(suggestArticles, $root.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest, $root.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse, request, callback); + }, "name", { value: "SuggestArticles" }); + + /** + * Calls SuggestArticles. + * @function suggestArticles + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest} request SuggestArticlesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|suggestFaqAnswers}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef SuggestFaqAnswersCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse} [response] SuggestFaqAnswersResponse + */ + + /** + * Calls SuggestFaqAnswers. + * @function suggestFaqAnswers + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest} request SuggestFaqAnswersRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswersCallback} callback Node-style callback called with the error, if any, and SuggestFaqAnswersResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.suggestFaqAnswers = function suggestFaqAnswers(request, callback) { + return this.rpcCall(suggestFaqAnswers, $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest, $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse, request, callback); + }, "name", { value: "SuggestFaqAnswers" }); + + /** + * Calls SuggestFaqAnswers. + * @function suggestFaqAnswers + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest} request SuggestFaqAnswersRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|suggestSmartReplies}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef SuggestSmartRepliesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse} [response] SuggestSmartRepliesResponse + */ + + /** + * Calls SuggestSmartReplies. + * @function suggestSmartReplies + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest} request SuggestSmartRepliesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.SuggestSmartRepliesCallback} callback Node-style callback called with the error, if any, and SuggestSmartRepliesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.suggestSmartReplies = function suggestSmartReplies(request, callback) { + return this.rpcCall(suggestSmartReplies, $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest, $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse, request, callback); + }, "name", { value: "SuggestSmartReplies" }); + + /** + * Calls SuggestSmartReplies. + * @function suggestSmartReplies + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest} request SuggestSmartRepliesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|listSuggestions}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef ListSuggestionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListSuggestionsResponse} [response] ListSuggestionsResponse + */ + + /** + * Calls ListSuggestions. + * @function listSuggestions + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsRequest} request ListSuggestionsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.ListSuggestionsCallback} callback Node-style callback called with the error, if any, and ListSuggestionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.listSuggestions = function listSuggestions(request, callback) { + return this.rpcCall(listSuggestions, $root.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest, $root.google.cloud.dialogflow.v2beta1.ListSuggestionsResponse, request, callback); + }, "name", { value: "ListSuggestions" }); + + /** + * Calls ListSuggestions. + * @function listSuggestions + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsRequest} request ListSuggestionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Participants|compileSuggestion}. + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @typedef CompileSuggestionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.CompileSuggestionResponse} [response] CompileSuggestionResponse + */ + + /** + * Calls CompileSuggestion. + * @function compileSuggestion + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest} request CompileSuggestionRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Participants.CompileSuggestionCallback} callback Node-style callback called with the error, if any, and CompileSuggestionResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Participants.prototype.compileSuggestion = function compileSuggestion(request, callback) { + return this.rpcCall(compileSuggestion, $root.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest, $root.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse, request, callback); + }, "name", { value: "CompileSuggestion" }); + + /** + * Calls CompileSuggestion. + * @function compileSuggestion + * @memberof google.cloud.dialogflow.v2beta1.Participants + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest} request CompileSuggestionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Participants; + })(); + + v2beta1.Participant = (function() { + + /** + * Properties of a Participant. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IParticipant + * @property {string|null} [name] Participant name + * @property {google.cloud.dialogflow.v2beta1.Participant.Role|null} [role] Participant role + * @property {string|null} [obfuscatedExternalUserId] Participant obfuscatedExternalUserId + * @property {Object.|null} [documentsMetadataFilters] Participant documentsMetadataFilters + */ + + /** + * Constructs a new Participant. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Participant. + * @implements IParticipant + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IParticipant=} [properties] Properties to set + */ + function Participant(properties) { + this.documentsMetadataFilters = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Participant name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @instance + */ + Participant.prototype.name = ""; + + /** + * Participant role. + * @member {google.cloud.dialogflow.v2beta1.Participant.Role} role + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @instance + */ + Participant.prototype.role = 0; + + /** + * Participant obfuscatedExternalUserId. + * @member {string} obfuscatedExternalUserId + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @instance + */ + Participant.prototype.obfuscatedExternalUserId = ""; + + /** + * Participant documentsMetadataFilters. + * @member {Object.} documentsMetadataFilters + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @instance + */ + Participant.prototype.documentsMetadataFilters = $util.emptyObject; + + /** + * Creates a new Participant instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @static + * @param {google.cloud.dialogflow.v2beta1.IParticipant=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Participant} Participant instance + */ + Participant.create = function create(properties) { + return new Participant(properties); + }; + + /** + * Encodes the specified Participant message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Participant.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @static + * @param {google.cloud.dialogflow.v2beta1.IParticipant} message Participant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Participant.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.role != null && Object.hasOwnProperty.call(message, "role")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.role); + if (message.obfuscatedExternalUserId != null && Object.hasOwnProperty.call(message, "obfuscatedExternalUserId")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.obfuscatedExternalUserId); + if (message.documentsMetadataFilters != null && Object.hasOwnProperty.call(message, "documentsMetadataFilters")) + for (var keys = Object.keys(message.documentsMetadataFilters), i = 0; i < keys.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.documentsMetadataFilters[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified Participant message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Participant.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @static + * @param {google.cloud.dialogflow.v2beta1.IParticipant} message Participant message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Participant.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Participant message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Participant} Participant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Participant.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Participant(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.role = reader.int32(); + break; + } + case 7: { + message.obfuscatedExternalUserId = reader.string(); + break; + } + case 8: { + if (message.documentsMetadataFilters === $util.emptyObject) + message.documentsMetadataFilters = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.documentsMetadataFilters[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Participant message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Participant} Participant + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Participant.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Participant message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Participant.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.role != null && message.hasOwnProperty("role")) + switch (message.role) { + default: + return "role: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.obfuscatedExternalUserId != null && message.hasOwnProperty("obfuscatedExternalUserId")) + if (!$util.isString(message.obfuscatedExternalUserId)) + return "obfuscatedExternalUserId: string expected"; + if (message.documentsMetadataFilters != null && message.hasOwnProperty("documentsMetadataFilters")) { + if (!$util.isObject(message.documentsMetadataFilters)) + return "documentsMetadataFilters: object expected"; + var key = Object.keys(message.documentsMetadataFilters); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.documentsMetadataFilters[key[i]])) + return "documentsMetadataFilters: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a Participant message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Participant} Participant + */ + Participant.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Participant) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Participant(); + if (object.name != null) + message.name = String(object.name); + switch (object.role) { + default: + if (typeof object.role === "number") { + message.role = object.role; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.role = 0; + break; + case "HUMAN_AGENT": + case 1: + message.role = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.role = 2; + break; + case "END_USER": + case 3: + message.role = 3; + break; + } + if (object.obfuscatedExternalUserId != null) + message.obfuscatedExternalUserId = String(object.obfuscatedExternalUserId); + if (object.documentsMetadataFilters) { + if (typeof object.documentsMetadataFilters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Participant.documentsMetadataFilters: object expected"); + message.documentsMetadataFilters = {}; + for (var keys = Object.keys(object.documentsMetadataFilters), i = 0; i < keys.length; ++i) + message.documentsMetadataFilters[keys[i]] = String(object.documentsMetadataFilters[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a Participant message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @static + * @param {google.cloud.dialogflow.v2beta1.Participant} message Participant + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Participant.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.documentsMetadataFilters = {}; + if (options.defaults) { + object.name = ""; + object.role = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.obfuscatedExternalUserId = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.role != null && message.hasOwnProperty("role")) + object.role = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.role] === undefined ? message.role : $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.role] : message.role; + if (message.obfuscatedExternalUserId != null && message.hasOwnProperty("obfuscatedExternalUserId")) + object.obfuscatedExternalUserId = message.obfuscatedExternalUserId; + var keys2; + if (message.documentsMetadataFilters && (keys2 = Object.keys(message.documentsMetadataFilters)).length) { + object.documentsMetadataFilters = {}; + for (var j = 0; j < keys2.length; ++j) + object.documentsMetadataFilters[keys2[j]] = message.documentsMetadataFilters[keys2[j]]; + } + return object; + }; + + /** + * Converts this Participant to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @instance + * @returns {Object.} JSON object + */ + Participant.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Participant + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Participant + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Participant.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Participant"; + }; + + /** + * Role enum. + * @name google.cloud.dialogflow.v2beta1.Participant.Role + * @enum {number} + * @property {number} ROLE_UNSPECIFIED=0 ROLE_UNSPECIFIED value + * @property {number} HUMAN_AGENT=1 HUMAN_AGENT value + * @property {number} AUTOMATED_AGENT=2 AUTOMATED_AGENT value + * @property {number} END_USER=3 END_USER value + */ + Participant.Role = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ROLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "HUMAN_AGENT"] = 1; + values[valuesById[2] = "AUTOMATED_AGENT"] = 2; + values[valuesById[3] = "END_USER"] = 3; + return values; + })(); + + return Participant; + })(); + + v2beta1.Message = (function() { + + /** + * Properties of a Message. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IMessage + * @property {string|null} [name] Message name + * @property {string|null} [content] Message content + * @property {string|null} [languageCode] Message languageCode + * @property {string|null} [participant] Message participant + * @property {google.cloud.dialogflow.v2beta1.Participant.Role|null} [participantRole] Message participantRole + * @property {google.protobuf.ITimestamp|null} [createTime] Message createTime + * @property {google.protobuf.ITimestamp|null} [sendTime] Message sendTime + * @property {google.cloud.dialogflow.v2beta1.IMessageAnnotation|null} [messageAnnotation] Message messageAnnotation + * @property {google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult|null} [sentimentAnalysis] Message sentimentAnalysis + */ + + /** + * Constructs a new Message. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Message. + * @implements IMessage + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IMessage=} [properties] Properties to set + */ + function Message(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Message name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + */ + Message.prototype.name = ""; + + /** + * Message content. + * @member {string} content + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + */ + Message.prototype.content = ""; + + /** + * Message languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + */ + Message.prototype.languageCode = ""; + + /** + * Message participant. + * @member {string} participant + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + */ + Message.prototype.participant = ""; + + /** + * Message participantRole. + * @member {google.cloud.dialogflow.v2beta1.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + */ + Message.prototype.participantRole = 0; + + /** + * Message createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + */ + Message.prototype.createTime = null; + + /** + * Message sendTime. + * @member {google.protobuf.ITimestamp|null|undefined} sendTime + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + */ + Message.prototype.sendTime = null; + + /** + * Message messageAnnotation. + * @member {google.cloud.dialogflow.v2beta1.IMessageAnnotation|null|undefined} messageAnnotation + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + */ + Message.prototype.messageAnnotation = null; + + /** + * Message sentimentAnalysis. + * @member {google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult|null|undefined} sentimentAnalysis + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + */ + Message.prototype.sentimentAnalysis = null; + + /** + * Creates a new Message instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Message + * @static + * @param {google.cloud.dialogflow.v2beta1.IMessage=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Message} Message instance + */ + Message.create = function create(properties) { + return new Message(properties); + }; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Message.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Message + * @static + * @param {google.cloud.dialogflow.v2beta1.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.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.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.content); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.participant); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.participantRole); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.messageAnnotation != null && Object.hasOwnProperty.call(message, "messageAnnotation")) + $root.google.cloud.dialogflow.v2beta1.MessageAnnotation.encode(message.messageAnnotation, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.sentimentAnalysis != null && Object.hasOwnProperty.call(message, "sentimentAnalysis")) + $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.encode(message.sentimentAnalysis, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sendTime != null && Object.hasOwnProperty.call(message, "sendTime")) + $root.google.protobuf.Timestamp.encode(message.sendTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Message.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Message + * @static + * @param {google.cloud.dialogflow.v2beta1.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Message message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Message(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.content = reader.string(); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 4: { + message.participant = reader.string(); + break; + } + case 5: { + message.participantRole = reader.int32(); + break; + } + case 6: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sendTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.messageAnnotation = $root.google.cloud.dialogflow.v2beta1.MessageAnnotation.decode(reader, reader.uint32()); + break; + } + case 8: { + message.sentimentAnalysis = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Message message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Message + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Message.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.content != null && message.hasOwnProperty("content")) + if (!$util.isString(message.content)) + return "content: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.sendTime != null && message.hasOwnProperty("sendTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.sendTime); + if (error) + return "sendTime." + error; + } + if (message.messageAnnotation != null && message.hasOwnProperty("messageAnnotation")) { + var error = $root.google.cloud.dialogflow.v2beta1.MessageAnnotation.verify(message.messageAnnotation); + if (error) + return "messageAnnotation." + error; + } + if (message.sentimentAnalysis != null && message.hasOwnProperty("sentimentAnalysis")) { + var error = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.verify(message.sentimentAnalysis); + if (error) + return "sentimentAnalysis." + error; + } + return null; + }; + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Message + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Message} Message + */ + Message.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Message) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Message(); + if (object.name != null) + message.name = String(object.name); + if (object.content != null) + message.content = String(object.content); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.participant != null) + message.participant = String(object.participant); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Message.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.sendTime != null) { + if (typeof object.sendTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Message.sendTime: object expected"); + message.sendTime = $root.google.protobuf.Timestamp.fromObject(object.sendTime); + } + if (object.messageAnnotation != null) { + if (typeof object.messageAnnotation !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Message.messageAnnotation: object expected"); + message.messageAnnotation = $root.google.cloud.dialogflow.v2beta1.MessageAnnotation.fromObject(object.messageAnnotation); + } + if (object.sentimentAnalysis != null) { + if (typeof object.sentimentAnalysis !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Message.sentimentAnalysis: object expected"); + message.sentimentAnalysis = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.fromObject(object.sentimentAnalysis); + } + return message; + }; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Message + * @static + * @param {google.cloud.dialogflow.v2beta1.Message} message Message + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Message.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.content = ""; + object.languageCode = ""; + object.participant = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.createTime = null; + object.messageAnnotation = null; + object.sentimentAnalysis = null; + object.sendTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.content != null && message.hasOwnProperty("content")) + object.content = message.content; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] : message.participantRole; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.messageAnnotation != null && message.hasOwnProperty("messageAnnotation")) + object.messageAnnotation = $root.google.cloud.dialogflow.v2beta1.MessageAnnotation.toObject(message.messageAnnotation, options); + if (message.sentimentAnalysis != null && message.hasOwnProperty("sentimentAnalysis")) + object.sentimentAnalysis = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.toObject(message.sentimentAnalysis, options); + if (message.sendTime != null && message.hasOwnProperty("sendTime")) + object.sendTime = $root.google.protobuf.Timestamp.toObject(message.sendTime, options); + return object; + }; + + /** + * Converts this Message to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Message + * @instance + * @returns {Object.} JSON object + */ + Message.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Message + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Message + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Message"; + }; + + return Message; + })(); + + v2beta1.CreateParticipantRequest = (function() { + + /** + * Properties of a CreateParticipantRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateParticipantRequest + * @property {string|null} [parent] CreateParticipantRequest parent + * @property {google.cloud.dialogflow.v2beta1.IParticipant|null} [participant] CreateParticipantRequest participant + */ + + /** + * Constructs a new CreateParticipantRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateParticipantRequest. + * @implements ICreateParticipantRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateParticipantRequest=} [properties] Properties to set + */ + function CreateParticipantRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateParticipantRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @instance + */ + CreateParticipantRequest.prototype.parent = ""; + + /** + * CreateParticipantRequest participant. + * @member {google.cloud.dialogflow.v2beta1.IParticipant|null|undefined} participant + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @instance + */ + CreateParticipantRequest.prototype.participant = null; + + /** + * Creates a new CreateParticipantRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateParticipantRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateParticipantRequest} CreateParticipantRequest instance + */ + CreateParticipantRequest.create = function create(properties) { + return new CreateParticipantRequest(properties); + }; + + /** + * Encodes the specified CreateParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateParticipantRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateParticipantRequest} message CreateParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateParticipantRequest.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.participant != null && Object.hasOwnProperty.call(message, "participant")) + $root.google.cloud.dialogflow.v2beta1.Participant.encode(message.participant, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateParticipantRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateParticipantRequest} message CreateParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateParticipantRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateParticipantRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateParticipantRequest} CreateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateParticipantRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateParticipantRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.participant = $root.google.cloud.dialogflow.v2beta1.Participant.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateParticipantRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateParticipantRequest} CreateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateParticipantRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateParticipantRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateParticipantRequest.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.participant != null && message.hasOwnProperty("participant")) { + var error = $root.google.cloud.dialogflow.v2beta1.Participant.verify(message.participant); + if (error) + return "participant." + error; + } + return null; + }; + + /** + * Creates a CreateParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateParticipantRequest} CreateParticipantRequest + */ + CreateParticipantRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateParticipantRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateParticipantRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.participant != null) { + if (typeof object.participant !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateParticipantRequest.participant: object expected"); + message.participant = $root.google.cloud.dialogflow.v2beta1.Participant.fromObject(object.participant); + } + return message; + }; + + /** + * Creates a plain object from a CreateParticipantRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateParticipantRequest} message CreateParticipantRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateParticipantRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.participant = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = $root.google.cloud.dialogflow.v2beta1.Participant.toObject(message.participant, options); + return object; + }; + + /** + * Converts this CreateParticipantRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @instance + * @returns {Object.} JSON object + */ + CreateParticipantRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateParticipantRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateParticipantRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateParticipantRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateParticipantRequest"; + }; + + return CreateParticipantRequest; + })(); + + v2beta1.GetParticipantRequest = (function() { + + /** + * Properties of a GetParticipantRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetParticipantRequest + * @property {string|null} [name] GetParticipantRequest name + */ + + /** + * Constructs a new GetParticipantRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetParticipantRequest. + * @implements IGetParticipantRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetParticipantRequest=} [properties] Properties to set + */ + function GetParticipantRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetParticipantRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @instance + */ + GetParticipantRequest.prototype.name = ""; + + /** + * Creates a new GetParticipantRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetParticipantRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetParticipantRequest} GetParticipantRequest instance + */ + GetParticipantRequest.create = function create(properties) { + return new GetParticipantRequest(properties); + }; + + /** + * Encodes the specified GetParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetParticipantRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetParticipantRequest} message GetParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetParticipantRequest.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 GetParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetParticipantRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetParticipantRequest} message GetParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetParticipantRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetParticipantRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetParticipantRequest} GetParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetParticipantRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetParticipantRequest(); + 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 GetParticipantRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetParticipantRequest} GetParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetParticipantRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetParticipantRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetParticipantRequest.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 GetParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetParticipantRequest} GetParticipantRequest + */ + GetParticipantRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetParticipantRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetParticipantRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetParticipantRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetParticipantRequest} message GetParticipantRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetParticipantRequest.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 GetParticipantRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @instance + * @returns {Object.} JSON object + */ + GetParticipantRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetParticipantRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetParticipantRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetParticipantRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetParticipantRequest"; + }; + + return GetParticipantRequest; + })(); + + v2beta1.ListParticipantsRequest = (function() { + + /** + * Properties of a ListParticipantsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListParticipantsRequest + * @property {string|null} [parent] ListParticipantsRequest parent + * @property {number|null} [pageSize] ListParticipantsRequest pageSize + * @property {string|null} [pageToken] ListParticipantsRequest pageToken + */ + + /** + * Constructs a new ListParticipantsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListParticipantsRequest. + * @implements IListParticipantsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsRequest=} [properties] Properties to set + */ + function ListParticipantsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListParticipantsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @instance + */ + ListParticipantsRequest.prototype.parent = ""; + + /** + * ListParticipantsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @instance + */ + ListParticipantsRequest.prototype.pageSize = 0; + + /** + * ListParticipantsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @instance + */ + ListParticipantsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListParticipantsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListParticipantsRequest} ListParticipantsRequest instance + */ + ListParticipantsRequest.create = function create(properties) { + return new ListParticipantsRequest(properties); + }; + + /** + * Encodes the specified ListParticipantsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListParticipantsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsRequest} message ListParticipantsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListParticipantsRequest.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 ListParticipantsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListParticipantsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsRequest} message ListParticipantsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListParticipantsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListParticipantsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListParticipantsRequest} ListParticipantsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListParticipantsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListParticipantsRequest(); + 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 ListParticipantsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListParticipantsRequest} ListParticipantsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListParticipantsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListParticipantsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListParticipantsRequest.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 ListParticipantsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListParticipantsRequest} ListParticipantsRequest + */ + ListParticipantsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListParticipantsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListParticipantsRequest(); + 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 ListParticipantsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListParticipantsRequest} message ListParticipantsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListParticipantsRequest.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 ListParticipantsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @instance + * @returns {Object.} JSON object + */ + ListParticipantsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListParticipantsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListParticipantsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListParticipantsRequest"; + }; + + return ListParticipantsRequest; + })(); + + v2beta1.ListParticipantsResponse = (function() { + + /** + * Properties of a ListParticipantsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListParticipantsResponse + * @property {Array.|null} [participants] ListParticipantsResponse participants + * @property {string|null} [nextPageToken] ListParticipantsResponse nextPageToken + */ + + /** + * Constructs a new ListParticipantsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListParticipantsResponse. + * @implements IListParticipantsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsResponse=} [properties] Properties to set + */ + function ListParticipantsResponse(properties) { + this.participants = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListParticipantsResponse participants. + * @member {Array.} participants + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @instance + */ + ListParticipantsResponse.prototype.participants = $util.emptyArray; + + /** + * ListParticipantsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @instance + */ + ListParticipantsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListParticipantsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListParticipantsResponse} ListParticipantsResponse instance + */ + ListParticipantsResponse.create = function create(properties) { + return new ListParticipantsResponse(properties); + }; + + /** + * Encodes the specified ListParticipantsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListParticipantsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsResponse} message ListParticipantsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListParticipantsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.participants != null && message.participants.length) + for (var i = 0; i < message.participants.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Participant.encode(message.participants[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 ListParticipantsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListParticipantsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListParticipantsResponse} message ListParticipantsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListParticipantsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListParticipantsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListParticipantsResponse} ListParticipantsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListParticipantsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListParticipantsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.participants && message.participants.length)) + message.participants = []; + message.participants.push($root.google.cloud.dialogflow.v2beta1.Participant.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListParticipantsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListParticipantsResponse} ListParticipantsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListParticipantsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListParticipantsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListParticipantsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.participants != null && message.hasOwnProperty("participants")) { + if (!Array.isArray(message.participants)) + return "participants: array expected"; + for (var i = 0; i < message.participants.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Participant.verify(message.participants[i]); + if (error) + return "participants." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListParticipantsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListParticipantsResponse} ListParticipantsResponse + */ + ListParticipantsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListParticipantsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListParticipantsResponse(); + if (object.participants) { + if (!Array.isArray(object.participants)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListParticipantsResponse.participants: array expected"); + message.participants = []; + for (var i = 0; i < object.participants.length; ++i) { + if (typeof object.participants[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListParticipantsResponse.participants: object expected"); + message.participants[i] = $root.google.cloud.dialogflow.v2beta1.Participant.fromObject(object.participants[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListParticipantsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListParticipantsResponse} message ListParticipantsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListParticipantsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.participants = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.participants && message.participants.length) { + object.participants = []; + for (var j = 0; j < message.participants.length; ++j) + object.participants[j] = $root.google.cloud.dialogflow.v2beta1.Participant.toObject(message.participants[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListParticipantsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @instance + * @returns {Object.} JSON object + */ + ListParticipantsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListParticipantsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListParticipantsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListParticipantsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListParticipantsResponse"; + }; + + return ListParticipantsResponse; + })(); + + v2beta1.UpdateParticipantRequest = (function() { + + /** + * Properties of an UpdateParticipantRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateParticipantRequest + * @property {google.cloud.dialogflow.v2beta1.IParticipant|null} [participant] UpdateParticipantRequest participant + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateParticipantRequest updateMask + */ + + /** + * Constructs a new UpdateParticipantRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateParticipantRequest. + * @implements IUpdateParticipantRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest=} [properties] Properties to set + */ + function UpdateParticipantRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateParticipantRequest participant. + * @member {google.cloud.dialogflow.v2beta1.IParticipant|null|undefined} participant + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @instance + */ + UpdateParticipantRequest.prototype.participant = null; + + /** + * UpdateParticipantRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @instance + */ + UpdateParticipantRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateParticipantRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateParticipantRequest} UpdateParticipantRequest instance + */ + UpdateParticipantRequest.create = function create(properties) { + return new UpdateParticipantRequest(properties); + }; + + /** + * Encodes the specified UpdateParticipantRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest} message UpdateParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateParticipantRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + $root.google.cloud.dialogflow.v2beta1.Participant.encode(message.participant, 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 UpdateParticipantRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest} message UpdateParticipantRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateParticipantRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateParticipantRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateParticipantRequest} UpdateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateParticipantRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.participant = $root.google.cloud.dialogflow.v2beta1.Participant.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 UpdateParticipantRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateParticipantRequest} UpdateParticipantRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateParticipantRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateParticipantRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateParticipantRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.participant != null && message.hasOwnProperty("participant")) { + var error = $root.google.cloud.dialogflow.v2beta1.Participant.verify(message.participant); + if (error) + return "participant." + 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 UpdateParticipantRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateParticipantRequest} UpdateParticipantRequest + */ + UpdateParticipantRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest(); + if (object.participant != null) { + if (typeof object.participant !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.participant: object expected"); + message.participant = $root.google.cloud.dialogflow.v2beta1.Participant.fromObject(object.participant); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateParticipantRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateParticipantRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateParticipantRequest} message UpdateParticipantRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateParticipantRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.participant = null; + object.updateMask = null; + } + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = $root.google.cloud.dialogflow.v2beta1.Participant.toObject(message.participant, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateParticipantRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateParticipantRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateParticipantRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateParticipantRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateParticipantRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateParticipantRequest"; + }; + + return UpdateParticipantRequest; + })(); + + v2beta1.AudioInput = (function() { + + /** + * Properties of an AudioInput. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAudioInput + * @property {google.cloud.dialogflow.v2beta1.IInputAudioConfig|null} [config] AudioInput config + * @property {Uint8Array|null} [audio] AudioInput audio + */ + + /** + * Constructs a new AudioInput. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AudioInput. + * @implements IAudioInput + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAudioInput=} [properties] Properties to set + */ + function AudioInput(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AudioInput config. + * @member {google.cloud.dialogflow.v2beta1.IInputAudioConfig|null|undefined} config + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @instance + */ + AudioInput.prototype.config = null; + + /** + * AudioInput audio. + * @member {Uint8Array} audio + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @instance + */ + AudioInput.prototype.audio = $util.newBuffer([]); + + /** + * Creates a new AudioInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @static + * @param {google.cloud.dialogflow.v2beta1.IAudioInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AudioInput} AudioInput instance + */ + AudioInput.create = function create(properties) { + return new AudioInput(properties); + }; + + /** + * Encodes the specified AudioInput message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AudioInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @static + * @param {google.cloud.dialogflow.v2beta1.IAudioInput} message AudioInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AudioInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.config != null && Object.hasOwnProperty.call(message, "config")) + $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.encode(message.config, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.audio != null && Object.hasOwnProperty.call(message, "audio")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.audio); + return writer; + }; + + /** + * Encodes the specified AudioInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AudioInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @static + * @param {google.cloud.dialogflow.v2beta1.IAudioInput} message AudioInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AudioInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AudioInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AudioInput} AudioInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AudioInput.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AudioInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.config = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.audio = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AudioInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AudioInput} AudioInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AudioInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AudioInput message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AudioInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.config != null && message.hasOwnProperty("config")) { + var error = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.verify(message.config); + if (error) + return "config." + error; + } + if (message.audio != null && message.hasOwnProperty("audio")) + if (!(message.audio && typeof message.audio.length === "number" || $util.isString(message.audio))) + return "audio: buffer expected"; + return null; + }; + + /** + * Creates an AudioInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AudioInput} AudioInput + */ + AudioInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AudioInput) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AudioInput(); + if (object.config != null) { + if (typeof object.config !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AudioInput.config: object expected"); + message.config = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.fromObject(object.config); + } + if (object.audio != null) + if (typeof object.audio === "string") + $util.base64.decode(object.audio, message.audio = $util.newBuffer($util.base64.length(object.audio)), 0); + else if (object.audio.length >= 0) + message.audio = object.audio; + return message; + }; + + /** + * Creates a plain object from an AudioInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @static + * @param {google.cloud.dialogflow.v2beta1.AudioInput} message AudioInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AudioInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.config = null; + if (options.bytes === String) + object.audio = ""; + else { + object.audio = []; + if (options.bytes !== Array) + object.audio = $util.newBuffer(object.audio); + } + } + if (message.config != null && message.hasOwnProperty("config")) + object.config = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.toObject(message.config, options); + if (message.audio != null && message.hasOwnProperty("audio")) + object.audio = options.bytes === String ? $util.base64.encode(message.audio, 0, message.audio.length) : options.bytes === Array ? Array.prototype.slice.call(message.audio) : message.audio; + return object; + }; + + /** + * Converts this AudioInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @instance + * @returns {Object.} JSON object + */ + AudioInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AudioInput + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AudioInput + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AudioInput.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AudioInput"; + }; + + return AudioInput; + })(); + + v2beta1.OutputAudio = (function() { + + /** + * Properties of an OutputAudio. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IOutputAudio + * @property {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null} [config] OutputAudio config + * @property {Uint8Array|null} [audio] OutputAudio audio + */ + + /** + * Constructs a new OutputAudio. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an OutputAudio. + * @implements IOutputAudio + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IOutputAudio=} [properties] Properties to set + */ + function OutputAudio(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputAudio config. + * @member {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null|undefined} config + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @instance + */ + OutputAudio.prototype.config = null; + + /** + * OutputAudio audio. + * @member {Uint8Array} audio + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @instance + */ + OutputAudio.prototype.audio = $util.newBuffer([]); + + /** + * Creates a new OutputAudio instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.IOutputAudio=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.OutputAudio} OutputAudio instance + */ + OutputAudio.create = function create(properties) { + return new OutputAudio(properties); + }; + + /** + * Encodes the specified OutputAudio message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OutputAudio.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.IOutputAudio} message OutputAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudio.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.config != null && Object.hasOwnProperty.call(message, "config")) + $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.encode(message.config, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.audio != null && Object.hasOwnProperty.call(message, "audio")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.audio); + return writer; + }; + + /** + * Encodes the specified OutputAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OutputAudio.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.IOutputAudio} message OutputAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudio.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputAudio message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.OutputAudio} OutputAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudio.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.OutputAudio(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.config = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.audio = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputAudio message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.OutputAudio} OutputAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudio.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputAudio message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputAudio.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.config != null && message.hasOwnProperty("config")) { + var error = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify(message.config); + if (error) + return "config." + error; + } + if (message.audio != null && message.hasOwnProperty("audio")) + if (!(message.audio && typeof message.audio.length === "number" || $util.isString(message.audio))) + return "audio: buffer expected"; + return null; + }; + + /** + * Creates an OutputAudio message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.OutputAudio} OutputAudio + */ + OutputAudio.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.OutputAudio) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.OutputAudio(); + if (object.config != null) { + if (typeof object.config !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.OutputAudio.config: object expected"); + message.config = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.fromObject(object.config); + } + if (object.audio != null) + if (typeof object.audio === "string") + $util.base64.decode(object.audio, message.audio = $util.newBuffer($util.base64.length(object.audio)), 0); + else if (object.audio.length >= 0) + message.audio = object.audio; + return message; + }; + + /** + * Creates a plain object from an OutputAudio message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.OutputAudio} message OutputAudio + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputAudio.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.config = null; + if (options.bytes === String) + object.audio = ""; + else { + object.audio = []; + if (options.bytes !== Array) + object.audio = $util.newBuffer(object.audio); + } + } + if (message.config != null && message.hasOwnProperty("config")) + object.config = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.toObject(message.config, options); + if (message.audio != null && message.hasOwnProperty("audio")) + object.audio = options.bytes === String ? $util.base64.encode(message.audio, 0, message.audio.length) : options.bytes === Array ? Array.prototype.slice.call(message.audio) : message.audio; + return object; + }; + + /** + * Converts this OutputAudio to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @instance + * @returns {Object.} JSON object + */ + OutputAudio.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OutputAudio + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.OutputAudio + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputAudio.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.OutputAudio"; + }; + + return OutputAudio; + })(); + + v2beta1.AutomatedAgentReply = (function() { + + /** + * Properties of an AutomatedAgentReply. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAutomatedAgentReply + * @property {google.cloud.dialogflow.v2beta1.IDetectIntentResponse|null} [detectIntentResponse] AutomatedAgentReply detectIntentResponse + * @property {Array.|null} [responseMessages] AutomatedAgentReply responseMessages + * @property {string|null} [intent] AutomatedAgentReply intent + * @property {string|null} [event] AutomatedAgentReply event + * @property {number|null} [matchConfidence] AutomatedAgentReply matchConfidence + * @property {google.protobuf.IStruct|null} [parameters] AutomatedAgentReply parameters + * @property {google.protobuf.IStruct|null} [cxSessionParameters] AutomatedAgentReply cxSessionParameters + * @property {google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType|null} [automatedAgentReplyType] AutomatedAgentReply automatedAgentReplyType + * @property {boolean|null} [allowCancellation] AutomatedAgentReply allowCancellation + */ + + /** + * Constructs a new AutomatedAgentReply. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AutomatedAgentReply. + * @implements IAutomatedAgentReply + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAutomatedAgentReply=} [properties] Properties to set + */ + function AutomatedAgentReply(properties) { + this.responseMessages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AutomatedAgentReply detectIntentResponse. + * @member {google.cloud.dialogflow.v2beta1.IDetectIntentResponse|null|undefined} detectIntentResponse + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.detectIntentResponse = null; + + /** + * AutomatedAgentReply responseMessages. + * @member {Array.} responseMessages + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.responseMessages = $util.emptyArray; + + /** + * AutomatedAgentReply intent. + * @member {string|null|undefined} intent + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.intent = null; + + /** + * AutomatedAgentReply event. + * @member {string|null|undefined} event + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.event = null; + + /** + * AutomatedAgentReply matchConfidence. + * @member {number} matchConfidence + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.matchConfidence = 0; + + /** + * AutomatedAgentReply parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.parameters = null; + + /** + * AutomatedAgentReply cxSessionParameters. + * @member {google.protobuf.IStruct|null|undefined} cxSessionParameters + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.cxSessionParameters = null; + + /** + * AutomatedAgentReply automatedAgentReplyType. + * @member {google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType} automatedAgentReplyType + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.automatedAgentReplyType = 0; + + /** + * AutomatedAgentReply allowCancellation. + * @member {boolean} allowCancellation + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + AutomatedAgentReply.prototype.allowCancellation = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AutomatedAgentReply response. + * @member {"detectIntentResponse"|undefined} response + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + Object.defineProperty(AutomatedAgentReply.prototype, "response", { + get: $util.oneOfGetter($oneOfFields = ["detectIntentResponse"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * AutomatedAgentReply match. + * @member {"intent"|"event"|undefined} match + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + */ + Object.defineProperty(AutomatedAgentReply.prototype, "match", { + get: $util.oneOfGetter($oneOfFields = ["intent", "event"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AutomatedAgentReply instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @static + * @param {google.cloud.dialogflow.v2beta1.IAutomatedAgentReply=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AutomatedAgentReply} AutomatedAgentReply instance + */ + AutomatedAgentReply.create = function create(properties) { + return new AutomatedAgentReply(properties); + }; + + /** + * Encodes the specified AutomatedAgentReply message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AutomatedAgentReply.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @static + * @param {google.cloud.dialogflow.v2beta1.IAutomatedAgentReply} message AutomatedAgentReply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutomatedAgentReply.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.detectIntentResponse != null && Object.hasOwnProperty.call(message, "detectIntentResponse")) + $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse.encode(message.detectIntentResponse, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.responseMessages != null && message.responseMessages.length) + for (var i = 0; i < message.responseMessages.length; ++i) + $root.google.cloud.dialogflow.v2beta1.ResponseMessage.encode(message.responseMessages[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.intent); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.event); + if (message.cxSessionParameters != null && Object.hasOwnProperty.call(message, "cxSessionParameters")) + $root.google.protobuf.Struct.encode(message.cxSessionParameters, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.automatedAgentReplyType != null && Object.hasOwnProperty.call(message, "automatedAgentReplyType")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.automatedAgentReplyType); + if (message.allowCancellation != null && Object.hasOwnProperty.call(message, "allowCancellation")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.allowCancellation); + if (message.matchConfidence != null && Object.hasOwnProperty.call(message, "matchConfidence")) + writer.uint32(/* id 9, wireType 5 =*/77).float(message.matchConfidence); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AutomatedAgentReply message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AutomatedAgentReply.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @static + * @param {google.cloud.dialogflow.v2beta1.IAutomatedAgentReply} message AutomatedAgentReply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutomatedAgentReply.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AutomatedAgentReply message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AutomatedAgentReply} AutomatedAgentReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutomatedAgentReply.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.detectIntentResponse = $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.responseMessages && message.responseMessages.length)) + message.responseMessages = []; + message.responseMessages.push($root.google.cloud.dialogflow.v2beta1.ResponseMessage.decode(reader, reader.uint32())); + break; + } + case 4: { + message.intent = reader.string(); + break; + } + case 5: { + message.event = reader.string(); + break; + } + case 9: { + message.matchConfidence = reader.float(); + break; + } + case 10: { + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 6: { + message.cxSessionParameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 7: { + message.automatedAgentReplyType = reader.int32(); + break; + } + case 8: { + message.allowCancellation = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AutomatedAgentReply message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AutomatedAgentReply} AutomatedAgentReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutomatedAgentReply.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AutomatedAgentReply message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AutomatedAgentReply.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.detectIntentResponse != null && message.hasOwnProperty("detectIntentResponse")) { + properties.response = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse.verify(message.detectIntentResponse); + if (error) + return "detectIntentResponse." + error; + } + } + if (message.responseMessages != null && message.hasOwnProperty("responseMessages")) { + if (!Array.isArray(message.responseMessages)) + return "responseMessages: array expected"; + for (var i = 0; i < message.responseMessages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.verify(message.responseMessages[i]); + if (error) + return "responseMessages." + error; + } + } + if (message.intent != null && message.hasOwnProperty("intent")) { + properties.match = 1; + if (!$util.isString(message.intent)) + return "intent: string expected"; + } + if (message.event != null && message.hasOwnProperty("event")) { + if (properties.match === 1) + return "match: multiple values"; + properties.match = 1; + if (!$util.isString(message.event)) + return "event: string expected"; + } + if (message.matchConfidence != null && message.hasOwnProperty("matchConfidence")) + if (typeof message.matchConfidence !== "number") + return "matchConfidence: number expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + if (message.cxSessionParameters != null && message.hasOwnProperty("cxSessionParameters")) { + var error = $root.google.protobuf.Struct.verify(message.cxSessionParameters); + if (error) + return "cxSessionParameters." + error; + } + if (message.automatedAgentReplyType != null && message.hasOwnProperty("automatedAgentReplyType")) + switch (message.automatedAgentReplyType) { + default: + return "automatedAgentReplyType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.allowCancellation != null && message.hasOwnProperty("allowCancellation")) + if (typeof message.allowCancellation !== "boolean") + return "allowCancellation: boolean expected"; + return null; + }; + + /** + * Creates an AutomatedAgentReply message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AutomatedAgentReply} AutomatedAgentReply + */ + AutomatedAgentReply.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply(); + if (object.detectIntentResponse != null) { + if (typeof object.detectIntentResponse !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AutomatedAgentReply.detectIntentResponse: object expected"); + message.detectIntentResponse = $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse.fromObject(object.detectIntentResponse); + } + if (object.responseMessages) { + if (!Array.isArray(object.responseMessages)) + throw TypeError(".google.cloud.dialogflow.v2beta1.AutomatedAgentReply.responseMessages: array expected"); + message.responseMessages = []; + for (var i = 0; i < object.responseMessages.length; ++i) { + if (typeof object.responseMessages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AutomatedAgentReply.responseMessages: object expected"); + message.responseMessages[i] = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.fromObject(object.responseMessages[i]); + } + } + if (object.intent != null) + message.intent = String(object.intent); + if (object.event != null) + message.event = String(object.event); + if (object.matchConfidence != null) + message.matchConfidence = Number(object.matchConfidence); + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AutomatedAgentReply.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + if (object.cxSessionParameters != null) { + if (typeof object.cxSessionParameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AutomatedAgentReply.cxSessionParameters: object expected"); + message.cxSessionParameters = $root.google.protobuf.Struct.fromObject(object.cxSessionParameters); + } + switch (object.automatedAgentReplyType) { + default: + if (typeof object.automatedAgentReplyType === "number") { + message.automatedAgentReplyType = object.automatedAgentReplyType; + break; + } + break; + case "AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED": + case 0: + message.automatedAgentReplyType = 0; + break; + case "PARTIAL": + case 1: + message.automatedAgentReplyType = 1; + break; + case "FINAL": + case 2: + message.automatedAgentReplyType = 2; + break; + } + if (object.allowCancellation != null) + message.allowCancellation = Boolean(object.allowCancellation); + return message; + }; + + /** + * Creates a plain object from an AutomatedAgentReply message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @static + * @param {google.cloud.dialogflow.v2beta1.AutomatedAgentReply} message AutomatedAgentReply + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AutomatedAgentReply.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.responseMessages = []; + if (options.defaults) { + object.cxSessionParameters = null; + object.automatedAgentReplyType = options.enums === String ? "AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED" : 0; + object.allowCancellation = false; + object.matchConfidence = 0; + object.parameters = null; + } + if (message.detectIntentResponse != null && message.hasOwnProperty("detectIntentResponse")) { + object.detectIntentResponse = $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse.toObject(message.detectIntentResponse, options); + if (options.oneofs) + object.response = "detectIntentResponse"; + } + if (message.responseMessages && message.responseMessages.length) { + object.responseMessages = []; + for (var j = 0; j < message.responseMessages.length; ++j) + object.responseMessages[j] = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.toObject(message.responseMessages[j], options); + } + if (message.intent != null && message.hasOwnProperty("intent")) { + object.intent = message.intent; + if (options.oneofs) + object.match = "intent"; + } + if (message.event != null && message.hasOwnProperty("event")) { + object.event = message.event; + if (options.oneofs) + object.match = "event"; + } + if (message.cxSessionParameters != null && message.hasOwnProperty("cxSessionParameters")) + object.cxSessionParameters = $root.google.protobuf.Struct.toObject(message.cxSessionParameters, options); + if (message.automatedAgentReplyType != null && message.hasOwnProperty("automatedAgentReplyType")) + object.automatedAgentReplyType = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType[message.automatedAgentReplyType] === undefined ? message.automatedAgentReplyType : $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType[message.automatedAgentReplyType] : message.automatedAgentReplyType; + if (message.allowCancellation != null && message.hasOwnProperty("allowCancellation")) + object.allowCancellation = message.allowCancellation; + if (message.matchConfidence != null && message.hasOwnProperty("matchConfidence")) + object.matchConfidence = options.json && !isFinite(message.matchConfidence) ? String(message.matchConfidence) : message.matchConfidence; + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + return object; + }; + + /** + * Converts this AutomatedAgentReply to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @instance + * @returns {Object.} JSON object + */ + AutomatedAgentReply.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AutomatedAgentReply + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentReply + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AutomatedAgentReply.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AutomatedAgentReply"; + }; + + /** + * AutomatedAgentReplyType enum. + * @name google.cloud.dialogflow.v2beta1.AutomatedAgentReply.AutomatedAgentReplyType + * @enum {number} + * @property {number} AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED=0 AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED value + * @property {number} PARTIAL=1 PARTIAL value + * @property {number} FINAL=2 FINAL value + */ + AutomatedAgentReply.AutomatedAgentReplyType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PARTIAL"] = 1; + values[valuesById[2] = "FINAL"] = 2; + return values; + })(); + + return AutomatedAgentReply; + })(); + + v2beta1.SuggestionFeature = (function() { + + /** + * Properties of a SuggestionFeature. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestionFeature + * @property {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|null} [type] SuggestionFeature type + */ + + /** + * Constructs a new SuggestionFeature. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestionFeature. + * @implements ISuggestionFeature + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestionFeature=} [properties] Properties to set + */ + function SuggestionFeature(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionFeature type. + * @member {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type} type + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @instance + */ + SuggestionFeature.prototype.type = 0; + + /** + * Creates a new SuggestionFeature instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestionFeature=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestionFeature} SuggestionFeature instance + */ + SuggestionFeature.create = function create(properties) { + return new SuggestionFeature(properties); + }; + + /** + * Encodes the specified SuggestionFeature message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestionFeature.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestionFeature} message SuggestionFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionFeature.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); + return writer; + }; + + /** + * Encodes the specified SuggestionFeature message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestionFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestionFeature} message SuggestionFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionFeature message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestionFeature} SuggestionFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionFeature.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestionFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestionFeature} SuggestionFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionFeature message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionFeature.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 8: + break; + } + return null; + }; + + /** + * Creates a SuggestionFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestionFeature} SuggestionFeature + */ + SuggestionFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestionFeature) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestionFeature(); + 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 "ARTICLE_SUGGESTION": + case 1: + message.type = 1; + break; + case "FAQ": + case 2: + message.type = 2; + break; + case "SMART_REPLY": + case 3: + message.type = 3; + break; + case "CONVERSATION_SUMMARIZATION": + case 8: + message.type = 8; + break; + } + return message; + }; + + /** + * Creates a plain object from a SuggestionFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestionFeature} message SuggestionFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionFeature.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.Type[message.type] === undefined ? message.type : $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this SuggestionFeature to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @instance + * @returns {Object.} JSON object + */ + SuggestionFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionFeature + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestionFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestionFeature"; + }; + + /** + * Type enum. + * @name google.cloud.dialogflow.v2beta1.SuggestionFeature.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} ARTICLE_SUGGESTION=1 ARTICLE_SUGGESTION value + * @property {number} FAQ=2 FAQ value + * @property {number} SMART_REPLY=3 SMART_REPLY value + * @property {number} CONVERSATION_SUMMARIZATION=8 CONVERSATION_SUMMARIZATION value + */ + SuggestionFeature.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ARTICLE_SUGGESTION"] = 1; + values[valuesById[2] = "FAQ"] = 2; + values[valuesById[3] = "SMART_REPLY"] = 3; + values[valuesById[8] = "CONVERSATION_SUMMARIZATION"] = 8; + return values; + })(); + + return SuggestionFeature; + })(); + + v2beta1.AssistQueryParameters = (function() { + + /** + * Properties of an AssistQueryParameters. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAssistQueryParameters + * @property {Object.|null} [documentsMetadataFilters] AssistQueryParameters documentsMetadataFilters + */ + + /** + * Constructs a new AssistQueryParameters. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AssistQueryParameters. + * @implements IAssistQueryParameters + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAssistQueryParameters=} [properties] Properties to set + */ + function AssistQueryParameters(properties) { + this.documentsMetadataFilters = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AssistQueryParameters documentsMetadataFilters. + * @member {Object.} documentsMetadataFilters + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @instance + */ + AssistQueryParameters.prototype.documentsMetadataFilters = $util.emptyObject; + + /** + * Creates a new AssistQueryParameters instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.IAssistQueryParameters=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AssistQueryParameters} AssistQueryParameters instance + */ + AssistQueryParameters.create = function create(properties) { + return new AssistQueryParameters(properties); + }; + + /** + * Encodes the specified AssistQueryParameters message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AssistQueryParameters.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.IAssistQueryParameters} message AssistQueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AssistQueryParameters.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documentsMetadataFilters != null && Object.hasOwnProperty.call(message, "documentsMetadataFilters")) + for (var keys = Object.keys(message.documentsMetadataFilters), i = 0; i < keys.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.documentsMetadataFilters[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified AssistQueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AssistQueryParameters.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.IAssistQueryParameters} message AssistQueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AssistQueryParameters.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AssistQueryParameters message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AssistQueryParameters} AssistQueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AssistQueryParameters.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (message.documentsMetadataFilters === $util.emptyObject) + message.documentsMetadataFilters = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.documentsMetadataFilters[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AssistQueryParameters message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AssistQueryParameters} AssistQueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AssistQueryParameters.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AssistQueryParameters message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AssistQueryParameters.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documentsMetadataFilters != null && message.hasOwnProperty("documentsMetadataFilters")) { + if (!$util.isObject(message.documentsMetadataFilters)) + return "documentsMetadataFilters: object expected"; + var key = Object.keys(message.documentsMetadataFilters); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.documentsMetadataFilters[key[i]])) + return "documentsMetadataFilters: string{k:string} expected"; + } + return null; + }; + + /** + * Creates an AssistQueryParameters message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AssistQueryParameters} AssistQueryParameters + */ + AssistQueryParameters.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters(); + if (object.documentsMetadataFilters) { + if (typeof object.documentsMetadataFilters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AssistQueryParameters.documentsMetadataFilters: object expected"); + message.documentsMetadataFilters = {}; + for (var keys = Object.keys(object.documentsMetadataFilters), i = 0; i < keys.length; ++i) + message.documentsMetadataFilters[keys[i]] = String(object.documentsMetadataFilters[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from an AssistQueryParameters message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.AssistQueryParameters} message AssistQueryParameters + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AssistQueryParameters.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.documentsMetadataFilters = {}; + var keys2; + if (message.documentsMetadataFilters && (keys2 = Object.keys(message.documentsMetadataFilters)).length) { + object.documentsMetadataFilters = {}; + for (var j = 0; j < keys2.length; ++j) + object.documentsMetadataFilters[keys2[j]] = message.documentsMetadataFilters[keys2[j]]; + } + return object; + }; + + /** + * Converts this AssistQueryParameters to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @instance + * @returns {Object.} JSON object + */ + AssistQueryParameters.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AssistQueryParameters + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AssistQueryParameters + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AssistQueryParameters.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AssistQueryParameters"; + }; + + return AssistQueryParameters; + })(); + + v2beta1.AnalyzeContentRequest = (function() { + + /** + * Properties of an AnalyzeContentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAnalyzeContentRequest + * @property {string|null} [participant] AnalyzeContentRequest participant + * @property {google.cloud.dialogflow.v2beta1.ITextInput|null} [textInput] AnalyzeContentRequest textInput + * @property {google.cloud.dialogflow.v2beta1.IAudioInput|null} [audioInput] AnalyzeContentRequest audioInput + * @property {google.cloud.dialogflow.v2beta1.IEventInput|null} [eventInput] AnalyzeContentRequest eventInput + * @property {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null} [replyAudioConfig] AnalyzeContentRequest replyAudioConfig + * @property {google.cloud.dialogflow.v2beta1.IQueryParameters|null} [queryParams] AnalyzeContentRequest queryParams + * @property {google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null} [assistQueryParams] AnalyzeContentRequest assistQueryParams + * @property {google.protobuf.IStruct|null} [cxParameters] AnalyzeContentRequest cxParameters + * @property {string|null} [cxCurrentPage] AnalyzeContentRequest cxCurrentPage + * @property {google.protobuf.ITimestamp|null} [messageSendTime] AnalyzeContentRequest messageSendTime + * @property {string|null} [requestId] AnalyzeContentRequest requestId + */ + + /** + * Constructs a new AnalyzeContentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AnalyzeContentRequest. + * @implements IAnalyzeContentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest=} [properties] Properties to set + */ + function AnalyzeContentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnalyzeContentRequest participant. + * @member {string} participant + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.participant = ""; + + /** + * AnalyzeContentRequest textInput. + * @member {google.cloud.dialogflow.v2beta1.ITextInput|null|undefined} textInput + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.textInput = null; + + /** + * AnalyzeContentRequest audioInput. + * @member {google.cloud.dialogflow.v2beta1.IAudioInput|null|undefined} audioInput + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.audioInput = null; + + /** + * AnalyzeContentRequest eventInput. + * @member {google.cloud.dialogflow.v2beta1.IEventInput|null|undefined} eventInput + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.eventInput = null; + + /** + * AnalyzeContentRequest replyAudioConfig. + * @member {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null|undefined} replyAudioConfig + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.replyAudioConfig = null; + + /** + * AnalyzeContentRequest queryParams. + * @member {google.cloud.dialogflow.v2beta1.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.queryParams = null; + + /** + * AnalyzeContentRequest assistQueryParams. + * @member {google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null|undefined} assistQueryParams + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.assistQueryParams = null; + + /** + * AnalyzeContentRequest cxParameters. + * @member {google.protobuf.IStruct|null|undefined} cxParameters + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.cxParameters = null; + + /** + * AnalyzeContentRequest cxCurrentPage. + * @member {string} cxCurrentPage + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.cxCurrentPage = ""; + + /** + * AnalyzeContentRequest messageSendTime. + * @member {google.protobuf.ITimestamp|null|undefined} messageSendTime + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.messageSendTime = null; + + /** + * AnalyzeContentRequest requestId. + * @member {string} requestId + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + AnalyzeContentRequest.prototype.requestId = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * AnalyzeContentRequest input. + * @member {"textInput"|"audioInput"|"eventInput"|undefined} input + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + */ + Object.defineProperty(AnalyzeContentRequest.prototype, "input", { + get: $util.oneOfGetter($oneOfFields = ["textInput", "audioInput", "eventInput"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AnalyzeContentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AnalyzeContentRequest} AnalyzeContentRequest instance + */ + AnalyzeContentRequest.create = function create(properties) { + return new AnalyzeContentRequest(properties); + }; + + /** + * Encodes the specified AnalyzeContentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest} message AnalyzeContentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyzeContentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.participant); + if (message.replyAudioConfig != null && Object.hasOwnProperty.call(message, "replyAudioConfig")) + $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.encode(message.replyAudioConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.textInput != null && Object.hasOwnProperty.call(message, "textInput")) + $root.google.cloud.dialogflow.v2beta1.TextInput.encode(message.textInput, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.audioInput != null && Object.hasOwnProperty.call(message, "audioInput")) + $root.google.cloud.dialogflow.v2beta1.AudioInput.encode(message.audioInput, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.eventInput != null && Object.hasOwnProperty.call(message, "eventInput")) + $root.google.cloud.dialogflow.v2beta1.EventInput.encode(message.eventInput, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.v2beta1.QueryParameters.encode(message.queryParams, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.messageSendTime != null && Object.hasOwnProperty.call(message, "messageSendTime")) + $root.google.protobuf.Timestamp.encode(message.messageSendTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.requestId); + if (message.assistQueryParams != null && Object.hasOwnProperty.call(message, "assistQueryParams")) + $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.encode(message.assistQueryParams, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.cxParameters != null && Object.hasOwnProperty.call(message, "cxParameters")) + $root.google.protobuf.Struct.encode(message.cxParameters, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.cxCurrentPage != null && Object.hasOwnProperty.call(message, "cxCurrentPage")) + writer.uint32(/* id 20, wireType 2 =*/162).string(message.cxCurrentPage); + return writer; + }; + + /** + * Encodes the specified AnalyzeContentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest} message AnalyzeContentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyzeContentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnalyzeContentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AnalyzeContentRequest} AnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyzeContentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.participant = reader.string(); + break; + } + case 6: { + message.textInput = $root.google.cloud.dialogflow.v2beta1.TextInput.decode(reader, reader.uint32()); + break; + } + case 7: { + message.audioInput = $root.google.cloud.dialogflow.v2beta1.AudioInput.decode(reader, reader.uint32()); + break; + } + case 8: { + message.eventInput = $root.google.cloud.dialogflow.v2beta1.EventInput.decode(reader, reader.uint32()); + break; + } + case 5: { + message.replyAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 9: { + message.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.decode(reader, reader.uint32()); + break; + } + case 14: { + message.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.decode(reader, reader.uint32()); + break; + } + case 18: { + message.cxParameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 20: { + message.cxCurrentPage = reader.string(); + break; + } + case 10: { + message.messageSendTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 11: { + message.requestId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnalyzeContentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AnalyzeContentRequest} AnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyzeContentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnalyzeContentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnalyzeContentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.textInput != null && message.hasOwnProperty("textInput")) { + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.TextInput.verify(message.textInput); + if (error) + return "textInput." + error; + } + } + if (message.audioInput != null && message.hasOwnProperty("audioInput")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.AudioInput.verify(message.audioInput); + if (error) + return "audioInput." + error; + } + } + if (message.eventInput != null && message.hasOwnProperty("eventInput")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.EventInput.verify(message.eventInput); + if (error) + return "eventInput." + error; + } + } + if (message.replyAudioConfig != null && message.hasOwnProperty("replyAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify(message.replyAudioConfig); + if (error) + return "replyAudioConfig." + error; + } + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) { + var error = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.verify(message.assistQueryParams); + if (error) + return "assistQueryParams." + error; + } + if (message.cxParameters != null && message.hasOwnProperty("cxParameters")) { + var error = $root.google.protobuf.Struct.verify(message.cxParameters); + if (error) + return "cxParameters." + error; + } + if (message.cxCurrentPage != null && message.hasOwnProperty("cxCurrentPage")) + if (!$util.isString(message.cxCurrentPage)) + return "cxCurrentPage: string expected"; + if (message.messageSendTime != null && message.hasOwnProperty("messageSendTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.messageSendTime); + if (error) + return "messageSendTime." + error; + } + if (message.requestId != null && message.hasOwnProperty("requestId")) + if (!$util.isString(message.requestId)) + return "requestId: string expected"; + return null; + }; + + /** + * Creates an AnalyzeContentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AnalyzeContentRequest} AnalyzeContentRequest + */ + AnalyzeContentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest(); + if (object.participant != null) + message.participant = String(object.participant); + if (object.textInput != null) { + if (typeof object.textInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.textInput: object expected"); + message.textInput = $root.google.cloud.dialogflow.v2beta1.TextInput.fromObject(object.textInput); + } + if (object.audioInput != null) { + if (typeof object.audioInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.audioInput: object expected"); + message.audioInput = $root.google.cloud.dialogflow.v2beta1.AudioInput.fromObject(object.audioInput); + } + if (object.eventInput != null) { + if (typeof object.eventInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.eventInput: object expected"); + message.eventInput = $root.google.cloud.dialogflow.v2beta1.EventInput.fromObject(object.eventInput); + } + if (object.replyAudioConfig != null) { + if (typeof object.replyAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.replyAudioConfig: object expected"); + message.replyAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.fromObject(object.replyAudioConfig); + } + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.fromObject(object.queryParams); + } + if (object.assistQueryParams != null) { + if (typeof object.assistQueryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.assistQueryParams: object expected"); + message.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.fromObject(object.assistQueryParams); + } + if (object.cxParameters != null) { + if (typeof object.cxParameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.cxParameters: object expected"); + message.cxParameters = $root.google.protobuf.Struct.fromObject(object.cxParameters); + } + if (object.cxCurrentPage != null) + message.cxCurrentPage = String(object.cxCurrentPage); + if (object.messageSendTime != null) { + if (typeof object.messageSendTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentRequest.messageSendTime: object expected"); + message.messageSendTime = $root.google.protobuf.Timestamp.fromObject(object.messageSendTime); + } + if (object.requestId != null) + message.requestId = String(object.requestId); + return message; + }; + + /** + * Creates a plain object from an AnalyzeContentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.AnalyzeContentRequest} message AnalyzeContentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnalyzeContentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.participant = ""; + object.replyAudioConfig = null; + object.queryParams = null; + object.messageSendTime = null; + object.requestId = ""; + object.assistQueryParams = null; + object.cxParameters = null; + object.cxCurrentPage = ""; + } + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.replyAudioConfig != null && message.hasOwnProperty("replyAudioConfig")) + object.replyAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.toObject(message.replyAudioConfig, options); + if (message.textInput != null && message.hasOwnProperty("textInput")) { + object.textInput = $root.google.cloud.dialogflow.v2beta1.TextInput.toObject(message.textInput, options); + if (options.oneofs) + object.input = "textInput"; + } + if (message.audioInput != null && message.hasOwnProperty("audioInput")) { + object.audioInput = $root.google.cloud.dialogflow.v2beta1.AudioInput.toObject(message.audioInput, options); + if (options.oneofs) + object.input = "audioInput"; + } + if (message.eventInput != null && message.hasOwnProperty("eventInput")) { + object.eventInput = $root.google.cloud.dialogflow.v2beta1.EventInput.toObject(message.eventInput, options); + if (options.oneofs) + object.input = "eventInput"; + } + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.toObject(message.queryParams, options); + if (message.messageSendTime != null && message.hasOwnProperty("messageSendTime")) + object.messageSendTime = $root.google.protobuf.Timestamp.toObject(message.messageSendTime, options); + if (message.requestId != null && message.hasOwnProperty("requestId")) + object.requestId = message.requestId; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) + object.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.toObject(message.assistQueryParams, options); + if (message.cxParameters != null && message.hasOwnProperty("cxParameters")) + object.cxParameters = $root.google.protobuf.Struct.toObject(message.cxParameters, options); + if (message.cxCurrentPage != null && message.hasOwnProperty("cxCurrentPage")) + object.cxCurrentPage = message.cxCurrentPage; + return object; + }; + + /** + * Converts this AnalyzeContentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @instance + * @returns {Object.} JSON object + */ + AnalyzeContentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnalyzeContentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnalyzeContentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AnalyzeContentRequest"; + }; + + return AnalyzeContentRequest; + })(); + + v2beta1.DtmfParameters = (function() { + + /** + * Properties of a DtmfParameters. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDtmfParameters + * @property {boolean|null} [acceptsDtmfInput] DtmfParameters acceptsDtmfInput + */ + + /** + * Constructs a new DtmfParameters. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DtmfParameters. + * @implements IDtmfParameters + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDtmfParameters=} [properties] Properties to set + */ + function DtmfParameters(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DtmfParameters acceptsDtmfInput. + * @member {boolean} acceptsDtmfInput + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @instance + */ + DtmfParameters.prototype.acceptsDtmfInput = false; + + /** + * Creates a new DtmfParameters instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.IDtmfParameters=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DtmfParameters} DtmfParameters instance + */ + DtmfParameters.create = function create(properties) { + return new DtmfParameters(properties); + }; + + /** + * Encodes the specified DtmfParameters message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DtmfParameters.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.IDtmfParameters} message DtmfParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DtmfParameters.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.acceptsDtmfInput != null && Object.hasOwnProperty.call(message, "acceptsDtmfInput")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.acceptsDtmfInput); + return writer; + }; + + /** + * Encodes the specified DtmfParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DtmfParameters.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.IDtmfParameters} message DtmfParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DtmfParameters.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DtmfParameters message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DtmfParameters} DtmfParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DtmfParameters.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DtmfParameters(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.acceptsDtmfInput = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DtmfParameters message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DtmfParameters} DtmfParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DtmfParameters.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DtmfParameters message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DtmfParameters.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.acceptsDtmfInput != null && message.hasOwnProperty("acceptsDtmfInput")) + if (typeof message.acceptsDtmfInput !== "boolean") + return "acceptsDtmfInput: boolean expected"; + return null; + }; + + /** + * Creates a DtmfParameters message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DtmfParameters} DtmfParameters + */ + DtmfParameters.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DtmfParameters) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DtmfParameters(); + if (object.acceptsDtmfInput != null) + message.acceptsDtmfInput = Boolean(object.acceptsDtmfInput); + return message; + }; + + /** + * Creates a plain object from a DtmfParameters message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.DtmfParameters} message DtmfParameters + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DtmfParameters.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.acceptsDtmfInput = false; + if (message.acceptsDtmfInput != null && message.hasOwnProperty("acceptsDtmfInput")) + object.acceptsDtmfInput = message.acceptsDtmfInput; + return object; + }; + + /** + * Converts this DtmfParameters to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @instance + * @returns {Object.} JSON object + */ + DtmfParameters.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DtmfParameters + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DtmfParameters + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DtmfParameters.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DtmfParameters"; + }; + + return DtmfParameters; + })(); + + v2beta1.AnalyzeContentResponse = (function() { + + /** + * Properties of an AnalyzeContentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAnalyzeContentResponse + * @property {string|null} [replyText] AnalyzeContentResponse replyText + * @property {google.cloud.dialogflow.v2beta1.IOutputAudio|null} [replyAudio] AnalyzeContentResponse replyAudio + * @property {google.cloud.dialogflow.v2beta1.IAutomatedAgentReply|null} [automatedAgentReply] AnalyzeContentResponse automatedAgentReply + * @property {google.cloud.dialogflow.v2beta1.IMessage|null} [message] AnalyzeContentResponse message + * @property {Array.|null} [humanAgentSuggestionResults] AnalyzeContentResponse humanAgentSuggestionResults + * @property {Array.|null} [endUserSuggestionResults] AnalyzeContentResponse endUserSuggestionResults + * @property {google.cloud.dialogflow.v2beta1.IDtmfParameters|null} [dtmfParameters] AnalyzeContentResponse dtmfParameters + */ + + /** + * Constructs a new AnalyzeContentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AnalyzeContentResponse. + * @implements IAnalyzeContentResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse=} [properties] Properties to set + */ + function AnalyzeContentResponse(properties) { + this.humanAgentSuggestionResults = []; + this.endUserSuggestionResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnalyzeContentResponse replyText. + * @member {string} replyText + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.replyText = ""; + + /** + * AnalyzeContentResponse replyAudio. + * @member {google.cloud.dialogflow.v2beta1.IOutputAudio|null|undefined} replyAudio + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.replyAudio = null; + + /** + * AnalyzeContentResponse automatedAgentReply. + * @member {google.cloud.dialogflow.v2beta1.IAutomatedAgentReply|null|undefined} automatedAgentReply + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.automatedAgentReply = null; + + /** + * AnalyzeContentResponse message. + * @member {google.cloud.dialogflow.v2beta1.IMessage|null|undefined} message + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.message = null; + + /** + * AnalyzeContentResponse humanAgentSuggestionResults. + * @member {Array.} humanAgentSuggestionResults + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.humanAgentSuggestionResults = $util.emptyArray; + + /** + * AnalyzeContentResponse endUserSuggestionResults. + * @member {Array.} endUserSuggestionResults + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.endUserSuggestionResults = $util.emptyArray; + + /** + * AnalyzeContentResponse dtmfParameters. + * @member {google.cloud.dialogflow.v2beta1.IDtmfParameters|null|undefined} dtmfParameters + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @instance + */ + AnalyzeContentResponse.prototype.dtmfParameters = null; + + /** + * Creates a new AnalyzeContentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AnalyzeContentResponse} AnalyzeContentResponse instance + */ + AnalyzeContentResponse.create = function create(properties) { + return new AnalyzeContentResponse(properties); + }; + + /** + * Encodes the specified AnalyzeContentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse} message AnalyzeContentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyzeContentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.replyText != null && Object.hasOwnProperty.call(message, "replyText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.replyText); + if (message.replyAudio != null && Object.hasOwnProperty.call(message, "replyAudio")) + $root.google.cloud.dialogflow.v2beta1.OutputAudio.encode(message.replyAudio, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.automatedAgentReply != null && Object.hasOwnProperty.call(message, "automatedAgentReply")) + $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.encode(message.automatedAgentReply, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.google.cloud.dialogflow.v2beta1.Message.encode(message.message, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.humanAgentSuggestionResults != null && message.humanAgentSuggestionResults.length) + for (var i = 0; i < message.humanAgentSuggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SuggestionResult.encode(message.humanAgentSuggestionResults[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.endUserSuggestionResults != null && message.endUserSuggestionResults.length) + for (var i = 0; i < message.endUserSuggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SuggestionResult.encode(message.endUserSuggestionResults[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.dtmfParameters != null && Object.hasOwnProperty.call(message, "dtmfParameters")) + $root.google.cloud.dialogflow.v2beta1.DtmfParameters.encode(message.dtmfParameters, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AnalyzeContentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse} message AnalyzeContentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnalyzeContentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnalyzeContentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AnalyzeContentResponse} AnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyzeContentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.replyText = reader.string(); + break; + } + case 2: { + message.replyAudio = $root.google.cloud.dialogflow.v2beta1.OutputAudio.decode(reader, reader.uint32()); + break; + } + case 3: { + message.automatedAgentReply = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.decode(reader, reader.uint32()); + break; + } + case 5: { + message.message = $root.google.cloud.dialogflow.v2beta1.Message.decode(reader, reader.uint32()); + break; + } + case 6: { + if (!(message.humanAgentSuggestionResults && message.humanAgentSuggestionResults.length)) + message.humanAgentSuggestionResults = []; + message.humanAgentSuggestionResults.push($root.google.cloud.dialogflow.v2beta1.SuggestionResult.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.endUserSuggestionResults && message.endUserSuggestionResults.length)) + message.endUserSuggestionResults = []; + message.endUserSuggestionResults.push($root.google.cloud.dialogflow.v2beta1.SuggestionResult.decode(reader, reader.uint32())); + break; + } + case 9: { + message.dtmfParameters = $root.google.cloud.dialogflow.v2beta1.DtmfParameters.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnalyzeContentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AnalyzeContentResponse} AnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnalyzeContentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnalyzeContentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnalyzeContentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.replyText != null && message.hasOwnProperty("replyText")) + if (!$util.isString(message.replyText)) + return "replyText: string expected"; + if (message.replyAudio != null && message.hasOwnProperty("replyAudio")) { + var error = $root.google.cloud.dialogflow.v2beta1.OutputAudio.verify(message.replyAudio); + if (error) + return "replyAudio." + error; + } + if (message.automatedAgentReply != null && message.hasOwnProperty("automatedAgentReply")) { + var error = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.verify(message.automatedAgentReply); + if (error) + return "automatedAgentReply." + error; + } + if (message.message != null && message.hasOwnProperty("message")) { + var error = $root.google.cloud.dialogflow.v2beta1.Message.verify(message.message); + if (error) + return "message." + error; + } + if (message.humanAgentSuggestionResults != null && message.hasOwnProperty("humanAgentSuggestionResults")) { + if (!Array.isArray(message.humanAgentSuggestionResults)) + return "humanAgentSuggestionResults: array expected"; + for (var i = 0; i < message.humanAgentSuggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.verify(message.humanAgentSuggestionResults[i]); + if (error) + return "humanAgentSuggestionResults." + error; + } + } + if (message.endUserSuggestionResults != null && message.hasOwnProperty("endUserSuggestionResults")) { + if (!Array.isArray(message.endUserSuggestionResults)) + return "endUserSuggestionResults: array expected"; + for (var i = 0; i < message.endUserSuggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.verify(message.endUserSuggestionResults[i]); + if (error) + return "endUserSuggestionResults." + error; + } + } + if (message.dtmfParameters != null && message.hasOwnProperty("dtmfParameters")) { + var error = $root.google.cloud.dialogflow.v2beta1.DtmfParameters.verify(message.dtmfParameters); + if (error) + return "dtmfParameters." + error; + } + return null; + }; + + /** + * Creates an AnalyzeContentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AnalyzeContentResponse} AnalyzeContentResponse + */ + AnalyzeContentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse(); + if (object.replyText != null) + message.replyText = String(object.replyText); + if (object.replyAudio != null) { + if (typeof object.replyAudio !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.replyAudio: object expected"); + message.replyAudio = $root.google.cloud.dialogflow.v2beta1.OutputAudio.fromObject(object.replyAudio); + } + if (object.automatedAgentReply != null) { + if (typeof object.automatedAgentReply !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.automatedAgentReply: object expected"); + message.automatedAgentReply = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.fromObject(object.automatedAgentReply); + } + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.message: object expected"); + message.message = $root.google.cloud.dialogflow.v2beta1.Message.fromObject(object.message); + } + if (object.humanAgentSuggestionResults) { + if (!Array.isArray(object.humanAgentSuggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.humanAgentSuggestionResults: array expected"); + message.humanAgentSuggestionResults = []; + for (var i = 0; i < object.humanAgentSuggestionResults.length; ++i) { + if (typeof object.humanAgentSuggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.humanAgentSuggestionResults: object expected"); + message.humanAgentSuggestionResults[i] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.fromObject(object.humanAgentSuggestionResults[i]); + } + } + if (object.endUserSuggestionResults) { + if (!Array.isArray(object.endUserSuggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.endUserSuggestionResults: array expected"); + message.endUserSuggestionResults = []; + for (var i = 0; i < object.endUserSuggestionResults.length; ++i) { + if (typeof object.endUserSuggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.endUserSuggestionResults: object expected"); + message.endUserSuggestionResults[i] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.fromObject(object.endUserSuggestionResults[i]); + } + } + if (object.dtmfParameters != null) { + if (typeof object.dtmfParameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse.dtmfParameters: object expected"); + message.dtmfParameters = $root.google.cloud.dialogflow.v2beta1.DtmfParameters.fromObject(object.dtmfParameters); + } + return message; + }; + + /** + * Creates a plain object from an AnalyzeContentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.AnalyzeContentResponse} message AnalyzeContentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnalyzeContentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.humanAgentSuggestionResults = []; + object.endUserSuggestionResults = []; + } + if (options.defaults) { + object.replyText = ""; + object.replyAudio = null; + object.automatedAgentReply = null; + object.message = null; + object.dtmfParameters = null; + } + if (message.replyText != null && message.hasOwnProperty("replyText")) + object.replyText = message.replyText; + if (message.replyAudio != null && message.hasOwnProperty("replyAudio")) + object.replyAudio = $root.google.cloud.dialogflow.v2beta1.OutputAudio.toObject(message.replyAudio, options); + if (message.automatedAgentReply != null && message.hasOwnProperty("automatedAgentReply")) + object.automatedAgentReply = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.toObject(message.automatedAgentReply, options); + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.google.cloud.dialogflow.v2beta1.Message.toObject(message.message, options); + if (message.humanAgentSuggestionResults && message.humanAgentSuggestionResults.length) { + object.humanAgentSuggestionResults = []; + for (var j = 0; j < message.humanAgentSuggestionResults.length; ++j) + object.humanAgentSuggestionResults[j] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.toObject(message.humanAgentSuggestionResults[j], options); + } + if (message.endUserSuggestionResults && message.endUserSuggestionResults.length) { + object.endUserSuggestionResults = []; + for (var j = 0; j < message.endUserSuggestionResults.length; ++j) + object.endUserSuggestionResults[j] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.toObject(message.endUserSuggestionResults[j], options); + } + if (message.dtmfParameters != null && message.hasOwnProperty("dtmfParameters")) + object.dtmfParameters = $root.google.cloud.dialogflow.v2beta1.DtmfParameters.toObject(message.dtmfParameters, options); + return object; + }; + + /** + * Converts this AnalyzeContentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @instance + * @returns {Object.} JSON object + */ + AnalyzeContentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnalyzeContentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AnalyzeContentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnalyzeContentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AnalyzeContentResponse"; + }; + + return AnalyzeContentResponse; + })(); + + v2beta1.InputTextConfig = (function() { + + /** + * Properties of an InputTextConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IInputTextConfig + * @property {string|null} [languageCode] InputTextConfig languageCode + */ + + /** + * Constructs a new InputTextConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an InputTextConfig. + * @implements IInputTextConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IInputTextConfig=} [properties] Properties to set + */ + function InputTextConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InputTextConfig languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @instance + */ + InputTextConfig.prototype.languageCode = ""; + + /** + * Creates a new InputTextConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IInputTextConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.InputTextConfig} InputTextConfig instance + */ + InputTextConfig.create = function create(properties) { + return new InputTextConfig(properties); + }; + + /** + * Encodes the specified InputTextConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.InputTextConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IInputTextConfig} message InputTextConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputTextConfig.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); + return writer; + }; + + /** + * Encodes the specified InputTextConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.InputTextConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IInputTextConfig} message InputTextConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputTextConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InputTextConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.InputTextConfig} InputTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputTextConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.InputTextConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InputTextConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.InputTextConfig} InputTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputTextConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InputTextConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InputTextConfig.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"; + return null; + }; + + /** + * Creates an InputTextConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.InputTextConfig} InputTextConfig + */ + InputTextConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.InputTextConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.InputTextConfig(); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from an InputTextConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.InputTextConfig} message InputTextConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InputTextConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.languageCode = ""; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this InputTextConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @instance + * @returns {Object.} JSON object + */ + InputTextConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InputTextConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.InputTextConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputTextConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.InputTextConfig"; + }; + + return InputTextConfig; + })(); + + v2beta1.StreamingAnalyzeContentRequest = (function() { + + /** + * Properties of a StreamingAnalyzeContentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IStreamingAnalyzeContentRequest + * @property {string|null} [participant] StreamingAnalyzeContentRequest participant + * @property {google.cloud.dialogflow.v2beta1.IInputAudioConfig|null} [audioConfig] StreamingAnalyzeContentRequest audioConfig + * @property {google.cloud.dialogflow.v2beta1.IInputTextConfig|null} [textConfig] StreamingAnalyzeContentRequest textConfig + * @property {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null} [replyAudioConfig] StreamingAnalyzeContentRequest replyAudioConfig + * @property {Uint8Array|null} [inputAudio] StreamingAnalyzeContentRequest inputAudio + * @property {string|null} [inputText] StreamingAnalyzeContentRequest inputText + * @property {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null} [inputDtmf] StreamingAnalyzeContentRequest inputDtmf + * @property {google.cloud.dialogflow.v2beta1.IQueryParameters|null} [queryParams] StreamingAnalyzeContentRequest queryParams + * @property {google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null} [assistQueryParams] StreamingAnalyzeContentRequest assistQueryParams + * @property {google.protobuf.IStruct|null} [cxParameters] StreamingAnalyzeContentRequest cxParameters + * @property {string|null} [cxCurrentPage] StreamingAnalyzeContentRequest cxCurrentPage + * @property {boolean|null} [enablePartialAutomatedAgentReply] StreamingAnalyzeContentRequest enablePartialAutomatedAgentReply + */ + + /** + * Constructs a new StreamingAnalyzeContentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a StreamingAnalyzeContentRequest. + * @implements IStreamingAnalyzeContentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest=} [properties] Properties to set + */ + function StreamingAnalyzeContentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingAnalyzeContentRequest participant. + * @member {string} participant + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.participant = ""; + + /** + * StreamingAnalyzeContentRequest audioConfig. + * @member {google.cloud.dialogflow.v2beta1.IInputAudioConfig|null|undefined} audioConfig + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.audioConfig = null; + + /** + * StreamingAnalyzeContentRequest textConfig. + * @member {google.cloud.dialogflow.v2beta1.IInputTextConfig|null|undefined} textConfig + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.textConfig = null; + + /** + * StreamingAnalyzeContentRequest replyAudioConfig. + * @member {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null|undefined} replyAudioConfig + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.replyAudioConfig = null; + + /** + * StreamingAnalyzeContentRequest inputAudio. + * @member {Uint8Array|null|undefined} inputAudio + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.inputAudio = null; + + /** + * StreamingAnalyzeContentRequest inputText. + * @member {string|null|undefined} inputText + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.inputText = null; + + /** + * StreamingAnalyzeContentRequest inputDtmf. + * @member {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null|undefined} inputDtmf + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.inputDtmf = null; + + /** + * StreamingAnalyzeContentRequest queryParams. + * @member {google.cloud.dialogflow.v2beta1.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.queryParams = null; + + /** + * StreamingAnalyzeContentRequest assistQueryParams. + * @member {google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null|undefined} assistQueryParams + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.assistQueryParams = null; + + /** + * StreamingAnalyzeContentRequest cxParameters. + * @member {google.protobuf.IStruct|null|undefined} cxParameters + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.cxParameters = null; + + /** + * StreamingAnalyzeContentRequest cxCurrentPage. + * @member {string} cxCurrentPage + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.cxCurrentPage = ""; + + /** + * StreamingAnalyzeContentRequest enablePartialAutomatedAgentReply. + * @member {boolean} enablePartialAutomatedAgentReply + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + StreamingAnalyzeContentRequest.prototype.enablePartialAutomatedAgentReply = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * StreamingAnalyzeContentRequest config. + * @member {"audioConfig"|"textConfig"|undefined} config + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + Object.defineProperty(StreamingAnalyzeContentRequest.prototype, "config", { + get: $util.oneOfGetter($oneOfFields = ["audioConfig", "textConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * StreamingAnalyzeContentRequest input. + * @member {"inputAudio"|"inputText"|"inputDtmf"|undefined} input + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + */ + Object.defineProperty(StreamingAnalyzeContentRequest.prototype, "input", { + get: $util.oneOfGetter($oneOfFields = ["inputAudio", "inputText", "inputDtmf"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new StreamingAnalyzeContentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest} StreamingAnalyzeContentRequest instance + */ + StreamingAnalyzeContentRequest.create = function create(properties) { + return new StreamingAnalyzeContentRequest(properties); + }; + + /** + * Encodes the specified StreamingAnalyzeContentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest} message StreamingAnalyzeContentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingAnalyzeContentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.participant); + if (message.audioConfig != null && Object.hasOwnProperty.call(message, "audioConfig")) + $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.encode(message.audioConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.textConfig != null && Object.hasOwnProperty.call(message, "textConfig")) + $root.google.cloud.dialogflow.v2beta1.InputTextConfig.encode(message.textConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.replyAudioConfig != null && Object.hasOwnProperty.call(message, "replyAudioConfig")) + $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.encode(message.replyAudioConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.inputAudio != null && Object.hasOwnProperty.call(message, "inputAudio")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.inputAudio); + if (message.inputText != null && Object.hasOwnProperty.call(message, "inputText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.inputText); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.v2beta1.QueryParameters.encode(message.queryParams, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.assistQueryParams != null && Object.hasOwnProperty.call(message, "assistQueryParams")) + $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.encode(message.assistQueryParams, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.inputDtmf != null && Object.hasOwnProperty.call(message, "inputDtmf")) + $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.encode(message.inputDtmf, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.enablePartialAutomatedAgentReply != null && Object.hasOwnProperty.call(message, "enablePartialAutomatedAgentReply")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.enablePartialAutomatedAgentReply); + if (message.cxParameters != null && Object.hasOwnProperty.call(message, "cxParameters")) + $root.google.protobuf.Struct.encode(message.cxParameters, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.cxCurrentPage != null && Object.hasOwnProperty.call(message, "cxCurrentPage")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.cxCurrentPage); + return writer; + }; + + /** + * Encodes the specified StreamingAnalyzeContentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentRequest} message StreamingAnalyzeContentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingAnalyzeContentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingAnalyzeContentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest} StreamingAnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingAnalyzeContentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.participant = reader.string(); + break; + } + case 2: { + message.audioConfig = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.textConfig = $root.google.cloud.dialogflow.v2beta1.InputTextConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.replyAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.inputAudio = reader.bytes(); + break; + } + case 6: { + message.inputText = reader.string(); + break; + } + case 9: { + message.inputDtmf = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.decode(reader, reader.uint32()); + break; + } + case 7: { + message.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.decode(reader, reader.uint32()); + break; + } + case 8: { + message.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.decode(reader, reader.uint32()); + break; + } + case 13: { + message.cxParameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 15: { + message.cxCurrentPage = reader.string(); + break; + } + case 12: { + message.enablePartialAutomatedAgentReply = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingAnalyzeContentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest} StreamingAnalyzeContentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingAnalyzeContentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingAnalyzeContentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingAnalyzeContentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { + properties.config = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.verify(message.audioConfig); + if (error) + return "audioConfig." + error; + } + } + if (message.textConfig != null && message.hasOwnProperty("textConfig")) { + if (properties.config === 1) + return "config: multiple values"; + properties.config = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.InputTextConfig.verify(message.textConfig); + if (error) + return "textConfig." + error; + } + } + if (message.replyAudioConfig != null && message.hasOwnProperty("replyAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify(message.replyAudioConfig); + if (error) + return "replyAudioConfig." + error; + } + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) { + properties.input = 1; + if (!(message.inputAudio && typeof message.inputAudio.length === "number" || $util.isString(message.inputAudio))) + return "inputAudio: buffer expected"; + } + if (message.inputText != null && message.hasOwnProperty("inputText")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + if (!$util.isString(message.inputText)) + return "inputText: string expected"; + } + if (message.inputDtmf != null && message.hasOwnProperty("inputDtmf")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.verify(message.inputDtmf); + if (error) + return "inputDtmf." + error; + } + } + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) { + var error = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.verify(message.assistQueryParams); + if (error) + return "assistQueryParams." + error; + } + if (message.cxParameters != null && message.hasOwnProperty("cxParameters")) { + var error = $root.google.protobuf.Struct.verify(message.cxParameters); + if (error) + return "cxParameters." + error; + } + if (message.cxCurrentPage != null && message.hasOwnProperty("cxCurrentPage")) + if (!$util.isString(message.cxCurrentPage)) + return "cxCurrentPage: string expected"; + if (message.enablePartialAutomatedAgentReply != null && message.hasOwnProperty("enablePartialAutomatedAgentReply")) + if (typeof message.enablePartialAutomatedAgentReply !== "boolean") + return "enablePartialAutomatedAgentReply: boolean expected"; + return null; + }; + + /** + * Creates a StreamingAnalyzeContentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest} StreamingAnalyzeContentRequest + */ + StreamingAnalyzeContentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest(); + if (object.participant != null) + message.participant = String(object.participant); + if (object.audioConfig != null) { + if (typeof object.audioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.audioConfig: object expected"); + message.audioConfig = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.fromObject(object.audioConfig); + } + if (object.textConfig != null) { + if (typeof object.textConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.textConfig: object expected"); + message.textConfig = $root.google.cloud.dialogflow.v2beta1.InputTextConfig.fromObject(object.textConfig); + } + if (object.replyAudioConfig != null) { + if (typeof object.replyAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.replyAudioConfig: object expected"); + message.replyAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.fromObject(object.replyAudioConfig); + } + if (object.inputAudio != null) + if (typeof object.inputAudio === "string") + $util.base64.decode(object.inputAudio, message.inputAudio = $util.newBuffer($util.base64.length(object.inputAudio)), 0); + else if (object.inputAudio.length >= 0) + message.inputAudio = object.inputAudio; + if (object.inputText != null) + message.inputText = String(object.inputText); + if (object.inputDtmf != null) { + if (typeof object.inputDtmf !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.inputDtmf: object expected"); + message.inputDtmf = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.fromObject(object.inputDtmf); + } + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.fromObject(object.queryParams); + } + if (object.assistQueryParams != null) { + if (typeof object.assistQueryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.assistQueryParams: object expected"); + message.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.fromObject(object.assistQueryParams); + } + if (object.cxParameters != null) { + if (typeof object.cxParameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest.cxParameters: object expected"); + message.cxParameters = $root.google.protobuf.Struct.fromObject(object.cxParameters); + } + if (object.cxCurrentPage != null) + message.cxCurrentPage = String(object.cxCurrentPage); + if (object.enablePartialAutomatedAgentReply != null) + message.enablePartialAutomatedAgentReply = Boolean(object.enablePartialAutomatedAgentReply); + return message; + }; + + /** + * Creates a plain object from a StreamingAnalyzeContentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest} message StreamingAnalyzeContentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingAnalyzeContentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.participant = ""; + object.replyAudioConfig = null; + object.queryParams = null; + object.assistQueryParams = null; + object.enablePartialAutomatedAgentReply = false; + object.cxParameters = null; + object.cxCurrentPage = ""; + } + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { + object.audioConfig = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.toObject(message.audioConfig, options); + if (options.oneofs) + object.config = "audioConfig"; + } + if (message.textConfig != null && message.hasOwnProperty("textConfig")) { + object.textConfig = $root.google.cloud.dialogflow.v2beta1.InputTextConfig.toObject(message.textConfig, options); + if (options.oneofs) + object.config = "textConfig"; + } + if (message.replyAudioConfig != null && message.hasOwnProperty("replyAudioConfig")) + object.replyAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.toObject(message.replyAudioConfig, options); + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) { + object.inputAudio = options.bytes === String ? $util.base64.encode(message.inputAudio, 0, message.inputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.inputAudio) : message.inputAudio; + if (options.oneofs) + object.input = "inputAudio"; + } + if (message.inputText != null && message.hasOwnProperty("inputText")) { + object.inputText = message.inputText; + if (options.oneofs) + object.input = "inputText"; + } + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.toObject(message.queryParams, options); + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) + object.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.toObject(message.assistQueryParams, options); + if (message.inputDtmf != null && message.hasOwnProperty("inputDtmf")) { + object.inputDtmf = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.toObject(message.inputDtmf, options); + if (options.oneofs) + object.input = "inputDtmf"; + } + if (message.enablePartialAutomatedAgentReply != null && message.hasOwnProperty("enablePartialAutomatedAgentReply")) + object.enablePartialAutomatedAgentReply = message.enablePartialAutomatedAgentReply; + if (message.cxParameters != null && message.hasOwnProperty("cxParameters")) + object.cxParameters = $root.google.protobuf.Struct.toObject(message.cxParameters, options); + if (message.cxCurrentPage != null && message.hasOwnProperty("cxCurrentPage")) + object.cxCurrentPage = message.cxCurrentPage; + return object; + }; + + /** + * Converts this StreamingAnalyzeContentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @instance + * @returns {Object.} JSON object + */ + StreamingAnalyzeContentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingAnalyzeContentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingAnalyzeContentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest"; + }; + + return StreamingAnalyzeContentRequest; + })(); + + v2beta1.StreamingAnalyzeContentResponse = (function() { + + /** + * Properties of a StreamingAnalyzeContentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IStreamingAnalyzeContentResponse + * @property {google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult|null} [recognitionResult] StreamingAnalyzeContentResponse recognitionResult + * @property {string|null} [replyText] StreamingAnalyzeContentResponse replyText + * @property {google.cloud.dialogflow.v2beta1.IOutputAudio|null} [replyAudio] StreamingAnalyzeContentResponse replyAudio + * @property {google.cloud.dialogflow.v2beta1.IAutomatedAgentReply|null} [automatedAgentReply] StreamingAnalyzeContentResponse automatedAgentReply + * @property {google.cloud.dialogflow.v2beta1.IMessage|null} [message] StreamingAnalyzeContentResponse message + * @property {Array.|null} [humanAgentSuggestionResults] StreamingAnalyzeContentResponse humanAgentSuggestionResults + * @property {Array.|null} [endUserSuggestionResults] StreamingAnalyzeContentResponse endUserSuggestionResults + * @property {google.cloud.dialogflow.v2beta1.IDtmfParameters|null} [dtmfParameters] StreamingAnalyzeContentResponse dtmfParameters + */ + + /** + * Constructs a new StreamingAnalyzeContentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a StreamingAnalyzeContentResponse. + * @implements IStreamingAnalyzeContentResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentResponse=} [properties] Properties to set + */ + function StreamingAnalyzeContentResponse(properties) { + this.humanAgentSuggestionResults = []; + this.endUserSuggestionResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingAnalyzeContentResponse recognitionResult. + * @member {google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult|null|undefined} recognitionResult + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.recognitionResult = null; + + /** + * StreamingAnalyzeContentResponse replyText. + * @member {string} replyText + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.replyText = ""; + + /** + * StreamingAnalyzeContentResponse replyAudio. + * @member {google.cloud.dialogflow.v2beta1.IOutputAudio|null|undefined} replyAudio + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.replyAudio = null; + + /** + * StreamingAnalyzeContentResponse automatedAgentReply. + * @member {google.cloud.dialogflow.v2beta1.IAutomatedAgentReply|null|undefined} automatedAgentReply + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.automatedAgentReply = null; + + /** + * StreamingAnalyzeContentResponse message. + * @member {google.cloud.dialogflow.v2beta1.IMessage|null|undefined} message + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.message = null; + + /** + * StreamingAnalyzeContentResponse humanAgentSuggestionResults. + * @member {Array.} humanAgentSuggestionResults + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.humanAgentSuggestionResults = $util.emptyArray; + + /** + * StreamingAnalyzeContentResponse endUserSuggestionResults. + * @member {Array.} endUserSuggestionResults + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.endUserSuggestionResults = $util.emptyArray; + + /** + * StreamingAnalyzeContentResponse dtmfParameters. + * @member {google.cloud.dialogflow.v2beta1.IDtmfParameters|null|undefined} dtmfParameters + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @instance + */ + StreamingAnalyzeContentResponse.prototype.dtmfParameters = null; + + /** + * Creates a new StreamingAnalyzeContentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse} StreamingAnalyzeContentResponse instance + */ + StreamingAnalyzeContentResponse.create = function create(properties) { + return new StreamingAnalyzeContentResponse(properties); + }; + + /** + * Encodes the specified StreamingAnalyzeContentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentResponse} message StreamingAnalyzeContentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingAnalyzeContentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recognitionResult != null && Object.hasOwnProperty.call(message, "recognitionResult")) + $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.encode(message.recognitionResult, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.replyText != null && Object.hasOwnProperty.call(message, "replyText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.replyText); + if (message.replyAudio != null && Object.hasOwnProperty.call(message, "replyAudio")) + $root.google.cloud.dialogflow.v2beta1.OutputAudio.encode(message.replyAudio, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.automatedAgentReply != null && Object.hasOwnProperty.call(message, "automatedAgentReply")) + $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.encode(message.automatedAgentReply, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + $root.google.cloud.dialogflow.v2beta1.Message.encode(message.message, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.humanAgentSuggestionResults != null && message.humanAgentSuggestionResults.length) + for (var i = 0; i < message.humanAgentSuggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SuggestionResult.encode(message.humanAgentSuggestionResults[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.endUserSuggestionResults != null && message.endUserSuggestionResults.length) + for (var i = 0; i < message.endUserSuggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SuggestionResult.encode(message.endUserSuggestionResults[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.dtmfParameters != null && Object.hasOwnProperty.call(message, "dtmfParameters")) + $root.google.cloud.dialogflow.v2beta1.DtmfParameters.encode(message.dtmfParameters, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingAnalyzeContentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingAnalyzeContentResponse} message StreamingAnalyzeContentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingAnalyzeContentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingAnalyzeContentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse} StreamingAnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingAnalyzeContentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.recognitionResult = $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.decode(reader, reader.uint32()); + break; + } + case 2: { + message.replyText = reader.string(); + break; + } + case 3: { + message.replyAudio = $root.google.cloud.dialogflow.v2beta1.OutputAudio.decode(reader, reader.uint32()); + break; + } + case 4: { + message.automatedAgentReply = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.decode(reader, reader.uint32()); + break; + } + case 6: { + message.message = $root.google.cloud.dialogflow.v2beta1.Message.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.humanAgentSuggestionResults && message.humanAgentSuggestionResults.length)) + message.humanAgentSuggestionResults = []; + message.humanAgentSuggestionResults.push($root.google.cloud.dialogflow.v2beta1.SuggestionResult.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.endUserSuggestionResults && message.endUserSuggestionResults.length)) + message.endUserSuggestionResults = []; + message.endUserSuggestionResults.push($root.google.cloud.dialogflow.v2beta1.SuggestionResult.decode(reader, reader.uint32())); + break; + } + case 10: { + message.dtmfParameters = $root.google.cloud.dialogflow.v2beta1.DtmfParameters.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingAnalyzeContentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse} StreamingAnalyzeContentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingAnalyzeContentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingAnalyzeContentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingAnalyzeContentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) { + var error = $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.verify(message.recognitionResult); + if (error) + return "recognitionResult." + error; + } + if (message.replyText != null && message.hasOwnProperty("replyText")) + if (!$util.isString(message.replyText)) + return "replyText: string expected"; + if (message.replyAudio != null && message.hasOwnProperty("replyAudio")) { + var error = $root.google.cloud.dialogflow.v2beta1.OutputAudio.verify(message.replyAudio); + if (error) + return "replyAudio." + error; + } + if (message.automatedAgentReply != null && message.hasOwnProperty("automatedAgentReply")) { + var error = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.verify(message.automatedAgentReply); + if (error) + return "automatedAgentReply." + error; + } + if (message.message != null && message.hasOwnProperty("message")) { + var error = $root.google.cloud.dialogflow.v2beta1.Message.verify(message.message); + if (error) + return "message." + error; + } + if (message.humanAgentSuggestionResults != null && message.hasOwnProperty("humanAgentSuggestionResults")) { + if (!Array.isArray(message.humanAgentSuggestionResults)) + return "humanAgentSuggestionResults: array expected"; + for (var i = 0; i < message.humanAgentSuggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.verify(message.humanAgentSuggestionResults[i]); + if (error) + return "humanAgentSuggestionResults." + error; + } + } + if (message.endUserSuggestionResults != null && message.hasOwnProperty("endUserSuggestionResults")) { + if (!Array.isArray(message.endUserSuggestionResults)) + return "endUserSuggestionResults: array expected"; + for (var i = 0; i < message.endUserSuggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.verify(message.endUserSuggestionResults[i]); + if (error) + return "endUserSuggestionResults." + error; + } + } + if (message.dtmfParameters != null && message.hasOwnProperty("dtmfParameters")) { + var error = $root.google.cloud.dialogflow.v2beta1.DtmfParameters.verify(message.dtmfParameters); + if (error) + return "dtmfParameters." + error; + } + return null; + }; + + /** + * Creates a StreamingAnalyzeContentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse} StreamingAnalyzeContentResponse + */ + StreamingAnalyzeContentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse(); + if (object.recognitionResult != null) { + if (typeof object.recognitionResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.recognitionResult: object expected"); + message.recognitionResult = $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.fromObject(object.recognitionResult); + } + if (object.replyText != null) + message.replyText = String(object.replyText); + if (object.replyAudio != null) { + if (typeof object.replyAudio !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.replyAudio: object expected"); + message.replyAudio = $root.google.cloud.dialogflow.v2beta1.OutputAudio.fromObject(object.replyAudio); + } + if (object.automatedAgentReply != null) { + if (typeof object.automatedAgentReply !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.automatedAgentReply: object expected"); + message.automatedAgentReply = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.fromObject(object.automatedAgentReply); + } + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.message: object expected"); + message.message = $root.google.cloud.dialogflow.v2beta1.Message.fromObject(object.message); + } + if (object.humanAgentSuggestionResults) { + if (!Array.isArray(object.humanAgentSuggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.humanAgentSuggestionResults: array expected"); + message.humanAgentSuggestionResults = []; + for (var i = 0; i < object.humanAgentSuggestionResults.length; ++i) { + if (typeof object.humanAgentSuggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.humanAgentSuggestionResults: object expected"); + message.humanAgentSuggestionResults[i] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.fromObject(object.humanAgentSuggestionResults[i]); + } + } + if (object.endUserSuggestionResults) { + if (!Array.isArray(object.endUserSuggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.endUserSuggestionResults: array expected"); + message.endUserSuggestionResults = []; + for (var i = 0; i < object.endUserSuggestionResults.length; ++i) { + if (typeof object.endUserSuggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.endUserSuggestionResults: object expected"); + message.endUserSuggestionResults[i] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.fromObject(object.endUserSuggestionResults[i]); + } + } + if (object.dtmfParameters != null) { + if (typeof object.dtmfParameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse.dtmfParameters: object expected"); + message.dtmfParameters = $root.google.cloud.dialogflow.v2beta1.DtmfParameters.fromObject(object.dtmfParameters); + } + return message; + }; + + /** + * Creates a plain object from a StreamingAnalyzeContentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse} message StreamingAnalyzeContentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingAnalyzeContentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.humanAgentSuggestionResults = []; + object.endUserSuggestionResults = []; + } + if (options.defaults) { + object.recognitionResult = null; + object.replyText = ""; + object.replyAudio = null; + object.automatedAgentReply = null; + object.message = null; + object.dtmfParameters = null; + } + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) + object.recognitionResult = $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.toObject(message.recognitionResult, options); + if (message.replyText != null && message.hasOwnProperty("replyText")) + object.replyText = message.replyText; + if (message.replyAudio != null && message.hasOwnProperty("replyAudio")) + object.replyAudio = $root.google.cloud.dialogflow.v2beta1.OutputAudio.toObject(message.replyAudio, options); + if (message.automatedAgentReply != null && message.hasOwnProperty("automatedAgentReply")) + object.automatedAgentReply = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentReply.toObject(message.automatedAgentReply, options); + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.google.cloud.dialogflow.v2beta1.Message.toObject(message.message, options); + if (message.humanAgentSuggestionResults && message.humanAgentSuggestionResults.length) { + object.humanAgentSuggestionResults = []; + for (var j = 0; j < message.humanAgentSuggestionResults.length; ++j) + object.humanAgentSuggestionResults[j] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.toObject(message.humanAgentSuggestionResults[j], options); + } + if (message.endUserSuggestionResults && message.endUserSuggestionResults.length) { + object.endUserSuggestionResults = []; + for (var j = 0; j < message.endUserSuggestionResults.length; ++j) + object.endUserSuggestionResults[j] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.toObject(message.endUserSuggestionResults[j], options); + } + if (message.dtmfParameters != null && message.hasOwnProperty("dtmfParameters")) + object.dtmfParameters = $root.google.cloud.dialogflow.v2beta1.DtmfParameters.toObject(message.dtmfParameters, options); + return object; + }; + + /** + * Converts this StreamingAnalyzeContentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @instance + * @returns {Object.} JSON object + */ + StreamingAnalyzeContentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingAnalyzeContentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingAnalyzeContentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse"; + }; + + return StreamingAnalyzeContentResponse; + })(); + + v2beta1.AnnotatedMessagePart = (function() { + + /** + * Properties of an AnnotatedMessagePart. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAnnotatedMessagePart + * @property {string|null} [text] AnnotatedMessagePart text + * @property {string|null} [entityType] AnnotatedMessagePart entityType + * @property {google.protobuf.IValue|null} [formattedValue] AnnotatedMessagePart formattedValue + */ + + /** + * Constructs a new AnnotatedMessagePart. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AnnotatedMessagePart. + * @implements IAnnotatedMessagePart + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart=} [properties] Properties to set + */ + function AnnotatedMessagePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AnnotatedMessagePart text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @instance + */ + AnnotatedMessagePart.prototype.text = ""; + + /** + * AnnotatedMessagePart entityType. + * @member {string} entityType + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @instance + */ + AnnotatedMessagePart.prototype.entityType = ""; + + /** + * AnnotatedMessagePart formattedValue. + * @member {google.protobuf.IValue|null|undefined} formattedValue + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @instance + */ + AnnotatedMessagePart.prototype.formattedValue = null; + + /** + * Creates a new AnnotatedMessagePart instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AnnotatedMessagePart} AnnotatedMessagePart instance + */ + AnnotatedMessagePart.create = function create(properties) { + return new AnnotatedMessagePart(properties); + }; + + /** + * Encodes the specified AnnotatedMessagePart message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart} message AnnotatedMessagePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotatedMessagePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityType); + if (message.formattedValue != null && Object.hasOwnProperty.call(message, "formattedValue")) + $root.google.protobuf.Value.encode(message.formattedValue, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AnnotatedMessagePart message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @static + * @param {google.cloud.dialogflow.v2beta1.IAnnotatedMessagePart} message AnnotatedMessagePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AnnotatedMessagePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AnnotatedMessagePart message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AnnotatedMessagePart} AnnotatedMessagePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotatedMessagePart.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AnnotatedMessagePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.entityType = reader.string(); + break; + } + case 3: { + message.formattedValue = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AnnotatedMessagePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AnnotatedMessagePart} AnnotatedMessagePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AnnotatedMessagePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AnnotatedMessagePart message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AnnotatedMessagePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) + if (!$util.isString(message.entityType)) + return "entityType: string expected"; + if (message.formattedValue != null && message.hasOwnProperty("formattedValue")) { + var error = $root.google.protobuf.Value.verify(message.formattedValue); + if (error) + return "formattedValue." + error; + } + return null; + }; + + /** + * Creates an AnnotatedMessagePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AnnotatedMessagePart} AnnotatedMessagePart + */ + AnnotatedMessagePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AnnotatedMessagePart) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AnnotatedMessagePart(); + if (object.text != null) + message.text = String(object.text); + if (object.entityType != null) + message.entityType = String(object.entityType); + if (object.formattedValue != null) { + if (typeof object.formattedValue !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.formattedValue: object expected"); + message.formattedValue = $root.google.protobuf.Value.fromObject(object.formattedValue); + } + return message; + }; + + /** + * Creates a plain object from an AnnotatedMessagePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @static + * @param {google.cloud.dialogflow.v2beta1.AnnotatedMessagePart} message AnnotatedMessagePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AnnotatedMessagePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.entityType = ""; + object.formattedValue = null; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = message.entityType; + if (message.formattedValue != null && message.hasOwnProperty("formattedValue")) + object.formattedValue = $root.google.protobuf.Value.toObject(message.formattedValue, options); + return object; + }; + + /** + * Converts this AnnotatedMessagePart to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @instance + * @returns {Object.} JSON object + */ + AnnotatedMessagePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AnnotatedMessagePart + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AnnotatedMessagePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AnnotatedMessagePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AnnotatedMessagePart"; + }; + + return AnnotatedMessagePart; + })(); + + v2beta1.MessageAnnotation = (function() { + + /** + * Properties of a MessageAnnotation. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IMessageAnnotation + * @property {Array.|null} [parts] MessageAnnotation parts + * @property {boolean|null} [containEntities] MessageAnnotation containEntities + */ + + /** + * Constructs a new MessageAnnotation. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a MessageAnnotation. + * @implements IMessageAnnotation + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IMessageAnnotation=} [properties] Properties to set + */ + function MessageAnnotation(properties) { + this.parts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageAnnotation parts. + * @member {Array.} parts + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @instance + */ + MessageAnnotation.prototype.parts = $util.emptyArray; + + /** + * MessageAnnotation containEntities. + * @member {boolean} containEntities + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @instance + */ + MessageAnnotation.prototype.containEntities = false; + + /** + * Creates a new MessageAnnotation instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @static + * @param {google.cloud.dialogflow.v2beta1.IMessageAnnotation=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.MessageAnnotation} MessageAnnotation instance + */ + MessageAnnotation.create = function create(properties) { + return new MessageAnnotation(properties); + }; + + /** + * Encodes the specified MessageAnnotation message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.MessageAnnotation.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @static + * @param {google.cloud.dialogflow.v2beta1.IMessageAnnotation} message MessageAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageAnnotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parts != null && message.parts.length) + for (var i = 0; i < message.parts.length; ++i) + $root.google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.encode(message.parts[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.containEntities != null && Object.hasOwnProperty.call(message, "containEntities")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.containEntities); + return writer; + }; + + /** + * Encodes the specified MessageAnnotation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.MessageAnnotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @static + * @param {google.cloud.dialogflow.v2beta1.IMessageAnnotation} message MessageAnnotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageAnnotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageAnnotation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.MessageAnnotation} MessageAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageAnnotation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.MessageAnnotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.parts && message.parts.length)) + message.parts = []; + message.parts.push($root.google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.decode(reader, reader.uint32())); + break; + } + case 2: { + message.containEntities = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageAnnotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.MessageAnnotation} MessageAnnotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageAnnotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageAnnotation message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageAnnotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parts != null && message.hasOwnProperty("parts")) { + if (!Array.isArray(message.parts)) + return "parts: array expected"; + for (var i = 0; i < message.parts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.verify(message.parts[i]); + if (error) + return "parts." + error; + } + } + if (message.containEntities != null && message.hasOwnProperty("containEntities")) + if (typeof message.containEntities !== "boolean") + return "containEntities: boolean expected"; + return null; + }; + + /** + * Creates a MessageAnnotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.MessageAnnotation} MessageAnnotation + */ + MessageAnnotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.MessageAnnotation) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.MessageAnnotation(); + if (object.parts) { + if (!Array.isArray(object.parts)) + throw TypeError(".google.cloud.dialogflow.v2beta1.MessageAnnotation.parts: array expected"); + message.parts = []; + for (var i = 0; i < object.parts.length; ++i) { + if (typeof object.parts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.MessageAnnotation.parts: object expected"); + message.parts[i] = $root.google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.fromObject(object.parts[i]); + } + } + if (object.containEntities != null) + message.containEntities = Boolean(object.containEntities); + return message; + }; + + /** + * Creates a plain object from a MessageAnnotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @static + * @param {google.cloud.dialogflow.v2beta1.MessageAnnotation} message MessageAnnotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageAnnotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parts = []; + if (options.defaults) + object.containEntities = false; + if (message.parts && message.parts.length) { + object.parts = []; + for (var j = 0; j < message.parts.length; ++j) + object.parts[j] = $root.google.cloud.dialogflow.v2beta1.AnnotatedMessagePart.toObject(message.parts[j], options); + } + if (message.containEntities != null && message.hasOwnProperty("containEntities")) + object.containEntities = message.containEntities; + return object; + }; + + /** + * Converts this MessageAnnotation to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @instance + * @returns {Object.} JSON object + */ + MessageAnnotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageAnnotation + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.MessageAnnotation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.MessageAnnotation"; + }; + + return MessageAnnotation; + })(); + + v2beta1.ArticleAnswer = (function() { + + /** + * Properties of an ArticleAnswer. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IArticleAnswer + * @property {string|null} [title] ArticleAnswer title + * @property {string|null} [uri] ArticleAnswer uri + * @property {Array.|null} [snippets] ArticleAnswer snippets + * @property {Object.|null} [metadata] ArticleAnswer metadata + * @property {string|null} [answerRecord] ArticleAnswer answerRecord + */ + + /** + * Constructs a new ArticleAnswer. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an ArticleAnswer. + * @implements IArticleAnswer + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IArticleAnswer=} [properties] Properties to set + */ + function ArticleAnswer(properties) { + this.snippets = []; + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ArticleAnswer title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.title = ""; + + /** + * ArticleAnswer uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.uri = ""; + + /** + * ArticleAnswer snippets. + * @member {Array.} snippets + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.snippets = $util.emptyArray; + + /** + * ArticleAnswer metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.metadata = $util.emptyObject; + + /** + * ArticleAnswer answerRecord. + * @member {string} answerRecord + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @instance + */ + ArticleAnswer.prototype.answerRecord = ""; + + /** + * Creates a new ArticleAnswer instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.IArticleAnswer=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ArticleAnswer} ArticleAnswer instance + */ + ArticleAnswer.create = function create(properties) { + return new ArticleAnswer(properties); + }; + + /** + * Encodes the specified ArticleAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ArticleAnswer.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.IArticleAnswer} message ArticleAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArticleAnswer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); + if (message.snippets != null && message.snippets.length) + for (var i = 0; i < message.snippets.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.snippets[i]); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.answerRecord); + return writer; + }; + + /** + * Encodes the specified ArticleAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ArticleAnswer.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.IArticleAnswer} message ArticleAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ArticleAnswer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ArticleAnswer message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ArticleAnswer} ArticleAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArticleAnswer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ArticleAnswer(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.uri = reader.string(); + break; + } + case 3: { + if (!(message.snippets && message.snippets.length)) + message.snippets = []; + message.snippets.push(reader.string()); + break; + } + case 5: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 6: { + message.answerRecord = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ArticleAnswer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ArticleAnswer} ArticleAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ArticleAnswer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ArticleAnswer message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ArticleAnswer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.snippets != null && message.hasOwnProperty("snippets")) { + if (!Array.isArray(message.snippets)) + return "snippets: array expected"; + for (var i = 0; i < message.snippets.length; ++i) + if (!$util.isString(message.snippets[i])) + return "snippets: string[] expected"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + if (!$util.isString(message.answerRecord)) + return "answerRecord: string expected"; + return null; + }; + + /** + * Creates an ArticleAnswer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ArticleAnswer} ArticleAnswer + */ + ArticleAnswer.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ArticleAnswer) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ArticleAnswer(); + if (object.title != null) + message.title = String(object.title); + if (object.uri != null) + message.uri = String(object.uri); + if (object.snippets) { + if (!Array.isArray(object.snippets)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ArticleAnswer.snippets: array expected"); + message.snippets = []; + for (var i = 0; i < object.snippets.length; ++i) + message.snippets[i] = String(object.snippets[i]); + } + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ArticleAnswer.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + if (object.answerRecord != null) + message.answerRecord = String(object.answerRecord); + return message; + }; + + /** + * Creates a plain object from an ArticleAnswer message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.ArticleAnswer} message ArticleAnswer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ArticleAnswer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.snippets = []; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) { + object.title = ""; + object.uri = ""; + object.answerRecord = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.snippets && message.snippets.length) { + object.snippets = []; + for (var j = 0; j < message.snippets.length; ++j) + object.snippets[j] = message.snippets[j]; + } + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = message.answerRecord; + return object; + }; + + /** + * Converts this ArticleAnswer to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @instance + * @returns {Object.} JSON object + */ + ArticleAnswer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ArticleAnswer + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ArticleAnswer + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ArticleAnswer.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ArticleAnswer"; + }; + + return ArticleAnswer; + })(); + + v2beta1.FaqAnswer = (function() { + + /** + * Properties of a FaqAnswer. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IFaqAnswer + * @property {string|null} [answer] FaqAnswer answer + * @property {number|null} [confidence] FaqAnswer confidence + * @property {string|null} [question] FaqAnswer question + * @property {string|null} [source] FaqAnswer source + * @property {Object.|null} [metadata] FaqAnswer metadata + * @property {string|null} [answerRecord] FaqAnswer answerRecord + */ + + /** + * Constructs a new FaqAnswer. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a FaqAnswer. + * @implements IFaqAnswer + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IFaqAnswer=} [properties] Properties to set + */ + function FaqAnswer(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FaqAnswer answer. + * @member {string} answer + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @instance + */ + FaqAnswer.prototype.answer = ""; + + /** + * FaqAnswer confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @instance + */ + FaqAnswer.prototype.confidence = 0; + + /** + * FaqAnswer question. + * @member {string} question + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @instance + */ + FaqAnswer.prototype.question = ""; + + /** + * FaqAnswer source. + * @member {string} source + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @instance + */ + FaqAnswer.prototype.source = ""; + + /** + * FaqAnswer metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @instance + */ + FaqAnswer.prototype.metadata = $util.emptyObject; + + /** + * FaqAnswer answerRecord. + * @member {string} answerRecord + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @instance + */ + FaqAnswer.prototype.answerRecord = ""; + + /** + * Creates a new FaqAnswer instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.IFaqAnswer=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.FaqAnswer} FaqAnswer instance + */ + FaqAnswer.create = function create(properties) { + return new FaqAnswer(properties); + }; + + /** + * Encodes the specified FaqAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.FaqAnswer.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.IFaqAnswer} message FaqAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaqAnswer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answer != null && Object.hasOwnProperty.call(message, "answer")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.answer); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.question != null && Object.hasOwnProperty.call(message, "question")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.question); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.source); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.answerRecord); + return writer; + }; + + /** + * Encodes the specified FaqAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.FaqAnswer.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.IFaqAnswer} message FaqAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaqAnswer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.FaqAnswer} FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaqAnswer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.FaqAnswer(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.answer = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + case 3: { + message.question = reader.string(); + break; + } + case 4: { + message.source = reader.string(); + break; + } + case 5: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 6: { + message.answerRecord = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.FaqAnswer} FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaqAnswer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FaqAnswer message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FaqAnswer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answer != null && message.hasOwnProperty("answer")) + if (!$util.isString(message.answer)) + return "answer: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.question != null && message.hasOwnProperty("question")) + if (!$util.isString(message.question)) + return "question: string expected"; + if (message.source != null && message.hasOwnProperty("source")) + if (!$util.isString(message.source)) + return "source: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + if (!$util.isString(message.answerRecord)) + return "answerRecord: string expected"; + return null; + }; + + /** + * Creates a FaqAnswer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.FaqAnswer} FaqAnswer + */ + FaqAnswer.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.FaqAnswer) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.FaqAnswer(); + if (object.answer != null) + message.answer = String(object.answer); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.question != null) + message.question = String(object.question); + if (object.source != null) + message.source = String(object.source); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.FaqAnswer.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + if (object.answerRecord != null) + message.answerRecord = String(object.answerRecord); + return message; + }; + + /** + * Creates a plain object from a FaqAnswer message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.FaqAnswer} message FaqAnswer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FaqAnswer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) { + object.answer = ""; + object.confidence = 0; + object.question = ""; + object.source = ""; + object.answerRecord = ""; + } + if (message.answer != null && message.hasOwnProperty("answer")) + object.answer = message.answer; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.question != null && message.hasOwnProperty("question")) + object.question = message.question; + if (message.source != null && message.hasOwnProperty("source")) + object.source = message.source; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = message.answerRecord; + return object; + }; + + /** + * Converts this FaqAnswer to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @instance + * @returns {Object.} JSON object + */ + FaqAnswer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FaqAnswer + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.FaqAnswer + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FaqAnswer.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.FaqAnswer"; + }; + + return FaqAnswer; + })(); + + v2beta1.SmartReplyAnswer = (function() { + + /** + * Properties of a SmartReplyAnswer. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISmartReplyAnswer + * @property {string|null} [reply] SmartReplyAnswer reply + * @property {number|null} [confidence] SmartReplyAnswer confidence + * @property {string|null} [answerRecord] SmartReplyAnswer answerRecord + */ + + /** + * Constructs a new SmartReplyAnswer. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SmartReplyAnswer. + * @implements ISmartReplyAnswer + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISmartReplyAnswer=} [properties] Properties to set + */ + function SmartReplyAnswer(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SmartReplyAnswer reply. + * @member {string} reply + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @instance + */ + SmartReplyAnswer.prototype.reply = ""; + + /** + * SmartReplyAnswer confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @instance + */ + SmartReplyAnswer.prototype.confidence = 0; + + /** + * SmartReplyAnswer answerRecord. + * @member {string} answerRecord + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @instance + */ + SmartReplyAnswer.prototype.answerRecord = ""; + + /** + * Creates a new SmartReplyAnswer instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.ISmartReplyAnswer=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SmartReplyAnswer} SmartReplyAnswer instance + */ + SmartReplyAnswer.create = function create(properties) { + return new SmartReplyAnswer(properties); + }; + + /** + * Encodes the specified SmartReplyAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SmartReplyAnswer.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.ISmartReplyAnswer} message SmartReplyAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyAnswer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.reply != null && Object.hasOwnProperty.call(message, "reply")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.reply); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.answerRecord); + return writer; + }; + + /** + * Encodes the specified SmartReplyAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SmartReplyAnswer.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.ISmartReplyAnswer} message SmartReplyAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SmartReplyAnswer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SmartReplyAnswer message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SmartReplyAnswer} SmartReplyAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyAnswer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SmartReplyAnswer(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.reply = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + case 3: { + message.answerRecord = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SmartReplyAnswer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SmartReplyAnswer} SmartReplyAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SmartReplyAnswer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SmartReplyAnswer message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SmartReplyAnswer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.reply != null && message.hasOwnProperty("reply")) + if (!$util.isString(message.reply)) + return "reply: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + if (!$util.isString(message.answerRecord)) + return "answerRecord: string expected"; + return null; + }; + + /** + * Creates a SmartReplyAnswer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SmartReplyAnswer} SmartReplyAnswer + */ + SmartReplyAnswer.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SmartReplyAnswer) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SmartReplyAnswer(); + if (object.reply != null) + message.reply = String(object.reply); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.answerRecord != null) + message.answerRecord = String(object.answerRecord); + return message; + }; + + /** + * Creates a plain object from a SmartReplyAnswer message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.SmartReplyAnswer} message SmartReplyAnswer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SmartReplyAnswer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.reply = ""; + object.confidence = 0; + object.answerRecord = ""; + } + if (message.reply != null && message.hasOwnProperty("reply")) + object.reply = message.reply; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = message.answerRecord; + return object; + }; + + /** + * Converts this SmartReplyAnswer to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @instance + * @returns {Object.} JSON object + */ + SmartReplyAnswer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SmartReplyAnswer + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SmartReplyAnswer + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SmartReplyAnswer.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SmartReplyAnswer"; + }; + + return SmartReplyAnswer; + })(); + + v2beta1.SuggestionResult = (function() { + + /** + * Properties of a SuggestionResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestionResult + * @property {google.rpc.IStatus|null} [error] SuggestionResult error + * @property {google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse|null} [suggestArticlesResponse] SuggestionResult suggestArticlesResponse + * @property {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse|null} [suggestFaqAnswersResponse] SuggestionResult suggestFaqAnswersResponse + * @property {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse|null} [suggestSmartRepliesResponse] SuggestionResult suggestSmartRepliesResponse + */ + + /** + * Constructs a new SuggestionResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestionResult. + * @implements ISuggestionResult + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestionResult=} [properties] Properties to set + */ + function SuggestionResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionResult error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @instance + */ + SuggestionResult.prototype.error = null; + + /** + * SuggestionResult suggestArticlesResponse. + * @member {google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse|null|undefined} suggestArticlesResponse + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @instance + */ + SuggestionResult.prototype.suggestArticlesResponse = null; + + /** + * SuggestionResult suggestFaqAnswersResponse. + * @member {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse|null|undefined} suggestFaqAnswersResponse + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @instance + */ + SuggestionResult.prototype.suggestFaqAnswersResponse = null; + + /** + * SuggestionResult suggestSmartRepliesResponse. + * @member {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse|null|undefined} suggestSmartRepliesResponse + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @instance + */ + SuggestionResult.prototype.suggestSmartRepliesResponse = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SuggestionResult suggestionResponse. + * @member {"error"|"suggestArticlesResponse"|"suggestFaqAnswersResponse"|"suggestSmartRepliesResponse"|undefined} suggestionResponse + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @instance + */ + Object.defineProperty(SuggestionResult.prototype, "suggestionResponse", { + get: $util.oneOfGetter($oneOfFields = ["error", "suggestArticlesResponse", "suggestFaqAnswersResponse", "suggestSmartRepliesResponse"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SuggestionResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestionResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestionResult} SuggestionResult instance + */ + SuggestionResult.create = function create(properties) { + return new SuggestionResult(properties); + }; + + /** + * Encodes the specified SuggestionResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestionResult} message SuggestionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.suggestArticlesResponse != null && Object.hasOwnProperty.call(message, "suggestArticlesResponse")) + $root.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.encode(message.suggestArticlesResponse, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.suggestFaqAnswersResponse != null && Object.hasOwnProperty.call(message, "suggestFaqAnswersResponse")) + $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.encode(message.suggestFaqAnswersResponse, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.suggestSmartRepliesResponse != null && Object.hasOwnProperty.call(message, "suggestSmartRepliesResponse")) + $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.encode(message.suggestSmartRepliesResponse, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestionResult} message SuggestionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestionResult} SuggestionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestionResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 2: { + message.suggestArticlesResponse = $root.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.decode(reader, reader.uint32()); + break; + } + case 3: { + message.suggestFaqAnswersResponse = $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.decode(reader, reader.uint32()); + break; + } + case 4: { + message.suggestSmartRepliesResponse = $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestionResult} SuggestionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.error != null && message.hasOwnProperty("error")) { + properties.suggestionResponse = 1; + { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.suggestArticlesResponse != null && message.hasOwnProperty("suggestArticlesResponse")) { + if (properties.suggestionResponse === 1) + return "suggestionResponse: multiple values"; + properties.suggestionResponse = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.verify(message.suggestArticlesResponse); + if (error) + return "suggestArticlesResponse." + error; + } + } + if (message.suggestFaqAnswersResponse != null && message.hasOwnProperty("suggestFaqAnswersResponse")) { + if (properties.suggestionResponse === 1) + return "suggestionResponse: multiple values"; + properties.suggestionResponse = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.verify(message.suggestFaqAnswersResponse); + if (error) + return "suggestFaqAnswersResponse." + error; + } + } + if (message.suggestSmartRepliesResponse != null && message.hasOwnProperty("suggestSmartRepliesResponse")) { + if (properties.suggestionResponse === 1) + return "suggestionResponse: multiple values"; + properties.suggestionResponse = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.verify(message.suggestSmartRepliesResponse); + if (error) + return "suggestSmartRepliesResponse." + error; + } + } + return null; + }; + + /** + * Creates a SuggestionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestionResult} SuggestionResult + */ + SuggestionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestionResult) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestionResult(); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestionResult.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.suggestArticlesResponse != null) { + if (typeof object.suggestArticlesResponse !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestionResult.suggestArticlesResponse: object expected"); + message.suggestArticlesResponse = $root.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.fromObject(object.suggestArticlesResponse); + } + if (object.suggestFaqAnswersResponse != null) { + if (typeof object.suggestFaqAnswersResponse !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestionResult.suggestFaqAnswersResponse: object expected"); + message.suggestFaqAnswersResponse = $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.fromObject(object.suggestFaqAnswersResponse); + } + if (object.suggestSmartRepliesResponse != null) { + if (typeof object.suggestSmartRepliesResponse !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestionResult.suggestSmartRepliesResponse: object expected"); + message.suggestSmartRepliesResponse = $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.fromObject(object.suggestSmartRepliesResponse); + } + return message; + }; + + /** + * Creates a plain object from a SuggestionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestionResult} message SuggestionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (options.oneofs) + object.suggestionResponse = "error"; + } + if (message.suggestArticlesResponse != null && message.hasOwnProperty("suggestArticlesResponse")) { + object.suggestArticlesResponse = $root.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.toObject(message.suggestArticlesResponse, options); + if (options.oneofs) + object.suggestionResponse = "suggestArticlesResponse"; + } + if (message.suggestFaqAnswersResponse != null && message.hasOwnProperty("suggestFaqAnswersResponse")) { + object.suggestFaqAnswersResponse = $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.toObject(message.suggestFaqAnswersResponse, options); + if (options.oneofs) + object.suggestionResponse = "suggestFaqAnswersResponse"; + } + if (message.suggestSmartRepliesResponse != null && message.hasOwnProperty("suggestSmartRepliesResponse")) { + object.suggestSmartRepliesResponse = $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.toObject(message.suggestSmartRepliesResponse, options); + if (options.oneofs) + object.suggestionResponse = "suggestSmartRepliesResponse"; + } + return object; + }; + + /** + * Converts this SuggestionResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @instance + * @returns {Object.} JSON object + */ + SuggestionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestionResult"; + }; + + return SuggestionResult; + })(); + + v2beta1.SuggestArticlesRequest = (function() { + + /** + * Properties of a SuggestArticlesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestArticlesRequest + * @property {string|null} [parent] SuggestArticlesRequest parent + * @property {string|null} [latestMessage] SuggestArticlesRequest latestMessage + * @property {number|null} [contextSize] SuggestArticlesRequest contextSize + * @property {google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null} [assistQueryParams] SuggestArticlesRequest assistQueryParams + */ + + /** + * Constructs a new SuggestArticlesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestArticlesRequest. + * @implements ISuggestArticlesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest=} [properties] Properties to set + */ + function SuggestArticlesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestArticlesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @instance + */ + SuggestArticlesRequest.prototype.parent = ""; + + /** + * SuggestArticlesRequest latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @instance + */ + SuggestArticlesRequest.prototype.latestMessage = ""; + + /** + * SuggestArticlesRequest contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @instance + */ + SuggestArticlesRequest.prototype.contextSize = 0; + + /** + * SuggestArticlesRequest assistQueryParams. + * @member {google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null|undefined} assistQueryParams + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @instance + */ + SuggestArticlesRequest.prototype.assistQueryParams = null; + + /** + * Creates a new SuggestArticlesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestArticlesRequest} SuggestArticlesRequest instance + */ + SuggestArticlesRequest.create = function create(properties) { + return new SuggestArticlesRequest(properties); + }; + + /** + * Encodes the specified SuggestArticlesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest} message SuggestArticlesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestArticlesRequest.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.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + if (message.assistQueryParams != null && Object.hasOwnProperty.call(message, "assistQueryParams")) + $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.encode(message.assistQueryParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestArticlesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest} message SuggestArticlesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestArticlesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestArticlesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestArticlesRequest} SuggestArticlesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestArticlesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + case 4: { + message.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestArticlesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestArticlesRequest} SuggestArticlesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestArticlesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestArticlesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestArticlesRequest.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.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) { + var error = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.verify(message.assistQueryParams); + if (error) + return "assistQueryParams." + error; + } + return null; + }; + + /** + * Creates a SuggestArticlesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestArticlesRequest} SuggestArticlesRequest + */ + SuggestArticlesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + if (object.assistQueryParams != null) { + if (typeof object.assistQueryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.assistQueryParams: object expected"); + message.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.fromObject(object.assistQueryParams); + } + return message; + }; + + /** + * Creates a plain object from a SuggestArticlesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestArticlesRequest} message SuggestArticlesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestArticlesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.latestMessage = ""; + object.contextSize = 0; + object.assistQueryParams = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) + object.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.toObject(message.assistQueryParams, options); + return object; + }; + + /** + * Converts this SuggestArticlesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @instance + * @returns {Object.} JSON object + */ + SuggestArticlesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestArticlesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestArticlesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestArticlesRequest"; + }; + + return SuggestArticlesRequest; + })(); + + v2beta1.SuggestArticlesResponse = (function() { + + /** + * Properties of a SuggestArticlesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestArticlesResponse + * @property {Array.|null} [articleAnswers] SuggestArticlesResponse articleAnswers + * @property {string|null} [latestMessage] SuggestArticlesResponse latestMessage + * @property {number|null} [contextSize] SuggestArticlesResponse contextSize + */ + + /** + * Constructs a new SuggestArticlesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestArticlesResponse. + * @implements ISuggestArticlesResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse=} [properties] Properties to set + */ + function SuggestArticlesResponse(properties) { + this.articleAnswers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestArticlesResponse articleAnswers. + * @member {Array.} articleAnswers + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @instance + */ + SuggestArticlesResponse.prototype.articleAnswers = $util.emptyArray; + + /** + * SuggestArticlesResponse latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @instance + */ + SuggestArticlesResponse.prototype.latestMessage = ""; + + /** + * SuggestArticlesResponse contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @instance + */ + SuggestArticlesResponse.prototype.contextSize = 0; + + /** + * Creates a new SuggestArticlesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestArticlesResponse} SuggestArticlesResponse instance + */ + SuggestArticlesResponse.create = function create(properties) { + return new SuggestArticlesResponse(properties); + }; + + /** + * Encodes the specified SuggestArticlesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse} message SuggestArticlesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestArticlesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.articleAnswers != null && message.articleAnswers.length) + for (var i = 0; i < message.articleAnswers.length; ++i) + $root.google.cloud.dialogflow.v2beta1.ArticleAnswer.encode(message.articleAnswers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified SuggestArticlesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse} message SuggestArticlesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestArticlesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestArticlesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestArticlesResponse} SuggestArticlesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestArticlesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.articleAnswers && message.articleAnswers.length)) + message.articleAnswers = []; + message.articleAnswers.push($root.google.cloud.dialogflow.v2beta1.ArticleAnswer.decode(reader, reader.uint32())); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestArticlesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestArticlesResponse} SuggestArticlesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestArticlesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestArticlesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestArticlesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.articleAnswers != null && message.hasOwnProperty("articleAnswers")) { + if (!Array.isArray(message.articleAnswers)) + return "articleAnswers: array expected"; + for (var i = 0; i < message.articleAnswers.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.ArticleAnswer.verify(message.articleAnswers[i]); + if (error) + return "articleAnswers." + error; + } + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestArticlesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestArticlesResponse} SuggestArticlesResponse + */ + SuggestArticlesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse(); + if (object.articleAnswers) { + if (!Array.isArray(object.articleAnswers)) + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.articleAnswers: array expected"); + message.articleAnswers = []; + for (var i = 0; i < object.articleAnswers.length; ++i) { + if (typeof object.articleAnswers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestArticlesResponse.articleAnswers: object expected"); + message.articleAnswers[i] = $root.google.cloud.dialogflow.v2beta1.ArticleAnswer.fromObject(object.articleAnswers[i]); + } + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestArticlesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestArticlesResponse} message SuggestArticlesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestArticlesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.articleAnswers = []; + if (options.defaults) { + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.articleAnswers && message.articleAnswers.length) { + object.articleAnswers = []; + for (var j = 0; j < message.articleAnswers.length; ++j) + object.articleAnswers[j] = $root.google.cloud.dialogflow.v2beta1.ArticleAnswer.toObject(message.articleAnswers[j], options); + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this SuggestArticlesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @instance + * @returns {Object.} JSON object + */ + SuggestArticlesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestArticlesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestArticlesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestArticlesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestArticlesResponse"; + }; + + return SuggestArticlesResponse; + })(); + + v2beta1.SuggestFaqAnswersRequest = (function() { + + /** + * Properties of a SuggestFaqAnswersRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestFaqAnswersRequest + * @property {string|null} [parent] SuggestFaqAnswersRequest parent + * @property {string|null} [latestMessage] SuggestFaqAnswersRequest latestMessage + * @property {number|null} [contextSize] SuggestFaqAnswersRequest contextSize + * @property {google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null} [assistQueryParams] SuggestFaqAnswersRequest assistQueryParams + */ + + /** + * Constructs a new SuggestFaqAnswersRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestFaqAnswersRequest. + * @implements ISuggestFaqAnswersRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest=} [properties] Properties to set + */ + function SuggestFaqAnswersRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestFaqAnswersRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @instance + */ + SuggestFaqAnswersRequest.prototype.parent = ""; + + /** + * SuggestFaqAnswersRequest latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @instance + */ + SuggestFaqAnswersRequest.prototype.latestMessage = ""; + + /** + * SuggestFaqAnswersRequest contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @instance + */ + SuggestFaqAnswersRequest.prototype.contextSize = 0; + + /** + * SuggestFaqAnswersRequest assistQueryParams. + * @member {google.cloud.dialogflow.v2beta1.IAssistQueryParameters|null|undefined} assistQueryParams + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @instance + */ + SuggestFaqAnswersRequest.prototype.assistQueryParams = null; + + /** + * Creates a new SuggestFaqAnswersRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest} SuggestFaqAnswersRequest instance + */ + SuggestFaqAnswersRequest.create = function create(properties) { + return new SuggestFaqAnswersRequest(properties); + }; + + /** + * Encodes the specified SuggestFaqAnswersRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest} message SuggestFaqAnswersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestFaqAnswersRequest.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.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + if (message.assistQueryParams != null && Object.hasOwnProperty.call(message, "assistQueryParams")) + $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.encode(message.assistQueryParams, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestFaqAnswersRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest} message SuggestFaqAnswersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestFaqAnswersRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestFaqAnswersRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest} SuggestFaqAnswersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestFaqAnswersRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + case 4: { + message.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestFaqAnswersRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest} SuggestFaqAnswersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestFaqAnswersRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestFaqAnswersRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestFaqAnswersRequest.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.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) { + var error = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.verify(message.assistQueryParams); + if (error) + return "assistQueryParams." + error; + } + return null; + }; + + /** + * Creates a SuggestFaqAnswersRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest} SuggestFaqAnswersRequest + */ + SuggestFaqAnswersRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + if (object.assistQueryParams != null) { + if (typeof object.assistQueryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest.assistQueryParams: object expected"); + message.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.fromObject(object.assistQueryParams); + } + return message; + }; + + /** + * Creates a plain object from a SuggestFaqAnswersRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest} message SuggestFaqAnswersRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestFaqAnswersRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.latestMessage = ""; + object.contextSize = 0; + object.assistQueryParams = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + if (message.assistQueryParams != null && message.hasOwnProperty("assistQueryParams")) + object.assistQueryParams = $root.google.cloud.dialogflow.v2beta1.AssistQueryParameters.toObject(message.assistQueryParams, options); + return object; + }; + + /** + * Converts this SuggestFaqAnswersRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @instance + * @returns {Object.} JSON object + */ + SuggestFaqAnswersRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestFaqAnswersRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestFaqAnswersRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest"; + }; + + return SuggestFaqAnswersRequest; + })(); + + v2beta1.SuggestFaqAnswersResponse = (function() { + + /** + * Properties of a SuggestFaqAnswersResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestFaqAnswersResponse + * @property {Array.|null} [faqAnswers] SuggestFaqAnswersResponse faqAnswers + * @property {string|null} [latestMessage] SuggestFaqAnswersResponse latestMessage + * @property {number|null} [contextSize] SuggestFaqAnswersResponse contextSize + */ + + /** + * Constructs a new SuggestFaqAnswersResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestFaqAnswersResponse. + * @implements ISuggestFaqAnswersResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse=} [properties] Properties to set + */ + function SuggestFaqAnswersResponse(properties) { + this.faqAnswers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestFaqAnswersResponse faqAnswers. + * @member {Array.} faqAnswers + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @instance + */ + SuggestFaqAnswersResponse.prototype.faqAnswers = $util.emptyArray; + + /** + * SuggestFaqAnswersResponse latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @instance + */ + SuggestFaqAnswersResponse.prototype.latestMessage = ""; + + /** + * SuggestFaqAnswersResponse contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @instance + */ + SuggestFaqAnswersResponse.prototype.contextSize = 0; + + /** + * Creates a new SuggestFaqAnswersResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse} SuggestFaqAnswersResponse instance + */ + SuggestFaqAnswersResponse.create = function create(properties) { + return new SuggestFaqAnswersResponse(properties); + }; + + /** + * Encodes the specified SuggestFaqAnswersResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse} message SuggestFaqAnswersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestFaqAnswersResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.faqAnswers != null && message.faqAnswers.length) + for (var i = 0; i < message.faqAnswers.length; ++i) + $root.google.cloud.dialogflow.v2beta1.FaqAnswer.encode(message.faqAnswers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified SuggestFaqAnswersResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse} message SuggestFaqAnswersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestFaqAnswersResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestFaqAnswersResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse} SuggestFaqAnswersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestFaqAnswersResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.faqAnswers && message.faqAnswers.length)) + message.faqAnswers = []; + message.faqAnswers.push($root.google.cloud.dialogflow.v2beta1.FaqAnswer.decode(reader, reader.uint32())); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestFaqAnswersResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse} SuggestFaqAnswersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestFaqAnswersResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestFaqAnswersResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestFaqAnswersResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.faqAnswers != null && message.hasOwnProperty("faqAnswers")) { + if (!Array.isArray(message.faqAnswers)) + return "faqAnswers: array expected"; + for (var i = 0; i < message.faqAnswers.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.FaqAnswer.verify(message.faqAnswers[i]); + if (error) + return "faqAnswers." + error; + } + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestFaqAnswersResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse} SuggestFaqAnswersResponse + */ + SuggestFaqAnswersResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse(); + if (object.faqAnswers) { + if (!Array.isArray(object.faqAnswers)) + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.faqAnswers: array expected"); + message.faqAnswers = []; + for (var i = 0; i < object.faqAnswers.length; ++i) { + if (typeof object.faqAnswers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse.faqAnswers: object expected"); + message.faqAnswers[i] = $root.google.cloud.dialogflow.v2beta1.FaqAnswer.fromObject(object.faqAnswers[i]); + } + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestFaqAnswersResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse} message SuggestFaqAnswersResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestFaqAnswersResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.faqAnswers = []; + if (options.defaults) { + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.faqAnswers && message.faqAnswers.length) { + object.faqAnswers = []; + for (var j = 0; j < message.faqAnswers.length; ++j) + object.faqAnswers[j] = $root.google.cloud.dialogflow.v2beta1.FaqAnswer.toObject(message.faqAnswers[j], options); + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this SuggestFaqAnswersResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @instance + * @returns {Object.} JSON object + */ + SuggestFaqAnswersResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestFaqAnswersResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestFaqAnswersResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse"; + }; + + return SuggestFaqAnswersResponse; + })(); + + v2beta1.SuggestSmartRepliesRequest = (function() { + + /** + * Properties of a SuggestSmartRepliesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestSmartRepliesRequest + * @property {string|null} [parent] SuggestSmartRepliesRequest parent + * @property {google.cloud.dialogflow.v2beta1.ITextInput|null} [currentTextInput] SuggestSmartRepliesRequest currentTextInput + * @property {string|null} [latestMessage] SuggestSmartRepliesRequest latestMessage + * @property {number|null} [contextSize] SuggestSmartRepliesRequest contextSize + */ + + /** + * Constructs a new SuggestSmartRepliesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestSmartRepliesRequest. + * @implements ISuggestSmartRepliesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest=} [properties] Properties to set + */ + function SuggestSmartRepliesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestSmartRepliesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @instance + */ + SuggestSmartRepliesRequest.prototype.parent = ""; + + /** + * SuggestSmartRepliesRequest currentTextInput. + * @member {google.cloud.dialogflow.v2beta1.ITextInput|null|undefined} currentTextInput + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @instance + */ + SuggestSmartRepliesRequest.prototype.currentTextInput = null; + + /** + * SuggestSmartRepliesRequest latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @instance + */ + SuggestSmartRepliesRequest.prototype.latestMessage = ""; + + /** + * SuggestSmartRepliesRequest contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @instance + */ + SuggestSmartRepliesRequest.prototype.contextSize = 0; + + /** + * Creates a new SuggestSmartRepliesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest} SuggestSmartRepliesRequest instance + */ + SuggestSmartRepliesRequest.create = function create(properties) { + return new SuggestSmartRepliesRequest(properties); + }; + + /** + * Encodes the specified SuggestSmartRepliesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest} message SuggestSmartRepliesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestSmartRepliesRequest.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.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + if (message.currentTextInput != null && Object.hasOwnProperty.call(message, "currentTextInput")) + $root.google.cloud.dialogflow.v2beta1.TextInput.encode(message.currentTextInput, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestSmartRepliesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest} message SuggestSmartRepliesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestSmartRepliesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestSmartRepliesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest} SuggestSmartRepliesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestSmartRepliesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 4: { + message.currentTextInput = $root.google.cloud.dialogflow.v2beta1.TextInput.decode(reader, reader.uint32()); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestSmartRepliesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest} SuggestSmartRepliesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestSmartRepliesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestSmartRepliesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestSmartRepliesRequest.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.currentTextInput != null && message.hasOwnProperty("currentTextInput")) { + var error = $root.google.cloud.dialogflow.v2beta1.TextInput.verify(message.currentTextInput); + if (error) + return "currentTextInput." + error; + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestSmartRepliesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest} SuggestSmartRepliesRequest + */ + SuggestSmartRepliesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.currentTextInput != null) { + if (typeof object.currentTextInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest.currentTextInput: object expected"); + message.currentTextInput = $root.google.cloud.dialogflow.v2beta1.TextInput.fromObject(object.currentTextInput); + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestSmartRepliesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest} message SuggestSmartRepliesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestSmartRepliesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.latestMessage = ""; + object.contextSize = 0; + object.currentTextInput = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + if (message.currentTextInput != null && message.hasOwnProperty("currentTextInput")) + object.currentTextInput = $root.google.cloud.dialogflow.v2beta1.TextInput.toObject(message.currentTextInput, options); + return object; + }; + + /** + * Converts this SuggestSmartRepliesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @instance + * @returns {Object.} JSON object + */ + SuggestSmartRepliesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestSmartRepliesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestSmartRepliesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest"; + }; + + return SuggestSmartRepliesRequest; + })(); + + v2beta1.SuggestSmartRepliesResponse = (function() { + + /** + * Properties of a SuggestSmartRepliesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestSmartRepliesResponse + * @property {Array.|null} [smartReplyAnswers] SuggestSmartRepliesResponse smartReplyAnswers + * @property {string|null} [latestMessage] SuggestSmartRepliesResponse latestMessage + * @property {number|null} [contextSize] SuggestSmartRepliesResponse contextSize + */ + + /** + * Constructs a new SuggestSmartRepliesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestSmartRepliesResponse. + * @implements ISuggestSmartRepliesResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse=} [properties] Properties to set + */ + function SuggestSmartRepliesResponse(properties) { + this.smartReplyAnswers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestSmartRepliesResponse smartReplyAnswers. + * @member {Array.} smartReplyAnswers + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @instance + */ + SuggestSmartRepliesResponse.prototype.smartReplyAnswers = $util.emptyArray; + + /** + * SuggestSmartRepliesResponse latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @instance + */ + SuggestSmartRepliesResponse.prototype.latestMessage = ""; + + /** + * SuggestSmartRepliesResponse contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @instance + */ + SuggestSmartRepliesResponse.prototype.contextSize = 0; + + /** + * Creates a new SuggestSmartRepliesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse} SuggestSmartRepliesResponse instance + */ + SuggestSmartRepliesResponse.create = function create(properties) { + return new SuggestSmartRepliesResponse(properties); + }; + + /** + * Encodes the specified SuggestSmartRepliesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse} message SuggestSmartRepliesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestSmartRepliesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.smartReplyAnswers != null && message.smartReplyAnswers.length) + for (var i = 0; i < message.smartReplyAnswers.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SmartReplyAnswer.encode(message.smartReplyAnswers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified SuggestSmartRepliesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse} message SuggestSmartRepliesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestSmartRepliesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestSmartRepliesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse} SuggestSmartRepliesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestSmartRepliesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.smartReplyAnswers && message.smartReplyAnswers.length)) + message.smartReplyAnswers = []; + message.smartReplyAnswers.push($root.google.cloud.dialogflow.v2beta1.SmartReplyAnswer.decode(reader, reader.uint32())); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestSmartRepliesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse} SuggestSmartRepliesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestSmartRepliesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestSmartRepliesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestSmartRepliesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.smartReplyAnswers != null && message.hasOwnProperty("smartReplyAnswers")) { + if (!Array.isArray(message.smartReplyAnswers)) + return "smartReplyAnswers: array expected"; + for (var i = 0; i < message.smartReplyAnswers.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SmartReplyAnswer.verify(message.smartReplyAnswers[i]); + if (error) + return "smartReplyAnswers." + error; + } + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestSmartRepliesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse} SuggestSmartRepliesResponse + */ + SuggestSmartRepliesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse(); + if (object.smartReplyAnswers) { + if (!Array.isArray(object.smartReplyAnswers)) + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.smartReplyAnswers: array expected"); + message.smartReplyAnswers = []; + for (var i = 0; i < object.smartReplyAnswers.length; ++i) { + if (typeof object.smartReplyAnswers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse.smartReplyAnswers: object expected"); + message.smartReplyAnswers[i] = $root.google.cloud.dialogflow.v2beta1.SmartReplyAnswer.fromObject(object.smartReplyAnswers[i]); + } + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestSmartRepliesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse} message SuggestSmartRepliesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestSmartRepliesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.smartReplyAnswers = []; + if (options.defaults) { + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.smartReplyAnswers && message.smartReplyAnswers.length) { + object.smartReplyAnswers = []; + for (var j = 0; j < message.smartReplyAnswers.length; ++j) + object.smartReplyAnswers[j] = $root.google.cloud.dialogflow.v2beta1.SmartReplyAnswer.toObject(message.smartReplyAnswers[j], options); + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this SuggestSmartRepliesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @instance + * @returns {Object.} JSON object + */ + SuggestSmartRepliesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestSmartRepliesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestSmartRepliesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse"; + }; + + return SuggestSmartRepliesResponse; + })(); + + v2beta1.Suggestion = (function() { + + /** + * Properties of a Suggestion. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestion + * @property {string|null} [name] Suggestion name + * @property {Array.|null} [articles] Suggestion articles + * @property {Array.|null} [faqAnswers] Suggestion faqAnswers + * @property {google.protobuf.ITimestamp|null} [createTime] Suggestion createTime + * @property {string|null} [latestMessage] Suggestion latestMessage + */ + + /** + * Constructs a new Suggestion. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Suggestion. + * @implements ISuggestion + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestion=} [properties] Properties to set + */ + function Suggestion(properties) { + this.articles = []; + this.faqAnswers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Suggestion name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @instance + */ + Suggestion.prototype.name = ""; + + /** + * Suggestion articles. + * @member {Array.} articles + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @instance + */ + Suggestion.prototype.articles = $util.emptyArray; + + /** + * Suggestion faqAnswers. + * @member {Array.} faqAnswers + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @instance + */ + Suggestion.prototype.faqAnswers = $util.emptyArray; + + /** + * Suggestion createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @instance + */ + Suggestion.prototype.createTime = null; + + /** + * Suggestion latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @instance + */ + Suggestion.prototype.latestMessage = ""; + + /** + * Creates a new Suggestion instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestion=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Suggestion} Suggestion instance + */ + Suggestion.create = function create(properties) { + return new Suggestion(properties); + }; + + /** + * Encodes the specified Suggestion message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestion} message Suggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestion.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.articles != null && message.articles.length) + for (var i = 0; i < message.articles.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Suggestion.Article.encode(message.articles[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.faqAnswers != null && message.faqAnswers.length) + for (var i = 0; i < message.faqAnswers.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.encode(message.faqAnswers[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + 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.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.latestMessage); + return writer; + }; + + /** + * Encodes the specified Suggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestion} message Suggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Suggestion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Suggestion} Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Suggestion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.articles && message.articles.length)) + message.articles = []; + message.articles.push($root.google.cloud.dialogflow.v2beta1.Suggestion.Article.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.faqAnswers && message.faqAnswers.length)) + message.faqAnswers = []; + message.faqAnswers.push($root.google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.decode(reader, reader.uint32())); + break; + } + case 5: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.latestMessage = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Suggestion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Suggestion} Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Suggestion message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Suggestion.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.articles != null && message.hasOwnProperty("articles")) { + if (!Array.isArray(message.articles)) + return "articles: array expected"; + for (var i = 0; i < message.articles.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Suggestion.Article.verify(message.articles[i]); + if (error) + return "articles." + error; + } + } + if (message.faqAnswers != null && message.hasOwnProperty("faqAnswers")) { + if (!Array.isArray(message.faqAnswers)) + return "faqAnswers: array expected"; + for (var i = 0; i < message.faqAnswers.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.verify(message.faqAnswers[i]); + if (error) + return "faqAnswers." + error; + } + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + return null; + }; + + /** + * Creates a Suggestion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Suggestion} Suggestion + */ + Suggestion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Suggestion) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Suggestion(); + if (object.name != null) + message.name = String(object.name); + if (object.articles) { + if (!Array.isArray(object.articles)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Suggestion.articles: array expected"); + message.articles = []; + for (var i = 0; i < object.articles.length; ++i) { + if (typeof object.articles[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Suggestion.articles: object expected"); + message.articles[i] = $root.google.cloud.dialogflow.v2beta1.Suggestion.Article.fromObject(object.articles[i]); + } + } + if (object.faqAnswers) { + if (!Array.isArray(object.faqAnswers)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Suggestion.faqAnswers: array expected"); + message.faqAnswers = []; + for (var i = 0; i < object.faqAnswers.length; ++i) { + if (typeof object.faqAnswers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Suggestion.faqAnswers: object expected"); + message.faqAnswers[i] = $root.google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.fromObject(object.faqAnswers[i]); + } + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Suggestion.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + return message; + }; + + /** + * Creates a plain object from a Suggestion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Suggestion} message Suggestion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Suggestion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.articles = []; + object.faqAnswers = []; + } + if (options.defaults) { + object.name = ""; + object.createTime = null; + object.latestMessage = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.articles && message.articles.length) { + object.articles = []; + for (var j = 0; j < message.articles.length; ++j) + object.articles[j] = $root.google.cloud.dialogflow.v2beta1.Suggestion.Article.toObject(message.articles[j], options); + } + if (message.faqAnswers && message.faqAnswers.length) { + object.faqAnswers = []; + for (var j = 0; j < message.faqAnswers.length; ++j) + object.faqAnswers[j] = $root.google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.toObject(message.faqAnswers[j], options); + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + return object; + }; + + /** + * Converts this Suggestion to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @instance + * @returns {Object.} JSON object + */ + Suggestion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Suggestion + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Suggestion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Suggestion"; + }; + + Suggestion.Article = (function() { + + /** + * Properties of an Article. + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @interface IArticle + * @property {string|null} [title] Article title + * @property {string|null} [uri] Article uri + * @property {Array.|null} [snippets] Article snippets + * @property {Object.|null} [metadata] Article metadata + * @property {string|null} [answerRecord] Article answerRecord + */ + + /** + * Constructs a new Article. + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @classdesc Represents an Article. + * @implements IArticle + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Suggestion.IArticle=} [properties] Properties to set + */ + function Article(properties) { + this.snippets = []; + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Article title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @instance + */ + Article.prototype.title = ""; + + /** + * Article uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @instance + */ + Article.prototype.uri = ""; + + /** + * Article snippets. + * @member {Array.} snippets + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @instance + */ + Article.prototype.snippets = $util.emptyArray; + + /** + * Article metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @instance + */ + Article.prototype.metadata = $util.emptyObject; + + /** + * Article answerRecord. + * @member {string} answerRecord + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @instance + */ + Article.prototype.answerRecord = ""; + + /** + * Creates a new Article instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @static + * @param {google.cloud.dialogflow.v2beta1.Suggestion.IArticle=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Suggestion.Article} Article instance + */ + Article.create = function create(properties) { + return new Article(properties); + }; + + /** + * Encodes the specified Article message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.Article.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @static + * @param {google.cloud.dialogflow.v2beta1.Suggestion.IArticle} message Article message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Article.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); + if (message.snippets != null && message.snippets.length) + for (var i = 0; i < message.snippets.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.snippets[i]); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.answerRecord); + return writer; + }; + + /** + * Encodes the specified Article message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.Article.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @static + * @param {google.cloud.dialogflow.v2beta1.Suggestion.IArticle} message Article message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Article.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Article message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Suggestion.Article} Article + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Article.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Suggestion.Article(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.uri = reader.string(); + break; + } + case 3: { + if (!(message.snippets && message.snippets.length)) + message.snippets = []; + message.snippets.push(reader.string()); + break; + } + case 5: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 6: { + message.answerRecord = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Article message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Suggestion.Article} Article + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Article.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Article message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Article.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.snippets != null && message.hasOwnProperty("snippets")) { + if (!Array.isArray(message.snippets)) + return "snippets: array expected"; + for (var i = 0; i < message.snippets.length; ++i) + if (!$util.isString(message.snippets[i])) + return "snippets: string[] expected"; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + if (!$util.isString(message.answerRecord)) + return "answerRecord: string expected"; + return null; + }; + + /** + * Creates an Article message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Suggestion.Article} Article + */ + Article.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Suggestion.Article) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Suggestion.Article(); + if (object.title != null) + message.title = String(object.title); + if (object.uri != null) + message.uri = String(object.uri); + if (object.snippets) { + if (!Array.isArray(object.snippets)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Suggestion.Article.snippets: array expected"); + message.snippets = []; + for (var i = 0; i < object.snippets.length; ++i) + message.snippets[i] = String(object.snippets[i]); + } + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Suggestion.Article.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + if (object.answerRecord != null) + message.answerRecord = String(object.answerRecord); + return message; + }; + + /** + * Creates a plain object from an Article message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @static + * @param {google.cloud.dialogflow.v2beta1.Suggestion.Article} message Article + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Article.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.snippets = []; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) { + object.title = ""; + object.uri = ""; + object.answerRecord = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.snippets && message.snippets.length) { + object.snippets = []; + for (var j = 0; j < message.snippets.length; ++j) + object.snippets[j] = message.snippets[j]; + } + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = message.answerRecord; + return object; + }; + + /** + * Converts this Article to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @instance + * @returns {Object.} JSON object + */ + Article.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Article + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.Article + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Article.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Suggestion.Article"; + }; + + return Article; + })(); + + Suggestion.FaqAnswer = (function() { + + /** + * Properties of a FaqAnswer. + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @interface IFaqAnswer + * @property {string|null} [answer] FaqAnswer answer + * @property {number|null} [confidence] FaqAnswer confidence + * @property {string|null} [question] FaqAnswer question + * @property {string|null} [source] FaqAnswer source + * @property {Object.|null} [metadata] FaqAnswer metadata + * @property {string|null} [answerRecord] FaqAnswer answerRecord + */ + + /** + * Constructs a new FaqAnswer. + * @memberof google.cloud.dialogflow.v2beta1.Suggestion + * @classdesc Represents a FaqAnswer. + * @implements IFaqAnswer + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer=} [properties] Properties to set + */ + function FaqAnswer(properties) { + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FaqAnswer answer. + * @member {string} answer + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @instance + */ + FaqAnswer.prototype.answer = ""; + + /** + * FaqAnswer confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @instance + */ + FaqAnswer.prototype.confidence = 0; + + /** + * FaqAnswer question. + * @member {string} question + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @instance + */ + FaqAnswer.prototype.question = ""; + + /** + * FaqAnswer source. + * @member {string} source + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @instance + */ + FaqAnswer.prototype.source = ""; + + /** + * FaqAnswer metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @instance + */ + FaqAnswer.prototype.metadata = $util.emptyObject; + + /** + * FaqAnswer answerRecord. + * @member {string} answerRecord + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @instance + */ + FaqAnswer.prototype.answerRecord = ""; + + /** + * Creates a new FaqAnswer instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer} FaqAnswer instance + */ + FaqAnswer.create = function create(properties) { + return new FaqAnswer(properties); + }; + + /** + * Encodes the specified FaqAnswer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer} message FaqAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaqAnswer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answer != null && Object.hasOwnProperty.call(message, "answer")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.answer); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.confidence); + if (message.question != null && Object.hasOwnProperty.call(message, "question")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.question); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.source); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.answerRecord); + return writer; + }; + + /** + * Encodes the specified FaqAnswer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.Suggestion.IFaqAnswer} message FaqAnswer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FaqAnswer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer} FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaqAnswer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.answer = reader.string(); + break; + } + case 2: { + message.confidence = reader.float(); + break; + } + case 3: { + message.question = reader.string(); + break; + } + case 4: { + message.source = reader.string(); + break; + } + case 5: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 6: { + message.answerRecord = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FaqAnswer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer} FaqAnswer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FaqAnswer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FaqAnswer message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FaqAnswer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answer != null && message.hasOwnProperty("answer")) + if (!$util.isString(message.answer)) + return "answer: string expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.question != null && message.hasOwnProperty("question")) + if (!$util.isString(message.question)) + return "question: string expected"; + if (message.source != null && message.hasOwnProperty("source")) + if (!$util.isString(message.source)) + return "source: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + if (!$util.isString(message.answerRecord)) + return "answerRecord: string expected"; + return null; + }; + + /** + * Creates a FaqAnswer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer} FaqAnswer + */ + FaqAnswer.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer(); + if (object.answer != null) + message.answer = String(object.answer); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.question != null) + message.question = String(object.question); + if (object.source != null) + message.source = String(object.source); + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + if (object.answerRecord != null) + message.answerRecord = String(object.answerRecord); + return message; + }; + + /** + * Creates a plain object from a FaqAnswer message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @static + * @param {google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer} message FaqAnswer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FaqAnswer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) { + object.answer = ""; + object.confidence = 0; + object.question = ""; + object.source = ""; + object.answerRecord = ""; + } + if (message.answer != null && message.hasOwnProperty("answer")) + object.answer = message.answer; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.question != null && message.hasOwnProperty("question")) + object.question = message.question; + if (message.source != null && message.hasOwnProperty("source")) + object.source = message.source; + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = message.answerRecord; + return object; + }; + + /** + * Converts this FaqAnswer to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @instance + * @returns {Object.} JSON object + */ + FaqAnswer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FaqAnswer + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FaqAnswer.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Suggestion.FaqAnswer"; + }; + + return FaqAnswer; + })(); + + return Suggestion; + })(); + + v2beta1.ListSuggestionsRequest = (function() { + + /** + * Properties of a ListSuggestionsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListSuggestionsRequest + * @property {string|null} [parent] ListSuggestionsRequest parent + * @property {number|null} [pageSize] ListSuggestionsRequest pageSize + * @property {string|null} [pageToken] ListSuggestionsRequest pageToken + * @property {string|null} [filter] ListSuggestionsRequest filter + */ + + /** + * Constructs a new ListSuggestionsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListSuggestionsRequest. + * @implements IListSuggestionsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsRequest=} [properties] Properties to set + */ + function ListSuggestionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSuggestionsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @instance + */ + ListSuggestionsRequest.prototype.parent = ""; + + /** + * ListSuggestionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @instance + */ + ListSuggestionsRequest.prototype.pageSize = 0; + + /** + * ListSuggestionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @instance + */ + ListSuggestionsRequest.prototype.pageToken = ""; + + /** + * ListSuggestionsRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @instance + */ + ListSuggestionsRequest.prototype.filter = ""; + + /** + * Creates a new ListSuggestionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListSuggestionsRequest} ListSuggestionsRequest instance + */ + ListSuggestionsRequest.create = function create(properties) { + return new ListSuggestionsRequest(properties); + }; + + /** + * Encodes the specified ListSuggestionsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSuggestionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsRequest} message ListSuggestionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSuggestionsRequest.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); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListSuggestionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSuggestionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsRequest} message ListSuggestionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSuggestionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSuggestionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListSuggestionsRequest} ListSuggestionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSuggestionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest(); + 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; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSuggestionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListSuggestionsRequest} ListSuggestionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSuggestionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSuggestionsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSuggestionsRequest.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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListSuggestionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListSuggestionsRequest} ListSuggestionsRequest + */ + ListSuggestionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest(); + 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); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListSuggestionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListSuggestionsRequest} message ListSuggestionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSuggestionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + 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; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListSuggestionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListSuggestionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSuggestionsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSuggestionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListSuggestionsRequest"; + }; + + return ListSuggestionsRequest; + })(); + + v2beta1.ListSuggestionsResponse = (function() { + + /** + * Properties of a ListSuggestionsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListSuggestionsResponse + * @property {Array.|null} [suggestions] ListSuggestionsResponse suggestions + * @property {string|null} [nextPageToken] ListSuggestionsResponse nextPageToken + */ + + /** + * Constructs a new ListSuggestionsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListSuggestionsResponse. + * @implements IListSuggestionsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsResponse=} [properties] Properties to set + */ + function ListSuggestionsResponse(properties) { + this.suggestions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSuggestionsResponse suggestions. + * @member {Array.} suggestions + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @instance + */ + ListSuggestionsResponse.prototype.suggestions = $util.emptyArray; + + /** + * ListSuggestionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @instance + */ + ListSuggestionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListSuggestionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListSuggestionsResponse} ListSuggestionsResponse instance + */ + ListSuggestionsResponse.create = function create(properties) { + return new ListSuggestionsResponse(properties); + }; + + /** + * Encodes the specified ListSuggestionsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSuggestionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsResponse} message ListSuggestionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSuggestionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestions != null && message.suggestions.length) + for (var i = 0; i < message.suggestions.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Suggestion.encode(message.suggestions[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 ListSuggestionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSuggestionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSuggestionsResponse} message ListSuggestionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSuggestionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSuggestionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListSuggestionsResponse} ListSuggestionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSuggestionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListSuggestionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.suggestions && message.suggestions.length)) + message.suggestions = []; + message.suggestions.push($root.google.cloud.dialogflow.v2beta1.Suggestion.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSuggestionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListSuggestionsResponse} ListSuggestionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSuggestionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSuggestionsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSuggestionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestions != null && message.hasOwnProperty("suggestions")) { + if (!Array.isArray(message.suggestions)) + return "suggestions: array expected"; + for (var i = 0; i < message.suggestions.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Suggestion.verify(message.suggestions[i]); + if (error) + return "suggestions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListSuggestionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListSuggestionsResponse} ListSuggestionsResponse + */ + ListSuggestionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListSuggestionsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListSuggestionsResponse(); + if (object.suggestions) { + if (!Array.isArray(object.suggestions)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListSuggestionsResponse.suggestions: array expected"); + message.suggestions = []; + for (var i = 0; i < object.suggestions.length; ++i) { + if (typeof object.suggestions[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListSuggestionsResponse.suggestions: object expected"); + message.suggestions[i] = $root.google.cloud.dialogflow.v2beta1.Suggestion.fromObject(object.suggestions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListSuggestionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListSuggestionsResponse} message ListSuggestionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSuggestionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.suggestions = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.suggestions && message.suggestions.length) { + object.suggestions = []; + for (var j = 0; j < message.suggestions.length; ++j) + object.suggestions[j] = $root.google.cloud.dialogflow.v2beta1.Suggestion.toObject(message.suggestions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListSuggestionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListSuggestionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSuggestionsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListSuggestionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSuggestionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListSuggestionsResponse"; + }; + + return ListSuggestionsResponse; + })(); + + v2beta1.CompileSuggestionRequest = (function() { + + /** + * Properties of a CompileSuggestionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICompileSuggestionRequest + * @property {string|null} [parent] CompileSuggestionRequest parent + * @property {string|null} [latestMessage] CompileSuggestionRequest latestMessage + * @property {number|null} [contextSize] CompileSuggestionRequest contextSize + */ + + /** + * Constructs a new CompileSuggestionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CompileSuggestionRequest. + * @implements ICompileSuggestionRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest=} [properties] Properties to set + */ + function CompileSuggestionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompileSuggestionRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @instance + */ + CompileSuggestionRequest.prototype.parent = ""; + + /** + * CompileSuggestionRequest latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @instance + */ + CompileSuggestionRequest.prototype.latestMessage = ""; + + /** + * CompileSuggestionRequest contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @instance + */ + CompileSuggestionRequest.prototype.contextSize = 0; + + /** + * Creates a new CompileSuggestionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CompileSuggestionRequest} CompileSuggestionRequest instance + */ + CompileSuggestionRequest.create = function create(properties) { + return new CompileSuggestionRequest(properties); + }; + + /** + * Encodes the specified CompileSuggestionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompileSuggestionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest} message CompileSuggestionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompileSuggestionRequest.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.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified CompileSuggestionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompileSuggestionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest} message CompileSuggestionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompileSuggestionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompileSuggestionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CompileSuggestionRequest} CompileSuggestionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompileSuggestionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompileSuggestionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CompileSuggestionRequest} CompileSuggestionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompileSuggestionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompileSuggestionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompileSuggestionRequest.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.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a CompileSuggestionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CompileSuggestionRequest} CompileSuggestionRequest + */ + CompileSuggestionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a CompileSuggestionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CompileSuggestionRequest} message CompileSuggestionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompileSuggestionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this CompileSuggestionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @instance + * @returns {Object.} JSON object + */ + CompileSuggestionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CompileSuggestionRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompileSuggestionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CompileSuggestionRequest"; + }; + + return CompileSuggestionRequest; + })(); + + v2beta1.CompileSuggestionResponse = (function() { + + /** + * Properties of a CompileSuggestionResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICompileSuggestionResponse + * @property {google.cloud.dialogflow.v2beta1.ISuggestion|null} [suggestion] CompileSuggestionResponse suggestion + * @property {string|null} [latestMessage] CompileSuggestionResponse latestMessage + * @property {number|null} [contextSize] CompileSuggestionResponse contextSize + */ + + /** + * Constructs a new CompileSuggestionResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CompileSuggestionResponse. + * @implements ICompileSuggestionResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse=} [properties] Properties to set + */ + function CompileSuggestionResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompileSuggestionResponse suggestion. + * @member {google.cloud.dialogflow.v2beta1.ISuggestion|null|undefined} suggestion + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @instance + */ + CompileSuggestionResponse.prototype.suggestion = null; + + /** + * CompileSuggestionResponse latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @instance + */ + CompileSuggestionResponse.prototype.latestMessage = ""; + + /** + * CompileSuggestionResponse contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @instance + */ + CompileSuggestionResponse.prototype.contextSize = 0; + + /** + * Creates a new CompileSuggestionResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CompileSuggestionResponse} CompileSuggestionResponse instance + */ + CompileSuggestionResponse.create = function create(properties) { + return new CompileSuggestionResponse(properties); + }; + + /** + * Encodes the specified CompileSuggestionResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompileSuggestionResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse} message CompileSuggestionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompileSuggestionResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestion != null && Object.hasOwnProperty.call(message, "suggestion")) + $root.google.cloud.dialogflow.v2beta1.Suggestion.encode(message.suggestion, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified CompileSuggestionResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompileSuggestionResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse} message CompileSuggestionResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompileSuggestionResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompileSuggestionResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CompileSuggestionResponse} CompileSuggestionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompileSuggestionResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.suggestion = $root.google.cloud.dialogflow.v2beta1.Suggestion.decode(reader, reader.uint32()); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CompileSuggestionResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CompileSuggestionResponse} CompileSuggestionResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompileSuggestionResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompileSuggestionResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompileSuggestionResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestion != null && message.hasOwnProperty("suggestion")) { + var error = $root.google.cloud.dialogflow.v2beta1.Suggestion.verify(message.suggestion); + if (error) + return "suggestion." + error; + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a CompileSuggestionResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CompileSuggestionResponse} CompileSuggestionResponse + */ + CompileSuggestionResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse(); + if (object.suggestion != null) { + if (typeof object.suggestion !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CompileSuggestionResponse.suggestion: object expected"); + message.suggestion = $root.google.cloud.dialogflow.v2beta1.Suggestion.fromObject(object.suggestion); + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a CompileSuggestionResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.CompileSuggestionResponse} message CompileSuggestionResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompileSuggestionResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.suggestion = null; + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.suggestion != null && message.hasOwnProperty("suggestion")) + object.suggestion = $root.google.cloud.dialogflow.v2beta1.Suggestion.toObject(message.suggestion, options); + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this CompileSuggestionResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @instance + * @returns {Object.} JSON object + */ + CompileSuggestionResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CompileSuggestionResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CompileSuggestionResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompileSuggestionResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CompileSuggestionResponse"; + }; + + return CompileSuggestionResponse; + })(); + + v2beta1.ResponseMessage = (function() { + + /** + * Properties of a ResponseMessage. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IResponseMessage + * @property {google.cloud.dialogflow.v2beta1.ResponseMessage.IText|null} [text] ResponseMessage text + * @property {google.protobuf.IStruct|null} [payload] ResponseMessage payload + * @property {google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff|null} [liveAgentHandoff] ResponseMessage liveAgentHandoff + * @property {google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction|null} [endInteraction] ResponseMessage endInteraction + * @property {google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio|null} [mixedAudio] ResponseMessage mixedAudio + * @property {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall|null} [telephonyTransferCall] ResponseMessage telephonyTransferCall + */ + + /** + * Constructs a new ResponseMessage. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ResponseMessage. + * @implements IResponseMessage + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IResponseMessage=} [properties] Properties to set + */ + function ResponseMessage(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseMessage text. + * @member {google.cloud.dialogflow.v2beta1.ResponseMessage.IText|null|undefined} text + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.text = null; + + /** + * ResponseMessage payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.payload = null; + + /** + * ResponseMessage liveAgentHandoff. + * @member {google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff|null|undefined} liveAgentHandoff + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.liveAgentHandoff = null; + + /** + * ResponseMessage endInteraction. + * @member {google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction|null|undefined} endInteraction + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.endInteraction = null; + + /** + * ResponseMessage mixedAudio. + * @member {google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio|null|undefined} mixedAudio + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.mixedAudio = null; + + /** + * ResponseMessage telephonyTransferCall. + * @member {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall|null|undefined} telephonyTransferCall + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @instance + */ + ResponseMessage.prototype.telephonyTransferCall = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ResponseMessage message. + * @member {"text"|"payload"|"liveAgentHandoff"|"endInteraction"|"mixedAudio"|"telephonyTransferCall"|undefined} message + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @instance + */ + Object.defineProperty(ResponseMessage.prototype, "message", { + get: $util.oneOfGetter($oneOfFields = ["text", "payload", "liveAgentHandoff", "endInteraction", "mixedAudio", "telephonyTransferCall"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ResponseMessage instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @static + * @param {google.cloud.dialogflow.v2beta1.IResponseMessage=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage} ResponseMessage instance + */ + ResponseMessage.create = function create(properties) { + return new ResponseMessage(properties); + }; + + /** + * Encodes the specified ResponseMessage message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @static + * @param {google.cloud.dialogflow.v2beta1.IResponseMessage} message ResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseMessage.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + $root.google.cloud.dialogflow.v2beta1.ResponseMessage.Text.encode(message.text, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.liveAgentHandoff != null && Object.hasOwnProperty.call(message, "liveAgentHandoff")) + $root.google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.encode(message.liveAgentHandoff, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.endInteraction != null && Object.hasOwnProperty.call(message, "endInteraction")) + $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.encode(message.endInteraction, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.mixedAudio != null && Object.hasOwnProperty.call(message, "mixedAudio")) + $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.encode(message.mixedAudio, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.telephonyTransferCall != null && Object.hasOwnProperty.call(message, "telephonyTransferCall")) + $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.encode(message.telephonyTransferCall, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ResponseMessage message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @static + * @param {google.cloud.dialogflow.v2beta1.IResponseMessage} message ResponseMessage message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseMessage.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseMessage message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage} ResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseMessage.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.Text.decode(reader, reader.uint32()); + break; + } + case 2: { + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 3: { + message.liveAgentHandoff = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.decode(reader, reader.uint32()); + break; + } + case 4: { + message.endInteraction = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.decode(reader, reader.uint32()); + break; + } + case 5: { + message.mixedAudio = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.decode(reader, reader.uint32()); + break; + } + case 6: { + message.telephonyTransferCall = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseMessage message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage} ResponseMessage + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseMessage.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseMessage message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseMessage.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.Text.verify(message.text); + if (error) + return "text." + error; + } + } + if (message.payload != null && message.hasOwnProperty("payload")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + } + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.verify(message.liveAgentHandoff); + if (error) + return "liveAgentHandoff." + error; + } + } + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.verify(message.endInteraction); + if (error) + return "endInteraction." + error; + } + } + if (message.mixedAudio != null && message.hasOwnProperty("mixedAudio")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.verify(message.mixedAudio); + if (error) + return "mixedAudio." + error; + } + } + if (message.telephonyTransferCall != null && message.hasOwnProperty("telephonyTransferCall")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify(message.telephonyTransferCall); + if (error) + return "telephonyTransferCall." + error; + } + } + return null; + }; + + /** + * Creates a ResponseMessage message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage} ResponseMessage + */ + ResponseMessage.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ResponseMessage) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage(); + if (object.text != null) { + if (typeof object.text !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.text: object expected"); + message.text = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.Text.fromObject(object.text); + } + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.liveAgentHandoff != null) { + if (typeof object.liveAgentHandoff !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.liveAgentHandoff: object expected"); + message.liveAgentHandoff = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.fromObject(object.liveAgentHandoff); + } + if (object.endInteraction != null) { + if (typeof object.endInteraction !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.endInteraction: object expected"); + message.endInteraction = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.fromObject(object.endInteraction); + } + if (object.mixedAudio != null) { + if (typeof object.mixedAudio !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.mixedAudio: object expected"); + message.mixedAudio = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.fromObject(object.mixedAudio); + } + if (object.telephonyTransferCall != null) { + if (typeof object.telephonyTransferCall !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.telephonyTransferCall: object expected"); + message.telephonyTransferCall = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.fromObject(object.telephonyTransferCall); + } + return message; + }; + + /** + * Creates a plain object from a ResponseMessage message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage} message ResponseMessage + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseMessage.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.text != null && message.hasOwnProperty("text")) { + object.text = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.Text.toObject(message.text, options); + if (options.oneofs) + object.message = "text"; + } + if (message.payload != null && message.hasOwnProperty("payload")) { + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (options.oneofs) + object.message = "payload"; + } + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) { + object.liveAgentHandoff = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.toObject(message.liveAgentHandoff, options); + if (options.oneofs) + object.message = "liveAgentHandoff"; + } + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) { + object.endInteraction = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.toObject(message.endInteraction, options); + if (options.oneofs) + object.message = "endInteraction"; + } + if (message.mixedAudio != null && message.hasOwnProperty("mixedAudio")) { + object.mixedAudio = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.toObject(message.mixedAudio, options); + if (options.oneofs) + object.message = "mixedAudio"; + } + if (message.telephonyTransferCall != null && message.hasOwnProperty("telephonyTransferCall")) { + object.telephonyTransferCall = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.toObject(message.telephonyTransferCall, options); + if (options.oneofs) + object.message = "telephonyTransferCall"; + } + return object; + }; + + /** + * Converts this ResponseMessage to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @instance + * @returns {Object.} JSON object + */ + ResponseMessage.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResponseMessage + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResponseMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ResponseMessage"; + }; + + ResponseMessage.Text = (function() { + + /** + * Properties of a Text. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @interface IText + * @property {Array.|null} [text] Text text + */ + + /** + * Constructs a new Text. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @classdesc Represents a Text. + * @implements IText + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IText=} [properties] Properties to set + */ + function Text(properties) { + this.text = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Text text. + * @member {Array.} text + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @instance + */ + Text.prototype.text = $util.emptyArray; + + /** + * Creates a new Text instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IText=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.Text} Text instance + */ + Text.create = function create(properties) { + return new Text(properties); + }; + + /** + * Encodes the specified Text message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.Text.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IText} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + return writer; + }; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.Text.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IText} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Text message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.Text(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Text message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Text.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + return null; + }; + + /** + * Creates a Text message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.Text} Text + */ + Text.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ResponseMessage.Text) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.Text(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.Text.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + return message; + }; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.Text} message Text + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Text.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.text = []; + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + return object; + }; + + /** + * Converts this Text to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @instance + * @returns {Object.} JSON object + */ + Text.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Text + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.Text + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Text.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ResponseMessage.Text"; + }; + + return Text; + })(); + + ResponseMessage.LiveAgentHandoff = (function() { + + /** + * Properties of a LiveAgentHandoff. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @interface ILiveAgentHandoff + * @property {google.protobuf.IStruct|null} [metadata] LiveAgentHandoff metadata + */ + + /** + * Constructs a new LiveAgentHandoff. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @classdesc Represents a LiveAgentHandoff. + * @implements ILiveAgentHandoff + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff=} [properties] Properties to set + */ + function LiveAgentHandoff(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LiveAgentHandoff metadata. + * @member {google.protobuf.IStruct|null|undefined} metadata + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @instance + */ + LiveAgentHandoff.prototype.metadata = null; + + /** + * Creates a new LiveAgentHandoff instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff} LiveAgentHandoff instance + */ + LiveAgentHandoff.create = function create(properties) { + return new LiveAgentHandoff(properties); + }; + + /** + * Encodes the specified LiveAgentHandoff message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff} message LiveAgentHandoff message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LiveAgentHandoff.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Struct.encode(message.metadata, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LiveAgentHandoff message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ILiveAgentHandoff} message LiveAgentHandoff message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LiveAgentHandoff.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LiveAgentHandoff message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff} LiveAgentHandoff + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LiveAgentHandoff.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.metadata = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LiveAgentHandoff message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff} LiveAgentHandoff + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LiveAgentHandoff.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LiveAgentHandoff message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LiveAgentHandoff.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.protobuf.Struct.verify(message.metadata); + if (error) + return "metadata." + error; + } + return null; + }; + + /** + * Creates a LiveAgentHandoff message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff} LiveAgentHandoff + */ + LiveAgentHandoff.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff(); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff.metadata: object expected"); + message.metadata = $root.google.protobuf.Struct.fromObject(object.metadata); + } + return message; + }; + + /** + * Creates a plain object from a LiveAgentHandoff message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff} message LiveAgentHandoff + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LiveAgentHandoff.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metadata = null; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.protobuf.Struct.toObject(message.metadata, options); + return object; + }; + + /** + * Converts this LiveAgentHandoff to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @instance + * @returns {Object.} JSON object + */ + LiveAgentHandoff.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LiveAgentHandoff + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LiveAgentHandoff.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ResponseMessage.LiveAgentHandoff"; + }; + + return LiveAgentHandoff; + })(); + + ResponseMessage.EndInteraction = (function() { + + /** + * Properties of an EndInteraction. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @interface IEndInteraction + */ + + /** + * Constructs a new EndInteraction. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @classdesc Represents an EndInteraction. + * @implements IEndInteraction + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction=} [properties] Properties to set + */ + function EndInteraction(properties) { + if (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 EndInteraction instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction} EndInteraction instance + */ + EndInteraction.create = function create(properties) { + return new EndInteraction(properties); + }; + + /** + * Encodes the specified EndInteraction message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction} message EndInteraction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndInteraction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified EndInteraction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IEndInteraction} message EndInteraction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndInteraction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EndInteraction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction} EndInteraction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndInteraction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EndInteraction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction} EndInteraction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndInteraction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EndInteraction message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EndInteraction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an EndInteraction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction} EndInteraction + */ + EndInteraction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction) + return object; + return new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction(); + }; + + /** + * Creates a plain object from an EndInteraction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction} message EndInteraction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EndInteraction.toObject = function toObject() { + return {}; + }; + + /** + * Converts this EndInteraction to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @instance + * @returns {Object.} JSON object + */ + EndInteraction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EndInteraction + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EndInteraction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ResponseMessage.EndInteraction"; + }; + + return EndInteraction; + })(); + + ResponseMessage.MixedAudio = (function() { + + /** + * Properties of a MixedAudio. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @interface IMixedAudio + * @property {Array.|null} [segments] MixedAudio segments + */ + + /** + * Constructs a new MixedAudio. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @classdesc Represents a MixedAudio. + * @implements IMixedAudio + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio=} [properties] Properties to set + */ + function MixedAudio(properties) { + this.segments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MixedAudio segments. + * @member {Array.} segments + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @instance + */ + MixedAudio.prototype.segments = $util.emptyArray; + + /** + * Creates a new MixedAudio instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio} MixedAudio instance + */ + MixedAudio.create = function create(properties) { + return new MixedAudio(properties); + }; + + /** + * Encodes the specified MixedAudio message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio} message MixedAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MixedAudio.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.segments != null && message.segments.length) + for (var i = 0; i < message.segments.length; ++i) + $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment.encode(message.segments[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MixedAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.IMixedAudio} message MixedAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MixedAudio.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MixedAudio message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio} MixedAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MixedAudio.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.segments && message.segments.length)) + message.segments = []; + message.segments.push($root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MixedAudio message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio} MixedAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MixedAudio.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MixedAudio message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MixedAudio.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.segments != null && message.hasOwnProperty("segments")) { + if (!Array.isArray(message.segments)) + return "segments: array expected"; + for (var i = 0; i < message.segments.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment.verify(message.segments[i]); + if (error) + return "segments." + error; + } + } + return null; + }; + + /** + * Creates a MixedAudio message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio} MixedAudio + */ + MixedAudio.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio(); + if (object.segments) { + if (!Array.isArray(object.segments)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.segments: array expected"); + message.segments = []; + for (var i = 0; i < object.segments.length; ++i) { + if (typeof object.segments[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.segments: object expected"); + message.segments[i] = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment.fromObject(object.segments[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MixedAudio message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio} message MixedAudio + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MixedAudio.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.segments = []; + if (message.segments && message.segments.length) { + object.segments = []; + for (var j = 0; j < message.segments.length; ++j) + object.segments[j] = $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment.toObject(message.segments[j], options); + } + return object; + }; + + /** + * Converts this MixedAudio to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @instance + * @returns {Object.} JSON object + */ + MixedAudio.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MixedAudio + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MixedAudio.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio"; + }; + + MixedAudio.Segment = (function() { + + /** + * Properties of a Segment. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @interface ISegment + * @property {Uint8Array|null} [audio] Segment audio + * @property {string|null} [uri] Segment uri + * @property {boolean|null} [allowPlaybackInterruption] Segment allowPlaybackInterruption + */ + + /** + * Constructs a new Segment. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio + * @classdesc Represents a Segment. + * @implements ISegment + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment=} [properties] Properties to set + */ + function Segment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Segment audio. + * @member {Uint8Array|null|undefined} audio + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @instance + */ + Segment.prototype.audio = null; + + /** + * Segment uri. + * @member {string|null|undefined} uri + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @instance + */ + Segment.prototype.uri = null; + + /** + * Segment allowPlaybackInterruption. + * @member {boolean} allowPlaybackInterruption + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @instance + */ + Segment.prototype.allowPlaybackInterruption = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Segment content. + * @member {"audio"|"uri"|undefined} content + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @instance + */ + Object.defineProperty(Segment.prototype, "content", { + get: $util.oneOfGetter($oneOfFields = ["audio", "uri"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Segment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment} Segment instance + */ + Segment.create = function create(properties) { + return new Segment(properties); + }; + + /** + * Encodes the specified Segment message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment} message Segment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Segment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audio != null && Object.hasOwnProperty.call(message, "audio")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.audio); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); + if (message.allowPlaybackInterruption != null && Object.hasOwnProperty.call(message, "allowPlaybackInterruption")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowPlaybackInterruption); + return writer; + }; + + /** + * Encodes the specified Segment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.ISegment} message Segment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Segment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Segment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment} Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Segment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.audio = reader.bytes(); + break; + } + case 2: { + message.uri = reader.string(); + break; + } + case 3: { + message.allowPlaybackInterruption = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Segment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment} Segment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Segment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Segment message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Segment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.audio != null && message.hasOwnProperty("audio")) { + properties.content = 1; + if (!(message.audio && typeof message.audio.length === "number" || $util.isString(message.audio))) + return "audio: buffer expected"; + } + if (message.uri != null && message.hasOwnProperty("uri")) { + if (properties.content === 1) + return "content: multiple values"; + properties.content = 1; + if (!$util.isString(message.uri)) + return "uri: string expected"; + } + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + if (typeof message.allowPlaybackInterruption !== "boolean") + return "allowPlaybackInterruption: boolean expected"; + return null; + }; + + /** + * Creates a Segment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment} Segment + */ + Segment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment(); + if (object.audio != null) + if (typeof object.audio === "string") + $util.base64.decode(object.audio, message.audio = $util.newBuffer($util.base64.length(object.audio)), 0); + else if (object.audio.length >= 0) + message.audio = object.audio; + if (object.uri != null) + message.uri = String(object.uri); + if (object.allowPlaybackInterruption != null) + message.allowPlaybackInterruption = Boolean(object.allowPlaybackInterruption); + return message; + }; + + /** + * Creates a plain object from a Segment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment} message Segment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Segment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.allowPlaybackInterruption = false; + if (message.audio != null && message.hasOwnProperty("audio")) { + object.audio = options.bytes === String ? $util.base64.encode(message.audio, 0, message.audio.length) : options.bytes === Array ? Array.prototype.slice.call(message.audio) : message.audio; + if (options.oneofs) + object.content = "audio"; + } + if (message.uri != null && message.hasOwnProperty("uri")) { + object.uri = message.uri; + if (options.oneofs) + object.content = "uri"; + } + if (message.allowPlaybackInterruption != null && message.hasOwnProperty("allowPlaybackInterruption")) + object.allowPlaybackInterruption = message.allowPlaybackInterruption; + return object; + }; + + /** + * Converts this Segment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @instance + * @returns {Object.} JSON object + */ + Segment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Segment + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Segment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ResponseMessage.MixedAudio.Segment"; + }; + + return Segment; + })(); + + return MixedAudio; + })(); + + ResponseMessage.TelephonyTransferCall = (function() { + + /** + * Properties of a TelephonyTransferCall. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @interface ITelephonyTransferCall + * @property {string|null} [phoneNumber] TelephonyTransferCall phoneNumber + * @property {string|null} [sipUri] TelephonyTransferCall sipUri + */ + + /** + * Constructs a new TelephonyTransferCall. + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage + * @classdesc Represents a TelephonyTransferCall. + * @implements ITelephonyTransferCall + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall=} [properties] Properties to set + */ + function TelephonyTransferCall(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TelephonyTransferCall phoneNumber. + * @member {string|null|undefined} phoneNumber + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @instance + */ + TelephonyTransferCall.prototype.phoneNumber = null; + + /** + * TelephonyTransferCall sipUri. + * @member {string|null|undefined} sipUri + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @instance + */ + TelephonyTransferCall.prototype.sipUri = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * TelephonyTransferCall endpoint. + * @member {"phoneNumber"|"sipUri"|undefined} endpoint + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @instance + */ + Object.defineProperty(TelephonyTransferCall.prototype, "endpoint", { + get: $util.oneOfGetter($oneOfFields = ["phoneNumber", "sipUri"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TelephonyTransferCall instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} TelephonyTransferCall instance + */ + TelephonyTransferCall.create = function create(properties) { + return new TelephonyTransferCall(properties); + }; + + /** + * Encodes the specified TelephonyTransferCall message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall} message TelephonyTransferCall message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyTransferCall.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.phoneNumber); + if (message.sipUri != null && Object.hasOwnProperty.call(message, "sipUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sipUri); + return writer; + }; + + /** + * Encodes the specified TelephonyTransferCall message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.ITelephonyTransferCall} message TelephonyTransferCall message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyTransferCall.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyTransferCall.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.phoneNumber = reader.string(); + break; + } + case 2: { + message.sipUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyTransferCall.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TelephonyTransferCall message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TelephonyTransferCall.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) { + properties.endpoint = 1; + if (!$util.isString(message.phoneNumber)) + return "phoneNumber: string expected"; + } + if (message.sipUri != null && message.hasOwnProperty("sipUri")) { + if (properties.endpoint === 1) + return "endpoint: multiple values"; + properties.endpoint = 1; + if (!$util.isString(message.sipUri)) + return "sipUri: string expected"; + } + return null; + }; + + /** + * Creates a TelephonyTransferCall message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} TelephonyTransferCall + */ + TelephonyTransferCall.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall(); + if (object.phoneNumber != null) + message.phoneNumber = String(object.phoneNumber); + if (object.sipUri != null) + message.sipUri = String(object.sipUri); + return message; + }; + + /** + * Creates a plain object from a TelephonyTransferCall message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall} message TelephonyTransferCall + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TelephonyTransferCall.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) { + object.phoneNumber = message.phoneNumber; + if (options.oneofs) + object.endpoint = "phoneNumber"; + } + if (message.sipUri != null && message.hasOwnProperty("sipUri")) { + object.sipUri = message.sipUri; + if (options.oneofs) + object.endpoint = "sipUri"; + } + return object; + }; + + /** + * Converts this TelephonyTransferCall to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @instance + * @returns {Object.} JSON object + */ + TelephonyTransferCall.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TelephonyTransferCall + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TelephonyTransferCall.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ResponseMessage.TelephonyTransferCall"; + }; + + return TelephonyTransferCall; + })(); + + return ResponseMessage; + })(); + + /** + * AudioEncoding enum. + * @name google.cloud.dialogflow.v2beta1.AudioEncoding + * @enum {number} + * @property {number} AUDIO_ENCODING_UNSPECIFIED=0 AUDIO_ENCODING_UNSPECIFIED value + * @property {number} AUDIO_ENCODING_LINEAR_16=1 AUDIO_ENCODING_LINEAR_16 value + * @property {number} AUDIO_ENCODING_FLAC=2 AUDIO_ENCODING_FLAC value + * @property {number} AUDIO_ENCODING_MULAW=3 AUDIO_ENCODING_MULAW value + * @property {number} AUDIO_ENCODING_AMR=4 AUDIO_ENCODING_AMR value + * @property {number} AUDIO_ENCODING_AMR_WB=5 AUDIO_ENCODING_AMR_WB value + * @property {number} AUDIO_ENCODING_OGG_OPUS=6 AUDIO_ENCODING_OGG_OPUS value + * @property {number} AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE=7 AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE value + */ + v2beta1.AudioEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUDIO_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUDIO_ENCODING_LINEAR_16"] = 1; + values[valuesById[2] = "AUDIO_ENCODING_FLAC"] = 2; + values[valuesById[3] = "AUDIO_ENCODING_MULAW"] = 3; + values[valuesById[4] = "AUDIO_ENCODING_AMR"] = 4; + values[valuesById[5] = "AUDIO_ENCODING_AMR_WB"] = 5; + values[valuesById[6] = "AUDIO_ENCODING_OGG_OPUS"] = 6; + values[valuesById[7] = "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE"] = 7; + return values; + })(); + + v2beta1.SpeechContext = (function() { + + /** + * Properties of a SpeechContext. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISpeechContext + * @property {Array.|null} [phrases] SpeechContext phrases + * @property {number|null} [boost] SpeechContext boost + */ + + /** + * Constructs a new SpeechContext. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SpeechContext. + * @implements ISpeechContext + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISpeechContext=} [properties] Properties to set + */ + function SpeechContext(properties) { + this.phrases = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpeechContext phrases. + * @member {Array.} phrases + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @instance + */ + SpeechContext.prototype.phrases = $util.emptyArray; + + /** + * SpeechContext boost. + * @member {number} boost + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @instance + */ + SpeechContext.prototype.boost = 0; + + /** + * Creates a new SpeechContext instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @static + * @param {google.cloud.dialogflow.v2beta1.ISpeechContext=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SpeechContext} SpeechContext instance + */ + SpeechContext.create = function create(properties) { + return new SpeechContext(properties); + }; + + /** + * Encodes the specified SpeechContext message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @static + * @param {google.cloud.dialogflow.v2beta1.ISpeechContext} message SpeechContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phrases != null && message.phrases.length) + for (var i = 0; i < message.phrases.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.phrases[i]); + if (message.boost != null && Object.hasOwnProperty.call(message, "boost")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.boost); + return writer; + }; + + /** + * Encodes the specified SpeechContext message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @static + * @param {google.cloud.dialogflow.v2beta1.ISpeechContext} message SpeechContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpeechContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SpeechContext} SpeechContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechContext.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SpeechContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.phrases && message.phrases.length)) + message.phrases = []; + message.phrases.push(reader.string()); + break; + } + case 2: { + message.boost = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpeechContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SpeechContext} SpeechContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpeechContext message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpeechContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.phrases != null && message.hasOwnProperty("phrases")) { + if (!Array.isArray(message.phrases)) + return "phrases: array expected"; + for (var i = 0; i < message.phrases.length; ++i) + if (!$util.isString(message.phrases[i])) + return "phrases: string[] expected"; + } + if (message.boost != null && message.hasOwnProperty("boost")) + if (typeof message.boost !== "number") + return "boost: number expected"; + return null; + }; + + /** + * Creates a SpeechContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SpeechContext} SpeechContext + */ + SpeechContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SpeechContext) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SpeechContext(); + if (object.phrases) { + if (!Array.isArray(object.phrases)) + throw TypeError(".google.cloud.dialogflow.v2beta1.SpeechContext.phrases: array expected"); + message.phrases = []; + for (var i = 0; i < object.phrases.length; ++i) + message.phrases[i] = String(object.phrases[i]); + } + if (object.boost != null) + message.boost = Number(object.boost); + return message; + }; + + /** + * Creates a plain object from a SpeechContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @static + * @param {google.cloud.dialogflow.v2beta1.SpeechContext} message SpeechContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpeechContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.phrases = []; + if (options.defaults) + object.boost = 0; + if (message.phrases && message.phrases.length) { + object.phrases = []; + for (var j = 0; j < message.phrases.length; ++j) + object.phrases[j] = message.phrases[j]; + } + if (message.boost != null && message.hasOwnProperty("boost")) + object.boost = options.json && !isFinite(message.boost) ? String(message.boost) : message.boost; + return object; + }; + + /** + * Converts this SpeechContext to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @instance + * @returns {Object.} JSON object + */ + SpeechContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SpeechContext + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SpeechContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpeechContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SpeechContext"; + }; + + return SpeechContext; + })(); + + /** + * SpeechModelVariant enum. + * @name google.cloud.dialogflow.v2beta1.SpeechModelVariant + * @enum {number} + * @property {number} SPEECH_MODEL_VARIANT_UNSPECIFIED=0 SPEECH_MODEL_VARIANT_UNSPECIFIED value + * @property {number} USE_BEST_AVAILABLE=1 USE_BEST_AVAILABLE value + * @property {number} USE_STANDARD=2 USE_STANDARD value + * @property {number} USE_ENHANCED=3 USE_ENHANCED value + */ + v2beta1.SpeechModelVariant = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SPEECH_MODEL_VARIANT_UNSPECIFIED"] = 0; + values[valuesById[1] = "USE_BEST_AVAILABLE"] = 1; + values[valuesById[2] = "USE_STANDARD"] = 2; + values[valuesById[3] = "USE_ENHANCED"] = 3; + return values; + })(); + + v2beta1.SpeechWordInfo = (function() { + + /** + * Properties of a SpeechWordInfo. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISpeechWordInfo + * @property {string|null} [word] SpeechWordInfo word + * @property {google.protobuf.IDuration|null} [startOffset] SpeechWordInfo startOffset + * @property {google.protobuf.IDuration|null} [endOffset] SpeechWordInfo endOffset + * @property {number|null} [confidence] SpeechWordInfo confidence + */ + + /** + * Constructs a new SpeechWordInfo. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SpeechWordInfo. + * @implements ISpeechWordInfo + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISpeechWordInfo=} [properties] Properties to set + */ + function SpeechWordInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpeechWordInfo word. + * @member {string} word + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.word = ""; + + /** + * SpeechWordInfo startOffset. + * @member {google.protobuf.IDuration|null|undefined} startOffset + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.startOffset = null; + + /** + * SpeechWordInfo endOffset. + * @member {google.protobuf.IDuration|null|undefined} endOffset + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.endOffset = null; + + /** + * SpeechWordInfo confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @instance + */ + SpeechWordInfo.prototype.confidence = 0; + + /** + * Creates a new SpeechWordInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.ISpeechWordInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SpeechWordInfo} SpeechWordInfo instance + */ + SpeechWordInfo.create = function create(properties) { + return new SpeechWordInfo(properties); + }; + + /** + * Encodes the specified SpeechWordInfo message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechWordInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.ISpeechWordInfo} message SpeechWordInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechWordInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startOffset != null && Object.hasOwnProperty.call(message, "startOffset")) + $root.google.protobuf.Duration.encode(message.startOffset, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endOffset != null && Object.hasOwnProperty.call(message, "endOffset")) + $root.google.protobuf.Duration.encode(message.endOffset, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.word != null && Object.hasOwnProperty.call(message, "word")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.word); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + return writer; + }; + + /** + * Encodes the specified SpeechWordInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechWordInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.ISpeechWordInfo} message SpeechWordInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechWordInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SpeechWordInfo} SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechWordInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SpeechWordInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.word = reader.string(); + break; + } + case 1: { + message.startOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 4: { + message.confidence = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpeechWordInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SpeechWordInfo} SpeechWordInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechWordInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpeechWordInfo message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpeechWordInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.word != null && message.hasOwnProperty("word")) + if (!$util.isString(message.word)) + return "word: string expected"; + if (message.startOffset != null && message.hasOwnProperty("startOffset")) { + var error = $root.google.protobuf.Duration.verify(message.startOffset); + if (error) + return "startOffset." + error; + } + if (message.endOffset != null && message.hasOwnProperty("endOffset")) { + var error = $root.google.protobuf.Duration.verify(message.endOffset); + if (error) + return "endOffset." + error; + } + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + return null; + }; + + /** + * Creates a SpeechWordInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SpeechWordInfo} SpeechWordInfo + */ + SpeechWordInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SpeechWordInfo) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SpeechWordInfo(); + if (object.word != null) + message.word = String(object.word); + if (object.startOffset != null) { + if (typeof object.startOffset !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SpeechWordInfo.startOffset: object expected"); + message.startOffset = $root.google.protobuf.Duration.fromObject(object.startOffset); + } + if (object.endOffset != null) { + if (typeof object.endOffset !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SpeechWordInfo.endOffset: object expected"); + message.endOffset = $root.google.protobuf.Duration.fromObject(object.endOffset); + } + if (object.confidence != null) + message.confidence = Number(object.confidence); + return message; + }; + + /** + * Creates a plain object from a SpeechWordInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.SpeechWordInfo} message SpeechWordInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpeechWordInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startOffset = null; + object.endOffset = null; + object.word = ""; + object.confidence = 0; + } + if (message.startOffset != null && message.hasOwnProperty("startOffset")) + object.startOffset = $root.google.protobuf.Duration.toObject(message.startOffset, options); + if (message.endOffset != null && message.hasOwnProperty("endOffset")) + object.endOffset = $root.google.protobuf.Duration.toObject(message.endOffset, options); + if (message.word != null && message.hasOwnProperty("word")) + object.word = message.word; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + return object; + }; + + /** + * Converts this SpeechWordInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @instance + * @returns {Object.} JSON object + */ + SpeechWordInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SpeechWordInfo + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SpeechWordInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpeechWordInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SpeechWordInfo"; + }; + + return SpeechWordInfo; + })(); + + v2beta1.InputAudioConfig = (function() { + + /** + * Properties of an InputAudioConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IInputAudioConfig + * @property {google.cloud.dialogflow.v2beta1.AudioEncoding|null} [audioEncoding] InputAudioConfig audioEncoding + * @property {number|null} [sampleRateHertz] InputAudioConfig sampleRateHertz + * @property {string|null} [languageCode] InputAudioConfig languageCode + * @property {boolean|null} [enableWordInfo] InputAudioConfig enableWordInfo + * @property {Array.|null} [phraseHints] InputAudioConfig phraseHints + * @property {Array.|null} [speechContexts] InputAudioConfig speechContexts + * @property {string|null} [model] InputAudioConfig model + * @property {google.cloud.dialogflow.v2beta1.SpeechModelVariant|null} [modelVariant] InputAudioConfig modelVariant + * @property {boolean|null} [singleUtterance] InputAudioConfig singleUtterance + * @property {boolean|null} [disableNoSpeechRecognizedEvent] InputAudioConfig disableNoSpeechRecognizedEvent + */ + + /** + * Constructs a new InputAudioConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an InputAudioConfig. + * @implements IInputAudioConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IInputAudioConfig=} [properties] Properties to set + */ + function InputAudioConfig(properties) { + this.phraseHints = []; + this.speechContexts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InputAudioConfig audioEncoding. + * @member {google.cloud.dialogflow.v2beta1.AudioEncoding} audioEncoding + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.audioEncoding = 0; + + /** + * InputAudioConfig sampleRateHertz. + * @member {number} sampleRateHertz + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.sampleRateHertz = 0; + + /** + * InputAudioConfig languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.languageCode = ""; + + /** + * InputAudioConfig enableWordInfo. + * @member {boolean} enableWordInfo + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.enableWordInfo = false; + + /** + * InputAudioConfig phraseHints. + * @member {Array.} phraseHints + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.phraseHints = $util.emptyArray; + + /** + * InputAudioConfig speechContexts. + * @member {Array.} speechContexts + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.speechContexts = $util.emptyArray; + + /** + * InputAudioConfig model. + * @member {string} model + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.model = ""; + + /** + * InputAudioConfig modelVariant. + * @member {google.cloud.dialogflow.v2beta1.SpeechModelVariant} modelVariant + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.modelVariant = 0; + + /** + * InputAudioConfig singleUtterance. + * @member {boolean} singleUtterance + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.singleUtterance = false; + + /** + * InputAudioConfig disableNoSpeechRecognizedEvent. + * @member {boolean} disableNoSpeechRecognizedEvent + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + */ + InputAudioConfig.prototype.disableNoSpeechRecognizedEvent = false; + + /** + * Creates a new InputAudioConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IInputAudioConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.InputAudioConfig} InputAudioConfig instance + */ + InputAudioConfig.create = function create(properties) { + return new InputAudioConfig(properties); + }; + + /** + * Encodes the specified InputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.InputAudioConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IInputAudioConfig} message InputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputAudioConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioEncoding != null && Object.hasOwnProperty.call(message, "audioEncoding")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.audioEncoding); + if (message.sampleRateHertz != null && Object.hasOwnProperty.call(message, "sampleRateHertz")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sampleRateHertz); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.phraseHints != null && message.phraseHints.length) + for (var i = 0; i < message.phraseHints.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.phraseHints[i]); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.model); + if (message.singleUtterance != null && Object.hasOwnProperty.call(message, "singleUtterance")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.singleUtterance); + if (message.modelVariant != null && Object.hasOwnProperty.call(message, "modelVariant")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.modelVariant); + if (message.speechContexts != null && message.speechContexts.length) + for (var i = 0; i < message.speechContexts.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SpeechContext.encode(message.speechContexts[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.enableWordInfo != null && Object.hasOwnProperty.call(message, "enableWordInfo")) + writer.uint32(/* id 13, wireType 0 =*/104).bool(message.enableWordInfo); + if (message.disableNoSpeechRecognizedEvent != null && Object.hasOwnProperty.call(message, "disableNoSpeechRecognizedEvent")) + writer.uint32(/* id 14, wireType 0 =*/112).bool(message.disableNoSpeechRecognizedEvent); + return writer; + }; + + /** + * Encodes the specified InputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.InputAudioConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IInputAudioConfig} message InputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InputAudioConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.InputAudioConfig} InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputAudioConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.InputAudioConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.audioEncoding = reader.int32(); + break; + } + case 2: { + message.sampleRateHertz = reader.int32(); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 13: { + message.enableWordInfo = reader.bool(); + break; + } + case 4: { + if (!(message.phraseHints && message.phraseHints.length)) + message.phraseHints = []; + message.phraseHints.push(reader.string()); + break; + } + case 11: { + if (!(message.speechContexts && message.speechContexts.length)) + message.speechContexts = []; + message.speechContexts.push($root.google.cloud.dialogflow.v2beta1.SpeechContext.decode(reader, reader.uint32())); + break; + } + case 7: { + message.model = reader.string(); + break; + } + case 10: { + message.modelVariant = reader.int32(); + break; + } + case 8: { + message.singleUtterance = reader.bool(); + break; + } + case 14: { + message.disableNoSpeechRecognizedEvent = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InputAudioConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.InputAudioConfig} InputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InputAudioConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InputAudioConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InputAudioConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + switch (message.audioEncoding) { + default: + return "audioEncoding: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + if (!$util.isInteger(message.sampleRateHertz)) + return "sampleRateHertz: integer expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.enableWordInfo != null && message.hasOwnProperty("enableWordInfo")) + if (typeof message.enableWordInfo !== "boolean") + return "enableWordInfo: boolean expected"; + if (message.phraseHints != null && message.hasOwnProperty("phraseHints")) { + if (!Array.isArray(message.phraseHints)) + return "phraseHints: array expected"; + for (var i = 0; i < message.phraseHints.length; ++i) + if (!$util.isString(message.phraseHints[i])) + return "phraseHints: string[] expected"; + } + if (message.speechContexts != null && message.hasOwnProperty("speechContexts")) { + if (!Array.isArray(message.speechContexts)) + return "speechContexts: array expected"; + for (var i = 0; i < message.speechContexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SpeechContext.verify(message.speechContexts[i]); + if (error) + return "speechContexts." + error; + } + } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + if (message.modelVariant != null && message.hasOwnProperty("modelVariant")) + switch (message.modelVariant) { + default: + return "modelVariant: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + if (typeof message.singleUtterance !== "boolean") + return "singleUtterance: boolean expected"; + if (message.disableNoSpeechRecognizedEvent != null && message.hasOwnProperty("disableNoSpeechRecognizedEvent")) + if (typeof message.disableNoSpeechRecognizedEvent !== "boolean") + return "disableNoSpeechRecognizedEvent: boolean expected"; + return null; + }; + + /** + * Creates an InputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.InputAudioConfig} InputAudioConfig + */ + InputAudioConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.InputAudioConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.InputAudioConfig(); + switch (object.audioEncoding) { + default: + if (typeof object.audioEncoding === "number") { + message.audioEncoding = object.audioEncoding; + break; + } + break; + case "AUDIO_ENCODING_UNSPECIFIED": + case 0: + message.audioEncoding = 0; + break; + case "AUDIO_ENCODING_LINEAR_16": + case 1: + message.audioEncoding = 1; + break; + case "AUDIO_ENCODING_FLAC": + case 2: + message.audioEncoding = 2; + break; + case "AUDIO_ENCODING_MULAW": + case 3: + message.audioEncoding = 3; + break; + case "AUDIO_ENCODING_AMR": + case 4: + message.audioEncoding = 4; + break; + case "AUDIO_ENCODING_AMR_WB": + case 5: + message.audioEncoding = 5; + break; + case "AUDIO_ENCODING_OGG_OPUS": + case 6: + message.audioEncoding = 6; + break; + case "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": + case 7: + message.audioEncoding = 7; + break; + } + if (object.sampleRateHertz != null) + message.sampleRateHertz = object.sampleRateHertz | 0; + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.enableWordInfo != null) + message.enableWordInfo = Boolean(object.enableWordInfo); + if (object.phraseHints) { + if (!Array.isArray(object.phraseHints)) + throw TypeError(".google.cloud.dialogflow.v2beta1.InputAudioConfig.phraseHints: array expected"); + message.phraseHints = []; + for (var i = 0; i < object.phraseHints.length; ++i) + message.phraseHints[i] = String(object.phraseHints[i]); + } + if (object.speechContexts) { + if (!Array.isArray(object.speechContexts)) + throw TypeError(".google.cloud.dialogflow.v2beta1.InputAudioConfig.speechContexts: array expected"); + message.speechContexts = []; + for (var i = 0; i < object.speechContexts.length; ++i) { + if (typeof object.speechContexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.InputAudioConfig.speechContexts: object expected"); + message.speechContexts[i] = $root.google.cloud.dialogflow.v2beta1.SpeechContext.fromObject(object.speechContexts[i]); + } + } + if (object.model != null) + message.model = String(object.model); + switch (object.modelVariant) { + default: + if (typeof object.modelVariant === "number") { + message.modelVariant = object.modelVariant; + break; + } + break; + case "SPEECH_MODEL_VARIANT_UNSPECIFIED": + case 0: + message.modelVariant = 0; + break; + case "USE_BEST_AVAILABLE": + case 1: + message.modelVariant = 1; + break; + case "USE_STANDARD": + case 2: + message.modelVariant = 2; + break; + case "USE_ENHANCED": + case 3: + message.modelVariant = 3; + break; + } + if (object.singleUtterance != null) + message.singleUtterance = Boolean(object.singleUtterance); + if (object.disableNoSpeechRecognizedEvent != null) + message.disableNoSpeechRecognizedEvent = Boolean(object.disableNoSpeechRecognizedEvent); + return message; + }; + + /** + * Creates a plain object from an InputAudioConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.InputAudioConfig} message InputAudioConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InputAudioConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.phraseHints = []; + object.speechContexts = []; + } + if (options.defaults) { + object.audioEncoding = options.enums === String ? "AUDIO_ENCODING_UNSPECIFIED" : 0; + object.sampleRateHertz = 0; + object.languageCode = ""; + object.model = ""; + object.singleUtterance = false; + object.modelVariant = options.enums === String ? "SPEECH_MODEL_VARIANT_UNSPECIFIED" : 0; + object.enableWordInfo = false; + object.disableNoSpeechRecognizedEvent = false; + } + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + object.audioEncoding = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.AudioEncoding[message.audioEncoding] === undefined ? message.audioEncoding : $root.google.cloud.dialogflow.v2beta1.AudioEncoding[message.audioEncoding] : message.audioEncoding; + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + object.sampleRateHertz = message.sampleRateHertz; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.phraseHints && message.phraseHints.length) { + object.phraseHints = []; + for (var j = 0; j < message.phraseHints.length; ++j) + object.phraseHints[j] = message.phraseHints[j]; + } + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + object.singleUtterance = message.singleUtterance; + if (message.modelVariant != null && message.hasOwnProperty("modelVariant")) + object.modelVariant = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.SpeechModelVariant[message.modelVariant] === undefined ? message.modelVariant : $root.google.cloud.dialogflow.v2beta1.SpeechModelVariant[message.modelVariant] : message.modelVariant; + if (message.speechContexts && message.speechContexts.length) { + object.speechContexts = []; + for (var j = 0; j < message.speechContexts.length; ++j) + object.speechContexts[j] = $root.google.cloud.dialogflow.v2beta1.SpeechContext.toObject(message.speechContexts[j], options); + } + if (message.enableWordInfo != null && message.hasOwnProperty("enableWordInfo")) + object.enableWordInfo = message.enableWordInfo; + if (message.disableNoSpeechRecognizedEvent != null && message.hasOwnProperty("disableNoSpeechRecognizedEvent")) + object.disableNoSpeechRecognizedEvent = message.disableNoSpeechRecognizedEvent; + return object; + }; + + /** + * Converts this InputAudioConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @instance + * @returns {Object.} JSON object + */ + InputAudioConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InputAudioConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.InputAudioConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputAudioConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.InputAudioConfig"; + }; + + return InputAudioConfig; + })(); + + /** + * SsmlVoiceGender enum. + * @name google.cloud.dialogflow.v2beta1.SsmlVoiceGender + * @enum {number} + * @property {number} SSML_VOICE_GENDER_UNSPECIFIED=0 SSML_VOICE_GENDER_UNSPECIFIED value + * @property {number} SSML_VOICE_GENDER_MALE=1 SSML_VOICE_GENDER_MALE value + * @property {number} SSML_VOICE_GENDER_FEMALE=2 SSML_VOICE_GENDER_FEMALE value + * @property {number} SSML_VOICE_GENDER_NEUTRAL=3 SSML_VOICE_GENDER_NEUTRAL value + */ + v2beta1.SsmlVoiceGender = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SSML_VOICE_GENDER_UNSPECIFIED"] = 0; + values[valuesById[1] = "SSML_VOICE_GENDER_MALE"] = 1; + values[valuesById[2] = "SSML_VOICE_GENDER_FEMALE"] = 2; + values[valuesById[3] = "SSML_VOICE_GENDER_NEUTRAL"] = 3; + return values; + })(); + + v2beta1.VoiceSelectionParams = (function() { + + /** + * Properties of a VoiceSelectionParams. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IVoiceSelectionParams + * @property {string|null} [name] VoiceSelectionParams name + * @property {google.cloud.dialogflow.v2beta1.SsmlVoiceGender|null} [ssmlGender] VoiceSelectionParams ssmlGender + */ + + /** + * Constructs a new VoiceSelectionParams. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a VoiceSelectionParams. + * @implements IVoiceSelectionParams + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IVoiceSelectionParams=} [properties] Properties to set + */ + function VoiceSelectionParams(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * VoiceSelectionParams name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @instance + */ + VoiceSelectionParams.prototype.name = ""; + + /** + * VoiceSelectionParams ssmlGender. + * @member {google.cloud.dialogflow.v2beta1.SsmlVoiceGender} ssmlGender + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @instance + */ + VoiceSelectionParams.prototype.ssmlGender = 0; + + /** + * Creates a new VoiceSelectionParams instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.v2beta1.IVoiceSelectionParams=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.VoiceSelectionParams} VoiceSelectionParams instance + */ + VoiceSelectionParams.create = function create(properties) { + return new VoiceSelectionParams(properties); + }; + + /** + * Encodes the specified VoiceSelectionParams message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.VoiceSelectionParams.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.v2beta1.IVoiceSelectionParams} message VoiceSelectionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoiceSelectionParams.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.ssmlGender != null && Object.hasOwnProperty.call(message, "ssmlGender")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.ssmlGender); + return writer; + }; + + /** + * Encodes the specified VoiceSelectionParams message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.VoiceSelectionParams.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.v2beta1.IVoiceSelectionParams} message VoiceSelectionParams message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VoiceSelectionParams.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.VoiceSelectionParams} VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoiceSelectionParams.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.VoiceSelectionParams(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.ssmlGender = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VoiceSelectionParams message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.VoiceSelectionParams} VoiceSelectionParams + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VoiceSelectionParams.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VoiceSelectionParams message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VoiceSelectionParams.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.ssmlGender != null && message.hasOwnProperty("ssmlGender")) + switch (message.ssmlGender) { + default: + return "ssmlGender: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a VoiceSelectionParams message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.VoiceSelectionParams} VoiceSelectionParams + */ + VoiceSelectionParams.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.VoiceSelectionParams) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.VoiceSelectionParams(); + if (object.name != null) + message.name = String(object.name); + switch (object.ssmlGender) { + default: + if (typeof object.ssmlGender === "number") { + message.ssmlGender = object.ssmlGender; + break; + } + break; + case "SSML_VOICE_GENDER_UNSPECIFIED": + case 0: + message.ssmlGender = 0; + break; + case "SSML_VOICE_GENDER_MALE": + case 1: + message.ssmlGender = 1; + break; + case "SSML_VOICE_GENDER_FEMALE": + case 2: + message.ssmlGender = 2; + break; + case "SSML_VOICE_GENDER_NEUTRAL": + case 3: + message.ssmlGender = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a VoiceSelectionParams message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @static + * @param {google.cloud.dialogflow.v2beta1.VoiceSelectionParams} message VoiceSelectionParams + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VoiceSelectionParams.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.ssmlGender = options.enums === String ? "SSML_VOICE_GENDER_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.ssmlGender != null && message.hasOwnProperty("ssmlGender")) + object.ssmlGender = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.SsmlVoiceGender[message.ssmlGender] === undefined ? message.ssmlGender : $root.google.cloud.dialogflow.v2beta1.SsmlVoiceGender[message.ssmlGender] : message.ssmlGender; + return object; + }; + + /** + * Converts this VoiceSelectionParams to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @instance + * @returns {Object.} JSON object + */ + VoiceSelectionParams.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VoiceSelectionParams + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.VoiceSelectionParams + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VoiceSelectionParams.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.VoiceSelectionParams"; + }; + + return VoiceSelectionParams; + })(); + + v2beta1.SynthesizeSpeechConfig = (function() { + + /** + * Properties of a SynthesizeSpeechConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISynthesizeSpeechConfig + * @property {number|null} [speakingRate] SynthesizeSpeechConfig speakingRate + * @property {number|null} [pitch] SynthesizeSpeechConfig pitch + * @property {number|null} [volumeGainDb] SynthesizeSpeechConfig volumeGainDb + * @property {Array.|null} [effectsProfileId] SynthesizeSpeechConfig effectsProfileId + * @property {google.cloud.dialogflow.v2beta1.IVoiceSelectionParams|null} [voice] SynthesizeSpeechConfig voice + */ + + /** + * Constructs a new SynthesizeSpeechConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SynthesizeSpeechConfig. + * @implements ISynthesizeSpeechConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig=} [properties] Properties to set + */ + function SynthesizeSpeechConfig(properties) { + this.effectsProfileId = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SynthesizeSpeechConfig speakingRate. + * @member {number} speakingRate + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.speakingRate = 0; + + /** + * SynthesizeSpeechConfig pitch. + * @member {number} pitch + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.pitch = 0; + + /** + * SynthesizeSpeechConfig volumeGainDb. + * @member {number} volumeGainDb + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.volumeGainDb = 0; + + /** + * SynthesizeSpeechConfig effectsProfileId. + * @member {Array.} effectsProfileId + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.effectsProfileId = $util.emptyArray; + + /** + * SynthesizeSpeechConfig voice. + * @member {google.cloud.dialogflow.v2beta1.IVoiceSelectionParams|null|undefined} voice + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @instance + */ + SynthesizeSpeechConfig.prototype.voice = null; + + /** + * Creates a new SynthesizeSpeechConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig} SynthesizeSpeechConfig instance + */ + SynthesizeSpeechConfig.create = function create(properties) { + return new SynthesizeSpeechConfig(properties); + }; + + /** + * Encodes the specified SynthesizeSpeechConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig} message SynthesizeSpeechConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SynthesizeSpeechConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.speakingRate != null && Object.hasOwnProperty.call(message, "speakingRate")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.speakingRate); + if (message.pitch != null && Object.hasOwnProperty.call(message, "pitch")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.pitch); + if (message.volumeGainDb != null && Object.hasOwnProperty.call(message, "volumeGainDb")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.volumeGainDb); + if (message.voice != null && Object.hasOwnProperty.call(message, "voice")) + $root.google.cloud.dialogflow.v2beta1.VoiceSelectionParams.encode(message.voice, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.effectsProfileId != null && message.effectsProfileId.length) + for (var i = 0; i < message.effectsProfileId.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.effectsProfileId[i]); + return writer; + }; + + /** + * Encodes the specified SynthesizeSpeechConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig} message SynthesizeSpeechConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SynthesizeSpeechConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig} SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SynthesizeSpeechConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.speakingRate = reader.double(); + break; + } + case 2: { + message.pitch = reader.double(); + break; + } + case 3: { + message.volumeGainDb = reader.double(); + break; + } + case 5: { + if (!(message.effectsProfileId && message.effectsProfileId.length)) + message.effectsProfileId = []; + message.effectsProfileId.push(reader.string()); + break; + } + case 4: { + message.voice = $root.google.cloud.dialogflow.v2beta1.VoiceSelectionParams.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SynthesizeSpeechConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig} SynthesizeSpeechConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SynthesizeSpeechConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SynthesizeSpeechConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SynthesizeSpeechConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.speakingRate != null && message.hasOwnProperty("speakingRate")) + if (typeof message.speakingRate !== "number") + return "speakingRate: number expected"; + if (message.pitch != null && message.hasOwnProperty("pitch")) + if (typeof message.pitch !== "number") + return "pitch: number expected"; + if (message.volumeGainDb != null && message.hasOwnProperty("volumeGainDb")) + if (typeof message.volumeGainDb !== "number") + return "volumeGainDb: number expected"; + if (message.effectsProfileId != null && message.hasOwnProperty("effectsProfileId")) { + if (!Array.isArray(message.effectsProfileId)) + return "effectsProfileId: array expected"; + for (var i = 0; i < message.effectsProfileId.length; ++i) + if (!$util.isString(message.effectsProfileId[i])) + return "effectsProfileId: string[] expected"; + } + if (message.voice != null && message.hasOwnProperty("voice")) { + var error = $root.google.cloud.dialogflow.v2beta1.VoiceSelectionParams.verify(message.voice); + if (error) + return "voice." + error; + } + return null; + }; + + /** + * Creates a SynthesizeSpeechConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig} SynthesizeSpeechConfig + */ + SynthesizeSpeechConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig(); + if (object.speakingRate != null) + message.speakingRate = Number(object.speakingRate); + if (object.pitch != null) + message.pitch = Number(object.pitch); + if (object.volumeGainDb != null) + message.volumeGainDb = Number(object.volumeGainDb); + if (object.effectsProfileId) { + if (!Array.isArray(object.effectsProfileId)) + throw TypeError(".google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.effectsProfileId: array expected"); + message.effectsProfileId = []; + for (var i = 0; i < object.effectsProfileId.length; ++i) + message.effectsProfileId[i] = String(object.effectsProfileId[i]); + } + if (object.voice != null) { + if (typeof object.voice !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.voice: object expected"); + message.voice = $root.google.cloud.dialogflow.v2beta1.VoiceSelectionParams.fromObject(object.voice); + } + return message; + }; + + /** + * Creates a plain object from a SynthesizeSpeechConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig} message SynthesizeSpeechConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SynthesizeSpeechConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.effectsProfileId = []; + if (options.defaults) { + object.speakingRate = 0; + object.pitch = 0; + object.volumeGainDb = 0; + object.voice = null; + } + if (message.speakingRate != null && message.hasOwnProperty("speakingRate")) + object.speakingRate = options.json && !isFinite(message.speakingRate) ? String(message.speakingRate) : message.speakingRate; + if (message.pitch != null && message.hasOwnProperty("pitch")) + object.pitch = options.json && !isFinite(message.pitch) ? String(message.pitch) : message.pitch; + if (message.volumeGainDb != null && message.hasOwnProperty("volumeGainDb")) + object.volumeGainDb = options.json && !isFinite(message.volumeGainDb) ? String(message.volumeGainDb) : message.volumeGainDb; + if (message.voice != null && message.hasOwnProperty("voice")) + object.voice = $root.google.cloud.dialogflow.v2beta1.VoiceSelectionParams.toObject(message.voice, options); + if (message.effectsProfileId && message.effectsProfileId.length) { + object.effectsProfileId = []; + for (var j = 0; j < message.effectsProfileId.length; ++j) + object.effectsProfileId[j] = message.effectsProfileId[j]; + } + return object; + }; + + /** + * Converts this SynthesizeSpeechConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @instance + * @returns {Object.} JSON object + */ + SynthesizeSpeechConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SynthesizeSpeechConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SynthesizeSpeechConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig"; + }; + + return SynthesizeSpeechConfig; + })(); + + /** + * OutputAudioEncoding enum. + * @name google.cloud.dialogflow.v2beta1.OutputAudioEncoding + * @enum {number} + * @property {number} OUTPUT_AUDIO_ENCODING_UNSPECIFIED=0 OUTPUT_AUDIO_ENCODING_UNSPECIFIED value + * @property {number} OUTPUT_AUDIO_ENCODING_LINEAR_16=1 OUTPUT_AUDIO_ENCODING_LINEAR_16 value + * @property {number} OUTPUT_AUDIO_ENCODING_MP3=2 OUTPUT_AUDIO_ENCODING_MP3 value + * @property {number} OUTPUT_AUDIO_ENCODING_MP3_64_KBPS=4 OUTPUT_AUDIO_ENCODING_MP3_64_KBPS value + * @property {number} OUTPUT_AUDIO_ENCODING_OGG_OPUS=3 OUTPUT_AUDIO_ENCODING_OGG_OPUS value + * @property {number} OUTPUT_AUDIO_ENCODING_MULAW=5 OUTPUT_AUDIO_ENCODING_MULAW value + */ + v2beta1.OutputAudioEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OUTPUT_AUDIO_ENCODING_UNSPECIFIED"] = 0; + values[valuesById[1] = "OUTPUT_AUDIO_ENCODING_LINEAR_16"] = 1; + values[valuesById[2] = "OUTPUT_AUDIO_ENCODING_MP3"] = 2; + values[valuesById[4] = "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS"] = 4; + values[valuesById[3] = "OUTPUT_AUDIO_ENCODING_OGG_OPUS"] = 3; + values[valuesById[5] = "OUTPUT_AUDIO_ENCODING_MULAW"] = 5; + return values; + })(); + + v2beta1.OutputAudioConfig = (function() { + + /** + * Properties of an OutputAudioConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IOutputAudioConfig + * @property {google.cloud.dialogflow.v2beta1.OutputAudioEncoding|null} [audioEncoding] OutputAudioConfig audioEncoding + * @property {number|null} [sampleRateHertz] OutputAudioConfig sampleRateHertz + * @property {google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig|null} [synthesizeSpeechConfig] OutputAudioConfig synthesizeSpeechConfig + */ + + /** + * Constructs a new OutputAudioConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an OutputAudioConfig. + * @implements IOutputAudioConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IOutputAudioConfig=} [properties] Properties to set + */ + function OutputAudioConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OutputAudioConfig audioEncoding. + * @member {google.cloud.dialogflow.v2beta1.OutputAudioEncoding} audioEncoding + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @instance + */ + OutputAudioConfig.prototype.audioEncoding = 0; + + /** + * OutputAudioConfig sampleRateHertz. + * @member {number} sampleRateHertz + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @instance + */ + OutputAudioConfig.prototype.sampleRateHertz = 0; + + /** + * OutputAudioConfig synthesizeSpeechConfig. + * @member {google.cloud.dialogflow.v2beta1.ISynthesizeSpeechConfig|null|undefined} synthesizeSpeechConfig + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @instance + */ + OutputAudioConfig.prototype.synthesizeSpeechConfig = null; + + /** + * Creates a new OutputAudioConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IOutputAudioConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.OutputAudioConfig} OutputAudioConfig instance + */ + OutputAudioConfig.create = function create(properties) { + return new OutputAudioConfig(properties); + }; + + /** + * Encodes the specified OutputAudioConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IOutputAudioConfig} message OutputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudioConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioEncoding != null && Object.hasOwnProperty.call(message, "audioEncoding")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.audioEncoding); + if (message.sampleRateHertz != null && Object.hasOwnProperty.call(message, "sampleRateHertz")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sampleRateHertz); + if (message.synthesizeSpeechConfig != null && Object.hasOwnProperty.call(message, "synthesizeSpeechConfig")) + $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.encode(message.synthesizeSpeechConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OutputAudioConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IOutputAudioConfig} message OutputAudioConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OutputAudioConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.OutputAudioConfig} OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudioConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.audioEncoding = reader.int32(); + break; + } + case 2: { + message.sampleRateHertz = reader.int32(); + break; + } + case 3: { + message.synthesizeSpeechConfig = $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OutputAudioConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.OutputAudioConfig} OutputAudioConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OutputAudioConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OutputAudioConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OutputAudioConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + switch (message.audioEncoding) { + default: + return "audioEncoding: enum value expected"; + case 0: + case 1: + case 2: + case 4: + case 3: + case 5: + break; + } + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + if (!$util.isInteger(message.sampleRateHertz)) + return "sampleRateHertz: integer expected"; + if (message.synthesizeSpeechConfig != null && message.hasOwnProperty("synthesizeSpeechConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.verify(message.synthesizeSpeechConfig); + if (error) + return "synthesizeSpeechConfig." + error; + } + return null; + }; + + /** + * Creates an OutputAudioConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.OutputAudioConfig} OutputAudioConfig + */ + OutputAudioConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig(); + switch (object.audioEncoding) { + default: + if (typeof object.audioEncoding === "number") { + message.audioEncoding = object.audioEncoding; + break; + } + break; + case "OUTPUT_AUDIO_ENCODING_UNSPECIFIED": + case 0: + message.audioEncoding = 0; + break; + case "OUTPUT_AUDIO_ENCODING_LINEAR_16": + case 1: + message.audioEncoding = 1; + break; + case "OUTPUT_AUDIO_ENCODING_MP3": + case 2: + message.audioEncoding = 2; + break; + case "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS": + case 4: + message.audioEncoding = 4; + break; + case "OUTPUT_AUDIO_ENCODING_OGG_OPUS": + case 3: + message.audioEncoding = 3; + break; + case "OUTPUT_AUDIO_ENCODING_MULAW": + case 5: + message.audioEncoding = 5; + break; + } + if (object.sampleRateHertz != null) + message.sampleRateHertz = object.sampleRateHertz | 0; + if (object.synthesizeSpeechConfig != null) { + if (typeof object.synthesizeSpeechConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.OutputAudioConfig.synthesizeSpeechConfig: object expected"); + message.synthesizeSpeechConfig = $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.fromObject(object.synthesizeSpeechConfig); + } + return message; + }; + + /** + * Creates a plain object from an OutputAudioConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.OutputAudioConfig} message OutputAudioConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OutputAudioConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.audioEncoding = options.enums === String ? "OUTPUT_AUDIO_ENCODING_UNSPECIFIED" : 0; + object.sampleRateHertz = 0; + object.synthesizeSpeechConfig = null; + } + if (message.audioEncoding != null && message.hasOwnProperty("audioEncoding")) + object.audioEncoding = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.OutputAudioEncoding[message.audioEncoding] === undefined ? message.audioEncoding : $root.google.cloud.dialogflow.v2beta1.OutputAudioEncoding[message.audioEncoding] : message.audioEncoding; + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + object.sampleRateHertz = message.sampleRateHertz; + if (message.synthesizeSpeechConfig != null && message.hasOwnProperty("synthesizeSpeechConfig")) + object.synthesizeSpeechConfig = $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.toObject(message.synthesizeSpeechConfig, options); + return object; + }; + + /** + * Converts this OutputAudioConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @instance + * @returns {Object.} JSON object + */ + OutputAudioConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OutputAudioConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.OutputAudioConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OutputAudioConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.OutputAudioConfig"; + }; + + return OutputAudioConfig; + })(); + + /** + * TelephonyDtmf enum. + * @name google.cloud.dialogflow.v2beta1.TelephonyDtmf + * @enum {number} + * @property {number} TELEPHONY_DTMF_UNSPECIFIED=0 TELEPHONY_DTMF_UNSPECIFIED value + * @property {number} DTMF_ONE=1 DTMF_ONE value + * @property {number} DTMF_TWO=2 DTMF_TWO value + * @property {number} DTMF_THREE=3 DTMF_THREE value + * @property {number} DTMF_FOUR=4 DTMF_FOUR value + * @property {number} DTMF_FIVE=5 DTMF_FIVE value + * @property {number} DTMF_SIX=6 DTMF_SIX value + * @property {number} DTMF_SEVEN=7 DTMF_SEVEN value + * @property {number} DTMF_EIGHT=8 DTMF_EIGHT value + * @property {number} DTMF_NINE=9 DTMF_NINE value + * @property {number} DTMF_ZERO=10 DTMF_ZERO value + * @property {number} DTMF_A=11 DTMF_A value + * @property {number} DTMF_B=12 DTMF_B value + * @property {number} DTMF_C=13 DTMF_C value + * @property {number} DTMF_D=14 DTMF_D value + * @property {number} DTMF_STAR=15 DTMF_STAR value + * @property {number} DTMF_POUND=16 DTMF_POUND value + */ + v2beta1.TelephonyDtmf = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TELEPHONY_DTMF_UNSPECIFIED"] = 0; + values[valuesById[1] = "DTMF_ONE"] = 1; + values[valuesById[2] = "DTMF_TWO"] = 2; + values[valuesById[3] = "DTMF_THREE"] = 3; + values[valuesById[4] = "DTMF_FOUR"] = 4; + values[valuesById[5] = "DTMF_FIVE"] = 5; + values[valuesById[6] = "DTMF_SIX"] = 6; + values[valuesById[7] = "DTMF_SEVEN"] = 7; + values[valuesById[8] = "DTMF_EIGHT"] = 8; + values[valuesById[9] = "DTMF_NINE"] = 9; + values[valuesById[10] = "DTMF_ZERO"] = 10; + values[valuesById[11] = "DTMF_A"] = 11; + values[valuesById[12] = "DTMF_B"] = 12; + values[valuesById[13] = "DTMF_C"] = 13; + values[valuesById[14] = "DTMF_D"] = 14; + values[valuesById[15] = "DTMF_STAR"] = 15; + values[valuesById[16] = "DTMF_POUND"] = 16; + return values; + })(); + + v2beta1.TelephonyDtmfEvents = (function() { + + /** + * Properties of a TelephonyDtmfEvents. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ITelephonyDtmfEvents + * @property {Array.|null} [dtmfEvents] TelephonyDtmfEvents dtmfEvents + */ + + /** + * Constructs a new TelephonyDtmfEvents. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a TelephonyDtmfEvents. + * @implements ITelephonyDtmfEvents + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents=} [properties] Properties to set + */ + function TelephonyDtmfEvents(properties) { + this.dtmfEvents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TelephonyDtmfEvents dtmfEvents. + * @member {Array.} dtmfEvents + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @instance + */ + TelephonyDtmfEvents.prototype.dtmfEvents = $util.emptyArray; + + /** + * Creates a new TelephonyDtmfEvents instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @static + * @param {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents} TelephonyDtmfEvents instance + */ + TelephonyDtmfEvents.create = function create(properties) { + return new TelephonyDtmfEvents(properties); + }; + + /** + * Encodes the specified TelephonyDtmfEvents message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @static + * @param {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents} message TelephonyDtmfEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyDtmfEvents.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dtmfEvents != null && message.dtmfEvents.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.dtmfEvents.length; ++i) + writer.int32(message.dtmfEvents[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified TelephonyDtmfEvents message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @static + * @param {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents} message TelephonyDtmfEvents message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyDtmfEvents.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TelephonyDtmfEvents message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents} TelephonyDtmfEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyDtmfEvents.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.dtmfEvents && message.dtmfEvents.length)) + message.dtmfEvents = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.dtmfEvents.push(reader.int32()); + } else + message.dtmfEvents.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TelephonyDtmfEvents message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents} TelephonyDtmfEvents + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyDtmfEvents.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TelephonyDtmfEvents message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TelephonyDtmfEvents.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dtmfEvents != null && message.hasOwnProperty("dtmfEvents")) { + if (!Array.isArray(message.dtmfEvents)) + return "dtmfEvents: array expected"; + for (var i = 0; i < message.dtmfEvents.length; ++i) + switch (message.dtmfEvents[i]) { + default: + return "dtmfEvents: 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: + break; + } + } + return null; + }; + + /** + * Creates a TelephonyDtmfEvents message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents} TelephonyDtmfEvents + */ + TelephonyDtmfEvents.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents(); + if (object.dtmfEvents) { + if (!Array.isArray(object.dtmfEvents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.dtmfEvents: array expected"); + message.dtmfEvents = []; + for (var i = 0; i < object.dtmfEvents.length; ++i) + switch (object.dtmfEvents[i]) { + default: + if (typeof object.dtmfEvents[i] === "number") { + message.dtmfEvents[i] = object.dtmfEvents[i]; + break; + } + case "TELEPHONY_DTMF_UNSPECIFIED": + case 0: + message.dtmfEvents[i] = 0; + break; + case "DTMF_ONE": + case 1: + message.dtmfEvents[i] = 1; + break; + case "DTMF_TWO": + case 2: + message.dtmfEvents[i] = 2; + break; + case "DTMF_THREE": + case 3: + message.dtmfEvents[i] = 3; + break; + case "DTMF_FOUR": + case 4: + message.dtmfEvents[i] = 4; + break; + case "DTMF_FIVE": + case 5: + message.dtmfEvents[i] = 5; + break; + case "DTMF_SIX": + case 6: + message.dtmfEvents[i] = 6; + break; + case "DTMF_SEVEN": + case 7: + message.dtmfEvents[i] = 7; + break; + case "DTMF_EIGHT": + case 8: + message.dtmfEvents[i] = 8; + break; + case "DTMF_NINE": + case 9: + message.dtmfEvents[i] = 9; + break; + case "DTMF_ZERO": + case 10: + message.dtmfEvents[i] = 10; + break; + case "DTMF_A": + case 11: + message.dtmfEvents[i] = 11; + break; + case "DTMF_B": + case 12: + message.dtmfEvents[i] = 12; + break; + case "DTMF_C": + case 13: + message.dtmfEvents[i] = 13; + break; + case "DTMF_D": + case 14: + message.dtmfEvents[i] = 14; + break; + case "DTMF_STAR": + case 15: + message.dtmfEvents[i] = 15; + break; + case "DTMF_POUND": + case 16: + message.dtmfEvents[i] = 16; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a TelephonyDtmfEvents message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @static + * @param {google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents} message TelephonyDtmfEvents + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TelephonyDtmfEvents.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.dtmfEvents = []; + if (message.dtmfEvents && message.dtmfEvents.length) { + object.dtmfEvents = []; + for (var j = 0; j < message.dtmfEvents.length; ++j) + object.dtmfEvents[j] = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.TelephonyDtmf[message.dtmfEvents[j]] === undefined ? message.dtmfEvents[j] : $root.google.cloud.dialogflow.v2beta1.TelephonyDtmf[message.dtmfEvents[j]] : message.dtmfEvents[j]; + } + return object; + }; + + /** + * Converts this TelephonyDtmfEvents to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @instance + * @returns {Object.} JSON object + */ + TelephonyDtmfEvents.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TelephonyDtmfEvents + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TelephonyDtmfEvents.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents"; + }; + + return TelephonyDtmfEvents; + })(); + + v2beta1.SpeechToTextConfig = (function() { + + /** + * Properties of a SpeechToTextConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISpeechToTextConfig + * @property {google.cloud.dialogflow.v2beta1.SpeechModelVariant|null} [speechModelVariant] SpeechToTextConfig speechModelVariant + * @property {string|null} [model] SpeechToTextConfig model + */ + + /** + * Constructs a new SpeechToTextConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SpeechToTextConfig. + * @implements ISpeechToTextConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISpeechToTextConfig=} [properties] Properties to set + */ + function SpeechToTextConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SpeechToTextConfig speechModelVariant. + * @member {google.cloud.dialogflow.v2beta1.SpeechModelVariant} speechModelVariant + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @instance + */ + SpeechToTextConfig.prototype.speechModelVariant = 0; + + /** + * SpeechToTextConfig model. + * @member {string} model + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @instance + */ + SpeechToTextConfig.prototype.model = ""; + + /** + * Creates a new SpeechToTextConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ISpeechToTextConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SpeechToTextConfig} SpeechToTextConfig instance + */ + SpeechToTextConfig.create = function create(properties) { + return new SpeechToTextConfig(properties); + }; + + /** + * Encodes the specified SpeechToTextConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechToTextConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ISpeechToTextConfig} message SpeechToTextConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechToTextConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.speechModelVariant != null && Object.hasOwnProperty.call(message, "speechModelVariant")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.speechModelVariant); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.model); + return writer; + }; + + /** + * Encodes the specified SpeechToTextConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SpeechToTextConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ISpeechToTextConfig} message SpeechToTextConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SpeechToTextConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SpeechToTextConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SpeechToTextConfig} SpeechToTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechToTextConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SpeechToTextConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.speechModelVariant = reader.int32(); + break; + } + case 2: { + message.model = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SpeechToTextConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SpeechToTextConfig} SpeechToTextConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SpeechToTextConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SpeechToTextConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SpeechToTextConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.speechModelVariant != null && message.hasOwnProperty("speechModelVariant")) + switch (message.speechModelVariant) { + default: + return "speechModelVariant: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates a SpeechToTextConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SpeechToTextConfig} SpeechToTextConfig + */ + SpeechToTextConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SpeechToTextConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SpeechToTextConfig(); + switch (object.speechModelVariant) { + default: + if (typeof object.speechModelVariant === "number") { + message.speechModelVariant = object.speechModelVariant; + break; + } + break; + case "SPEECH_MODEL_VARIANT_UNSPECIFIED": + case 0: + message.speechModelVariant = 0; + break; + case "USE_BEST_AVAILABLE": + case 1: + message.speechModelVariant = 1; + break; + case "USE_STANDARD": + case 2: + message.speechModelVariant = 2; + break; + case "USE_ENHANCED": + case 3: + message.speechModelVariant = 3; + break; + } + if (object.model != null) + message.model = String(object.model); + return message; + }; + + /** + * Creates a plain object from a SpeechToTextConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.SpeechToTextConfig} message SpeechToTextConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SpeechToTextConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.speechModelVariant = options.enums === String ? "SPEECH_MODEL_VARIANT_UNSPECIFIED" : 0; + object.model = ""; + } + if (message.speechModelVariant != null && message.hasOwnProperty("speechModelVariant")) + object.speechModelVariant = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.SpeechModelVariant[message.speechModelVariant] === undefined ? message.speechModelVariant : $root.google.cloud.dialogflow.v2beta1.SpeechModelVariant[message.speechModelVariant] : message.speechModelVariant; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + return object; + }; + + /** + * Converts this SpeechToTextConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @instance + * @returns {Object.} JSON object + */ + SpeechToTextConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SpeechToTextConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SpeechToTextConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SpeechToTextConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SpeechToTextConfig"; + }; + + return SpeechToTextConfig; + })(); + + v2beta1.Sessions = (function() { + + /** + * Constructs a new Sessions service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Sessions + * @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 Sessions(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Sessions.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Sessions; + + /** + * Creates new Sessions service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Sessions + * @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 {Sessions} RPC service. Useful where requests and/or responses are streamed. + */ + Sessions.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Sessions|detectIntent}. + * @memberof google.cloud.dialogflow.v2beta1.Sessions + * @typedef DetectIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.DetectIntentResponse} [response] DetectIntentResponse + */ + + /** + * Calls DetectIntent. + * @function detectIntent + * @memberof google.cloud.dialogflow.v2beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentRequest} request DetectIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Sessions.DetectIntentCallback} callback Node-style callback called with the error, if any, and DetectIntentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Sessions.prototype.detectIntent = function detectIntent(request, callback) { + return this.rpcCall(detectIntent, $root.google.cloud.dialogflow.v2beta1.DetectIntentRequest, $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse, request, callback); + }, "name", { value: "DetectIntent" }); + + /** + * Calls DetectIntent. + * @function detectIntent + * @memberof google.cloud.dialogflow.v2beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentRequest} request DetectIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Sessions|streamingDetectIntent}. + * @memberof google.cloud.dialogflow.v2beta1.Sessions + * @typedef StreamingDetectIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} [response] StreamingDetectIntentResponse + */ + + /** + * Calls StreamingDetectIntent. + * @function streamingDetectIntent + * @memberof google.cloud.dialogflow.v2beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest} request StreamingDetectIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntentCallback} callback Node-style callback called with the error, if any, and StreamingDetectIntentResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Sessions.prototype.streamingDetectIntent = function streamingDetectIntent(request, callback) { + return this.rpcCall(streamingDetectIntent, $root.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest, $root.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse, request, callback); + }, "name", { value: "StreamingDetectIntent" }); + + /** + * Calls StreamingDetectIntent. + * @function streamingDetectIntent + * @memberof google.cloud.dialogflow.v2beta1.Sessions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest} request StreamingDetectIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Sessions; + })(); + + v2beta1.DetectIntentRequest = (function() { + + /** + * Properties of a DetectIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDetectIntentRequest + * @property {string|null} [session] DetectIntentRequest session + * @property {google.cloud.dialogflow.v2beta1.IQueryParameters|null} [queryParams] DetectIntentRequest queryParams + * @property {google.cloud.dialogflow.v2beta1.IQueryInput|null} [queryInput] DetectIntentRequest queryInput + * @property {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null} [outputAudioConfig] DetectIntentRequest outputAudioConfig + * @property {google.protobuf.IFieldMask|null} [outputAudioConfigMask] DetectIntentRequest outputAudioConfigMask + * @property {Uint8Array|null} [inputAudio] DetectIntentRequest inputAudio + */ + + /** + * Constructs a new DetectIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DetectIntentRequest. + * @implements IDetectIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentRequest=} [properties] Properties to set + */ + function DetectIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectIntentRequest session. + * @member {string} session + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.session = ""; + + /** + * DetectIntentRequest queryParams. + * @member {google.cloud.dialogflow.v2beta1.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.queryParams = null; + + /** + * DetectIntentRequest queryInput. + * @member {google.cloud.dialogflow.v2beta1.IQueryInput|null|undefined} queryInput + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.queryInput = null; + + /** + * DetectIntentRequest outputAudioConfig. + * @member {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.outputAudioConfig = null; + + /** + * DetectIntentRequest outputAudioConfigMask. + * @member {google.protobuf.IFieldMask|null|undefined} outputAudioConfigMask + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.outputAudioConfigMask = null; + + /** + * DetectIntentRequest inputAudio. + * @member {Uint8Array} inputAudio + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @instance + */ + DetectIntentRequest.prototype.inputAudio = $util.newBuffer([]); + + /** + * Creates a new DetectIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DetectIntentRequest} DetectIntentRequest instance + */ + DetectIntentRequest.create = function create(properties) { + return new DetectIntentRequest(properties); + }; + + /** + * Encodes the specified DetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentRequest} message DetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.v2beta1.QueryParameters.encode(message.queryParams, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.queryInput != null && Object.hasOwnProperty.call(message, "queryInput")) + $root.google.cloud.dialogflow.v2beta1.QueryInput.encode(message.queryInput, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.inputAudio != null && Object.hasOwnProperty.call(message, "inputAudio")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.inputAudio); + if (message.outputAudioConfigMask != null && Object.hasOwnProperty.call(message, "outputAudioConfigMask")) + $root.google.protobuf.FieldMask.encode(message.outputAudioConfigMask, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentRequest} message DetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DetectIntentRequest} DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DetectIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.session = reader.string(); + break; + } + case 2: { + message.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.decode(reader, reader.uint32()); + break; + } + case 3: { + message.queryInput = $root.google.cloud.dialogflow.v2beta1.QueryInput.decode(reader, reader.uint32()); + break; + } + case 4: { + message.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.outputAudioConfigMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 5: { + message.inputAudio = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DetectIntentRequest} DetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.queryInput != null && message.hasOwnProperty("queryInput")) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryInput.verify(message.queryInput); + if (error) + return "queryInput." + error; + } + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + if (message.outputAudioConfigMask != null && message.hasOwnProperty("outputAudioConfigMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.outputAudioConfigMask); + if (error) + return "outputAudioConfigMask." + error; + } + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) + if (!(message.inputAudio && typeof message.inputAudio.length === "number" || $util.isString(message.inputAudio))) + return "inputAudio: buffer expected"; + return null; + }; + + /** + * Creates a DetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DetectIntentRequest} DetectIntentRequest + */ + DetectIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DetectIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DetectIntentRequest(); + if (object.session != null) + message.session = String(object.session); + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.DetectIntentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.fromObject(object.queryParams); + } + if (object.queryInput != null) { + if (typeof object.queryInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.DetectIntentRequest.queryInput: object expected"); + message.queryInput = $root.google.cloud.dialogflow.v2beta1.QueryInput.fromObject(object.queryInput); + } + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.DetectIntentRequest.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + if (object.outputAudioConfigMask != null) { + if (typeof object.outputAudioConfigMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.DetectIntentRequest.outputAudioConfigMask: object expected"); + message.outputAudioConfigMask = $root.google.protobuf.FieldMask.fromObject(object.outputAudioConfigMask); + } + if (object.inputAudio != null) + if (typeof object.inputAudio === "string") + $util.base64.decode(object.inputAudio, message.inputAudio = $util.newBuffer($util.base64.length(object.inputAudio)), 0); + else if (object.inputAudio.length >= 0) + message.inputAudio = object.inputAudio; + return message; + }; + + /** + * Creates a plain object from a DetectIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DetectIntentRequest} message DetectIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.session = ""; + object.queryParams = null; + object.queryInput = null; + object.outputAudioConfig = null; + if (options.bytes === String) + object.inputAudio = ""; + else { + object.inputAudio = []; + if (options.bytes !== Array) + object.inputAudio = $util.newBuffer(object.inputAudio); + } + object.outputAudioConfigMask = null; + } + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.toObject(message.queryParams, options); + if (message.queryInput != null && message.hasOwnProperty("queryInput")) + object.queryInput = $root.google.cloud.dialogflow.v2beta1.QueryInput.toObject(message.queryInput, options); + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.toObject(message.outputAudioConfig, options); + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) + object.inputAudio = options.bytes === String ? $util.base64.encode(message.inputAudio, 0, message.inputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.inputAudio) : message.inputAudio; + if (message.outputAudioConfigMask != null && message.hasOwnProperty("outputAudioConfigMask")) + object.outputAudioConfigMask = $root.google.protobuf.FieldMask.toObject(message.outputAudioConfigMask, options); + return object; + }; + + /** + * Converts this DetectIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @instance + * @returns {Object.} JSON object + */ + DetectIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DetectIntentRequest"; + }; + + return DetectIntentRequest; + })(); + + v2beta1.DetectIntentResponse = (function() { + + /** + * Properties of a DetectIntentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDetectIntentResponse + * @property {string|null} [responseId] DetectIntentResponse responseId + * @property {google.cloud.dialogflow.v2beta1.IQueryResult|null} [queryResult] DetectIntentResponse queryResult + * @property {Array.|null} [alternativeQueryResults] DetectIntentResponse alternativeQueryResults + * @property {google.rpc.IStatus|null} [webhookStatus] DetectIntentResponse webhookStatus + * @property {Uint8Array|null} [outputAudio] DetectIntentResponse outputAudio + * @property {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null} [outputAudioConfig] DetectIntentResponse outputAudioConfig + */ + + /** + * Constructs a new DetectIntentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DetectIntentResponse. + * @implements IDetectIntentResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentResponse=} [properties] Properties to set + */ + function DetectIntentResponse(properties) { + this.alternativeQueryResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DetectIntentResponse responseId. + * @member {string} responseId + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.responseId = ""; + + /** + * DetectIntentResponse queryResult. + * @member {google.cloud.dialogflow.v2beta1.IQueryResult|null|undefined} queryResult + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.queryResult = null; + + /** + * DetectIntentResponse alternativeQueryResults. + * @member {Array.} alternativeQueryResults + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.alternativeQueryResults = $util.emptyArray; + + /** + * DetectIntentResponse webhookStatus. + * @member {google.rpc.IStatus|null|undefined} webhookStatus + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.webhookStatus = null; + + /** + * DetectIntentResponse outputAudio. + * @member {Uint8Array} outputAudio + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.outputAudio = $util.newBuffer([]); + + /** + * DetectIntentResponse outputAudioConfig. + * @member {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @instance + */ + DetectIntentResponse.prototype.outputAudioConfig = null; + + /** + * Creates a new DetectIntentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DetectIntentResponse} DetectIntentResponse instance + */ + DetectIntentResponse.create = function create(properties) { + return new DetectIntentResponse(properties); + }; + + /** + * Encodes the specified DetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DetectIntentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentResponse} message DetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseId != null && Object.hasOwnProperty.call(message, "responseId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseId); + if (message.queryResult != null && Object.hasOwnProperty.call(message, "queryResult")) + $root.google.cloud.dialogflow.v2beta1.QueryResult.encode(message.queryResult, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.webhookStatus != null && Object.hasOwnProperty.call(message, "webhookStatus")) + $root.google.rpc.Status.encode(message.webhookStatus, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.outputAudio != null && Object.hasOwnProperty.call(message, "outputAudio")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.outputAudio); + if (message.alternativeQueryResults != null && message.alternativeQueryResults.length) + for (var i = 0; i < message.alternativeQueryResults.length; ++i) + $root.google.cloud.dialogflow.v2beta1.QueryResult.encode(message.alternativeQueryResults[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DetectIntentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IDetectIntentResponse} message DetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DetectIntentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DetectIntentResponse} DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.responseId = reader.string(); + break; + } + case 2: { + message.queryResult = $root.google.cloud.dialogflow.v2beta1.QueryResult.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.alternativeQueryResults && message.alternativeQueryResults.length)) + message.alternativeQueryResults = []; + message.alternativeQueryResults.push($root.google.cloud.dialogflow.v2beta1.QueryResult.decode(reader, reader.uint32())); + break; + } + case 3: { + message.webhookStatus = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 4: { + message.outputAudio = reader.bytes(); + break; + } + case 6: { + message.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DetectIntentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DetectIntentResponse} DetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DetectIntentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DetectIntentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DetectIntentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseId != null && message.hasOwnProperty("responseId")) + if (!$util.isString(message.responseId)) + return "responseId: string expected"; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryResult.verify(message.queryResult); + if (error) + return "queryResult." + error; + } + if (message.alternativeQueryResults != null && message.hasOwnProperty("alternativeQueryResults")) { + if (!Array.isArray(message.alternativeQueryResults)) + return "alternativeQueryResults: array expected"; + for (var i = 0; i < message.alternativeQueryResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryResult.verify(message.alternativeQueryResults[i]); + if (error) + return "alternativeQueryResults." + error; + } + } + if (message.webhookStatus != null && message.hasOwnProperty("webhookStatus")) { + var error = $root.google.rpc.Status.verify(message.webhookStatus); + if (error) + return "webhookStatus." + error; + } + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + if (!(message.outputAudio && typeof message.outputAudio.length === "number" || $util.isString(message.outputAudio))) + return "outputAudio: buffer expected"; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + return null; + }; + + /** + * Creates a DetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DetectIntentResponse} DetectIntentResponse + */ + DetectIntentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DetectIntentResponse(); + if (object.responseId != null) + message.responseId = String(object.responseId); + if (object.queryResult != null) { + if (typeof object.queryResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.DetectIntentResponse.queryResult: object expected"); + message.queryResult = $root.google.cloud.dialogflow.v2beta1.QueryResult.fromObject(object.queryResult); + } + if (object.alternativeQueryResults) { + if (!Array.isArray(object.alternativeQueryResults)) + throw TypeError(".google.cloud.dialogflow.v2beta1.DetectIntentResponse.alternativeQueryResults: array expected"); + message.alternativeQueryResults = []; + for (var i = 0; i < object.alternativeQueryResults.length; ++i) { + if (typeof object.alternativeQueryResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.DetectIntentResponse.alternativeQueryResults: object expected"); + message.alternativeQueryResults[i] = $root.google.cloud.dialogflow.v2beta1.QueryResult.fromObject(object.alternativeQueryResults[i]); + } + } + if (object.webhookStatus != null) { + if (typeof object.webhookStatus !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.DetectIntentResponse.webhookStatus: object expected"); + message.webhookStatus = $root.google.rpc.Status.fromObject(object.webhookStatus); + } + if (object.outputAudio != null) + if (typeof object.outputAudio === "string") + $util.base64.decode(object.outputAudio, message.outputAudio = $util.newBuffer($util.base64.length(object.outputAudio)), 0); + else if (object.outputAudio.length >= 0) + message.outputAudio = object.outputAudio; + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.DetectIntentResponse.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + return message; + }; + + /** + * Creates a plain object from a DetectIntentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.DetectIntentResponse} message DetectIntentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DetectIntentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.alternativeQueryResults = []; + if (options.defaults) { + object.responseId = ""; + object.queryResult = null; + object.webhookStatus = null; + if (options.bytes === String) + object.outputAudio = ""; + else { + object.outputAudio = []; + if (options.bytes !== Array) + object.outputAudio = $util.newBuffer(object.outputAudio); + } + object.outputAudioConfig = null; + } + if (message.responseId != null && message.hasOwnProperty("responseId")) + object.responseId = message.responseId; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) + object.queryResult = $root.google.cloud.dialogflow.v2beta1.QueryResult.toObject(message.queryResult, options); + if (message.webhookStatus != null && message.hasOwnProperty("webhookStatus")) + object.webhookStatus = $root.google.rpc.Status.toObject(message.webhookStatus, options); + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + object.outputAudio = options.bytes === String ? $util.base64.encode(message.outputAudio, 0, message.outputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.outputAudio) : message.outputAudio; + if (message.alternativeQueryResults && message.alternativeQueryResults.length) { + object.alternativeQueryResults = []; + for (var j = 0; j < message.alternativeQueryResults.length; ++j) + object.alternativeQueryResults[j] = $root.google.cloud.dialogflow.v2beta1.QueryResult.toObject(message.alternativeQueryResults[j], options); + } + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.toObject(message.outputAudioConfig, options); + return object; + }; + + /** + * Converts this DetectIntentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @instance + * @returns {Object.} JSON object + */ + DetectIntentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DetectIntentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DetectIntentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DetectIntentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DetectIntentResponse"; + }; + + return DetectIntentResponse; + })(); + + v2beta1.QueryParameters = (function() { + + /** + * Properties of a QueryParameters. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IQueryParameters + * @property {string|null} [timeZone] QueryParameters timeZone + * @property {google.type.ILatLng|null} [geoLocation] QueryParameters geoLocation + * @property {Array.|null} [contexts] QueryParameters contexts + * @property {boolean|null} [resetContexts] QueryParameters resetContexts + * @property {Array.|null} [sessionEntityTypes] QueryParameters sessionEntityTypes + * @property {google.protobuf.IStruct|null} [payload] QueryParameters payload + * @property {Array.|null} [knowledgeBaseNames] QueryParameters knowledgeBaseNames + * @property {google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig|null} [sentimentAnalysisRequestConfig] QueryParameters sentimentAnalysisRequestConfig + * @property {Array.|null} [subAgents] QueryParameters subAgents + * @property {Object.|null} [webhookHeaders] QueryParameters webhookHeaders + */ + + /** + * Constructs a new QueryParameters. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a QueryParameters. + * @implements IQueryParameters + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IQueryParameters=} [properties] Properties to set + */ + function QueryParameters(properties) { + this.contexts = []; + this.sessionEntityTypes = []; + this.knowledgeBaseNames = []; + this.subAgents = []; + this.webhookHeaders = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryParameters timeZone. + * @member {string} timeZone + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.timeZone = ""; + + /** + * QueryParameters geoLocation. + * @member {google.type.ILatLng|null|undefined} geoLocation + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.geoLocation = null; + + /** + * QueryParameters contexts. + * @member {Array.} contexts + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.contexts = $util.emptyArray; + + /** + * QueryParameters resetContexts. + * @member {boolean} resetContexts + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.resetContexts = false; + + /** + * QueryParameters sessionEntityTypes. + * @member {Array.} sessionEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.sessionEntityTypes = $util.emptyArray; + + /** + * QueryParameters payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.payload = null; + + /** + * QueryParameters knowledgeBaseNames. + * @member {Array.} knowledgeBaseNames + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.knowledgeBaseNames = $util.emptyArray; + + /** + * QueryParameters sentimentAnalysisRequestConfig. + * @member {google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig|null|undefined} sentimentAnalysisRequestConfig + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.sentimentAnalysisRequestConfig = null; + + /** + * QueryParameters subAgents. + * @member {Array.} subAgents + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.subAgents = $util.emptyArray; + + /** + * QueryParameters webhookHeaders. + * @member {Object.} webhookHeaders + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + */ + QueryParameters.prototype.webhookHeaders = $util.emptyObject; + + /** + * Creates a new QueryParameters instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.IQueryParameters=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.QueryParameters} QueryParameters instance + */ + QueryParameters.create = function create(properties) { + return new QueryParameters(properties); + }; + + /** + * Encodes the specified QueryParameters message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryParameters.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.IQueryParameters} message QueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParameters.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.timeZone); + if (message.geoLocation != null && Object.hasOwnProperty.call(message, "geoLocation")) + $root.google.type.LatLng.encode(message.geoLocation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.contexts != null && message.contexts.length) + for (var i = 0; i < message.contexts.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Context.encode(message.contexts[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.resetContexts != null && Object.hasOwnProperty.call(message, "resetContexts")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.resetContexts); + if (message.sessionEntityTypes != null && message.sessionEntityTypes.length) + for (var i = 0; i < message.sessionEntityTypes.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SessionEntityType.encode(message.sessionEntityTypes[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.sentimentAnalysisRequestConfig != null && Object.hasOwnProperty.call(message, "sentimentAnalysisRequestConfig")) + $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.encode(message.sentimentAnalysisRequestConfig, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.knowledgeBaseNames != null && message.knowledgeBaseNames.length) + for (var i = 0; i < message.knowledgeBaseNames.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.knowledgeBaseNames[i]); + if (message.subAgents != null && message.subAgents.length) + for (var i = 0; i < message.subAgents.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SubAgent.encode(message.subAgents[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.webhookHeaders != null && Object.hasOwnProperty.call(message, "webhookHeaders")) + for (var keys = Object.keys(message.webhookHeaders), i = 0; i < keys.length; ++i) + writer.uint32(/* id 14, wireType 2 =*/114).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.webhookHeaders[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryParameters message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryParameters.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.IQueryParameters} message QueryParameters message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryParameters.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryParameters message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.QueryParameters} QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParameters.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.QueryParameters(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.timeZone = reader.string(); + break; + } + case 2: { + message.geoLocation = $root.google.type.LatLng.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.contexts && message.contexts.length)) + message.contexts = []; + message.contexts.push($root.google.cloud.dialogflow.v2beta1.Context.decode(reader, reader.uint32())); + break; + } + case 4: { + message.resetContexts = reader.bool(); + break; + } + case 5: { + if (!(message.sessionEntityTypes && message.sessionEntityTypes.length)) + message.sessionEntityTypes = []; + message.sessionEntityTypes.push($root.google.cloud.dialogflow.v2beta1.SessionEntityType.decode(reader, reader.uint32())); + break; + } + case 6: { + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 12: { + if (!(message.knowledgeBaseNames && message.knowledgeBaseNames.length)) + message.knowledgeBaseNames = []; + message.knowledgeBaseNames.push(reader.string()); + break; + } + case 10: { + message.sentimentAnalysisRequestConfig = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.decode(reader, reader.uint32()); + break; + } + case 13: { + if (!(message.subAgents && message.subAgents.length)) + message.subAgents = []; + message.subAgents.push($root.google.cloud.dialogflow.v2beta1.SubAgent.decode(reader, reader.uint32())); + break; + } + case 14: { + if (message.webhookHeaders === $util.emptyObject) + message.webhookHeaders = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.webhookHeaders[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryParameters message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.QueryParameters} QueryParameters + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryParameters.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryParameters message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryParameters.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.geoLocation != null && message.hasOwnProperty("geoLocation")) { + var error = $root.google.type.LatLng.verify(message.geoLocation); + if (error) + return "geoLocation." + error; + } + if (message.contexts != null && message.hasOwnProperty("contexts")) { + if (!Array.isArray(message.contexts)) + return "contexts: array expected"; + for (var i = 0; i < message.contexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Context.verify(message.contexts[i]); + if (error) + return "contexts." + error; + } + } + if (message.resetContexts != null && message.hasOwnProperty("resetContexts")) + if (typeof message.resetContexts !== "boolean") + return "resetContexts: boolean expected"; + if (message.sessionEntityTypes != null && message.hasOwnProperty("sessionEntityTypes")) { + if (!Array.isArray(message.sessionEntityTypes)) + return "sessionEntityTypes: array expected"; + for (var i = 0; i < message.sessionEntityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.verify(message.sessionEntityTypes[i]); + if (error) + return "sessionEntityTypes." + error; + } + } + if (message.payload != null && message.hasOwnProperty("payload")) { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + if (message.knowledgeBaseNames != null && message.hasOwnProperty("knowledgeBaseNames")) { + if (!Array.isArray(message.knowledgeBaseNames)) + return "knowledgeBaseNames: array expected"; + for (var i = 0; i < message.knowledgeBaseNames.length; ++i) + if (!$util.isString(message.knowledgeBaseNames[i])) + return "knowledgeBaseNames: string[] expected"; + } + if (message.sentimentAnalysisRequestConfig != null && message.hasOwnProperty("sentimentAnalysisRequestConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.verify(message.sentimentAnalysisRequestConfig); + if (error) + return "sentimentAnalysisRequestConfig." + error; + } + if (message.subAgents != null && message.hasOwnProperty("subAgents")) { + if (!Array.isArray(message.subAgents)) + return "subAgents: array expected"; + for (var i = 0; i < message.subAgents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SubAgent.verify(message.subAgents[i]); + if (error) + return "subAgents." + error; + } + } + if (message.webhookHeaders != null && message.hasOwnProperty("webhookHeaders")) { + if (!$util.isObject(message.webhookHeaders)) + return "webhookHeaders: object expected"; + var key = Object.keys(message.webhookHeaders); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.webhookHeaders[key[i]])) + return "webhookHeaders: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a QueryParameters message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.QueryParameters} QueryParameters + */ + QueryParameters.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.QueryParameters) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.QueryParameters(); + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.geoLocation != null) { + if (typeof object.geoLocation !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.geoLocation: object expected"); + message.geoLocation = $root.google.type.LatLng.fromObject(object.geoLocation); + } + if (object.contexts) { + if (!Array.isArray(object.contexts)) + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.contexts: array expected"); + message.contexts = []; + for (var i = 0; i < object.contexts.length; ++i) { + if (typeof object.contexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.contexts: object expected"); + message.contexts[i] = $root.google.cloud.dialogflow.v2beta1.Context.fromObject(object.contexts[i]); + } + } + if (object.resetContexts != null) + message.resetContexts = Boolean(object.resetContexts); + if (object.sessionEntityTypes) { + if (!Array.isArray(object.sessionEntityTypes)) + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.sessionEntityTypes: array expected"); + message.sessionEntityTypes = []; + for (var i = 0; i < object.sessionEntityTypes.length; ++i) { + if (typeof object.sessionEntityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.sessionEntityTypes: object expected"); + message.sessionEntityTypes[i] = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.fromObject(object.sessionEntityTypes[i]); + } + } + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.knowledgeBaseNames) { + if (!Array.isArray(object.knowledgeBaseNames)) + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.knowledgeBaseNames: array expected"); + message.knowledgeBaseNames = []; + for (var i = 0; i < object.knowledgeBaseNames.length; ++i) + message.knowledgeBaseNames[i] = String(object.knowledgeBaseNames[i]); + } + if (object.sentimentAnalysisRequestConfig != null) { + if (typeof object.sentimentAnalysisRequestConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.sentimentAnalysisRequestConfig: object expected"); + message.sentimentAnalysisRequestConfig = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.fromObject(object.sentimentAnalysisRequestConfig); + } + if (object.subAgents) { + if (!Array.isArray(object.subAgents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.subAgents: array expected"); + message.subAgents = []; + for (var i = 0; i < object.subAgents.length; ++i) { + if (typeof object.subAgents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.subAgents: object expected"); + message.subAgents[i] = $root.google.cloud.dialogflow.v2beta1.SubAgent.fromObject(object.subAgents[i]); + } + } + if (object.webhookHeaders) { + if (typeof object.webhookHeaders !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryParameters.webhookHeaders: object expected"); + message.webhookHeaders = {}; + for (var keys = Object.keys(object.webhookHeaders), i = 0; i < keys.length; ++i) + message.webhookHeaders[keys[i]] = String(object.webhookHeaders[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a QueryParameters message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @static + * @param {google.cloud.dialogflow.v2beta1.QueryParameters} message QueryParameters + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryParameters.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.contexts = []; + object.sessionEntityTypes = []; + object.knowledgeBaseNames = []; + object.subAgents = []; + } + if (options.objects || options.defaults) + object.webhookHeaders = {}; + if (options.defaults) { + object.timeZone = ""; + object.geoLocation = null; + object.resetContexts = false; + object.payload = null; + object.sentimentAnalysisRequestConfig = null; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.geoLocation != null && message.hasOwnProperty("geoLocation")) + object.geoLocation = $root.google.type.LatLng.toObject(message.geoLocation, options); + if (message.contexts && message.contexts.length) { + object.contexts = []; + for (var j = 0; j < message.contexts.length; ++j) + object.contexts[j] = $root.google.cloud.dialogflow.v2beta1.Context.toObject(message.contexts[j], options); + } + if (message.resetContexts != null && message.hasOwnProperty("resetContexts")) + object.resetContexts = message.resetContexts; + if (message.sessionEntityTypes && message.sessionEntityTypes.length) { + object.sessionEntityTypes = []; + for (var j = 0; j < message.sessionEntityTypes.length; ++j) + object.sessionEntityTypes[j] = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.toObject(message.sessionEntityTypes[j], options); + } + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (message.sentimentAnalysisRequestConfig != null && message.hasOwnProperty("sentimentAnalysisRequestConfig")) + object.sentimentAnalysisRequestConfig = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.toObject(message.sentimentAnalysisRequestConfig, options); + if (message.knowledgeBaseNames && message.knowledgeBaseNames.length) { + object.knowledgeBaseNames = []; + for (var j = 0; j < message.knowledgeBaseNames.length; ++j) + object.knowledgeBaseNames[j] = message.knowledgeBaseNames[j]; + } + if (message.subAgents && message.subAgents.length) { + object.subAgents = []; + for (var j = 0; j < message.subAgents.length; ++j) + object.subAgents[j] = $root.google.cloud.dialogflow.v2beta1.SubAgent.toObject(message.subAgents[j], options); + } + var keys2; + if (message.webhookHeaders && (keys2 = Object.keys(message.webhookHeaders)).length) { + object.webhookHeaders = {}; + for (var j = 0; j < keys2.length; ++j) + object.webhookHeaders[keys2[j]] = message.webhookHeaders[keys2[j]]; + } + return object; + }; + + /** + * Converts this QueryParameters to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @instance + * @returns {Object.} JSON object + */ + QueryParameters.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryParameters + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.QueryParameters + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryParameters.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.QueryParameters"; + }; + + return QueryParameters; + })(); + + v2beta1.QueryInput = (function() { + + /** + * Properties of a QueryInput. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IQueryInput + * @property {google.cloud.dialogflow.v2beta1.IInputAudioConfig|null} [audioConfig] QueryInput audioConfig + * @property {google.cloud.dialogflow.v2beta1.ITextInput|null} [text] QueryInput text + * @property {google.cloud.dialogflow.v2beta1.IEventInput|null} [event] QueryInput event + * @property {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null} [dtmf] QueryInput dtmf + */ + + /** + * Constructs a new QueryInput. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a QueryInput. + * @implements IQueryInput + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IQueryInput=} [properties] Properties to set + */ + function QueryInput(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryInput audioConfig. + * @member {google.cloud.dialogflow.v2beta1.IInputAudioConfig|null|undefined} audioConfig + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @instance + */ + QueryInput.prototype.audioConfig = null; + + /** + * QueryInput text. + * @member {google.cloud.dialogflow.v2beta1.ITextInput|null|undefined} text + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @instance + */ + QueryInput.prototype.text = null; + + /** + * QueryInput event. + * @member {google.cloud.dialogflow.v2beta1.IEventInput|null|undefined} event + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @instance + */ + QueryInput.prototype.event = null; + + /** + * QueryInput dtmf. + * @member {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null|undefined} dtmf + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @instance + */ + QueryInput.prototype.dtmf = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * QueryInput input. + * @member {"audioConfig"|"text"|"event"|"dtmf"|undefined} input + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @instance + */ + Object.defineProperty(QueryInput.prototype, "input", { + get: $util.oneOfGetter($oneOfFields = ["audioConfig", "text", "event", "dtmf"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new QueryInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @static + * @param {google.cloud.dialogflow.v2beta1.IQueryInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.QueryInput} QueryInput instance + */ + QueryInput.create = function create(properties) { + return new QueryInput(properties); + }; + + /** + * Encodes the specified QueryInput message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @static + * @param {google.cloud.dialogflow.v2beta1.IQueryInput} message QueryInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioConfig != null && Object.hasOwnProperty.call(message, "audioConfig")) + $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.encode(message.audioConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + $root.google.cloud.dialogflow.v2beta1.TextInput.encode(message.text, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.event != null && Object.hasOwnProperty.call(message, "event")) + $root.google.cloud.dialogflow.v2beta1.EventInput.encode(message.event, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.dtmf != null && Object.hasOwnProperty.call(message, "dtmf")) + $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.encode(message.dtmf, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @static + * @param {google.cloud.dialogflow.v2beta1.IQueryInput} message QueryInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.QueryInput} QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInput.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.QueryInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.audioConfig = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.text = $root.google.cloud.dialogflow.v2beta1.TextInput.decode(reader, reader.uint32()); + break; + } + case 3: { + message.event = $root.google.cloud.dialogflow.v2beta1.EventInput.decode(reader, reader.uint32()); + break; + } + case 4: { + message.dtmf = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.QueryInput} QueryInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryInput message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.verify(message.audioConfig); + if (error) + return "audioConfig." + error; + } + } + if (message.text != null && message.hasOwnProperty("text")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.TextInput.verify(message.text); + if (error) + return "text." + error; + } + } + if (message.event != null && message.hasOwnProperty("event")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.EventInput.verify(message.event); + if (error) + return "event." + error; + } + } + if (message.dtmf != null && message.hasOwnProperty("dtmf")) { + if (properties.input === 1) + return "input: multiple values"; + properties.input = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.verify(message.dtmf); + if (error) + return "dtmf." + error; + } + } + return null; + }; + + /** + * Creates a QueryInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.QueryInput} QueryInput + */ + QueryInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.QueryInput) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.QueryInput(); + if (object.audioConfig != null) { + if (typeof object.audioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryInput.audioConfig: object expected"); + message.audioConfig = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.fromObject(object.audioConfig); + } + if (object.text != null) { + if (typeof object.text !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryInput.text: object expected"); + message.text = $root.google.cloud.dialogflow.v2beta1.TextInput.fromObject(object.text); + } + if (object.event != null) { + if (typeof object.event !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryInput.event: object expected"); + message.event = $root.google.cloud.dialogflow.v2beta1.EventInput.fromObject(object.event); + } + if (object.dtmf != null) { + if (typeof object.dtmf !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryInput.dtmf: object expected"); + message.dtmf = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.fromObject(object.dtmf); + } + return message; + }; + + /** + * Creates a plain object from a QueryInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @static + * @param {google.cloud.dialogflow.v2beta1.QueryInput} message QueryInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.audioConfig != null && message.hasOwnProperty("audioConfig")) { + object.audioConfig = $root.google.cloud.dialogflow.v2beta1.InputAudioConfig.toObject(message.audioConfig, options); + if (options.oneofs) + object.input = "audioConfig"; + } + if (message.text != null && message.hasOwnProperty("text")) { + object.text = $root.google.cloud.dialogflow.v2beta1.TextInput.toObject(message.text, options); + if (options.oneofs) + object.input = "text"; + } + if (message.event != null && message.hasOwnProperty("event")) { + object.event = $root.google.cloud.dialogflow.v2beta1.EventInput.toObject(message.event, options); + if (options.oneofs) + object.input = "event"; + } + if (message.dtmf != null && message.hasOwnProperty("dtmf")) { + object.dtmf = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.toObject(message.dtmf, options); + if (options.oneofs) + object.input = "dtmf"; + } + return object; + }; + + /** + * Converts this QueryInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @instance + * @returns {Object.} JSON object + */ + QueryInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryInput + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.QueryInput + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryInput.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.QueryInput"; + }; + + return QueryInput; + })(); + + v2beta1.QueryResult = (function() { + + /** + * Properties of a QueryResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IQueryResult + * @property {string|null} [queryText] QueryResult queryText + * @property {string|null} [languageCode] QueryResult languageCode + * @property {number|null} [speechRecognitionConfidence] QueryResult speechRecognitionConfidence + * @property {string|null} [action] QueryResult action + * @property {google.protobuf.IStruct|null} [parameters] QueryResult parameters + * @property {boolean|null} [allRequiredParamsPresent] QueryResult allRequiredParamsPresent + * @property {boolean|null} [cancelsSlotFilling] QueryResult cancelsSlotFilling + * @property {string|null} [fulfillmentText] QueryResult fulfillmentText + * @property {Array.|null} [fulfillmentMessages] QueryResult fulfillmentMessages + * @property {string|null} [webhookSource] QueryResult webhookSource + * @property {google.protobuf.IStruct|null} [webhookPayload] QueryResult webhookPayload + * @property {Array.|null} [outputContexts] QueryResult outputContexts + * @property {google.cloud.dialogflow.v2beta1.IIntent|null} [intent] QueryResult intent + * @property {number|null} [intentDetectionConfidence] QueryResult intentDetectionConfidence + * @property {google.protobuf.IStruct|null} [diagnosticInfo] QueryResult diagnosticInfo + * @property {google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult|null} [sentimentAnalysisResult] QueryResult sentimentAnalysisResult + * @property {google.cloud.dialogflow.v2beta1.IKnowledgeAnswers|null} [knowledgeAnswers] QueryResult knowledgeAnswers + */ + + /** + * Constructs a new QueryResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a QueryResult. + * @implements IQueryResult + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IQueryResult=} [properties] Properties to set + */ + function QueryResult(properties) { + this.fulfillmentMessages = []; + this.outputContexts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryResult queryText. + * @member {string} queryText + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.queryText = ""; + + /** + * QueryResult languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.languageCode = ""; + + /** + * QueryResult speechRecognitionConfidence. + * @member {number} speechRecognitionConfidence + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.speechRecognitionConfidence = 0; + + /** + * QueryResult action. + * @member {string} action + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.action = ""; + + /** + * QueryResult parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.parameters = null; + + /** + * QueryResult allRequiredParamsPresent. + * @member {boolean} allRequiredParamsPresent + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.allRequiredParamsPresent = false; + + /** + * QueryResult cancelsSlotFilling. + * @member {boolean} cancelsSlotFilling + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.cancelsSlotFilling = false; + + /** + * QueryResult fulfillmentText. + * @member {string} fulfillmentText + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.fulfillmentText = ""; + + /** + * QueryResult fulfillmentMessages. + * @member {Array.} fulfillmentMessages + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.fulfillmentMessages = $util.emptyArray; + + /** + * QueryResult webhookSource. + * @member {string} webhookSource + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.webhookSource = ""; + + /** + * QueryResult webhookPayload. + * @member {google.protobuf.IStruct|null|undefined} webhookPayload + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.webhookPayload = null; + + /** + * QueryResult outputContexts. + * @member {Array.} outputContexts + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.outputContexts = $util.emptyArray; + + /** + * QueryResult intent. + * @member {google.cloud.dialogflow.v2beta1.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.intent = null; + + /** + * QueryResult intentDetectionConfidence. + * @member {number} intentDetectionConfidence + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.intentDetectionConfidence = 0; + + /** + * QueryResult diagnosticInfo. + * @member {google.protobuf.IStruct|null|undefined} diagnosticInfo + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.diagnosticInfo = null; + + /** + * QueryResult sentimentAnalysisResult. + * @member {google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult|null|undefined} sentimentAnalysisResult + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.sentimentAnalysisResult = null; + + /** + * QueryResult knowledgeAnswers. + * @member {google.cloud.dialogflow.v2beta1.IKnowledgeAnswers|null|undefined} knowledgeAnswers + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + */ + QueryResult.prototype.knowledgeAnswers = null; + + /** + * Creates a new QueryResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @static + * @param {google.cloud.dialogflow.v2beta1.IQueryResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.QueryResult} QueryResult instance + */ + QueryResult.create = function create(properties) { + return new QueryResult(properties); + }; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @static + * @param {google.cloud.dialogflow.v2beta1.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryText != null && Object.hasOwnProperty.call(message, "queryText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.queryText); + if (message.speechRecognitionConfidence != null && Object.hasOwnProperty.call(message, "speechRecognitionConfidence")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.speechRecognitionConfidence); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.action); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allRequiredParamsPresent != null && Object.hasOwnProperty.call(message, "allRequiredParamsPresent")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.allRequiredParamsPresent); + if (message.fulfillmentText != null && Object.hasOwnProperty.call(message, "fulfillmentText")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.fulfillmentText); + if (message.fulfillmentMessages != null && message.fulfillmentMessages.length) + for (var i = 0; i < message.fulfillmentMessages.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.encode(message.fulfillmentMessages[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.webhookSource != null && Object.hasOwnProperty.call(message, "webhookSource")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.webhookSource); + if (message.webhookPayload != null && Object.hasOwnProperty.call(message, "webhookPayload")) + $root.google.protobuf.Struct.encode(message.webhookPayload, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.outputContexts != null && message.outputContexts.length) + for (var i = 0; i < message.outputContexts.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Context.encode(message.outputContexts[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.v2beta1.Intent.encode(message.intent, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.intentDetectionConfidence != null && Object.hasOwnProperty.call(message, "intentDetectionConfidence")) + writer.uint32(/* id 12, wireType 5 =*/101).float(message.intentDetectionConfidence); + if (message.diagnosticInfo != null && Object.hasOwnProperty.call(message, "diagnosticInfo")) + $root.google.protobuf.Struct.encode(message.diagnosticInfo, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.languageCode); + if (message.sentimentAnalysisResult != null && Object.hasOwnProperty.call(message, "sentimentAnalysisResult")) + $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.encode(message.sentimentAnalysisResult, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.knowledgeAnswers != null && Object.hasOwnProperty.call(message, "knowledgeAnswers")) + $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.encode(message.knowledgeAnswers, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.cancelsSlotFilling != null && Object.hasOwnProperty.call(message, "cancelsSlotFilling")) + writer.uint32(/* id 21, wireType 0 =*/168).bool(message.cancelsSlotFilling); + return writer; + }; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.QueryResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @static + * @param {google.cloud.dialogflow.v2beta1.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.QueryResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.queryText = reader.string(); + break; + } + case 15: { + message.languageCode = reader.string(); + break; + } + case 2: { + message.speechRecognitionConfidence = reader.float(); + break; + } + case 3: { + message.action = reader.string(); + break; + } + case 4: { + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 5: { + message.allRequiredParamsPresent = reader.bool(); + break; + } + case 21: { + message.cancelsSlotFilling = reader.bool(); + break; + } + case 6: { + message.fulfillmentText = reader.string(); + break; + } + case 7: { + if (!(message.fulfillmentMessages && message.fulfillmentMessages.length)) + message.fulfillmentMessages = []; + message.fulfillmentMessages.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.decode(reader, reader.uint32())); + break; + } + case 8: { + message.webhookSource = reader.string(); + break; + } + case 9: { + message.webhookPayload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 10: { + if (!(message.outputContexts && message.outputContexts.length)) + message.outputContexts = []; + message.outputContexts.push($root.google.cloud.dialogflow.v2beta1.Context.decode(reader, reader.uint32())); + break; + } + case 11: { + message.intent = $root.google.cloud.dialogflow.v2beta1.Intent.decode(reader, reader.uint32()); + break; + } + case 12: { + message.intentDetectionConfidence = reader.float(); + break; + } + case 14: { + message.diagnosticInfo = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 17: { + message.sentimentAnalysisResult = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.decode(reader, reader.uint32()); + break; + } + case 18: { + message.knowledgeAnswers = $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryText != null && message.hasOwnProperty("queryText")) + if (!$util.isString(message.queryText)) + return "queryText: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.speechRecognitionConfidence != null && message.hasOwnProperty("speechRecognitionConfidence")) + if (typeof message.speechRecognitionConfidence !== "number") + return "speechRecognitionConfidence: number expected"; + if (message.action != null && message.hasOwnProperty("action")) + if (!$util.isString(message.action)) + return "action: string expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + if (message.allRequiredParamsPresent != null && message.hasOwnProperty("allRequiredParamsPresent")) + if (typeof message.allRequiredParamsPresent !== "boolean") + return "allRequiredParamsPresent: boolean expected"; + if (message.cancelsSlotFilling != null && message.hasOwnProperty("cancelsSlotFilling")) + if (typeof message.cancelsSlotFilling !== "boolean") + return "cancelsSlotFilling: boolean expected"; + if (message.fulfillmentText != null && message.hasOwnProperty("fulfillmentText")) + if (!$util.isString(message.fulfillmentText)) + return "fulfillmentText: string expected"; + if (message.fulfillmentMessages != null && message.hasOwnProperty("fulfillmentMessages")) { + if (!Array.isArray(message.fulfillmentMessages)) + return "fulfillmentMessages: array expected"; + for (var i = 0; i < message.fulfillmentMessages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.verify(message.fulfillmentMessages[i]); + if (error) + return "fulfillmentMessages." + error; + } + } + if (message.webhookSource != null && message.hasOwnProperty("webhookSource")) + if (!$util.isString(message.webhookSource)) + return "webhookSource: string expected"; + if (message.webhookPayload != null && message.hasOwnProperty("webhookPayload")) { + var error = $root.google.protobuf.Struct.verify(message.webhookPayload); + if (error) + return "webhookPayload." + error; + } + if (message.outputContexts != null && message.hasOwnProperty("outputContexts")) { + if (!Array.isArray(message.outputContexts)) + return "outputContexts: array expected"; + for (var i = 0; i < message.outputContexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Context.verify(message.outputContexts[i]); + if (error) + return "outputContexts." + error; + } + } + if (message.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.intentDetectionConfidence != null && message.hasOwnProperty("intentDetectionConfidence")) + if (typeof message.intentDetectionConfidence !== "number") + return "intentDetectionConfidence: number expected"; + if (message.diagnosticInfo != null && message.hasOwnProperty("diagnosticInfo")) { + var error = $root.google.protobuf.Struct.verify(message.diagnosticInfo); + if (error) + return "diagnosticInfo." + error; + } + if (message.sentimentAnalysisResult != null && message.hasOwnProperty("sentimentAnalysisResult")) { + var error = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.verify(message.sentimentAnalysisResult); + if (error) + return "sentimentAnalysisResult." + error; + } + if (message.knowledgeAnswers != null && message.hasOwnProperty("knowledgeAnswers")) { + var error = $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.verify(message.knowledgeAnswers); + if (error) + return "knowledgeAnswers." + error; + } + return null; + }; + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.QueryResult} QueryResult + */ + QueryResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.QueryResult) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.QueryResult(); + if (object.queryText != null) + message.queryText = String(object.queryText); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.speechRecognitionConfidence != null) + message.speechRecognitionConfidence = Number(object.speechRecognitionConfidence); + if (object.action != null) + message.action = String(object.action); + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + if (object.allRequiredParamsPresent != null) + message.allRequiredParamsPresent = Boolean(object.allRequiredParamsPresent); + if (object.cancelsSlotFilling != null) + message.cancelsSlotFilling = Boolean(object.cancelsSlotFilling); + if (object.fulfillmentText != null) + message.fulfillmentText = String(object.fulfillmentText); + if (object.fulfillmentMessages) { + if (!Array.isArray(object.fulfillmentMessages)) + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.fulfillmentMessages: array expected"); + message.fulfillmentMessages = []; + for (var i = 0; i < object.fulfillmentMessages.length; ++i) { + if (typeof object.fulfillmentMessages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.fulfillmentMessages: object expected"); + message.fulfillmentMessages[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.fromObject(object.fulfillmentMessages[i]); + } + } + if (object.webhookSource != null) + message.webhookSource = String(object.webhookSource); + if (object.webhookPayload != null) { + if (typeof object.webhookPayload !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.webhookPayload: object expected"); + message.webhookPayload = $root.google.protobuf.Struct.fromObject(object.webhookPayload); + } + if (object.outputContexts) { + if (!Array.isArray(object.outputContexts)) + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.outputContexts: array expected"); + message.outputContexts = []; + for (var i = 0; i < object.outputContexts.length; ++i) { + if (typeof object.outputContexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.outputContexts: object expected"); + message.outputContexts[i] = $root.google.cloud.dialogflow.v2beta1.Context.fromObject(object.outputContexts[i]); + } + } + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.v2beta1.Intent.fromObject(object.intent); + } + if (object.intentDetectionConfidence != null) + message.intentDetectionConfidence = Number(object.intentDetectionConfidence); + if (object.diagnosticInfo != null) { + if (typeof object.diagnosticInfo !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.diagnosticInfo: object expected"); + message.diagnosticInfo = $root.google.protobuf.Struct.fromObject(object.diagnosticInfo); + } + if (object.sentimentAnalysisResult != null) { + if (typeof object.sentimentAnalysisResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.sentimentAnalysisResult: object expected"); + message.sentimentAnalysisResult = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.fromObject(object.sentimentAnalysisResult); + } + if (object.knowledgeAnswers != null) { + if (typeof object.knowledgeAnswers !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.QueryResult.knowledgeAnswers: object expected"); + message.knowledgeAnswers = $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.fromObject(object.knowledgeAnswers); + } + return message; + }; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @static + * @param {google.cloud.dialogflow.v2beta1.QueryResult} message QueryResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.fulfillmentMessages = []; + object.outputContexts = []; + } + if (options.defaults) { + object.queryText = ""; + object.speechRecognitionConfidence = 0; + object.action = ""; + object.parameters = null; + object.allRequiredParamsPresent = false; + object.fulfillmentText = ""; + object.webhookSource = ""; + object.webhookPayload = null; + object.intent = null; + object.intentDetectionConfidence = 0; + object.diagnosticInfo = null; + object.languageCode = ""; + object.sentimentAnalysisResult = null; + object.knowledgeAnswers = null; + object.cancelsSlotFilling = false; + } + if (message.queryText != null && message.hasOwnProperty("queryText")) + object.queryText = message.queryText; + if (message.speechRecognitionConfidence != null && message.hasOwnProperty("speechRecognitionConfidence")) + object.speechRecognitionConfidence = options.json && !isFinite(message.speechRecognitionConfidence) ? String(message.speechRecognitionConfidence) : message.speechRecognitionConfidence; + if (message.action != null && message.hasOwnProperty("action")) + object.action = message.action; + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + if (message.allRequiredParamsPresent != null && message.hasOwnProperty("allRequiredParamsPresent")) + object.allRequiredParamsPresent = message.allRequiredParamsPresent; + if (message.fulfillmentText != null && message.hasOwnProperty("fulfillmentText")) + object.fulfillmentText = message.fulfillmentText; + if (message.fulfillmentMessages && message.fulfillmentMessages.length) { + object.fulfillmentMessages = []; + for (var j = 0; j < message.fulfillmentMessages.length; ++j) + object.fulfillmentMessages[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.toObject(message.fulfillmentMessages[j], options); + } + if (message.webhookSource != null && message.hasOwnProperty("webhookSource")) + object.webhookSource = message.webhookSource; + if (message.webhookPayload != null && message.hasOwnProperty("webhookPayload")) + object.webhookPayload = $root.google.protobuf.Struct.toObject(message.webhookPayload, options); + if (message.outputContexts && message.outputContexts.length) { + object.outputContexts = []; + for (var j = 0; j < message.outputContexts.length; ++j) + object.outputContexts[j] = $root.google.cloud.dialogflow.v2beta1.Context.toObject(message.outputContexts[j], options); + } + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.v2beta1.Intent.toObject(message.intent, options); + if (message.intentDetectionConfidence != null && message.hasOwnProperty("intentDetectionConfidence")) + object.intentDetectionConfidence = options.json && !isFinite(message.intentDetectionConfidence) ? String(message.intentDetectionConfidence) : message.intentDetectionConfidence; + if (message.diagnosticInfo != null && message.hasOwnProperty("diagnosticInfo")) + object.diagnosticInfo = $root.google.protobuf.Struct.toObject(message.diagnosticInfo, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.sentimentAnalysisResult != null && message.hasOwnProperty("sentimentAnalysisResult")) + object.sentimentAnalysisResult = $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.toObject(message.sentimentAnalysisResult, options); + if (message.knowledgeAnswers != null && message.hasOwnProperty("knowledgeAnswers")) + object.knowledgeAnswers = $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.toObject(message.knowledgeAnswers, options); + if (message.cancelsSlotFilling != null && message.hasOwnProperty("cancelsSlotFilling")) + object.cancelsSlotFilling = message.cancelsSlotFilling; + return object; + }; + + /** + * Converts this QueryResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @instance + * @returns {Object.} JSON object + */ + QueryResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.QueryResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.QueryResult"; + }; + + return QueryResult; + })(); + + v2beta1.KnowledgeAnswers = (function() { + + /** + * Properties of a KnowledgeAnswers. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IKnowledgeAnswers + * @property {Array.|null} [answers] KnowledgeAnswers answers + */ + + /** + * Constructs a new KnowledgeAnswers. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a KnowledgeAnswers. + * @implements IKnowledgeAnswers + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeAnswers=} [properties] Properties to set + */ + function KnowledgeAnswers(properties) { + this.answers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KnowledgeAnswers answers. + * @member {Array.} answers + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @instance + */ + KnowledgeAnswers.prototype.answers = $util.emptyArray; + + /** + * Creates a new KnowledgeAnswers instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @static + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeAnswers=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeAnswers} KnowledgeAnswers instance + */ + KnowledgeAnswers.create = function create(properties) { + return new KnowledgeAnswers(properties); + }; + + /** + * Encodes the specified KnowledgeAnswers message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeAnswers.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @static + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeAnswers} message KnowledgeAnswers message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeAnswers.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.answers != null && message.answers.length) + for (var i = 0; i < message.answers.length; ++i) + $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.encode(message.answers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified KnowledgeAnswers message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeAnswers.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @static + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeAnswers} message KnowledgeAnswers message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeAnswers.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KnowledgeAnswers message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeAnswers} KnowledgeAnswers + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeAnswers.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.answers && message.answers.length)) + message.answers = []; + message.answers.push($root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KnowledgeAnswers message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeAnswers} KnowledgeAnswers + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeAnswers.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KnowledgeAnswers message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KnowledgeAnswers.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.answers != null && message.hasOwnProperty("answers")) { + if (!Array.isArray(message.answers)) + return "answers: array expected"; + for (var i = 0; i < message.answers.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.verify(message.answers[i]); + if (error) + return "answers." + error; + } + } + return null; + }; + + /** + * Creates a KnowledgeAnswers message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeAnswers} KnowledgeAnswers + */ + KnowledgeAnswers.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers(); + if (object.answers) { + if (!Array.isArray(object.answers)) + throw TypeError(".google.cloud.dialogflow.v2beta1.KnowledgeAnswers.answers: array expected"); + message.answers = []; + for (var i = 0; i < object.answers.length; ++i) { + if (typeof object.answers[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.KnowledgeAnswers.answers: object expected"); + message.answers[i] = $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.fromObject(object.answers[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a KnowledgeAnswers message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @static + * @param {google.cloud.dialogflow.v2beta1.KnowledgeAnswers} message KnowledgeAnswers + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KnowledgeAnswers.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.answers = []; + if (message.answers && message.answers.length) { + object.answers = []; + for (var j = 0; j < message.answers.length; ++j) + object.answers[j] = $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.toObject(message.answers[j], options); + } + return object; + }; + + /** + * Converts this KnowledgeAnswers to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @instance + * @returns {Object.} JSON object + */ + KnowledgeAnswers.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for KnowledgeAnswers + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KnowledgeAnswers.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.KnowledgeAnswers"; + }; + + KnowledgeAnswers.Answer = (function() { + + /** + * Properties of an Answer. + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @interface IAnswer + * @property {string|null} [source] Answer source + * @property {string|null} [faqQuestion] Answer faqQuestion + * @property {string|null} [answer] Answer answer + * @property {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel|null} [matchConfidenceLevel] Answer matchConfidenceLevel + * @property {number|null} [matchConfidence] Answer matchConfidence + */ + + /** + * Constructs a new Answer. + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers + * @classdesc Represents an Answer. + * @implements IAnswer + * @constructor + * @param {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer=} [properties] Properties to set + */ + function Answer(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Answer source. + * @member {string} source + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @instance + */ + Answer.prototype.source = ""; + + /** + * Answer faqQuestion. + * @member {string} faqQuestion + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @instance + */ + Answer.prototype.faqQuestion = ""; + + /** + * Answer answer. + * @member {string} answer + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @instance + */ + Answer.prototype.answer = ""; + + /** + * Answer matchConfidenceLevel. + * @member {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel} matchConfidenceLevel + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @instance + */ + Answer.prototype.matchConfidenceLevel = 0; + + /** + * Answer matchConfidence. + * @member {number} matchConfidence + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @instance + */ + Answer.prototype.matchConfidence = 0; + + /** + * Creates a new Answer instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @static + * @param {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer} Answer instance + */ + Answer.create = function create(properties) { + return new Answer(properties); + }; + + /** + * Encodes the specified Answer message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @static + * @param {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer} message Answer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Answer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.source); + if (message.faqQuestion != null && Object.hasOwnProperty.call(message, "faqQuestion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.faqQuestion); + if (message.answer != null && Object.hasOwnProperty.call(message, "answer")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.answer); + if (message.matchConfidenceLevel != null && Object.hasOwnProperty.call(message, "matchConfidenceLevel")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.matchConfidenceLevel); + if (message.matchConfidence != null && Object.hasOwnProperty.call(message, "matchConfidence")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.matchConfidence); + return writer; + }; + + /** + * Encodes the specified Answer message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @static + * @param {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.IAnswer} message Answer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Answer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Answer message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer} Answer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Answer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.source = reader.string(); + break; + } + case 2: { + message.faqQuestion = reader.string(); + break; + } + case 3: { + message.answer = reader.string(); + break; + } + case 4: { + message.matchConfidenceLevel = reader.int32(); + break; + } + case 5: { + message.matchConfidence = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Answer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer} Answer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Answer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Answer message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Answer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.source != null && message.hasOwnProperty("source")) + if (!$util.isString(message.source)) + return "source: string expected"; + if (message.faqQuestion != null && message.hasOwnProperty("faqQuestion")) + if (!$util.isString(message.faqQuestion)) + return "faqQuestion: string expected"; + if (message.answer != null && message.hasOwnProperty("answer")) + if (!$util.isString(message.answer)) + return "answer: string expected"; + if (message.matchConfidenceLevel != null && message.hasOwnProperty("matchConfidenceLevel")) + switch (message.matchConfidenceLevel) { + default: + return "matchConfidenceLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.matchConfidence != null && message.hasOwnProperty("matchConfidence")) + if (typeof message.matchConfidence !== "number") + return "matchConfidence: number expected"; + return null; + }; + + /** + * Creates an Answer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer} Answer + */ + Answer.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer(); + if (object.source != null) + message.source = String(object.source); + if (object.faqQuestion != null) + message.faqQuestion = String(object.faqQuestion); + if (object.answer != null) + message.answer = String(object.answer); + switch (object.matchConfidenceLevel) { + default: + if (typeof object.matchConfidenceLevel === "number") { + message.matchConfidenceLevel = object.matchConfidenceLevel; + break; + } + break; + case "MATCH_CONFIDENCE_LEVEL_UNSPECIFIED": + case 0: + message.matchConfidenceLevel = 0; + break; + case "LOW": + case 1: + message.matchConfidenceLevel = 1; + break; + case "MEDIUM": + case 2: + message.matchConfidenceLevel = 2; + break; + case "HIGH": + case 3: + message.matchConfidenceLevel = 3; + break; + } + if (object.matchConfidence != null) + message.matchConfidence = Number(object.matchConfidence); + return message; + }; + + /** + * Creates a plain object from an Answer message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @static + * @param {google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer} message Answer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Answer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.source = ""; + object.faqQuestion = ""; + object.answer = ""; + object.matchConfidenceLevel = options.enums === String ? "MATCH_CONFIDENCE_LEVEL_UNSPECIFIED" : 0; + object.matchConfidence = 0; + } + if (message.source != null && message.hasOwnProperty("source")) + object.source = message.source; + if (message.faqQuestion != null && message.hasOwnProperty("faqQuestion")) + object.faqQuestion = message.faqQuestion; + if (message.answer != null && message.hasOwnProperty("answer")) + object.answer = message.answer; + if (message.matchConfidenceLevel != null && message.hasOwnProperty("matchConfidenceLevel")) + object.matchConfidenceLevel = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel[message.matchConfidenceLevel] === undefined ? message.matchConfidenceLevel : $root.google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel[message.matchConfidenceLevel] : message.matchConfidenceLevel; + if (message.matchConfidence != null && message.hasOwnProperty("matchConfidence")) + object.matchConfidence = options.json && !isFinite(message.matchConfidence) ? String(message.matchConfidence) : message.matchConfidence; + return object; + }; + + /** + * Converts this Answer to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @instance + * @returns {Object.} JSON object + */ + Answer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Answer + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Answer.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer"; + }; + + /** + * MatchConfidenceLevel enum. + * @name google.cloud.dialogflow.v2beta1.KnowledgeAnswers.Answer.MatchConfidenceLevel + * @enum {number} + * @property {number} MATCH_CONFIDENCE_LEVEL_UNSPECIFIED=0 MATCH_CONFIDENCE_LEVEL_UNSPECIFIED value + * @property {number} LOW=1 LOW value + * @property {number} MEDIUM=2 MEDIUM value + * @property {number} HIGH=3 HIGH value + */ + Answer.MatchConfidenceLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MATCH_CONFIDENCE_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "LOW"] = 1; + values[valuesById[2] = "MEDIUM"] = 2; + values[valuesById[3] = "HIGH"] = 3; + return values; + })(); + + return Answer; + })(); + + return KnowledgeAnswers; + })(); + + v2beta1.StreamingDetectIntentRequest = (function() { + + /** + * Properties of a StreamingDetectIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IStreamingDetectIntentRequest + * @property {string|null} [session] StreamingDetectIntentRequest session + * @property {google.cloud.dialogflow.v2beta1.IQueryParameters|null} [queryParams] StreamingDetectIntentRequest queryParams + * @property {google.cloud.dialogflow.v2beta1.IQueryInput|null} [queryInput] StreamingDetectIntentRequest queryInput + * @property {boolean|null} [singleUtterance] StreamingDetectIntentRequest singleUtterance + * @property {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null} [outputAudioConfig] StreamingDetectIntentRequest outputAudioConfig + * @property {google.protobuf.IFieldMask|null} [outputAudioConfigMask] StreamingDetectIntentRequest outputAudioConfigMask + * @property {Uint8Array|null} [inputAudio] StreamingDetectIntentRequest inputAudio + */ + + /** + * Constructs a new StreamingDetectIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a StreamingDetectIntentRequest. + * @implements IStreamingDetectIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest=} [properties] Properties to set + */ + function StreamingDetectIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingDetectIntentRequest session. + * @member {string} session + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.session = ""; + + /** + * StreamingDetectIntentRequest queryParams. + * @member {google.cloud.dialogflow.v2beta1.IQueryParameters|null|undefined} queryParams + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.queryParams = null; + + /** + * StreamingDetectIntentRequest queryInput. + * @member {google.cloud.dialogflow.v2beta1.IQueryInput|null|undefined} queryInput + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.queryInput = null; + + /** + * StreamingDetectIntentRequest singleUtterance. + * @member {boolean} singleUtterance + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.singleUtterance = false; + + /** + * StreamingDetectIntentRequest outputAudioConfig. + * @member {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.outputAudioConfig = null; + + /** + * StreamingDetectIntentRequest outputAudioConfigMask. + * @member {google.protobuf.IFieldMask|null|undefined} outputAudioConfigMask + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.outputAudioConfigMask = null; + + /** + * StreamingDetectIntentRequest inputAudio. + * @member {Uint8Array} inputAudio + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @instance + */ + StreamingDetectIntentRequest.prototype.inputAudio = $util.newBuffer([]); + + /** + * Creates a new StreamingDetectIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest} StreamingDetectIntentRequest instance + */ + StreamingDetectIntentRequest.create = function create(properties) { + return new StreamingDetectIntentRequest(properties); + }; + + /** + * Encodes the specified StreamingDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest} message StreamingDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.session); + if (message.queryParams != null && Object.hasOwnProperty.call(message, "queryParams")) + $root.google.cloud.dialogflow.v2beta1.QueryParameters.encode(message.queryParams, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.queryInput != null && Object.hasOwnProperty.call(message, "queryInput")) + $root.google.cloud.dialogflow.v2beta1.QueryInput.encode(message.queryInput, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.singleUtterance != null && Object.hasOwnProperty.call(message, "singleUtterance")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.singleUtterance); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.inputAudio != null && Object.hasOwnProperty.call(message, "inputAudio")) + writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.inputAudio); + if (message.outputAudioConfigMask != null && Object.hasOwnProperty.call(message, "outputAudioConfigMask")) + $root.google.protobuf.FieldMask.encode(message.outputAudioConfigMask, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentRequest} message StreamingDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest} StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.session = reader.string(); + break; + } + case 2: { + message.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.decode(reader, reader.uint32()); + break; + } + case 3: { + message.queryInput = $root.google.cloud.dialogflow.v2beta1.QueryInput.decode(reader, reader.uint32()); + break; + } + case 4: { + message.singleUtterance = reader.bool(); + break; + } + case 5: { + message.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.outputAudioConfigMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 6: { + message.inputAudio = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingDetectIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest} StreamingDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingDetectIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingDetectIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryParameters.verify(message.queryParams); + if (error) + return "queryParams." + error; + } + if (message.queryInput != null && message.hasOwnProperty("queryInput")) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryInput.verify(message.queryInput); + if (error) + return "queryInput." + error; + } + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + if (typeof message.singleUtterance !== "boolean") + return "singleUtterance: boolean expected"; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + if (message.outputAudioConfigMask != null && message.hasOwnProperty("outputAudioConfigMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.outputAudioConfigMask); + if (error) + return "outputAudioConfigMask." + error; + } + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) + if (!(message.inputAudio && typeof message.inputAudio.length === "number" || $util.isString(message.inputAudio))) + return "inputAudio: buffer expected"; + return null; + }; + + /** + * Creates a StreamingDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest} StreamingDetectIntentRequest + */ + StreamingDetectIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest(); + if (object.session != null) + message.session = String(object.session); + if (object.queryParams != null) { + if (typeof object.queryParams !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.queryParams: object expected"); + message.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.fromObject(object.queryParams); + } + if (object.queryInput != null) { + if (typeof object.queryInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.queryInput: object expected"); + message.queryInput = $root.google.cloud.dialogflow.v2beta1.QueryInput.fromObject(object.queryInput); + } + if (object.singleUtterance != null) + message.singleUtterance = Boolean(object.singleUtterance); + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + if (object.outputAudioConfigMask != null) { + if (typeof object.outputAudioConfigMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.outputAudioConfigMask: object expected"); + message.outputAudioConfigMask = $root.google.protobuf.FieldMask.fromObject(object.outputAudioConfigMask); + } + if (object.inputAudio != null) + if (typeof object.inputAudio === "string") + $util.base64.decode(object.inputAudio, message.inputAudio = $util.newBuffer($util.base64.length(object.inputAudio)), 0); + else if (object.inputAudio.length >= 0) + message.inputAudio = object.inputAudio; + return message; + }; + + /** + * Creates a plain object from a StreamingDetectIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest} message StreamingDetectIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingDetectIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.session = ""; + object.queryParams = null; + object.queryInput = null; + object.singleUtterance = false; + object.outputAudioConfig = null; + if (options.bytes === String) + object.inputAudio = ""; + else { + object.inputAudio = []; + if (options.bytes !== Array) + object.inputAudio = $util.newBuffer(object.inputAudio); + } + object.outputAudioConfigMask = null; + } + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + if (message.queryParams != null && message.hasOwnProperty("queryParams")) + object.queryParams = $root.google.cloud.dialogflow.v2beta1.QueryParameters.toObject(message.queryParams, options); + if (message.queryInput != null && message.hasOwnProperty("queryInput")) + object.queryInput = $root.google.cloud.dialogflow.v2beta1.QueryInput.toObject(message.queryInput, options); + if (message.singleUtterance != null && message.hasOwnProperty("singleUtterance")) + object.singleUtterance = message.singleUtterance; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.toObject(message.outputAudioConfig, options); + if (message.inputAudio != null && message.hasOwnProperty("inputAudio")) + object.inputAudio = options.bytes === String ? $util.base64.encode(message.inputAudio, 0, message.inputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.inputAudio) : message.inputAudio; + if (message.outputAudioConfigMask != null && message.hasOwnProperty("outputAudioConfigMask")) + object.outputAudioConfigMask = $root.google.protobuf.FieldMask.toObject(message.outputAudioConfigMask, options); + return object; + }; + + /** + * Converts this StreamingDetectIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @instance + * @returns {Object.} JSON object + */ + StreamingDetectIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingDetectIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingDetectIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest"; + }; + + return StreamingDetectIntentRequest; + })(); + + v2beta1.StreamingDetectIntentResponse = (function() { + + /** + * Properties of a StreamingDetectIntentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IStreamingDetectIntentResponse + * @property {string|null} [responseId] StreamingDetectIntentResponse responseId + * @property {google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult|null} [recognitionResult] StreamingDetectIntentResponse recognitionResult + * @property {google.cloud.dialogflow.v2beta1.IQueryResult|null} [queryResult] StreamingDetectIntentResponse queryResult + * @property {Array.|null} [alternativeQueryResults] StreamingDetectIntentResponse alternativeQueryResults + * @property {google.rpc.IStatus|null} [webhookStatus] StreamingDetectIntentResponse webhookStatus + * @property {Uint8Array|null} [outputAudio] StreamingDetectIntentResponse outputAudio + * @property {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null} [outputAudioConfig] StreamingDetectIntentResponse outputAudioConfig + */ + + /** + * Constructs a new StreamingDetectIntentResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a StreamingDetectIntentResponse. + * @implements IStreamingDetectIntentResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentResponse=} [properties] Properties to set + */ + function StreamingDetectIntentResponse(properties) { + this.alternativeQueryResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingDetectIntentResponse responseId. + * @member {string} responseId + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.responseId = ""; + + /** + * StreamingDetectIntentResponse recognitionResult. + * @member {google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult|null|undefined} recognitionResult + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.recognitionResult = null; + + /** + * StreamingDetectIntentResponse queryResult. + * @member {google.cloud.dialogflow.v2beta1.IQueryResult|null|undefined} queryResult + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.queryResult = null; + + /** + * StreamingDetectIntentResponse alternativeQueryResults. + * @member {Array.} alternativeQueryResults + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.alternativeQueryResults = $util.emptyArray; + + /** + * StreamingDetectIntentResponse webhookStatus. + * @member {google.rpc.IStatus|null|undefined} webhookStatus + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.webhookStatus = null; + + /** + * StreamingDetectIntentResponse outputAudio. + * @member {Uint8Array} outputAudio + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.outputAudio = $util.newBuffer([]); + + /** + * StreamingDetectIntentResponse outputAudioConfig. + * @member {google.cloud.dialogflow.v2beta1.IOutputAudioConfig|null|undefined} outputAudioConfig + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @instance + */ + StreamingDetectIntentResponse.prototype.outputAudioConfig = null; + + /** + * Creates a new StreamingDetectIntentResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} StreamingDetectIntentResponse instance + */ + StreamingDetectIntentResponse.create = function create(properties) { + return new StreamingDetectIntentResponse(properties); + }; + + /** + * Encodes the specified StreamingDetectIntentResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentResponse} message StreamingDetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseId != null && Object.hasOwnProperty.call(message, "responseId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseId); + if (message.recognitionResult != null && Object.hasOwnProperty.call(message, "recognitionResult")) + $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.encode(message.recognitionResult, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.queryResult != null && Object.hasOwnProperty.call(message, "queryResult")) + $root.google.cloud.dialogflow.v2beta1.QueryResult.encode(message.queryResult, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.webhookStatus != null && Object.hasOwnProperty.call(message, "webhookStatus")) + $root.google.rpc.Status.encode(message.webhookStatus, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.outputAudio != null && Object.hasOwnProperty.call(message, "outputAudio")) + writer.uint32(/* id 5, wireType 2 =*/42).bytes(message.outputAudio); + if (message.outputAudioConfig != null && Object.hasOwnProperty.call(message, "outputAudioConfig")) + $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.encode(message.outputAudioConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.alternativeQueryResults != null && message.alternativeQueryResults.length) + for (var i = 0; i < message.alternativeQueryResults.length; ++i) + $root.google.cloud.dialogflow.v2beta1.QueryResult.encode(message.alternativeQueryResults[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified StreamingDetectIntentResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingDetectIntentResponse} message StreamingDetectIntentResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingDetectIntentResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.responseId = reader.string(); + break; + } + case 2: { + message.recognitionResult = $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.decode(reader, reader.uint32()); + break; + } + case 3: { + message.queryResult = $root.google.cloud.dialogflow.v2beta1.QueryResult.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.alternativeQueryResults && message.alternativeQueryResults.length)) + message.alternativeQueryResults = []; + message.alternativeQueryResults.push($root.google.cloud.dialogflow.v2beta1.QueryResult.decode(reader, reader.uint32())); + break; + } + case 4: { + message.webhookStatus = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 5: { + message.outputAudio = reader.bytes(); + break; + } + case 6: { + message.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingDetectIntentResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} StreamingDetectIntentResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingDetectIntentResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingDetectIntentResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingDetectIntentResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseId != null && message.hasOwnProperty("responseId")) + if (!$util.isString(message.responseId)) + return "responseId: string expected"; + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) { + var error = $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.verify(message.recognitionResult); + if (error) + return "recognitionResult." + error; + } + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryResult.verify(message.queryResult); + if (error) + return "queryResult." + error; + } + if (message.alternativeQueryResults != null && message.hasOwnProperty("alternativeQueryResults")) { + if (!Array.isArray(message.alternativeQueryResults)) + return "alternativeQueryResults: array expected"; + for (var i = 0; i < message.alternativeQueryResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryResult.verify(message.alternativeQueryResults[i]); + if (error) + return "alternativeQueryResults." + error; + } + } + if (message.webhookStatus != null && message.hasOwnProperty("webhookStatus")) { + var error = $root.google.rpc.Status.verify(message.webhookStatus); + if (error) + return "webhookStatus." + error; + } + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + if (!(message.outputAudio && typeof message.outputAudio.length === "number" || $util.isString(message.outputAudio))) + return "outputAudio: buffer expected"; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.verify(message.outputAudioConfig); + if (error) + return "outputAudioConfig." + error; + } + return null; + }; + + /** + * Creates a StreamingDetectIntentResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} StreamingDetectIntentResponse + */ + StreamingDetectIntentResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse(); + if (object.responseId != null) + message.responseId = String(object.responseId); + if (object.recognitionResult != null) { + if (typeof object.recognitionResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.recognitionResult: object expected"); + message.recognitionResult = $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.fromObject(object.recognitionResult); + } + if (object.queryResult != null) { + if (typeof object.queryResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.queryResult: object expected"); + message.queryResult = $root.google.cloud.dialogflow.v2beta1.QueryResult.fromObject(object.queryResult); + } + if (object.alternativeQueryResults) { + if (!Array.isArray(object.alternativeQueryResults)) + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.alternativeQueryResults: array expected"); + message.alternativeQueryResults = []; + for (var i = 0; i < object.alternativeQueryResults.length; ++i) { + if (typeof object.alternativeQueryResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.alternativeQueryResults: object expected"); + message.alternativeQueryResults[i] = $root.google.cloud.dialogflow.v2beta1.QueryResult.fromObject(object.alternativeQueryResults[i]); + } + } + if (object.webhookStatus != null) { + if (typeof object.webhookStatus !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.webhookStatus: object expected"); + message.webhookStatus = $root.google.rpc.Status.fromObject(object.webhookStatus); + } + if (object.outputAudio != null) + if (typeof object.outputAudio === "string") + $util.base64.decode(object.outputAudio, message.outputAudio = $util.newBuffer($util.base64.length(object.outputAudio)), 0); + else if (object.outputAudio.length >= 0) + message.outputAudio = object.outputAudio; + if (object.outputAudioConfig != null) { + if (typeof object.outputAudioConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse.outputAudioConfig: object expected"); + message.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.fromObject(object.outputAudioConfig); + } + return message; + }; + + /** + * Creates a plain object from a StreamingDetectIntentResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} message StreamingDetectIntentResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingDetectIntentResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.alternativeQueryResults = []; + if (options.defaults) { + object.responseId = ""; + object.recognitionResult = null; + object.queryResult = null; + object.webhookStatus = null; + if (options.bytes === String) + object.outputAudio = ""; + else { + object.outputAudio = []; + if (options.bytes !== Array) + object.outputAudio = $util.newBuffer(object.outputAudio); + } + object.outputAudioConfig = null; + } + if (message.responseId != null && message.hasOwnProperty("responseId")) + object.responseId = message.responseId; + if (message.recognitionResult != null && message.hasOwnProperty("recognitionResult")) + object.recognitionResult = $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.toObject(message.recognitionResult, options); + if (message.queryResult != null && message.hasOwnProperty("queryResult")) + object.queryResult = $root.google.cloud.dialogflow.v2beta1.QueryResult.toObject(message.queryResult, options); + if (message.webhookStatus != null && message.hasOwnProperty("webhookStatus")) + object.webhookStatus = $root.google.rpc.Status.toObject(message.webhookStatus, options); + if (message.outputAudio != null && message.hasOwnProperty("outputAudio")) + object.outputAudio = options.bytes === String ? $util.base64.encode(message.outputAudio, 0, message.outputAudio.length) : options.bytes === Array ? Array.prototype.slice.call(message.outputAudio) : message.outputAudio; + if (message.outputAudioConfig != null && message.hasOwnProperty("outputAudioConfig")) + object.outputAudioConfig = $root.google.cloud.dialogflow.v2beta1.OutputAudioConfig.toObject(message.outputAudioConfig, options); + if (message.alternativeQueryResults && message.alternativeQueryResults.length) { + object.alternativeQueryResults = []; + for (var j = 0; j < message.alternativeQueryResults.length; ++j) + object.alternativeQueryResults[j] = $root.google.cloud.dialogflow.v2beta1.QueryResult.toObject(message.alternativeQueryResults[j], options); + } + return object; + }; + + /** + * Converts this StreamingDetectIntentResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @instance + * @returns {Object.} JSON object + */ + StreamingDetectIntentResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingDetectIntentResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingDetectIntentResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse"; + }; + + return StreamingDetectIntentResponse; + })(); + + v2beta1.StreamingRecognitionResult = (function() { + + /** + * Properties of a StreamingRecognitionResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IStreamingRecognitionResult + * @property {google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType|null} [messageType] StreamingRecognitionResult messageType + * @property {string|null} [transcript] StreamingRecognitionResult transcript + * @property {boolean|null} [isFinal] StreamingRecognitionResult isFinal + * @property {number|null} [confidence] StreamingRecognitionResult confidence + * @property {number|null} [stability] StreamingRecognitionResult stability + * @property {Array.|null} [speechWordInfo] StreamingRecognitionResult speechWordInfo + * @property {google.protobuf.IDuration|null} [speechEndOffset] StreamingRecognitionResult speechEndOffset + * @property {string|null} [languageCode] StreamingRecognitionResult languageCode + * @property {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null} [dtmfDigits] StreamingRecognitionResult dtmfDigits + */ + + /** + * Constructs a new StreamingRecognitionResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a StreamingRecognitionResult. + * @implements IStreamingRecognitionResult + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult=} [properties] Properties to set + */ + function StreamingRecognitionResult(properties) { + this.speechWordInfo = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingRecognitionResult messageType. + * @member {google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType} messageType + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.messageType = 0; + + /** + * StreamingRecognitionResult transcript. + * @member {string} transcript + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.transcript = ""; + + /** + * StreamingRecognitionResult isFinal. + * @member {boolean} isFinal + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.isFinal = false; + + /** + * StreamingRecognitionResult confidence. + * @member {number} confidence + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.confidence = 0; + + /** + * StreamingRecognitionResult stability. + * @member {number} stability + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.stability = 0; + + /** + * StreamingRecognitionResult speechWordInfo. + * @member {Array.} speechWordInfo + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.speechWordInfo = $util.emptyArray; + + /** + * StreamingRecognitionResult speechEndOffset. + * @member {google.protobuf.IDuration|null|undefined} speechEndOffset + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.speechEndOffset = null; + + /** + * StreamingRecognitionResult languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.languageCode = ""; + + /** + * StreamingRecognitionResult dtmfDigits. + * @member {google.cloud.dialogflow.v2beta1.ITelephonyDtmfEvents|null|undefined} dtmfDigits + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + */ + StreamingRecognitionResult.prototype.dtmfDigits = null; + + /** + * Creates a new StreamingRecognitionResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.StreamingRecognitionResult} StreamingRecognitionResult instance + */ + StreamingRecognitionResult.create = function create(properties) { + return new StreamingRecognitionResult(properties); + }; + + /** + * Encodes the specified StreamingRecognitionResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult} message StreamingRecognitionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRecognitionResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageType != null && Object.hasOwnProperty.call(message, "messageType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.messageType); + if (message.transcript != null && Object.hasOwnProperty.call(message, "transcript")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.transcript); + if (message.isFinal != null && Object.hasOwnProperty.call(message, "isFinal")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.isFinal); + if (message.confidence != null && Object.hasOwnProperty.call(message, "confidence")) + writer.uint32(/* id 4, wireType 5 =*/37).float(message.confidence); + if (message.dtmfDigits != null && Object.hasOwnProperty.call(message, "dtmfDigits")) + $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.encode(message.dtmfDigits, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.stability != null && Object.hasOwnProperty.call(message, "stability")) + writer.uint32(/* id 6, wireType 5 =*/53).float(message.stability); + if (message.speechWordInfo != null && message.speechWordInfo.length) + for (var i = 0; i < message.speechWordInfo.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SpeechWordInfo.encode(message.speechWordInfo[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.speechEndOffset != null && Object.hasOwnProperty.call(message, "speechEndOffset")) + $root.google.protobuf.Duration.encode(message.speechEndOffset, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified StreamingRecognitionResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.v2beta1.IStreamingRecognitionResult} message StreamingRecognitionResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRecognitionResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.StreamingRecognitionResult} StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRecognitionResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.messageType = reader.int32(); + break; + } + case 2: { + message.transcript = reader.string(); + break; + } + case 3: { + message.isFinal = reader.bool(); + break; + } + case 4: { + message.confidence = reader.float(); + break; + } + case 6: { + message.stability = reader.float(); + break; + } + case 7: { + if (!(message.speechWordInfo && message.speechWordInfo.length)) + message.speechWordInfo = []; + message.speechWordInfo.push($root.google.cloud.dialogflow.v2beta1.SpeechWordInfo.decode(reader, reader.uint32())); + break; + } + case 8: { + message.speechEndOffset = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 10: { + message.languageCode = reader.string(); + break; + } + case 5: { + message.dtmfDigits = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingRecognitionResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.StreamingRecognitionResult} StreamingRecognitionResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRecognitionResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingRecognitionResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingRecognitionResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageType != null && message.hasOwnProperty("messageType")) + switch (message.messageType) { + default: + return "messageType: enum value expected"; + case 0: + case 1: + case 3: + case 2: + case 4: + break; + } + if (message.transcript != null && message.hasOwnProperty("transcript")) + if (!$util.isString(message.transcript)) + return "transcript: string expected"; + if (message.isFinal != null && message.hasOwnProperty("isFinal")) + if (typeof message.isFinal !== "boolean") + return "isFinal: boolean expected"; + if (message.confidence != null && message.hasOwnProperty("confidence")) + if (typeof message.confidence !== "number") + return "confidence: number expected"; + if (message.stability != null && message.hasOwnProperty("stability")) + if (typeof message.stability !== "number") + return "stability: number expected"; + if (message.speechWordInfo != null && message.hasOwnProperty("speechWordInfo")) { + if (!Array.isArray(message.speechWordInfo)) + return "speechWordInfo: array expected"; + for (var i = 0; i < message.speechWordInfo.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SpeechWordInfo.verify(message.speechWordInfo[i]); + if (error) + return "speechWordInfo." + error; + } + } + if (message.speechEndOffset != null && message.hasOwnProperty("speechEndOffset")) { + var error = $root.google.protobuf.Duration.verify(message.speechEndOffset); + if (error) + return "speechEndOffset." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.dtmfDigits != null && message.hasOwnProperty("dtmfDigits")) { + var error = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.verify(message.dtmfDigits); + if (error) + return "dtmfDigits." + error; + } + return null; + }; + + /** + * Creates a StreamingRecognitionResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.StreamingRecognitionResult} StreamingRecognitionResult + */ + StreamingRecognitionResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult(); + switch (object.messageType) { + default: + if (typeof object.messageType === "number") { + message.messageType = object.messageType; + break; + } + break; + case "MESSAGE_TYPE_UNSPECIFIED": + case 0: + message.messageType = 0; + break; + case "TRANSCRIPT": + case 1: + message.messageType = 1; + break; + case "DTMF_DIGITS": + case 3: + message.messageType = 3; + break; + case "END_OF_SINGLE_UTTERANCE": + case 2: + message.messageType = 2; + break; + case "PARTIAL_DTMF_DIGITS": + case 4: + message.messageType = 4; + break; + } + if (object.transcript != null) + message.transcript = String(object.transcript); + if (object.isFinal != null) + message.isFinal = Boolean(object.isFinal); + if (object.confidence != null) + message.confidence = Number(object.confidence); + if (object.stability != null) + message.stability = Number(object.stability); + if (object.speechWordInfo) { + if (!Array.isArray(object.speechWordInfo)) + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.speechWordInfo: array expected"); + message.speechWordInfo = []; + for (var i = 0; i < object.speechWordInfo.length; ++i) { + if (typeof object.speechWordInfo[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.speechWordInfo: object expected"); + message.speechWordInfo[i] = $root.google.cloud.dialogflow.v2beta1.SpeechWordInfo.fromObject(object.speechWordInfo[i]); + } + } + if (object.speechEndOffset != null) { + if (typeof object.speechEndOffset !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.speechEndOffset: object expected"); + message.speechEndOffset = $root.google.protobuf.Duration.fromObject(object.speechEndOffset); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.dtmfDigits != null) { + if (typeof object.dtmfDigits !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.dtmfDigits: object expected"); + message.dtmfDigits = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.fromObject(object.dtmfDigits); + } + return message; + }; + + /** + * Creates a plain object from a StreamingRecognitionResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @static + * @param {google.cloud.dialogflow.v2beta1.StreamingRecognitionResult} message StreamingRecognitionResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingRecognitionResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.speechWordInfo = []; + if (options.defaults) { + object.messageType = options.enums === String ? "MESSAGE_TYPE_UNSPECIFIED" : 0; + object.transcript = ""; + object.isFinal = false; + object.confidence = 0; + object.dtmfDigits = null; + object.stability = 0; + object.speechEndOffset = null; + object.languageCode = ""; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) + object.messageType = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType[message.messageType] === undefined ? message.messageType : $root.google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType[message.messageType] : message.messageType; + if (message.transcript != null && message.hasOwnProperty("transcript")) + object.transcript = message.transcript; + if (message.isFinal != null && message.hasOwnProperty("isFinal")) + object.isFinal = message.isFinal; + if (message.confidence != null && message.hasOwnProperty("confidence")) + object.confidence = options.json && !isFinite(message.confidence) ? String(message.confidence) : message.confidence; + if (message.dtmfDigits != null && message.hasOwnProperty("dtmfDigits")) + object.dtmfDigits = $root.google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents.toObject(message.dtmfDigits, options); + if (message.stability != null && message.hasOwnProperty("stability")) + object.stability = options.json && !isFinite(message.stability) ? String(message.stability) : message.stability; + if (message.speechWordInfo && message.speechWordInfo.length) { + object.speechWordInfo = []; + for (var j = 0; j < message.speechWordInfo.length; ++j) + object.speechWordInfo[j] = $root.google.cloud.dialogflow.v2beta1.SpeechWordInfo.toObject(message.speechWordInfo[j], options); + } + if (message.speechEndOffset != null && message.hasOwnProperty("speechEndOffset")) + object.speechEndOffset = $root.google.protobuf.Duration.toObject(message.speechEndOffset, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this StreamingRecognitionResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @instance + * @returns {Object.} JSON object + */ + StreamingRecognitionResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingRecognitionResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.StreamingRecognitionResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingRecognitionResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.StreamingRecognitionResult"; + }; + + /** + * MessageType enum. + * @name google.cloud.dialogflow.v2beta1.StreamingRecognitionResult.MessageType + * @enum {number} + * @property {number} MESSAGE_TYPE_UNSPECIFIED=0 MESSAGE_TYPE_UNSPECIFIED value + * @property {number} TRANSCRIPT=1 TRANSCRIPT value + * @property {number} DTMF_DIGITS=3 DTMF_DIGITS value + * @property {number} END_OF_SINGLE_UTTERANCE=2 END_OF_SINGLE_UTTERANCE value + * @property {number} PARTIAL_DTMF_DIGITS=4 PARTIAL_DTMF_DIGITS value + */ + StreamingRecognitionResult.MessageType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "TRANSCRIPT"] = 1; + values[valuesById[3] = "DTMF_DIGITS"] = 3; + values[valuesById[2] = "END_OF_SINGLE_UTTERANCE"] = 2; + values[valuesById[4] = "PARTIAL_DTMF_DIGITS"] = 4; + return values; + })(); + + return StreamingRecognitionResult; + })(); + + v2beta1.TextInput = (function() { + + /** + * Properties of a TextInput. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ITextInput + * @property {string|null} [text] TextInput text + * @property {string|null} [languageCode] TextInput languageCode + */ + + /** + * Constructs a new TextInput. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a TextInput. + * @implements ITextInput + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ITextInput=} [properties] Properties to set + */ + function TextInput(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextInput text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @instance + */ + TextInput.prototype.text = ""; + + /** + * TextInput languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @instance + */ + TextInput.prototype.languageCode = ""; + + /** + * Creates a new TextInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @static + * @param {google.cloud.dialogflow.v2beta1.ITextInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.TextInput} TextInput instance + */ + TextInput.create = function create(properties) { + return new TextInput(properties); + }; + + /** + * Encodes the specified TextInput message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TextInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @static + * @param {google.cloud.dialogflow.v2beta1.ITextInput} message TextInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextInput.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified TextInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TextInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @static + * @param {google.cloud.dialogflow.v2beta1.ITextInput} message TextInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.TextInput} TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextInput.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.TextInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.TextInput} TextInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextInput message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextInput.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a TextInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.TextInput} TextInput + */ + TextInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.TextInput) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.TextInput(); + if (object.text != null) + message.text = String(object.text); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a TextInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @static + * @param {google.cloud.dialogflow.v2beta1.TextInput} message TextInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.languageCode = ""; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this TextInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @instance + * @returns {Object.} JSON object + */ + TextInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TextInput + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.TextInput + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextInput.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.TextInput"; + }; + + return TextInput; + })(); + + v2beta1.EventInput = (function() { + + /** + * Properties of an EventInput. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IEventInput + * @property {string|null} [name] EventInput name + * @property {google.protobuf.IStruct|null} [parameters] EventInput parameters + * @property {string|null} [languageCode] EventInput languageCode + */ + + /** + * Constructs a new EventInput. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an EventInput. + * @implements IEventInput + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IEventInput=} [properties] Properties to set + */ + function EventInput(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EventInput name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @instance + */ + EventInput.prototype.name = ""; + + /** + * EventInput parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @instance + */ + EventInput.prototype.parameters = null; + + /** + * EventInput languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @instance + */ + EventInput.prototype.languageCode = ""; + + /** + * Creates a new EventInput instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @static + * @param {google.cloud.dialogflow.v2beta1.IEventInput=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.EventInput} EventInput instance + */ + EventInput.create = function create(properties) { + return new EventInput(properties); + }; + + /** + * Encodes the specified EventInput message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EventInput.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @static + * @param {google.cloud.dialogflow.v2beta1.IEventInput} message EventInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventInput.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.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified EventInput message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EventInput.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @static + * @param {google.cloud.dialogflow.v2beta1.IEventInput} message EventInput message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EventInput.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EventInput message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.EventInput} EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventInput.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.EventInput(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EventInput message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.EventInput} EventInput + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EventInput.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EventInput message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EventInput.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.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates an EventInput message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.EventInput} EventInput + */ + EventInput.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.EventInput) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.EventInput(); + if (object.name != null) + message.name = String(object.name); + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.EventInput.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from an EventInput message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @static + * @param {google.cloud.dialogflow.v2beta1.EventInput} message EventInput + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EventInput.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.parameters = null; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this EventInput to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @instance + * @returns {Object.} JSON object + */ + EventInput.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EventInput + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.EventInput + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EventInput.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.EventInput"; + }; + + return EventInput; + })(); + + v2beta1.SentimentAnalysisRequestConfig = (function() { + + /** + * Properties of a SentimentAnalysisRequestConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISentimentAnalysisRequestConfig + * @property {boolean|null} [analyzeQueryTextSentiment] SentimentAnalysisRequestConfig analyzeQueryTextSentiment + */ + + /** + * Constructs a new SentimentAnalysisRequestConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SentimentAnalysisRequestConfig. + * @implements ISentimentAnalysisRequestConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig=} [properties] Properties to set + */ + function SentimentAnalysisRequestConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SentimentAnalysisRequestConfig analyzeQueryTextSentiment. + * @member {boolean} analyzeQueryTextSentiment + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @instance + */ + SentimentAnalysisRequestConfig.prototype.analyzeQueryTextSentiment = false; + + /** + * Creates a new SentimentAnalysisRequestConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig} SentimentAnalysisRequestConfig instance + */ + SentimentAnalysisRequestConfig.create = function create(properties) { + return new SentimentAnalysisRequestConfig(properties); + }; + + /** + * Encodes the specified SentimentAnalysisRequestConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig} message SentimentAnalysisRequestConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisRequestConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.analyzeQueryTextSentiment != null && Object.hasOwnProperty.call(message, "analyzeQueryTextSentiment")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.analyzeQueryTextSentiment); + return writer; + }; + + /** + * Encodes the specified SentimentAnalysisRequestConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ISentimentAnalysisRequestConfig} message SentimentAnalysisRequestConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisRequestConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SentimentAnalysisRequestConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig} SentimentAnalysisRequestConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisRequestConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.analyzeQueryTextSentiment = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SentimentAnalysisRequestConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig} SentimentAnalysisRequestConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisRequestConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SentimentAnalysisRequestConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SentimentAnalysisRequestConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.analyzeQueryTextSentiment != null && message.hasOwnProperty("analyzeQueryTextSentiment")) + if (typeof message.analyzeQueryTextSentiment !== "boolean") + return "analyzeQueryTextSentiment: boolean expected"; + return null; + }; + + /** + * Creates a SentimentAnalysisRequestConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig} SentimentAnalysisRequestConfig + */ + SentimentAnalysisRequestConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig(); + if (object.analyzeQueryTextSentiment != null) + message.analyzeQueryTextSentiment = Boolean(object.analyzeQueryTextSentiment); + return message; + }; + + /** + * Creates a plain object from a SentimentAnalysisRequestConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig} message SentimentAnalysisRequestConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SentimentAnalysisRequestConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.analyzeQueryTextSentiment = false; + if (message.analyzeQueryTextSentiment != null && message.hasOwnProperty("analyzeQueryTextSentiment")) + object.analyzeQueryTextSentiment = message.analyzeQueryTextSentiment; + return object; + }; + + /** + * Converts this SentimentAnalysisRequestConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @instance + * @returns {Object.} JSON object + */ + SentimentAnalysisRequestConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SentimentAnalysisRequestConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SentimentAnalysisRequestConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SentimentAnalysisRequestConfig"; + }; + + return SentimentAnalysisRequestConfig; + })(); + + v2beta1.SentimentAnalysisResult = (function() { + + /** + * Properties of a SentimentAnalysisResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISentimentAnalysisResult + * @property {google.cloud.dialogflow.v2beta1.ISentiment|null} [queryTextSentiment] SentimentAnalysisResult queryTextSentiment + */ + + /** + * Constructs a new SentimentAnalysisResult. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SentimentAnalysisResult. + * @implements ISentimentAnalysisResult + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult=} [properties] Properties to set + */ + function SentimentAnalysisResult(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SentimentAnalysisResult queryTextSentiment. + * @member {google.cloud.dialogflow.v2beta1.ISentiment|null|undefined} queryTextSentiment + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @instance + */ + SentimentAnalysisResult.prototype.queryTextSentiment = null; + + /** + * Creates a new SentimentAnalysisResult instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SentimentAnalysisResult} SentimentAnalysisResult instance + */ + SentimentAnalysisResult.create = function create(properties) { + return new SentimentAnalysisResult(properties); + }; + + /** + * Encodes the specified SentimentAnalysisResult message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult} message SentimentAnalysisResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryTextSentiment != null && Object.hasOwnProperty.call(message, "queryTextSentiment")) + $root.google.cloud.dialogflow.v2beta1.Sentiment.encode(message.queryTextSentiment, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SentimentAnalysisResult message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.v2beta1.ISentimentAnalysisResult} message SentimentAnalysisResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SentimentAnalysisResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SentimentAnalysisResult} SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisResult.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.queryTextSentiment = $root.google.cloud.dialogflow.v2beta1.Sentiment.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SentimentAnalysisResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SentimentAnalysisResult} SentimentAnalysisResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SentimentAnalysisResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SentimentAnalysisResult message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SentimentAnalysisResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryTextSentiment != null && message.hasOwnProperty("queryTextSentiment")) { + var error = $root.google.cloud.dialogflow.v2beta1.Sentiment.verify(message.queryTextSentiment); + if (error) + return "queryTextSentiment." + error; + } + return null; + }; + + /** + * Creates a SentimentAnalysisResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SentimentAnalysisResult} SentimentAnalysisResult + */ + SentimentAnalysisResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SentimentAnalysisResult(); + if (object.queryTextSentiment != null) { + if (typeof object.queryTextSentiment !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SentimentAnalysisResult.queryTextSentiment: object expected"); + message.queryTextSentiment = $root.google.cloud.dialogflow.v2beta1.Sentiment.fromObject(object.queryTextSentiment); + } + return message; + }; + + /** + * Creates a plain object from a SentimentAnalysisResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @static + * @param {google.cloud.dialogflow.v2beta1.SentimentAnalysisResult} message SentimentAnalysisResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SentimentAnalysisResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.queryTextSentiment = null; + if (message.queryTextSentiment != null && message.hasOwnProperty("queryTextSentiment")) + object.queryTextSentiment = $root.google.cloud.dialogflow.v2beta1.Sentiment.toObject(message.queryTextSentiment, options); + return object; + }; + + /** + * Converts this SentimentAnalysisResult to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @instance + * @returns {Object.} JSON object + */ + SentimentAnalysisResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SentimentAnalysisResult + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SentimentAnalysisResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SentimentAnalysisResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SentimentAnalysisResult"; + }; + + return SentimentAnalysisResult; + })(); + + v2beta1.Sentiment = (function() { + + /** + * Properties of a Sentiment. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISentiment + * @property {number|null} [score] Sentiment score + * @property {number|null} [magnitude] Sentiment magnitude + */ + + /** + * Constructs a new Sentiment. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Sentiment. + * @implements ISentiment + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISentiment=} [properties] Properties to set + */ + function Sentiment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Sentiment score. + * @member {number} score + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @instance + */ + Sentiment.prototype.score = 0; + + /** + * Sentiment magnitude. + * @member {number} magnitude + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @instance + */ + Sentiment.prototype.magnitude = 0; + + /** + * Creates a new Sentiment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @static + * @param {google.cloud.dialogflow.v2beta1.ISentiment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Sentiment} Sentiment instance + */ + Sentiment.create = function create(properties) { + return new Sentiment(properties); + }; + + /** + * Encodes the specified Sentiment message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Sentiment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @static + * @param {google.cloud.dialogflow.v2beta1.ISentiment} message Sentiment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sentiment.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.score != null && Object.hasOwnProperty.call(message, "score")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.score); + if (message.magnitude != null && Object.hasOwnProperty.call(message, "magnitude")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.magnitude); + return writer; + }; + + /** + * Encodes the specified Sentiment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Sentiment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @static + * @param {google.cloud.dialogflow.v2beta1.ISentiment} message Sentiment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Sentiment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Sentiment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Sentiment} Sentiment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sentiment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Sentiment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.score = reader.float(); + break; + } + case 2: { + message.magnitude = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Sentiment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Sentiment} Sentiment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Sentiment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Sentiment message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Sentiment.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.score != null && message.hasOwnProperty("score")) + if (typeof message.score !== "number") + return "score: number expected"; + if (message.magnitude != null && message.hasOwnProperty("magnitude")) + if (typeof message.magnitude !== "number") + return "magnitude: number expected"; + return null; + }; + + /** + * Creates a Sentiment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Sentiment} Sentiment + */ + Sentiment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Sentiment) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Sentiment(); + if (object.score != null) + message.score = Number(object.score); + if (object.magnitude != null) + message.magnitude = Number(object.magnitude); + return message; + }; + + /** + * Creates a plain object from a Sentiment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @static + * @param {google.cloud.dialogflow.v2beta1.Sentiment} message Sentiment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Sentiment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.score = 0; + object.magnitude = 0; + } + if (message.score != null && message.hasOwnProperty("score")) + object.score = options.json && !isFinite(message.score) ? String(message.score) : message.score; + if (message.magnitude != null && message.hasOwnProperty("magnitude")) + object.magnitude = options.json && !isFinite(message.magnitude) ? String(message.magnitude) : message.magnitude; + return object; + }; + + /** + * Converts this Sentiment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @instance + * @returns {Object.} JSON object + */ + Sentiment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Sentiment + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Sentiment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Sentiment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Sentiment"; + }; + + return Sentiment; + })(); + + v2beta1.Contexts = (function() { + + /** + * Constructs a new Contexts service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Contexts + * @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 Contexts(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Contexts.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Contexts; + + /** + * Creates new Contexts service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @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 {Contexts} RPC service. Useful where requests and/or responses are streamed. + */ + Contexts.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|listContexts}. + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @typedef ListContextsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListContextsResponse} [response] ListContextsResponse + */ + + /** + * Calls ListContexts. + * @function listContexts + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListContextsRequest} request ListContextsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Contexts.ListContextsCallback} callback Node-style callback called with the error, if any, and ListContextsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.listContexts = function listContexts(request, callback) { + return this.rpcCall(listContexts, $root.google.cloud.dialogflow.v2beta1.ListContextsRequest, $root.google.cloud.dialogflow.v2beta1.ListContextsResponse, request, callback); + }, "name", { value: "ListContexts" }); + + /** + * Calls ListContexts. + * @function listContexts + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListContextsRequest} request ListContextsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|getContext}. + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @typedef GetContextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Context} [response] Context + */ + + /** + * Calls GetContext. + * @function getContext + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetContextRequest} request GetContextRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Contexts.GetContextCallback} callback Node-style callback called with the error, if any, and Context + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.getContext = function getContext(request, callback) { + return this.rpcCall(getContext, $root.google.cloud.dialogflow.v2beta1.GetContextRequest, $root.google.cloud.dialogflow.v2beta1.Context, request, callback); + }, "name", { value: "GetContext" }); + + /** + * Calls GetContext. + * @function getContext + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetContextRequest} request GetContextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|createContext}. + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @typedef CreateContextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Context} [response] Context + */ + + /** + * Calls CreateContext. + * @function createContext + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateContextRequest} request CreateContextRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Contexts.CreateContextCallback} callback Node-style callback called with the error, if any, and Context + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.createContext = function createContext(request, callback) { + return this.rpcCall(createContext, $root.google.cloud.dialogflow.v2beta1.CreateContextRequest, $root.google.cloud.dialogflow.v2beta1.Context, request, callback); + }, "name", { value: "CreateContext" }); + + /** + * Calls CreateContext. + * @function createContext + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateContextRequest} request CreateContextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|updateContext}. + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @typedef UpdateContextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Context} [response] Context + */ + + /** + * Calls UpdateContext. + * @function updateContext + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateContextRequest} request UpdateContextRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Contexts.UpdateContextCallback} callback Node-style callback called with the error, if any, and Context + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.updateContext = function updateContext(request, callback) { + return this.rpcCall(updateContext, $root.google.cloud.dialogflow.v2beta1.UpdateContextRequest, $root.google.cloud.dialogflow.v2beta1.Context, request, callback); + }, "name", { value: "UpdateContext" }); + + /** + * Calls UpdateContext. + * @function updateContext + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateContextRequest} request UpdateContextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|deleteContext}. + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @typedef DeleteContextCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteContext. + * @function deleteContext + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteContextRequest} request DeleteContextRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Contexts.DeleteContextCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.deleteContext = function deleteContext(request, callback) { + return this.rpcCall(deleteContext, $root.google.cloud.dialogflow.v2beta1.DeleteContextRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteContext" }); + + /** + * Calls DeleteContext. + * @function deleteContext + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteContextRequest} request DeleteContextRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Contexts|deleteAllContexts}. + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @typedef DeleteAllContextsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteAllContexts. + * @function deleteAllContexts + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest} request DeleteAllContextsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContextsCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Contexts.prototype.deleteAllContexts = function deleteAllContexts(request, callback) { + return this.rpcCall(deleteAllContexts, $root.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteAllContexts" }); + + /** + * Calls DeleteAllContexts. + * @function deleteAllContexts + * @memberof google.cloud.dialogflow.v2beta1.Contexts + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest} request DeleteAllContextsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Contexts; + })(); + + v2beta1.Context = (function() { + + /** + * Properties of a Context. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IContext + * @property {string|null} [name] Context name + * @property {number|null} [lifespanCount] Context lifespanCount + * @property {google.protobuf.IStruct|null} [parameters] Context parameters + */ + + /** + * Constructs a new Context. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Context. + * @implements IContext + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IContext=} [properties] Properties to set + */ + function Context(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Context name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Context + * @instance + */ + Context.prototype.name = ""; + + /** + * Context lifespanCount. + * @member {number} lifespanCount + * @memberof google.cloud.dialogflow.v2beta1.Context + * @instance + */ + Context.prototype.lifespanCount = 0; + + /** + * Context parameters. + * @member {google.protobuf.IStruct|null|undefined} parameters + * @memberof google.cloud.dialogflow.v2beta1.Context + * @instance + */ + Context.prototype.parameters = null; + + /** + * Creates a new Context instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Context + * @static + * @param {google.cloud.dialogflow.v2beta1.IContext=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Context} Context instance + */ + Context.create = function create(properties) { + return new Context(properties); + }; + + /** + * Encodes the specified Context message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Context.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Context + * @static + * @param {google.cloud.dialogflow.v2beta1.IContext} message Context message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Context.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.lifespanCount != null && Object.hasOwnProperty.call(message, "lifespanCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.lifespanCount); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.protobuf.Struct.encode(message.parameters, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Context message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Context.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Context + * @static + * @param {google.cloud.dialogflow.v2beta1.IContext} message Context message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Context.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Context message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Context + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Context} Context + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Context.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Context(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.lifespanCount = reader.int32(); + break; + } + case 3: { + message.parameters = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Context message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Context + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Context} Context + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Context.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Context message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Context + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Context.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.lifespanCount != null && message.hasOwnProperty("lifespanCount")) + if (!$util.isInteger(message.lifespanCount)) + return "lifespanCount: integer expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.protobuf.Struct.verify(message.parameters); + if (error) + return "parameters." + error; + } + return null; + }; + + /** + * Creates a Context message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Context + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Context} Context + */ + Context.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Context) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Context(); + if (object.name != null) + message.name = String(object.name); + if (object.lifespanCount != null) + message.lifespanCount = object.lifespanCount | 0; + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Context.parameters: object expected"); + message.parameters = $root.google.protobuf.Struct.fromObject(object.parameters); + } + return message; + }; + + /** + * Creates a plain object from a Context message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Context + * @static + * @param {google.cloud.dialogflow.v2beta1.Context} message Context + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Context.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.lifespanCount = 0; + object.parameters = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.lifespanCount != null && message.hasOwnProperty("lifespanCount")) + object.lifespanCount = message.lifespanCount; + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.protobuf.Struct.toObject(message.parameters, options); + return object; + }; + + /** + * Converts this Context to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Context + * @instance + * @returns {Object.} JSON object + */ + Context.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Context + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Context + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Context.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Context"; + }; + + return Context; + })(); + + v2beta1.ListContextsRequest = (function() { + + /** + * Properties of a ListContextsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListContextsRequest + * @property {string|null} [parent] ListContextsRequest parent + * @property {number|null} [pageSize] ListContextsRequest pageSize + * @property {string|null} [pageToken] ListContextsRequest pageToken + */ + + /** + * Constructs a new ListContextsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListContextsRequest. + * @implements IListContextsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListContextsRequest=} [properties] Properties to set + */ + function ListContextsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListContextsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @instance + */ + ListContextsRequest.prototype.parent = ""; + + /** + * ListContextsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @instance + */ + ListContextsRequest.prototype.pageSize = 0; + + /** + * ListContextsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @instance + */ + ListContextsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListContextsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListContextsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListContextsRequest} ListContextsRequest instance + */ + ListContextsRequest.create = function create(properties) { + return new ListContextsRequest(properties); + }; + + /** + * Encodes the specified ListContextsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListContextsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListContextsRequest} message ListContextsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListContextsRequest.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 ListContextsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListContextsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListContextsRequest} message ListContextsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListContextsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListContextsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListContextsRequest} ListContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListContextsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListContextsRequest(); + 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 ListContextsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListContextsRequest} ListContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListContextsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListContextsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListContextsRequest.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 ListContextsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListContextsRequest} ListContextsRequest + */ + ListContextsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListContextsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListContextsRequest(); + 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 ListContextsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListContextsRequest} message ListContextsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListContextsRequest.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 ListContextsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @instance + * @returns {Object.} JSON object + */ + ListContextsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListContextsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListContextsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListContextsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListContextsRequest"; + }; + + return ListContextsRequest; + })(); + + v2beta1.ListContextsResponse = (function() { + + /** + * Properties of a ListContextsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListContextsResponse + * @property {Array.|null} [contexts] ListContextsResponse contexts + * @property {string|null} [nextPageToken] ListContextsResponse nextPageToken + */ + + /** + * Constructs a new ListContextsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListContextsResponse. + * @implements IListContextsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListContextsResponse=} [properties] Properties to set + */ + function ListContextsResponse(properties) { + this.contexts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListContextsResponse contexts. + * @member {Array.} contexts + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @instance + */ + ListContextsResponse.prototype.contexts = $util.emptyArray; + + /** + * ListContextsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @instance + */ + ListContextsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListContextsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListContextsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListContextsResponse} ListContextsResponse instance + */ + ListContextsResponse.create = function create(properties) { + return new ListContextsResponse(properties); + }; + + /** + * Encodes the specified ListContextsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListContextsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListContextsResponse} message ListContextsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListContextsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.contexts != null && message.contexts.length) + for (var i = 0; i < message.contexts.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Context.encode(message.contexts[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 ListContextsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListContextsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListContextsResponse} message ListContextsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListContextsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListContextsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListContextsResponse} ListContextsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListContextsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListContextsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.contexts && message.contexts.length)) + message.contexts = []; + message.contexts.push($root.google.cloud.dialogflow.v2beta1.Context.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListContextsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListContextsResponse} ListContextsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListContextsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListContextsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListContextsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.contexts != null && message.hasOwnProperty("contexts")) { + if (!Array.isArray(message.contexts)) + return "contexts: array expected"; + for (var i = 0; i < message.contexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Context.verify(message.contexts[i]); + if (error) + return "contexts." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListContextsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListContextsResponse} ListContextsResponse + */ + ListContextsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListContextsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListContextsResponse(); + if (object.contexts) { + if (!Array.isArray(object.contexts)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListContextsResponse.contexts: array expected"); + message.contexts = []; + for (var i = 0; i < object.contexts.length; ++i) { + if (typeof object.contexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListContextsResponse.contexts: object expected"); + message.contexts[i] = $root.google.cloud.dialogflow.v2beta1.Context.fromObject(object.contexts[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListContextsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListContextsResponse} message ListContextsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListContextsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.contexts = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.contexts && message.contexts.length) { + object.contexts = []; + for (var j = 0; j < message.contexts.length; ++j) + object.contexts[j] = $root.google.cloud.dialogflow.v2beta1.Context.toObject(message.contexts[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListContextsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @instance + * @returns {Object.} JSON object + */ + ListContextsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListContextsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListContextsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListContextsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListContextsResponse"; + }; + + return ListContextsResponse; + })(); + + v2beta1.GetContextRequest = (function() { + + /** + * Properties of a GetContextRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetContextRequest + * @property {string|null} [name] GetContextRequest name + */ + + /** + * Constructs a new GetContextRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetContextRequest. + * @implements IGetContextRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetContextRequest=} [properties] Properties to set + */ + function GetContextRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetContextRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @instance + */ + GetContextRequest.prototype.name = ""; + + /** + * Creates a new GetContextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetContextRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetContextRequest} GetContextRequest instance + */ + GetContextRequest.create = function create(properties) { + return new GetContextRequest(properties); + }; + + /** + * Encodes the specified GetContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetContextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetContextRequest} message GetContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetContextRequest.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 GetContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetContextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetContextRequest} message GetContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetContextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetContextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetContextRequest} GetContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetContextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetContextRequest(); + 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 GetContextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetContextRequest} GetContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetContextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetContextRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetContextRequest.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 GetContextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetContextRequest} GetContextRequest + */ + GetContextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetContextRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetContextRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetContextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetContextRequest} message GetContextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetContextRequest.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 GetContextRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @instance + * @returns {Object.} JSON object + */ + GetContextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetContextRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetContextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetContextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetContextRequest"; + }; + + return GetContextRequest; + })(); + + v2beta1.CreateContextRequest = (function() { + + /** + * Properties of a CreateContextRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateContextRequest + * @property {string|null} [parent] CreateContextRequest parent + * @property {google.cloud.dialogflow.v2beta1.IContext|null} [context] CreateContextRequest context + */ + + /** + * Constructs a new CreateContextRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateContextRequest. + * @implements ICreateContextRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateContextRequest=} [properties] Properties to set + */ + function CreateContextRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateContextRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @instance + */ + CreateContextRequest.prototype.parent = ""; + + /** + * CreateContextRequest context. + * @member {google.cloud.dialogflow.v2beta1.IContext|null|undefined} context + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @instance + */ + CreateContextRequest.prototype.context = null; + + /** + * Creates a new CreateContextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateContextRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateContextRequest} CreateContextRequest instance + */ + CreateContextRequest.create = function create(properties) { + return new CreateContextRequest(properties); + }; + + /** + * Encodes the specified CreateContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateContextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateContextRequest} message CreateContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateContextRequest.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.context != null && Object.hasOwnProperty.call(message, "context")) + $root.google.cloud.dialogflow.v2beta1.Context.encode(message.context, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateContextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateContextRequest} message CreateContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateContextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateContextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateContextRequest} CreateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateContextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateContextRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.context = $root.google.cloud.dialogflow.v2beta1.Context.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateContextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateContextRequest} CreateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateContextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateContextRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateContextRequest.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.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.dialogflow.v2beta1.Context.verify(message.context); + if (error) + return "context." + error; + } + return null; + }; + + /** + * Creates a CreateContextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateContextRequest} CreateContextRequest + */ + CreateContextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateContextRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateContextRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateContextRequest.context: object expected"); + message.context = $root.google.cloud.dialogflow.v2beta1.Context.fromObject(object.context); + } + return message; + }; + + /** + * Creates a plain object from a CreateContextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateContextRequest} message CreateContextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateContextRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.context = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.dialogflow.v2beta1.Context.toObject(message.context, options); + return object; + }; + + /** + * Converts this CreateContextRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @instance + * @returns {Object.} JSON object + */ + CreateContextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateContextRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateContextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateContextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateContextRequest"; + }; + + return CreateContextRequest; + })(); + + v2beta1.UpdateContextRequest = (function() { + + /** + * Properties of an UpdateContextRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateContextRequest + * @property {google.cloud.dialogflow.v2beta1.IContext|null} [context] UpdateContextRequest context + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateContextRequest updateMask + */ + + /** + * Constructs a new UpdateContextRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateContextRequest. + * @implements IUpdateContextRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateContextRequest=} [properties] Properties to set + */ + function UpdateContextRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateContextRequest context. + * @member {google.cloud.dialogflow.v2beta1.IContext|null|undefined} context + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @instance + */ + UpdateContextRequest.prototype.context = null; + + /** + * UpdateContextRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @instance + */ + UpdateContextRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateContextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateContextRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateContextRequest} UpdateContextRequest instance + */ + UpdateContextRequest.create = function create(properties) { + return new UpdateContextRequest(properties); + }; + + /** + * Encodes the specified UpdateContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateContextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateContextRequest} message UpdateContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateContextRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.context != null && Object.hasOwnProperty.call(message, "context")) + $root.google.cloud.dialogflow.v2beta1.Context.encode(message.context, 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 UpdateContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateContextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateContextRequest} message UpdateContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateContextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateContextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateContextRequest} UpdateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateContextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateContextRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.context = $root.google.cloud.dialogflow.v2beta1.Context.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 UpdateContextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateContextRequest} UpdateContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateContextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateContextRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateContextRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.dialogflow.v2beta1.Context.verify(message.context); + if (error) + return "context." + 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 UpdateContextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateContextRequest} UpdateContextRequest + */ + UpdateContextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateContextRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateContextRequest(); + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateContextRequest.context: object expected"); + message.context = $root.google.cloud.dialogflow.v2beta1.Context.fromObject(object.context); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateContextRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateContextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateContextRequest} message UpdateContextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateContextRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.context = null; + object.updateMask = null; + } + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.dialogflow.v2beta1.Context.toObject(message.context, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateContextRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateContextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateContextRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateContextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateContextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateContextRequest"; + }; + + return UpdateContextRequest; + })(); + + v2beta1.DeleteContextRequest = (function() { + + /** + * Properties of a DeleteContextRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteContextRequest + * @property {string|null} [name] DeleteContextRequest name + */ + + /** + * Constructs a new DeleteContextRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteContextRequest. + * @implements IDeleteContextRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteContextRequest=} [properties] Properties to set + */ + function DeleteContextRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteContextRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @instance + */ + DeleteContextRequest.prototype.name = ""; + + /** + * Creates a new DeleteContextRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteContextRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteContextRequest} DeleteContextRequest instance + */ + DeleteContextRequest.create = function create(properties) { + return new DeleteContextRequest(properties); + }; + + /** + * Encodes the specified DeleteContextRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteContextRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteContextRequest} message DeleteContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteContextRequest.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 DeleteContextRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteContextRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteContextRequest} message DeleteContextRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteContextRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteContextRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteContextRequest} DeleteContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteContextRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteContextRequest(); + 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 DeleteContextRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteContextRequest} DeleteContextRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteContextRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteContextRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteContextRequest.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 DeleteContextRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteContextRequest} DeleteContextRequest + */ + DeleteContextRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteContextRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteContextRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteContextRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteContextRequest} message DeleteContextRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteContextRequest.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 DeleteContextRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteContextRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteContextRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteContextRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteContextRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteContextRequest"; + }; + + return DeleteContextRequest; + })(); + + v2beta1.DeleteAllContextsRequest = (function() { + + /** + * Properties of a DeleteAllContextsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteAllContextsRequest + * @property {string|null} [parent] DeleteAllContextsRequest parent + */ + + /** + * Constructs a new DeleteAllContextsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteAllContextsRequest. + * @implements IDeleteAllContextsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest=} [properties] Properties to set + */ + function DeleteAllContextsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteAllContextsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @instance + */ + DeleteAllContextsRequest.prototype.parent = ""; + + /** + * Creates a new DeleteAllContextsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest} DeleteAllContextsRequest instance + */ + DeleteAllContextsRequest.create = function create(properties) { + return new DeleteAllContextsRequest(properties); + }; + + /** + * Encodes the specified DeleteAllContextsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest} message DeleteAllContextsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAllContextsRequest.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); + return writer; + }; + + /** + * Encodes the specified DeleteAllContextsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest} message DeleteAllContextsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteAllContextsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteAllContextsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest} DeleteAllContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAllContextsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteAllContextsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest} DeleteAllContextsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteAllContextsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteAllContextsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteAllContextsRequest.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"; + return null; + }; + + /** + * Creates a DeleteAllContextsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest} DeleteAllContextsRequest + */ + DeleteAllContextsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + return message; + }; + + /** + * Creates a plain object from a DeleteAllContextsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest} message DeleteAllContextsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteAllContextsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + return object; + }; + + /** + * Converts this DeleteAllContextsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteAllContextsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteAllContextsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteAllContextsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest"; + }; + + return DeleteAllContextsRequest; + })(); + + v2beta1.Intents = (function() { + + /** + * Constructs a new Intents service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an Intents + * @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 Intents(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Intents.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Intents; + + /** + * Creates new Intents service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @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 {Intents} RPC service. Useful where requests and/or responses are streamed. + */ + Intents.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|listIntents}. + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @typedef ListIntentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListIntentsResponse} [response] ListIntentsResponse + */ + + /** + * Calls ListIntents. + * @function listIntents + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListIntentsRequest} request ListIntentsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Intents.ListIntentsCallback} callback Node-style callback called with the error, if any, and ListIntentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.listIntents = function listIntents(request, callback) { + return this.rpcCall(listIntents, $root.google.cloud.dialogflow.v2beta1.ListIntentsRequest, $root.google.cloud.dialogflow.v2beta1.ListIntentsResponse, request, callback); + }, "name", { value: "ListIntents" }); + + /** + * Calls ListIntents. + * @function listIntents + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListIntentsRequest} request ListIntentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|getIntent}. + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @typedef GetIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Intent} [response] Intent + */ + + /** + * Calls GetIntent. + * @function getIntent + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetIntentRequest} request GetIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Intents.GetIntentCallback} callback Node-style callback called with the error, if any, and Intent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.getIntent = function getIntent(request, callback) { + return this.rpcCall(getIntent, $root.google.cloud.dialogflow.v2beta1.GetIntentRequest, $root.google.cloud.dialogflow.v2beta1.Intent, request, callback); + }, "name", { value: "GetIntent" }); + + /** + * Calls GetIntent. + * @function getIntent + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetIntentRequest} request GetIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|createIntent}. + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @typedef CreateIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Intent} [response] Intent + */ + + /** + * Calls CreateIntent. + * @function createIntent + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateIntentRequest} request CreateIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Intents.CreateIntentCallback} callback Node-style callback called with the error, if any, and Intent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.createIntent = function createIntent(request, callback) { + return this.rpcCall(createIntent, $root.google.cloud.dialogflow.v2beta1.CreateIntentRequest, $root.google.cloud.dialogflow.v2beta1.Intent, request, callback); + }, "name", { value: "CreateIntent" }); + + /** + * Calls CreateIntent. + * @function createIntent + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateIntentRequest} request CreateIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|updateIntent}. + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @typedef UpdateIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Intent} [response] Intent + */ + + /** + * Calls UpdateIntent. + * @function updateIntent + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateIntentRequest} request UpdateIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Intents.UpdateIntentCallback} callback Node-style callback called with the error, if any, and Intent + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.updateIntent = function updateIntent(request, callback) { + return this.rpcCall(updateIntent, $root.google.cloud.dialogflow.v2beta1.UpdateIntentRequest, $root.google.cloud.dialogflow.v2beta1.Intent, request, callback); + }, "name", { value: "UpdateIntent" }); + + /** + * Calls UpdateIntent. + * @function updateIntent + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateIntentRequest} request UpdateIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|deleteIntent}. + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @typedef DeleteIntentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteIntent. + * @function deleteIntent + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteIntentRequest} request DeleteIntentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Intents.DeleteIntentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.deleteIntent = function deleteIntent(request, callback) { + return this.rpcCall(deleteIntent, $root.google.cloud.dialogflow.v2beta1.DeleteIntentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteIntent" }); + + /** + * Calls DeleteIntent. + * @function deleteIntent + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteIntentRequest} request DeleteIntentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|batchUpdateIntents}. + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @typedef BatchUpdateIntentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchUpdateIntents. + * @function batchUpdateIntents + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest} request BatchUpdateIntentsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.batchUpdateIntents = function batchUpdateIntents(request, callback) { + return this.rpcCall(batchUpdateIntents, $root.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchUpdateIntents" }); + + /** + * Calls BatchUpdateIntents. + * @function batchUpdateIntents + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest} request BatchUpdateIntentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Intents|batchDeleteIntents}. + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @typedef BatchDeleteIntentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchDeleteIntents. + * @function batchDeleteIntents + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest} request BatchDeleteIntentsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Intents.prototype.batchDeleteIntents = function batchDeleteIntents(request, callback) { + return this.rpcCall(batchDeleteIntents, $root.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchDeleteIntents" }); + + /** + * Calls BatchDeleteIntents. + * @function batchDeleteIntents + * @memberof google.cloud.dialogflow.v2beta1.Intents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest} request BatchDeleteIntentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Intents; + })(); + + v2beta1.Intent = (function() { + + /** + * Properties of an Intent. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IIntent + * @property {string|null} [name] Intent name + * @property {string|null} [displayName] Intent displayName + * @property {google.cloud.dialogflow.v2beta1.Intent.WebhookState|null} [webhookState] Intent webhookState + * @property {number|null} [priority] Intent priority + * @property {boolean|null} [isFallback] Intent isFallback + * @property {boolean|null} [mlEnabled] Intent mlEnabled + * @property {boolean|null} [mlDisabled] Intent mlDisabled + * @property {boolean|null} [liveAgentHandoff] Intent liveAgentHandoff + * @property {boolean|null} [endInteraction] Intent endInteraction + * @property {Array.|null} [inputContextNames] Intent inputContextNames + * @property {Array.|null} [events] Intent events + * @property {Array.|null} [trainingPhrases] Intent trainingPhrases + * @property {string|null} [action] Intent action + * @property {Array.|null} [outputContexts] Intent outputContexts + * @property {boolean|null} [resetContexts] Intent resetContexts + * @property {Array.|null} [parameters] Intent parameters + * @property {Array.|null} [messages] Intent messages + * @property {Array.|null} [defaultResponsePlatforms] Intent defaultResponsePlatforms + * @property {string|null} [rootFollowupIntentName] Intent rootFollowupIntentName + * @property {string|null} [parentFollowupIntentName] Intent parentFollowupIntentName + * @property {Array.|null} [followupIntentInfo] Intent followupIntentInfo + */ + + /** + * Constructs a new Intent. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an Intent. + * @implements IIntent + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IIntent=} [properties] Properties to set + */ + function Intent(properties) { + this.inputContextNames = []; + this.events = []; + this.trainingPhrases = []; + this.outputContexts = []; + this.parameters = []; + this.messages = []; + this.defaultResponsePlatforms = []; + this.followupIntentInfo = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Intent name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.name = ""; + + /** + * Intent displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.displayName = ""; + + /** + * Intent webhookState. + * @member {google.cloud.dialogflow.v2beta1.Intent.WebhookState} webhookState + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.webhookState = 0; + + /** + * Intent priority. + * @member {number} priority + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.priority = 0; + + /** + * Intent isFallback. + * @member {boolean} isFallback + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.isFallback = false; + + /** + * Intent mlEnabled. + * @member {boolean} mlEnabled + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.mlEnabled = false; + + /** + * Intent mlDisabled. + * @member {boolean} mlDisabled + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.mlDisabled = false; + + /** + * Intent liveAgentHandoff. + * @member {boolean} liveAgentHandoff + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.liveAgentHandoff = false; + + /** + * Intent endInteraction. + * @member {boolean} endInteraction + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.endInteraction = false; + + /** + * Intent inputContextNames. + * @member {Array.} inputContextNames + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.inputContextNames = $util.emptyArray; + + /** + * Intent events. + * @member {Array.} events + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.events = $util.emptyArray; + + /** + * Intent trainingPhrases. + * @member {Array.} trainingPhrases + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.trainingPhrases = $util.emptyArray; + + /** + * Intent action. + * @member {string} action + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.action = ""; + + /** + * Intent outputContexts. + * @member {Array.} outputContexts + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.outputContexts = $util.emptyArray; + + /** + * Intent resetContexts. + * @member {boolean} resetContexts + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.resetContexts = false; + + /** + * Intent parameters. + * @member {Array.} parameters + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.parameters = $util.emptyArray; + + /** + * Intent messages. + * @member {Array.} messages + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.messages = $util.emptyArray; + + /** + * Intent defaultResponsePlatforms. + * @member {Array.} defaultResponsePlatforms + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.defaultResponsePlatforms = $util.emptyArray; + + /** + * Intent rootFollowupIntentName. + * @member {string} rootFollowupIntentName + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.rootFollowupIntentName = ""; + + /** + * Intent parentFollowupIntentName. + * @member {string} parentFollowupIntentName + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.parentFollowupIntentName = ""; + + /** + * Intent followupIntentInfo. + * @member {Array.} followupIntentInfo + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + */ + Intent.prototype.followupIntentInfo = $util.emptyArray; + + /** + * Creates a new Intent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @static + * @param {google.cloud.dialogflow.v2beta1.IIntent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent} Intent instance + */ + Intent.create = function create(properties) { + return new Intent(properties); + }; + + /** + * Encodes the specified Intent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @static + * @param {google.cloud.dialogflow.v2beta1.IIntent} message Intent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Intent.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.priority != null && Object.hasOwnProperty.call(message, "priority")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.priority); + if (message.isFallback != null && Object.hasOwnProperty.call(message, "isFallback")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.isFallback); + if (message.mlEnabled != null && Object.hasOwnProperty.call(message, "mlEnabled")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.mlEnabled); + if (message.webhookState != null && Object.hasOwnProperty.call(message, "webhookState")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.webhookState); + if (message.inputContextNames != null && message.inputContextNames.length) + for (var i = 0; i < message.inputContextNames.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.inputContextNames[i]); + if (message.events != null && message.events.length) + for (var i = 0; i < message.events.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.events[i]); + if (message.trainingPhrases != null && message.trainingPhrases.length) + for (var i = 0; i < message.trainingPhrases.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.encode(message.trainingPhrases[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.action); + if (message.outputContexts != null && message.outputContexts.length) + for (var i = 0; i < message.outputContexts.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Context.encode(message.outputContexts[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.resetContexts != null && Object.hasOwnProperty.call(message, "resetContexts")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.resetContexts); + if (message.parameters != null && message.parameters.length) + for (var i = 0; i < message.parameters.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Parameter.encode(message.parameters[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.encode(message.messages[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.defaultResponsePlatforms != null && message.defaultResponsePlatforms.length) { + writer.uint32(/* id 15, wireType 2 =*/122).fork(); + for (var i = 0; i < message.defaultResponsePlatforms.length; ++i) + writer.int32(message.defaultResponsePlatforms[i]); + writer.ldelim(); + } + if (message.rootFollowupIntentName != null && Object.hasOwnProperty.call(message, "rootFollowupIntentName")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.rootFollowupIntentName); + if (message.parentFollowupIntentName != null && Object.hasOwnProperty.call(message, "parentFollowupIntentName")) + writer.uint32(/* id 17, wireType 2 =*/138).string(message.parentFollowupIntentName); + if (message.followupIntentInfo != null && message.followupIntentInfo.length) + for (var i = 0; i < message.followupIntentInfo.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.encode(message.followupIntentInfo[i], writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.mlDisabled != null && Object.hasOwnProperty.call(message, "mlDisabled")) + writer.uint32(/* id 19, wireType 0 =*/152).bool(message.mlDisabled); + if (message.liveAgentHandoff != null && Object.hasOwnProperty.call(message, "liveAgentHandoff")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.liveAgentHandoff); + if (message.endInteraction != null && Object.hasOwnProperty.call(message, "endInteraction")) + writer.uint32(/* id 21, wireType 0 =*/168).bool(message.endInteraction); + return writer; + }; + + /** + * Encodes the specified Intent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @static + * @param {google.cloud.dialogflow.v2beta1.IIntent} message Intent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Intent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Intent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent} Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Intent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent(); + 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 6: { + message.webhookState = reader.int32(); + break; + } + case 3: { + message.priority = reader.int32(); + break; + } + case 4: { + message.isFallback = reader.bool(); + break; + } + case 5: { + message.mlEnabled = reader.bool(); + break; + } + case 19: { + message.mlDisabled = reader.bool(); + break; + } + case 20: { + message.liveAgentHandoff = reader.bool(); + break; + } + case 21: { + message.endInteraction = reader.bool(); + break; + } + case 7: { + if (!(message.inputContextNames && message.inputContextNames.length)) + message.inputContextNames = []; + message.inputContextNames.push(reader.string()); + break; + } + case 8: { + if (!(message.events && message.events.length)) + message.events = []; + message.events.push(reader.string()); + break; + } + case 9: { + if (!(message.trainingPhrases && message.trainingPhrases.length)) + message.trainingPhrases = []; + message.trainingPhrases.push($root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.decode(reader, reader.uint32())); + break; + } + case 10: { + message.action = reader.string(); + break; + } + case 11: { + if (!(message.outputContexts && message.outputContexts.length)) + message.outputContexts = []; + message.outputContexts.push($root.google.cloud.dialogflow.v2beta1.Context.decode(reader, reader.uint32())); + break; + } + case 12: { + message.resetContexts = reader.bool(); + break; + } + case 13: { + if (!(message.parameters && message.parameters.length)) + message.parameters = []; + message.parameters.push($root.google.cloud.dialogflow.v2beta1.Intent.Parameter.decode(reader, reader.uint32())); + break; + } + case 14: { + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.decode(reader, reader.uint32())); + break; + } + case 15: { + if (!(message.defaultResponsePlatforms && message.defaultResponsePlatforms.length)) + message.defaultResponsePlatforms = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.defaultResponsePlatforms.push(reader.int32()); + } else + message.defaultResponsePlatforms.push(reader.int32()); + break; + } + case 16: { + message.rootFollowupIntentName = reader.string(); + break; + } + case 17: { + message.parentFollowupIntentName = reader.string(); + break; + } + case 18: { + if (!(message.followupIntentInfo && message.followupIntentInfo.length)) + message.followupIntentInfo = []; + message.followupIntentInfo.push($root.google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Intent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent} Intent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Intent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Intent message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Intent.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.webhookState != null && message.hasOwnProperty("webhookState")) + switch (message.webhookState) { + default: + return "webhookState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.priority != null && message.hasOwnProperty("priority")) + if (!$util.isInteger(message.priority)) + return "priority: integer expected"; + if (message.isFallback != null && message.hasOwnProperty("isFallback")) + if (typeof message.isFallback !== "boolean") + return "isFallback: boolean expected"; + if (message.mlEnabled != null && message.hasOwnProperty("mlEnabled")) + if (typeof message.mlEnabled !== "boolean") + return "mlEnabled: boolean expected"; + if (message.mlDisabled != null && message.hasOwnProperty("mlDisabled")) + if (typeof message.mlDisabled !== "boolean") + return "mlDisabled: boolean expected"; + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) + if (typeof message.liveAgentHandoff !== "boolean") + return "liveAgentHandoff: boolean expected"; + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) + if (typeof message.endInteraction !== "boolean") + return "endInteraction: boolean expected"; + if (message.inputContextNames != null && message.hasOwnProperty("inputContextNames")) { + if (!Array.isArray(message.inputContextNames)) + return "inputContextNames: array expected"; + for (var i = 0; i < message.inputContextNames.length; ++i) + if (!$util.isString(message.inputContextNames[i])) + return "inputContextNames: string[] expected"; + } + if (message.events != null && message.hasOwnProperty("events")) { + if (!Array.isArray(message.events)) + return "events: array expected"; + for (var i = 0; i < message.events.length; ++i) + if (!$util.isString(message.events[i])) + return "events: string[] expected"; + } + if (message.trainingPhrases != null && message.hasOwnProperty("trainingPhrases")) { + if (!Array.isArray(message.trainingPhrases)) + return "trainingPhrases: array expected"; + for (var i = 0; i < message.trainingPhrases.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.verify(message.trainingPhrases[i]); + if (error) + return "trainingPhrases." + error; + } + } + if (message.action != null && message.hasOwnProperty("action")) + if (!$util.isString(message.action)) + return "action: string expected"; + if (message.outputContexts != null && message.hasOwnProperty("outputContexts")) { + if (!Array.isArray(message.outputContexts)) + return "outputContexts: array expected"; + for (var i = 0; i < message.outputContexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Context.verify(message.outputContexts[i]); + if (error) + return "outputContexts." + error; + } + } + if (message.resetContexts != null && message.hasOwnProperty("resetContexts")) + if (typeof message.resetContexts !== "boolean") + return "resetContexts: boolean expected"; + if (message.parameters != null && message.hasOwnProperty("parameters")) { + if (!Array.isArray(message.parameters)) + return "parameters: array expected"; + for (var i = 0; i < message.parameters.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Parameter.verify(message.parameters[i]); + if (error) + return "parameters." + error; + } + } + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.defaultResponsePlatforms != null && message.hasOwnProperty("defaultResponsePlatforms")) { + if (!Array.isArray(message.defaultResponsePlatforms)) + return "defaultResponsePlatforms: array expected"; + for (var i = 0; i < message.defaultResponsePlatforms.length; ++i) + switch (message.defaultResponsePlatforms[i]) { + default: + return "defaultResponsePlatforms: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 10: + case 11: + break; + } + } + if (message.rootFollowupIntentName != null && message.hasOwnProperty("rootFollowupIntentName")) + if (!$util.isString(message.rootFollowupIntentName)) + return "rootFollowupIntentName: string expected"; + if (message.parentFollowupIntentName != null && message.hasOwnProperty("parentFollowupIntentName")) + if (!$util.isString(message.parentFollowupIntentName)) + return "parentFollowupIntentName: string expected"; + if (message.followupIntentInfo != null && message.hasOwnProperty("followupIntentInfo")) { + if (!Array.isArray(message.followupIntentInfo)) + return "followupIntentInfo: array expected"; + for (var i = 0; i < message.followupIntentInfo.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.verify(message.followupIntentInfo[i]); + if (error) + return "followupIntentInfo." + error; + } + } + return null; + }; + + /** + * Creates an Intent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent} Intent + */ + Intent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.webhookState) { + default: + if (typeof object.webhookState === "number") { + message.webhookState = object.webhookState; + break; + } + break; + case "WEBHOOK_STATE_UNSPECIFIED": + case 0: + message.webhookState = 0; + break; + case "WEBHOOK_STATE_ENABLED": + case 1: + message.webhookState = 1; + break; + case "WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING": + case 2: + message.webhookState = 2; + break; + } + if (object.priority != null) + message.priority = object.priority | 0; + if (object.isFallback != null) + message.isFallback = Boolean(object.isFallback); + if (object.mlEnabled != null) + message.mlEnabled = Boolean(object.mlEnabled); + if (object.mlDisabled != null) + message.mlDisabled = Boolean(object.mlDisabled); + if (object.liveAgentHandoff != null) + message.liveAgentHandoff = Boolean(object.liveAgentHandoff); + if (object.endInteraction != null) + message.endInteraction = Boolean(object.endInteraction); + if (object.inputContextNames) { + if (!Array.isArray(object.inputContextNames)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.inputContextNames: array expected"); + message.inputContextNames = []; + for (var i = 0; i < object.inputContextNames.length; ++i) + message.inputContextNames[i] = String(object.inputContextNames[i]); + } + if (object.events) { + if (!Array.isArray(object.events)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.events: array expected"); + message.events = []; + for (var i = 0; i < object.events.length; ++i) + message.events[i] = String(object.events[i]); + } + if (object.trainingPhrases) { + if (!Array.isArray(object.trainingPhrases)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.trainingPhrases: array expected"); + message.trainingPhrases = []; + for (var i = 0; i < object.trainingPhrases.length; ++i) { + if (typeof object.trainingPhrases[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.trainingPhrases: object expected"); + message.trainingPhrases[i] = $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.fromObject(object.trainingPhrases[i]); + } + } + if (object.action != null) + message.action = String(object.action); + if (object.outputContexts) { + if (!Array.isArray(object.outputContexts)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.outputContexts: array expected"); + message.outputContexts = []; + for (var i = 0; i < object.outputContexts.length; ++i) { + if (typeof object.outputContexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.outputContexts: object expected"); + message.outputContexts[i] = $root.google.cloud.dialogflow.v2beta1.Context.fromObject(object.outputContexts[i]); + } + } + if (object.resetContexts != null) + message.resetContexts = Boolean(object.resetContexts); + if (object.parameters) { + if (!Array.isArray(object.parameters)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.parameters: array expected"); + message.parameters = []; + for (var i = 0; i < object.parameters.length; ++i) { + if (typeof object.parameters[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.parameters: object expected"); + message.parameters[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Parameter.fromObject(object.parameters[i]); + } + } + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.messages: object expected"); + message.messages[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.fromObject(object.messages[i]); + } + } + if (object.defaultResponsePlatforms) { + if (!Array.isArray(object.defaultResponsePlatforms)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.defaultResponsePlatforms: array expected"); + message.defaultResponsePlatforms = []; + for (var i = 0; i < object.defaultResponsePlatforms.length; ++i) + switch (object.defaultResponsePlatforms[i]) { + default: + if (typeof object.defaultResponsePlatforms[i] === "number") { + message.defaultResponsePlatforms[i] = object.defaultResponsePlatforms[i]; + break; + } + case "PLATFORM_UNSPECIFIED": + case 0: + message.defaultResponsePlatforms[i] = 0; + break; + case "FACEBOOK": + case 1: + message.defaultResponsePlatforms[i] = 1; + break; + case "SLACK": + case 2: + message.defaultResponsePlatforms[i] = 2; + break; + case "TELEGRAM": + case 3: + message.defaultResponsePlatforms[i] = 3; + break; + case "KIK": + case 4: + message.defaultResponsePlatforms[i] = 4; + break; + case "SKYPE": + case 5: + message.defaultResponsePlatforms[i] = 5; + break; + case "LINE": + case 6: + message.defaultResponsePlatforms[i] = 6; + break; + case "VIBER": + case 7: + message.defaultResponsePlatforms[i] = 7; + break; + case "ACTIONS_ON_GOOGLE": + case 8: + message.defaultResponsePlatforms[i] = 8; + break; + case "TELEPHONY": + case 10: + message.defaultResponsePlatforms[i] = 10; + break; + case "GOOGLE_HANGOUTS": + case 11: + message.defaultResponsePlatforms[i] = 11; + break; + } + } + if (object.rootFollowupIntentName != null) + message.rootFollowupIntentName = String(object.rootFollowupIntentName); + if (object.parentFollowupIntentName != null) + message.parentFollowupIntentName = String(object.parentFollowupIntentName); + if (object.followupIntentInfo) { + if (!Array.isArray(object.followupIntentInfo)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.followupIntentInfo: array expected"); + message.followupIntentInfo = []; + for (var i = 0; i < object.followupIntentInfo.length; ++i) { + if (typeof object.followupIntentInfo[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.followupIntentInfo: object expected"); + message.followupIntentInfo[i] = $root.google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.fromObject(object.followupIntentInfo[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an Intent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent} message Intent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Intent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.inputContextNames = []; + object.events = []; + object.trainingPhrases = []; + object.outputContexts = []; + object.parameters = []; + object.messages = []; + object.defaultResponsePlatforms = []; + object.followupIntentInfo = []; + } + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.priority = 0; + object.isFallback = false; + object.mlEnabled = false; + object.webhookState = options.enums === String ? "WEBHOOK_STATE_UNSPECIFIED" : 0; + object.action = ""; + object.resetContexts = false; + object.rootFollowupIntentName = ""; + object.parentFollowupIntentName = ""; + object.mlDisabled = false; + object.liveAgentHandoff = false; + object.endInteraction = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.priority != null && message.hasOwnProperty("priority")) + object.priority = message.priority; + if (message.isFallback != null && message.hasOwnProperty("isFallback")) + object.isFallback = message.isFallback; + if (message.mlEnabled != null && message.hasOwnProperty("mlEnabled")) + object.mlEnabled = message.mlEnabled; + if (message.webhookState != null && message.hasOwnProperty("webhookState")) + object.webhookState = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.WebhookState[message.webhookState] === undefined ? message.webhookState : $root.google.cloud.dialogflow.v2beta1.Intent.WebhookState[message.webhookState] : message.webhookState; + if (message.inputContextNames && message.inputContextNames.length) { + object.inputContextNames = []; + for (var j = 0; j < message.inputContextNames.length; ++j) + object.inputContextNames[j] = message.inputContextNames[j]; + } + if (message.events && message.events.length) { + object.events = []; + for (var j = 0; j < message.events.length; ++j) + object.events[j] = message.events[j]; + } + if (message.trainingPhrases && message.trainingPhrases.length) { + object.trainingPhrases = []; + for (var j = 0; j < message.trainingPhrases.length; ++j) + object.trainingPhrases[j] = $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.toObject(message.trainingPhrases[j], options); + } + if (message.action != null && message.hasOwnProperty("action")) + object.action = message.action; + if (message.outputContexts && message.outputContexts.length) { + object.outputContexts = []; + for (var j = 0; j < message.outputContexts.length; ++j) + object.outputContexts[j] = $root.google.cloud.dialogflow.v2beta1.Context.toObject(message.outputContexts[j], options); + } + if (message.resetContexts != null && message.hasOwnProperty("resetContexts")) + object.resetContexts = message.resetContexts; + if (message.parameters && message.parameters.length) { + object.parameters = []; + for (var j = 0; j < message.parameters.length; ++j) + object.parameters[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Parameter.toObject(message.parameters[j], options); + } + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.toObject(message.messages[j], options); + } + if (message.defaultResponsePlatforms && message.defaultResponsePlatforms.length) { + object.defaultResponsePlatforms = []; + for (var j = 0; j < message.defaultResponsePlatforms.length; ++j) + object.defaultResponsePlatforms[j] = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.Platform[message.defaultResponsePlatforms[j]] === undefined ? message.defaultResponsePlatforms[j] : $root.google.cloud.dialogflow.v2beta1.Intent.Message.Platform[message.defaultResponsePlatforms[j]] : message.defaultResponsePlatforms[j]; + } + if (message.rootFollowupIntentName != null && message.hasOwnProperty("rootFollowupIntentName")) + object.rootFollowupIntentName = message.rootFollowupIntentName; + if (message.parentFollowupIntentName != null && message.hasOwnProperty("parentFollowupIntentName")) + object.parentFollowupIntentName = message.parentFollowupIntentName; + if (message.followupIntentInfo && message.followupIntentInfo.length) { + object.followupIntentInfo = []; + for (var j = 0; j < message.followupIntentInfo.length; ++j) + object.followupIntentInfo[j] = $root.google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.toObject(message.followupIntentInfo[j], options); + } + if (message.mlDisabled != null && message.hasOwnProperty("mlDisabled")) + object.mlDisabled = message.mlDisabled; + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) + object.liveAgentHandoff = message.liveAgentHandoff; + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) + object.endInteraction = message.endInteraction; + return object; + }; + + /** + * Converts this Intent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @instance + * @returns {Object.} JSON object + */ + Intent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Intent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Intent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent"; + }; + + /** + * WebhookState enum. + * @name google.cloud.dialogflow.v2beta1.Intent.WebhookState + * @enum {number} + * @property {number} WEBHOOK_STATE_UNSPECIFIED=0 WEBHOOK_STATE_UNSPECIFIED value + * @property {number} WEBHOOK_STATE_ENABLED=1 WEBHOOK_STATE_ENABLED value + * @property {number} WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING=2 WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING value + */ + Intent.WebhookState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WEBHOOK_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "WEBHOOK_STATE_ENABLED"] = 1; + values[valuesById[2] = "WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING"] = 2; + return values; + })(); + + Intent.TrainingPhrase = (function() { + + /** + * Properties of a TrainingPhrase. + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @interface ITrainingPhrase + * @property {string|null} [name] TrainingPhrase name + * @property {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type|null} [type] TrainingPhrase type + * @property {Array.|null} [parts] TrainingPhrase parts + * @property {number|null} [timesAddedCount] TrainingPhrase timesAddedCount + */ + + /** + * Constructs a new TrainingPhrase. + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @classdesc Represents a TrainingPhrase. + * @implements ITrainingPhrase + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase=} [properties] Properties to set + */ + function TrainingPhrase(properties) { + this.parts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TrainingPhrase name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.name = ""; + + /** + * TrainingPhrase type. + * @member {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type} type + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.type = 0; + + /** + * TrainingPhrase parts. + * @member {Array.} parts + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.parts = $util.emptyArray; + + /** + * TrainingPhrase timesAddedCount. + * @member {number} timesAddedCount + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @instance + */ + TrainingPhrase.prototype.timesAddedCount = 0; + + /** + * Creates a new TrainingPhrase instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase} TrainingPhrase instance + */ + TrainingPhrase.create = function create(properties) { + return new TrainingPhrase(properties); + }; + + /** + * Encodes the specified TrainingPhrase message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase} message TrainingPhrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainingPhrase.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.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.parts != null && message.parts.length) + for (var i = 0; i < message.parts.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.encode(message.parts[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.timesAddedCount != null && Object.hasOwnProperty.call(message, "timesAddedCount")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.timesAddedCount); + return writer; + }; + + /** + * Encodes the specified TrainingPhrase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.ITrainingPhrase} message TrainingPhrase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TrainingPhrase.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase} TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainingPhrase.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + if (!(message.parts && message.parts.length)) + message.parts = []; + message.parts.push($root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.decode(reader, reader.uint32())); + break; + } + case 4: { + message.timesAddedCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TrainingPhrase message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase} TrainingPhrase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TrainingPhrase.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TrainingPhrase message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TrainingPhrase.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.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.parts != null && message.hasOwnProperty("parts")) { + if (!Array.isArray(message.parts)) + return "parts: array expected"; + for (var i = 0; i < message.parts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.verify(message.parts[i]); + if (error) + return "parts." + error; + } + } + if (message.timesAddedCount != null && message.hasOwnProperty("timesAddedCount")) + if (!$util.isInteger(message.timesAddedCount)) + return "timesAddedCount: integer expected"; + return null; + }; + + /** + * Creates a TrainingPhrase message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase} TrainingPhrase + */ + TrainingPhrase.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase(); + if (object.name != null) + message.name = String(object.name); + 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 "EXAMPLE": + case 1: + message.type = 1; + break; + case "TEMPLATE": + case 2: + message.type = 2; + break; + } + if (object.parts) { + if (!Array.isArray(object.parts)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.parts: array expected"); + message.parts = []; + for (var i = 0; i < object.parts.length; ++i) { + if (typeof object.parts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.parts: object expected"); + message.parts[i] = $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.fromObject(object.parts[i]); + } + } + if (object.timesAddedCount != null) + message.timesAddedCount = object.timesAddedCount | 0; + return message; + }; + + /** + * Creates a plain object from a TrainingPhrase message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase} message TrainingPhrase + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TrainingPhrase.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.parts = []; + if (options.defaults) { + object.name = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.timesAddedCount = 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type[message.type] === undefined ? message.type : $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type[message.type] : message.type; + if (message.parts && message.parts.length) { + object.parts = []; + for (var j = 0; j < message.parts.length; ++j) + object.parts[j] = $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.toObject(message.parts[j], options); + } + if (message.timesAddedCount != null && message.hasOwnProperty("timesAddedCount")) + object.timesAddedCount = message.timesAddedCount; + return object; + }; + + /** + * Converts this TrainingPhrase to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @instance + * @returns {Object.} JSON object + */ + TrainingPhrase.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TrainingPhrase + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TrainingPhrase.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase"; + }; + + /** + * Type enum. + * @name google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} EXAMPLE=1 EXAMPLE value + * @property {number} TEMPLATE=2 TEMPLATE value + */ + TrainingPhrase.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "EXAMPLE"] = 1; + values[valuesById[2] = "TEMPLATE"] = 2; + return values; + })(); + + TrainingPhrase.Part = (function() { + + /** + * Properties of a Part. + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @interface IPart + * @property {string|null} [text] Part text + * @property {string|null} [entityType] Part entityType + * @property {string|null} [alias] Part alias + * @property {boolean|null} [userDefined] Part userDefined + */ + + /** + * Constructs a new Part. + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase + * @classdesc Represents a Part. + * @implements IPart + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart=} [properties] Properties to set + */ + function Part(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Part text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.text = ""; + + /** + * Part entityType. + * @member {string} entityType + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.entityType = ""; + + /** + * Part alias. + * @member {string} alias + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.alias = ""; + + /** + * Part userDefined. + * @member {boolean} userDefined + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @instance + */ + Part.prototype.userDefined = false; + + /** + * Creates a new Part instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part} Part instance + */ + Part.create = function create(properties) { + return new Part(properties); + }; + + /** + * Encodes the specified Part message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart} message Part message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Part.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityType); + if (message.alias != null && Object.hasOwnProperty.call(message, "alias")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.alias); + if (message.userDefined != null && Object.hasOwnProperty.call(message, "userDefined")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.userDefined); + return writer; + }; + + /** + * Encodes the specified Part message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.IPart} message Part message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Part.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Part message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part} Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Part.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.entityType = reader.string(); + break; + } + case 3: { + message.alias = reader.string(); + break; + } + case 4: { + message.userDefined = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Part message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part} Part + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Part.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Part message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Part.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) + if (!$util.isString(message.entityType)) + return "entityType: string expected"; + if (message.alias != null && message.hasOwnProperty("alias")) + if (!$util.isString(message.alias)) + return "alias: string expected"; + if (message.userDefined != null && message.hasOwnProperty("userDefined")) + if (typeof message.userDefined !== "boolean") + return "userDefined: boolean expected"; + return null; + }; + + /** + * Creates a Part message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part} Part + */ + Part.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part(); + if (object.text != null) + message.text = String(object.text); + if (object.entityType != null) + message.entityType = String(object.entityType); + if (object.alias != null) + message.alias = String(object.alias); + if (object.userDefined != null) + message.userDefined = Boolean(object.userDefined); + return message; + }; + + /** + * Creates a plain object from a Part message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part} message Part + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Part.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.entityType = ""; + object.alias = ""; + object.userDefined = false; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = message.entityType; + if (message.alias != null && message.hasOwnProperty("alias")) + object.alias = message.alias; + if (message.userDefined != null && message.hasOwnProperty("userDefined")) + object.userDefined = message.userDefined; + return object; + }; + + /** + * Converts this Part to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @instance + * @returns {Object.} JSON object + */ + Part.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Part + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Part.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.TrainingPhrase.Part"; + }; + + return Part; + })(); + + return TrainingPhrase; + })(); + + Intent.Parameter = (function() { + + /** + * Properties of a Parameter. + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @interface IParameter + * @property {string|null} [name] Parameter name + * @property {string|null} [displayName] Parameter displayName + * @property {string|null} [value] Parameter value + * @property {string|null} [defaultValue] Parameter defaultValue + * @property {string|null} [entityTypeDisplayName] Parameter entityTypeDisplayName + * @property {boolean|null} [mandatory] Parameter mandatory + * @property {Array.|null} [prompts] Parameter prompts + * @property {boolean|null} [isList] Parameter isList + */ + + /** + * Constructs a new Parameter. + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @classdesc Represents a Parameter. + * @implements IParameter + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.IParameter=} [properties] Properties to set + */ + function Parameter(properties) { + this.prompts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Parameter name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.name = ""; + + /** + * Parameter displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.displayName = ""; + + /** + * Parameter value. + * @member {string} value + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.value = ""; + + /** + * Parameter defaultValue. + * @member {string} defaultValue + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.defaultValue = ""; + + /** + * Parameter entityTypeDisplayName. + * @member {string} entityTypeDisplayName + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.entityTypeDisplayName = ""; + + /** + * Parameter mandatory. + * @member {boolean} mandatory + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.mandatory = false; + + /** + * Parameter prompts. + * @member {Array.} prompts + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.prompts = $util.emptyArray; + + /** + * Parameter isList. + * @member {boolean} isList + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @instance + */ + Parameter.prototype.isList = false; + + /** + * Creates a new Parameter instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.IParameter=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Parameter} Parameter instance + */ + Parameter.create = function create(properties) { + return new Parameter(properties); + }; + + /** + * Encodes the specified Parameter message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Parameter.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.IParameter} message Parameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parameter.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.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.value); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.defaultValue); + if (message.entityTypeDisplayName != null && Object.hasOwnProperty.call(message, "entityTypeDisplayName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.entityTypeDisplayName); + if (message.mandatory != null && Object.hasOwnProperty.call(message, "mandatory")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.mandatory); + if (message.prompts != null && message.prompts.length) + for (var i = 0; i < message.prompts.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.prompts[i]); + if (message.isList != null && Object.hasOwnProperty.call(message, "isList")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.isList); + return writer; + }; + + /** + * Encodes the specified Parameter message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Parameter.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.IParameter} message Parameter message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Parameter.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Parameter message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Parameter} Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parameter.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Parameter(); + 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.value = reader.string(); + break; + } + case 4: { + message.defaultValue = reader.string(); + break; + } + case 5: { + message.entityTypeDisplayName = reader.string(); + break; + } + case 6: { + message.mandatory = reader.bool(); + break; + } + case 7: { + if (!(message.prompts && message.prompts.length)) + message.prompts = []; + message.prompts.push(reader.string()); + break; + } + case 8: { + message.isList = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Parameter message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Parameter} Parameter + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Parameter.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Parameter message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Parameter.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.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.entityTypeDisplayName != null && message.hasOwnProperty("entityTypeDisplayName")) + if (!$util.isString(message.entityTypeDisplayName)) + return "entityTypeDisplayName: string expected"; + if (message.mandatory != null && message.hasOwnProperty("mandatory")) + if (typeof message.mandatory !== "boolean") + return "mandatory: boolean expected"; + if (message.prompts != null && message.hasOwnProperty("prompts")) { + if (!Array.isArray(message.prompts)) + return "prompts: array expected"; + for (var i = 0; i < message.prompts.length; ++i) + if (!$util.isString(message.prompts[i])) + return "prompts: string[] expected"; + } + if (message.isList != null && message.hasOwnProperty("isList")) + if (typeof message.isList !== "boolean") + return "isList: boolean expected"; + return null; + }; + + /** + * Creates a Parameter message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Parameter} Parameter + */ + Parameter.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Parameter) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Parameter(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.value != null) + message.value = String(object.value); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.entityTypeDisplayName != null) + message.entityTypeDisplayName = String(object.entityTypeDisplayName); + if (object.mandatory != null) + message.mandatory = Boolean(object.mandatory); + if (object.prompts) { + if (!Array.isArray(object.prompts)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Parameter.prompts: array expected"); + message.prompts = []; + for (var i = 0; i < object.prompts.length; ++i) + message.prompts[i] = String(object.prompts[i]); + } + if (object.isList != null) + message.isList = Boolean(object.isList); + return message; + }; + + /** + * Creates a plain object from a Parameter message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Parameter} message Parameter + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Parameter.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.prompts = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.value = ""; + object.defaultValue = ""; + object.entityTypeDisplayName = ""; + object.mandatory = false; + object.isList = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.entityTypeDisplayName != null && message.hasOwnProperty("entityTypeDisplayName")) + object.entityTypeDisplayName = message.entityTypeDisplayName; + if (message.mandatory != null && message.hasOwnProperty("mandatory")) + object.mandatory = message.mandatory; + if (message.prompts && message.prompts.length) { + object.prompts = []; + for (var j = 0; j < message.prompts.length; ++j) + object.prompts[j] = message.prompts[j]; + } + if (message.isList != null && message.hasOwnProperty("isList")) + object.isList = message.isList; + return object; + }; + + /** + * Converts this Parameter to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @instance + * @returns {Object.} JSON object + */ + Parameter.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Parameter + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Parameter + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Parameter.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Parameter"; + }; + + return Parameter; + })(); + + Intent.Message = (function() { + + /** + * Properties of a Message. + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @interface IMessage + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IText|null} [text] Message text + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null} [image] Message image + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies|null} [quickReplies] Message quickReplies + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ICard|null} [card] Message card + * @property {google.protobuf.IStruct|null} [payload] Message payload + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses|null} [simpleResponses] Message simpleResponses + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard|null} [basicCard] Message basicCard + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions|null} [suggestions] Message suggestions + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion|null} [linkOutSuggestion] Message linkOutSuggestion + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect|null} [listSelect] Message listSelect + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect|null} [carouselSelect] Message carouselSelect + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio|null} [telephonyPlayAudio] Message telephonyPlayAudio + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech|null} [telephonySynthesizeSpeech] Message telephonySynthesizeSpeech + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall|null} [telephonyTransferCall] Message telephonyTransferCall + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText|null} [rbmText] Message rbmText + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard|null} [rbmStandaloneRichCard] Message rbmStandaloneRichCard + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard|null} [rbmCarouselRichCard] Message rbmCarouselRichCard + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard|null} [browseCarouselCard] Message browseCarouselCard + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard|null} [tableCard] Message tableCard + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent|null} [mediaContent] Message mediaContent + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.Platform|null} [platform] Message platform + */ + + /** + * Constructs a new Message. + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @classdesc Represents a Message. + * @implements IMessage + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.IMessage=} [properties] Properties to set + */ + function Message(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Message text. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IText|null|undefined} text + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.text = null; + + /** + * Message image. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.image = null; + + /** + * Message quickReplies. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies|null|undefined} quickReplies + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.quickReplies = null; + + /** + * Message card. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ICard|null|undefined} card + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.card = null; + + /** + * Message payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.payload = null; + + /** + * Message simpleResponses. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses|null|undefined} simpleResponses + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.simpleResponses = null; + + /** + * Message basicCard. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard|null|undefined} basicCard + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.basicCard = null; + + /** + * Message suggestions. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions|null|undefined} suggestions + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.suggestions = null; + + /** + * Message linkOutSuggestion. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion|null|undefined} linkOutSuggestion + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.linkOutSuggestion = null; + + /** + * Message listSelect. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect|null|undefined} listSelect + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.listSelect = null; + + /** + * Message carouselSelect. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect|null|undefined} carouselSelect + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.carouselSelect = null; + + /** + * Message telephonyPlayAudio. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio|null|undefined} telephonyPlayAudio + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.telephonyPlayAudio = null; + + /** + * Message telephonySynthesizeSpeech. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech|null|undefined} telephonySynthesizeSpeech + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.telephonySynthesizeSpeech = null; + + /** + * Message telephonyTransferCall. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall|null|undefined} telephonyTransferCall + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.telephonyTransferCall = null; + + /** + * Message rbmText. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText|null|undefined} rbmText + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.rbmText = null; + + /** + * Message rbmStandaloneRichCard. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard|null|undefined} rbmStandaloneRichCard + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.rbmStandaloneRichCard = null; + + /** + * Message rbmCarouselRichCard. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard|null|undefined} rbmCarouselRichCard + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.rbmCarouselRichCard = null; + + /** + * Message browseCarouselCard. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard|null|undefined} browseCarouselCard + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.browseCarouselCard = null; + + /** + * Message tableCard. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard|null|undefined} tableCard + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.tableCard = null; + + /** + * Message mediaContent. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent|null|undefined} mediaContent + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.mediaContent = null; + + /** + * Message platform. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.Platform} platform + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Message.prototype.platform = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Message message. + * @member {"text"|"image"|"quickReplies"|"card"|"payload"|"simpleResponses"|"basicCard"|"suggestions"|"linkOutSuggestion"|"listSelect"|"carouselSelect"|"telephonyPlayAudio"|"telephonySynthesizeSpeech"|"telephonyTransferCall"|"rbmText"|"rbmStandaloneRichCard"|"rbmCarouselRichCard"|"browseCarouselCard"|"tableCard"|"mediaContent"|undefined} message + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + */ + Object.defineProperty(Message.prototype, "message", { + get: $util.oneOfGetter($oneOfFields = ["text", "image", "quickReplies", "card", "payload", "simpleResponses", "basicCard", "suggestions", "linkOutSuggestion", "listSelect", "carouselSelect", "telephonyPlayAudio", "telephonySynthesizeSpeech", "telephonyTransferCall", "rbmText", "rbmStandaloneRichCard", "rbmCarouselRichCard", "browseCarouselCard", "tableCard", "mediaContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Message instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.IMessage=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message} Message instance + */ + Message.create = function create(properties) { + return new Message(properties); + }; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Text.encode(message.text, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.encode(message.image, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.quickReplies != null && Object.hasOwnProperty.call(message, "quickReplies")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.encode(message.quickReplies, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.card != null && Object.hasOwnProperty.call(message, "card")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.encode(message.card, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.platform != null && Object.hasOwnProperty.call(message, "platform")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.platform); + if (message.simpleResponses != null && Object.hasOwnProperty.call(message, "simpleResponses")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.encode(message.simpleResponses, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.basicCard != null && Object.hasOwnProperty.call(message, "basicCard")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.encode(message.basicCard, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.suggestions != null && Object.hasOwnProperty.call(message, "suggestions")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.encode(message.suggestions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.linkOutSuggestion != null && Object.hasOwnProperty.call(message, "linkOutSuggestion")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.encode(message.linkOutSuggestion, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.listSelect != null && Object.hasOwnProperty.call(message, "listSelect")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.encode(message.listSelect, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.carouselSelect != null && Object.hasOwnProperty.call(message, "carouselSelect")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.encode(message.carouselSelect, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.telephonyPlayAudio != null && Object.hasOwnProperty.call(message, "telephonyPlayAudio")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.encode(message.telephonyPlayAudio, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.telephonySynthesizeSpeech != null && Object.hasOwnProperty.call(message, "telephonySynthesizeSpeech")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.encode(message.telephonySynthesizeSpeech, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.telephonyTransferCall != null && Object.hasOwnProperty.call(message, "telephonyTransferCall")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.encode(message.telephonyTransferCall, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.rbmText != null && Object.hasOwnProperty.call(message, "rbmText")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.encode(message.rbmText, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.rbmStandaloneRichCard != null && Object.hasOwnProperty.call(message, "rbmStandaloneRichCard")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.encode(message.rbmStandaloneRichCard, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + if (message.rbmCarouselRichCard != null && Object.hasOwnProperty.call(message, "rbmCarouselRichCard")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.encode(message.rbmCarouselRichCard, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.browseCarouselCard != null && Object.hasOwnProperty.call(message, "browseCarouselCard")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.encode(message.browseCarouselCard, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.tableCard != null && Object.hasOwnProperty.call(message, "tableCard")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.encode(message.tableCard, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.mediaContent != null && Object.hasOwnProperty.call(message, "mediaContent")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.encode(message.mediaContent, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Message message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Text.decode(reader, reader.uint32()); + break; + } + case 2: { + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 3: { + message.quickReplies = $root.google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.decode(reader, reader.uint32()); + break; + } + case 4: { + message.card = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.decode(reader, reader.uint32()); + break; + } + case 5: { + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 7: { + message.simpleResponses = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.decode(reader, reader.uint32()); + break; + } + case 8: { + message.basicCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.decode(reader, reader.uint32()); + break; + } + case 9: { + message.suggestions = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.decode(reader, reader.uint32()); + break; + } + case 10: { + message.linkOutSuggestion = $root.google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.decode(reader, reader.uint32()); + break; + } + case 11: { + message.listSelect = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.decode(reader, reader.uint32()); + break; + } + case 12: { + message.carouselSelect = $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.decode(reader, reader.uint32()); + break; + } + case 13: { + message.telephonyPlayAudio = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.decode(reader, reader.uint32()); + break; + } + case 14: { + message.telephonySynthesizeSpeech = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.decode(reader, reader.uint32()); + break; + } + case 15: { + message.telephonyTransferCall = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.decode(reader, reader.uint32()); + break; + } + case 18: { + message.rbmText = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.decode(reader, reader.uint32()); + break; + } + case 19: { + message.rbmStandaloneRichCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.decode(reader, reader.uint32()); + break; + } + case 20: { + message.rbmCarouselRichCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.decode(reader, reader.uint32()); + break; + } + case 22: { + message.browseCarouselCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.decode(reader, reader.uint32()); + break; + } + case 23: { + message.tableCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.decode(reader, reader.uint32()); + break; + } + case 24: { + message.mediaContent = $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.decode(reader, reader.uint32()); + break; + } + case 6: { + message.platform = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Message message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Message.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Text.verify(message.text); + if (error) + return "text." + error; + } + } + if (message.image != null && message.hasOwnProperty("image")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + } + if (message.quickReplies != null && message.hasOwnProperty("quickReplies")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.verify(message.quickReplies); + if (error) + return "quickReplies." + error; + } + } + if (message.card != null && message.hasOwnProperty("card")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.verify(message.card); + if (error) + return "card." + error; + } + } + if (message.payload != null && message.hasOwnProperty("payload")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + } + if (message.simpleResponses != null && message.hasOwnProperty("simpleResponses")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.verify(message.simpleResponses); + if (error) + return "simpleResponses." + error; + } + } + if (message.basicCard != null && message.hasOwnProperty("basicCard")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.verify(message.basicCard); + if (error) + return "basicCard." + error; + } + } + if (message.suggestions != null && message.hasOwnProperty("suggestions")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.verify(message.suggestions); + if (error) + return "suggestions." + error; + } + } + if (message.linkOutSuggestion != null && message.hasOwnProperty("linkOutSuggestion")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.verify(message.linkOutSuggestion); + if (error) + return "linkOutSuggestion." + error; + } + } + if (message.listSelect != null && message.hasOwnProperty("listSelect")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.verify(message.listSelect); + if (error) + return "listSelect." + error; + } + } + if (message.carouselSelect != null && message.hasOwnProperty("carouselSelect")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.verify(message.carouselSelect); + if (error) + return "carouselSelect." + error; + } + } + if (message.telephonyPlayAudio != null && message.hasOwnProperty("telephonyPlayAudio")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.verify(message.telephonyPlayAudio); + if (error) + return "telephonyPlayAudio." + error; + } + } + if (message.telephonySynthesizeSpeech != null && message.hasOwnProperty("telephonySynthesizeSpeech")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.verify(message.telephonySynthesizeSpeech); + if (error) + return "telephonySynthesizeSpeech." + error; + } + } + if (message.telephonyTransferCall != null && message.hasOwnProperty("telephonyTransferCall")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.verify(message.telephonyTransferCall); + if (error) + return "telephonyTransferCall." + error; + } + } + if (message.rbmText != null && message.hasOwnProperty("rbmText")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.verify(message.rbmText); + if (error) + return "rbmText." + error; + } + } + if (message.rbmStandaloneRichCard != null && message.hasOwnProperty("rbmStandaloneRichCard")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.verify(message.rbmStandaloneRichCard); + if (error) + return "rbmStandaloneRichCard." + error; + } + } + if (message.rbmCarouselRichCard != null && message.hasOwnProperty("rbmCarouselRichCard")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.verify(message.rbmCarouselRichCard); + if (error) + return "rbmCarouselRichCard." + error; + } + } + if (message.browseCarouselCard != null && message.hasOwnProperty("browseCarouselCard")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.verify(message.browseCarouselCard); + if (error) + return "browseCarouselCard." + error; + } + } + if (message.tableCard != null && message.hasOwnProperty("tableCard")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.verify(message.tableCard); + if (error) + return "tableCard." + error; + } + } + if (message.mediaContent != null && message.hasOwnProperty("mediaContent")) { + if (properties.message === 1) + return "message: multiple values"; + properties.message = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.verify(message.mediaContent); + if (error) + return "mediaContent." + error; + } + } + if (message.platform != null && message.hasOwnProperty("platform")) + switch (message.platform) { + default: + return "platform: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 10: + case 11: + break; + } + return null; + }; + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message} Message + */ + Message.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message(); + if (object.text != null) { + if (typeof object.text !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.text: object expected"); + message.text = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Text.fromObject(object.text); + } + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.fromObject(object.image); + } + if (object.quickReplies != null) { + if (typeof object.quickReplies !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.quickReplies: object expected"); + message.quickReplies = $root.google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.fromObject(object.quickReplies); + } + if (object.card != null) { + if (typeof object.card !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.card: object expected"); + message.card = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.fromObject(object.card); + } + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.simpleResponses != null) { + if (typeof object.simpleResponses !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.simpleResponses: object expected"); + message.simpleResponses = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.fromObject(object.simpleResponses); + } + if (object.basicCard != null) { + if (typeof object.basicCard !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.basicCard: object expected"); + message.basicCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.fromObject(object.basicCard); + } + if (object.suggestions != null) { + if (typeof object.suggestions !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.suggestions: object expected"); + message.suggestions = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.fromObject(object.suggestions); + } + if (object.linkOutSuggestion != null) { + if (typeof object.linkOutSuggestion !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.linkOutSuggestion: object expected"); + message.linkOutSuggestion = $root.google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.fromObject(object.linkOutSuggestion); + } + if (object.listSelect != null) { + if (typeof object.listSelect !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.listSelect: object expected"); + message.listSelect = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.fromObject(object.listSelect); + } + if (object.carouselSelect != null) { + if (typeof object.carouselSelect !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.carouselSelect: object expected"); + message.carouselSelect = $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.fromObject(object.carouselSelect); + } + if (object.telephonyPlayAudio != null) { + if (typeof object.telephonyPlayAudio !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.telephonyPlayAudio: object expected"); + message.telephonyPlayAudio = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.fromObject(object.telephonyPlayAudio); + } + if (object.telephonySynthesizeSpeech != null) { + if (typeof object.telephonySynthesizeSpeech !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.telephonySynthesizeSpeech: object expected"); + message.telephonySynthesizeSpeech = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.fromObject(object.telephonySynthesizeSpeech); + } + if (object.telephonyTransferCall != null) { + if (typeof object.telephonyTransferCall !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.telephonyTransferCall: object expected"); + message.telephonyTransferCall = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.fromObject(object.telephonyTransferCall); + } + if (object.rbmText != null) { + if (typeof object.rbmText !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.rbmText: object expected"); + message.rbmText = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.fromObject(object.rbmText); + } + if (object.rbmStandaloneRichCard != null) { + if (typeof object.rbmStandaloneRichCard !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.rbmStandaloneRichCard: object expected"); + message.rbmStandaloneRichCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.fromObject(object.rbmStandaloneRichCard); + } + if (object.rbmCarouselRichCard != null) { + if (typeof object.rbmCarouselRichCard !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.rbmCarouselRichCard: object expected"); + message.rbmCarouselRichCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.fromObject(object.rbmCarouselRichCard); + } + if (object.browseCarouselCard != null) { + if (typeof object.browseCarouselCard !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.browseCarouselCard: object expected"); + message.browseCarouselCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.fromObject(object.browseCarouselCard); + } + if (object.tableCard != null) { + if (typeof object.tableCard !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.tableCard: object expected"); + message.tableCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.fromObject(object.tableCard); + } + if (object.mediaContent != null) { + if (typeof object.mediaContent !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.mediaContent: object expected"); + message.mediaContent = $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.fromObject(object.mediaContent); + } + switch (object.platform) { + default: + if (typeof object.platform === "number") { + message.platform = object.platform; + break; + } + break; + case "PLATFORM_UNSPECIFIED": + case 0: + message.platform = 0; + break; + case "FACEBOOK": + case 1: + message.platform = 1; + break; + case "SLACK": + case 2: + message.platform = 2; + break; + case "TELEGRAM": + case 3: + message.platform = 3; + break; + case "KIK": + case 4: + message.platform = 4; + break; + case "SKYPE": + case 5: + message.platform = 5; + break; + case "LINE": + case 6: + message.platform = 6; + break; + case "VIBER": + case 7: + message.platform = 7; + break; + case "ACTIONS_ON_GOOGLE": + case 8: + message.platform = 8; + break; + case "TELEPHONY": + case 10: + message.platform = 10; + break; + case "GOOGLE_HANGOUTS": + case 11: + message.platform = 11; + break; + } + return message; + }; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message} message Message + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Message.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.platform = options.enums === String ? "PLATFORM_UNSPECIFIED" : 0; + if (message.text != null && message.hasOwnProperty("text")) { + object.text = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Text.toObject(message.text, options); + if (options.oneofs) + object.message = "text"; + } + if (message.image != null && message.hasOwnProperty("image")) { + object.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.toObject(message.image, options); + if (options.oneofs) + object.message = "image"; + } + if (message.quickReplies != null && message.hasOwnProperty("quickReplies")) { + object.quickReplies = $root.google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.toObject(message.quickReplies, options); + if (options.oneofs) + object.message = "quickReplies"; + } + if (message.card != null && message.hasOwnProperty("card")) { + object.card = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.toObject(message.card, options); + if (options.oneofs) + object.message = "card"; + } + if (message.payload != null && message.hasOwnProperty("payload")) { + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (options.oneofs) + object.message = "payload"; + } + if (message.platform != null && message.hasOwnProperty("platform")) + object.platform = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.Platform[message.platform] === undefined ? message.platform : $root.google.cloud.dialogflow.v2beta1.Intent.Message.Platform[message.platform] : message.platform; + if (message.simpleResponses != null && message.hasOwnProperty("simpleResponses")) { + object.simpleResponses = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.toObject(message.simpleResponses, options); + if (options.oneofs) + object.message = "simpleResponses"; + } + if (message.basicCard != null && message.hasOwnProperty("basicCard")) { + object.basicCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.toObject(message.basicCard, options); + if (options.oneofs) + object.message = "basicCard"; + } + if (message.suggestions != null && message.hasOwnProperty("suggestions")) { + object.suggestions = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.toObject(message.suggestions, options); + if (options.oneofs) + object.message = "suggestions"; + } + if (message.linkOutSuggestion != null && message.hasOwnProperty("linkOutSuggestion")) { + object.linkOutSuggestion = $root.google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.toObject(message.linkOutSuggestion, options); + if (options.oneofs) + object.message = "linkOutSuggestion"; + } + if (message.listSelect != null && message.hasOwnProperty("listSelect")) { + object.listSelect = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.toObject(message.listSelect, options); + if (options.oneofs) + object.message = "listSelect"; + } + if (message.carouselSelect != null && message.hasOwnProperty("carouselSelect")) { + object.carouselSelect = $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.toObject(message.carouselSelect, options); + if (options.oneofs) + object.message = "carouselSelect"; + } + if (message.telephonyPlayAudio != null && message.hasOwnProperty("telephonyPlayAudio")) { + object.telephonyPlayAudio = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.toObject(message.telephonyPlayAudio, options); + if (options.oneofs) + object.message = "telephonyPlayAudio"; + } + if (message.telephonySynthesizeSpeech != null && message.hasOwnProperty("telephonySynthesizeSpeech")) { + object.telephonySynthesizeSpeech = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.toObject(message.telephonySynthesizeSpeech, options); + if (options.oneofs) + object.message = "telephonySynthesizeSpeech"; + } + if (message.telephonyTransferCall != null && message.hasOwnProperty("telephonyTransferCall")) { + object.telephonyTransferCall = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.toObject(message.telephonyTransferCall, options); + if (options.oneofs) + object.message = "telephonyTransferCall"; + } + if (message.rbmText != null && message.hasOwnProperty("rbmText")) { + object.rbmText = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.toObject(message.rbmText, options); + if (options.oneofs) + object.message = "rbmText"; + } + if (message.rbmStandaloneRichCard != null && message.hasOwnProperty("rbmStandaloneRichCard")) { + object.rbmStandaloneRichCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.toObject(message.rbmStandaloneRichCard, options); + if (options.oneofs) + object.message = "rbmStandaloneRichCard"; + } + if (message.rbmCarouselRichCard != null && message.hasOwnProperty("rbmCarouselRichCard")) { + object.rbmCarouselRichCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.toObject(message.rbmCarouselRichCard, options); + if (options.oneofs) + object.message = "rbmCarouselRichCard"; + } + if (message.browseCarouselCard != null && message.hasOwnProperty("browseCarouselCard")) { + object.browseCarouselCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.toObject(message.browseCarouselCard, options); + if (options.oneofs) + object.message = "browseCarouselCard"; + } + if (message.tableCard != null && message.hasOwnProperty("tableCard")) { + object.tableCard = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.toObject(message.tableCard, options); + if (options.oneofs) + object.message = "tableCard"; + } + if (message.mediaContent != null && message.hasOwnProperty("mediaContent")) { + object.mediaContent = $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.toObject(message.mediaContent, options); + if (options.oneofs) + object.message = "mediaContent"; + } + return object; + }; + + /** + * Converts this Message to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @instance + * @returns {Object.} JSON object + */ + Message.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Message + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message"; + }; + + /** + * Platform enum. + * @name google.cloud.dialogflow.v2beta1.Intent.Message.Platform + * @enum {number} + * @property {number} PLATFORM_UNSPECIFIED=0 PLATFORM_UNSPECIFIED value + * @property {number} FACEBOOK=1 FACEBOOK value + * @property {number} SLACK=2 SLACK value + * @property {number} TELEGRAM=3 TELEGRAM value + * @property {number} KIK=4 KIK value + * @property {number} SKYPE=5 SKYPE value + * @property {number} LINE=6 LINE value + * @property {number} VIBER=7 VIBER value + * @property {number} ACTIONS_ON_GOOGLE=8 ACTIONS_ON_GOOGLE value + * @property {number} TELEPHONY=10 TELEPHONY value + * @property {number} GOOGLE_HANGOUTS=11 GOOGLE_HANGOUTS value + */ + Message.Platform = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PLATFORM_UNSPECIFIED"] = 0; + values[valuesById[1] = "FACEBOOK"] = 1; + values[valuesById[2] = "SLACK"] = 2; + values[valuesById[3] = "TELEGRAM"] = 3; + values[valuesById[4] = "KIK"] = 4; + values[valuesById[5] = "SKYPE"] = 5; + values[valuesById[6] = "LINE"] = 6; + values[valuesById[7] = "VIBER"] = 7; + values[valuesById[8] = "ACTIONS_ON_GOOGLE"] = 8; + values[valuesById[10] = "TELEPHONY"] = 10; + values[valuesById[11] = "GOOGLE_HANGOUTS"] = 11; + return values; + })(); + + Message.Text = (function() { + + /** + * Properties of a Text. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IText + * @property {Array.|null} [text] Text text + */ + + /** + * Constructs a new Text. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a Text. + * @implements IText + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IText=} [properties] Properties to set + */ + function Text(properties) { + this.text = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Text text. + * @member {Array.} text + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @instance + */ + Text.prototype.text = $util.emptyArray; + + /** + * Creates a new Text instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IText=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Text} Text instance + */ + Text.create = function create(properties) { + return new Text(properties); + }; + + /** + * Encodes the specified Text message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Text.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IText} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && message.text.length) + for (var i = 0; i < message.text.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text[i]); + return writer; + }; + + /** + * Encodes the specified Text message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Text.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IText} message Text message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Text.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Text message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Text(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.text && message.text.length)) + message.text = []; + message.text.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Text message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Text} Text + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Text.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Text message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Text.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) { + if (!Array.isArray(message.text)) + return "text: array expected"; + for (var i = 0; i < message.text.length; ++i) + if (!$util.isString(message.text[i])) + return "text: string[] expected"; + } + return null; + }; + + /** + * Creates a Text message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Text} Text + */ + Text.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.Text) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Text(); + if (object.text) { + if (!Array.isArray(object.text)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.Text.text: array expected"); + message.text = []; + for (var i = 0; i < object.text.length; ++i) + message.text[i] = String(object.text[i]); + } + return message; + }; + + /** + * Creates a plain object from a Text message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.Text} message Text + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Text.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.text = []; + if (message.text && message.text.length) { + object.text = []; + for (var j = 0; j < message.text.length; ++j) + object.text[j] = message.text[j]; + } + return object; + }; + + /** + * Converts this Text to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @instance + * @returns {Object.} JSON object + */ + Text.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Text + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Text + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Text.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.Text"; + }; + + return Text; + })(); + + Message.Image = (function() { + + /** + * Properties of an Image. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IImage + * @property {string|null} [imageUri] Image imageUri + * @property {string|null} [accessibilityText] Image accessibilityText + */ + + /** + * Constructs a new Image. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents an Image. + * @implements IImage + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.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 imageUri. + * @member {string} imageUri + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Image + * @instance + */ + Image.prototype.imageUri = ""; + + /** + * Image accessibilityText. + * @member {string} accessibilityText + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Image + * @instance + */ + Image.prototype.accessibilityText = ""; + + /** + * Creates a new Image instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Image + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IImage=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Image} Image instance + */ + Image.create = function create(properties) { + return new Image(properties); + }; + + /** + * Encodes the specified Image message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Image + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.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.imageUri != null && Object.hasOwnProperty.call(message, "imageUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.imageUri); + if (message.accessibilityText != null && Object.hasOwnProperty.call(message, "accessibilityText")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.accessibilityText); + return writer; + }; + + /** + * Encodes the specified Image message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Image + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.Image(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.imageUri = reader.string(); + break; + } + case 2: { + message.accessibilityText = reader.string(); + 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.dialogflow.v2beta1.Intent.Message.Image + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.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.imageUri != null && message.hasOwnProperty("imageUri")) + if (!$util.isString(message.imageUri)) + return "imageUri: string expected"; + if (message.accessibilityText != null && message.hasOwnProperty("accessibilityText")) + if (!$util.isString(message.accessibilityText)) + return "accessibilityText: string expected"; + return null; + }; + + /** + * Creates an Image message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Image + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Image} Image + */ + Image.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image(); + if (object.imageUri != null) + message.imageUri = String(object.imageUri); + if (object.accessibilityText != null) + message.accessibilityText = String(object.accessibilityText); + return message; + }; + + /** + * Creates a plain object from an Image message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Image + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.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) { + object.imageUri = ""; + object.accessibilityText = ""; + } + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + object.imageUri = message.imageUri; + if (message.accessibilityText != null && message.hasOwnProperty("accessibilityText")) + object.accessibilityText = message.accessibilityText; + return object; + }; + + /** + * Converts this Image to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.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.dialogflow.v2beta1.Intent.Message.Image"; + }; + + return Image; + })(); + + Message.QuickReplies = (function() { + + /** + * Properties of a QuickReplies. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IQuickReplies + * @property {string|null} [title] QuickReplies title + * @property {Array.|null} [quickReplies] QuickReplies quickReplies + */ + + /** + * Constructs a new QuickReplies. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a QuickReplies. + * @implements IQuickReplies + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies=} [properties] Properties to set + */ + function QuickReplies(properties) { + this.quickReplies = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QuickReplies title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @instance + */ + QuickReplies.prototype.title = ""; + + /** + * QuickReplies quickReplies. + * @member {Array.} quickReplies + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @instance + */ + QuickReplies.prototype.quickReplies = $util.emptyArray; + + /** + * Creates a new QuickReplies instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies} QuickReplies instance + */ + QuickReplies.create = function create(properties) { + return new QuickReplies(properties); + }; + + /** + * Encodes the specified QuickReplies message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies} message QuickReplies message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuickReplies.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.quickReplies != null && message.quickReplies.length) + for (var i = 0; i < message.quickReplies.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.quickReplies[i]); + return writer; + }; + + /** + * Encodes the specified QuickReplies message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IQuickReplies} message QuickReplies message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QuickReplies.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QuickReplies message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies} QuickReplies + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuickReplies.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + if (!(message.quickReplies && message.quickReplies.length)) + message.quickReplies = []; + message.quickReplies.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QuickReplies message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies} QuickReplies + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QuickReplies.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QuickReplies message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QuickReplies.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.quickReplies != null && message.hasOwnProperty("quickReplies")) { + if (!Array.isArray(message.quickReplies)) + return "quickReplies: array expected"; + for (var i = 0; i < message.quickReplies.length; ++i) + if (!$util.isString(message.quickReplies[i])) + return "quickReplies: string[] expected"; + } + return null; + }; + + /** + * Creates a QuickReplies message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies} QuickReplies + */ + QuickReplies.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies(); + if (object.title != null) + message.title = String(object.title); + if (object.quickReplies) { + if (!Array.isArray(object.quickReplies)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies.quickReplies: array expected"); + message.quickReplies = []; + for (var i = 0; i < object.quickReplies.length; ++i) + message.quickReplies[i] = String(object.quickReplies[i]); + } + return message; + }; + + /** + * Creates a plain object from a QuickReplies message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies} message QuickReplies + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QuickReplies.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.quickReplies = []; + if (options.defaults) + object.title = ""; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.quickReplies && message.quickReplies.length) { + object.quickReplies = []; + for (var j = 0; j < message.quickReplies.length; ++j) + object.quickReplies[j] = message.quickReplies[j]; + } + return object; + }; + + /** + * Converts this QuickReplies to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @instance + * @returns {Object.} JSON object + */ + QuickReplies.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QuickReplies + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QuickReplies.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.QuickReplies"; + }; + + return QuickReplies; + })(); + + Message.Card = (function() { + + /** + * Properties of a Card. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ICard + * @property {string|null} [title] Card title + * @property {string|null} [subtitle] Card subtitle + * @property {string|null} [imageUri] Card imageUri + * @property {Array.|null} [buttons] Card buttons + */ + + /** + * Constructs a new Card. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a Card. + * @implements ICard + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ICard=} [properties] Properties to set + */ + function Card(properties) { + this.buttons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Card title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @instance + */ + Card.prototype.title = ""; + + /** + * Card subtitle. + * @member {string} subtitle + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @instance + */ + Card.prototype.subtitle = ""; + + /** + * Card imageUri. + * @member {string} imageUri + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @instance + */ + Card.prototype.imageUri = ""; + + /** + * Card buttons. + * @member {Array.} buttons + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @instance + */ + Card.prototype.buttons = $util.emptyArray; + + /** + * Creates a new Card instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ICard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Card} Card instance + */ + Card.create = function create(properties) { + return new Card(properties); + }; + + /** + * Encodes the specified Card message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Card.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ICard} message Card message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Card.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.subtitle != null && Object.hasOwnProperty.call(message, "subtitle")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subtitle); + if (message.imageUri != null && Object.hasOwnProperty.call(message, "imageUri")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.imageUri); + if (message.buttons != null && message.buttons.length) + for (var i = 0; i < message.buttons.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.encode(message.buttons[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Card message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Card.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ICard} message Card message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Card.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Card message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Card} Card + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Card.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.subtitle = reader.string(); + break; + } + case 3: { + message.imageUri = reader.string(); + break; + } + case 4: { + if (!(message.buttons && message.buttons.length)) + message.buttons = []; + message.buttons.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Card message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Card} Card + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Card.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Card message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Card.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + if (!$util.isString(message.subtitle)) + return "subtitle: string expected"; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + if (!$util.isString(message.imageUri)) + return "imageUri: string expected"; + if (message.buttons != null && message.hasOwnProperty("buttons")) { + if (!Array.isArray(message.buttons)) + return "buttons: array expected"; + for (var i = 0; i < message.buttons.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.verify(message.buttons[i]); + if (error) + return "buttons." + error; + } + } + return null; + }; + + /** + * Creates a Card message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Card} Card + */ + Card.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card(); + if (object.title != null) + message.title = String(object.title); + if (object.subtitle != null) + message.subtitle = String(object.subtitle); + if (object.imageUri != null) + message.imageUri = String(object.imageUri); + if (object.buttons) { + if (!Array.isArray(object.buttons)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.Card.buttons: array expected"); + message.buttons = []; + for (var i = 0; i < object.buttons.length; ++i) { + if (typeof object.buttons[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.Card.buttons: object expected"); + message.buttons[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.fromObject(object.buttons[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Card message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.Card} message Card + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Card.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.buttons = []; + if (options.defaults) { + object.title = ""; + object.subtitle = ""; + object.imageUri = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + object.subtitle = message.subtitle; + if (message.imageUri != null && message.hasOwnProperty("imageUri")) + object.imageUri = message.imageUri; + if (message.buttons && message.buttons.length) { + object.buttons = []; + for (var j = 0; j < message.buttons.length; ++j) + object.buttons[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.toObject(message.buttons[j], options); + } + return object; + }; + + /** + * Converts this Card to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @instance + * @returns {Object.} JSON object + */ + Card.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Card + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Card.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.Card"; + }; + + Card.Button = (function() { + + /** + * Properties of a Button. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @interface IButton + * @property {string|null} [text] Button text + * @property {string|null} [postback] Button postback + */ + + /** + * Constructs a new Button. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card + * @classdesc Represents a Button. + * @implements IButton + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton=} [properties] Properties to set + */ + function Button(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Button text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @instance + */ + Button.prototype.text = ""; + + /** + * Button postback. + * @member {string} postback + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @instance + */ + Button.prototype.postback = ""; + + /** + * Creates a new Button instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button} Button instance + */ + Button.create = function create(properties) { + return new Button(properties); + }; + + /** + * Encodes the specified Button message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.postback != null && Object.hasOwnProperty.call(message, "postback")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.postback); + return writer; + }; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.Card.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Button message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.postback = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Button message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Button.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.postback != null && message.hasOwnProperty("postback")) + if (!$util.isString(message.postback)) + return "postback: string expected"; + return null; + }; + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button} Button + */ + Button.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button(); + if (object.text != null) + message.text = String(object.text); + if (object.postback != null) + message.postback = String(object.postback); + return message; + }; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button} message Button + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Button.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.postback = ""; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.postback != null && message.hasOwnProperty("postback")) + object.postback = message.postback; + return object; + }; + + /** + * Converts this Button to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @instance + * @returns {Object.} JSON object + */ + Button.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Button + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Button.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.Card.Button"; + }; + + return Button; + })(); + + return Card; + })(); + + Message.SimpleResponse = (function() { + + /** + * Properties of a SimpleResponse. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ISimpleResponse + * @property {string|null} [textToSpeech] SimpleResponse textToSpeech + * @property {string|null} [ssml] SimpleResponse ssml + * @property {string|null} [displayText] SimpleResponse displayText + */ + + /** + * Constructs a new SimpleResponse. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a SimpleResponse. + * @implements ISimpleResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse=} [properties] Properties to set + */ + function SimpleResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SimpleResponse textToSpeech. + * @member {string} textToSpeech + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @instance + */ + SimpleResponse.prototype.textToSpeech = ""; + + /** + * SimpleResponse ssml. + * @member {string} ssml + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @instance + */ + SimpleResponse.prototype.ssml = ""; + + /** + * SimpleResponse displayText. + * @member {string} displayText + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @instance + */ + SimpleResponse.prototype.displayText = ""; + + /** + * Creates a new SimpleResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse} SimpleResponse instance + */ + SimpleResponse.create = function create(properties) { + return new SimpleResponse(properties); + }; + + /** + * Encodes the specified SimpleResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse} message SimpleResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.textToSpeech != null && Object.hasOwnProperty.call(message, "textToSpeech")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.textToSpeech); + if (message.ssml != null && Object.hasOwnProperty.call(message, "ssml")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ssml); + if (message.displayText != null && Object.hasOwnProperty.call(message, "displayText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayText); + return writer; + }; + + /** + * Encodes the specified SimpleResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponse} message SimpleResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SimpleResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse} SimpleResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.textToSpeech = reader.string(); + break; + } + case 2: { + message.ssml = reader.string(); + break; + } + case 3: { + message.displayText = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SimpleResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse} SimpleResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SimpleResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SimpleResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.textToSpeech != null && message.hasOwnProperty("textToSpeech")) + if (!$util.isString(message.textToSpeech)) + return "textToSpeech: string expected"; + if (message.ssml != null && message.hasOwnProperty("ssml")) + if (!$util.isString(message.ssml)) + return "ssml: string expected"; + if (message.displayText != null && message.hasOwnProperty("displayText")) + if (!$util.isString(message.displayText)) + return "displayText: string expected"; + return null; + }; + + /** + * Creates a SimpleResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse} SimpleResponse + */ + SimpleResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse(); + if (object.textToSpeech != null) + message.textToSpeech = String(object.textToSpeech); + if (object.ssml != null) + message.ssml = String(object.ssml); + if (object.displayText != null) + message.displayText = String(object.displayText); + return message; + }; + + /** + * Creates a plain object from a SimpleResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse} message SimpleResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SimpleResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.textToSpeech = ""; + object.ssml = ""; + object.displayText = ""; + } + if (message.textToSpeech != null && message.hasOwnProperty("textToSpeech")) + object.textToSpeech = message.textToSpeech; + if (message.ssml != null && message.hasOwnProperty("ssml")) + object.ssml = message.ssml; + if (message.displayText != null && message.hasOwnProperty("displayText")) + object.displayText = message.displayText; + return object; + }; + + /** + * Converts this SimpleResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @instance + * @returns {Object.} JSON object + */ + SimpleResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SimpleResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SimpleResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse"; + }; + + return SimpleResponse; + })(); + + Message.SimpleResponses = (function() { + + /** + * Properties of a SimpleResponses. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ISimpleResponses + * @property {Array.|null} [simpleResponses] SimpleResponses simpleResponses + */ + + /** + * Constructs a new SimpleResponses. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a SimpleResponses. + * @implements ISimpleResponses + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses=} [properties] Properties to set + */ + function SimpleResponses(properties) { + this.simpleResponses = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SimpleResponses simpleResponses. + * @member {Array.} simpleResponses + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @instance + */ + SimpleResponses.prototype.simpleResponses = $util.emptyArray; + + /** + * Creates a new SimpleResponses instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses} SimpleResponses instance + */ + SimpleResponses.create = function create(properties) { + return new SimpleResponses(properties); + }; + + /** + * Encodes the specified SimpleResponses message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses} message SimpleResponses message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleResponses.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.simpleResponses != null && message.simpleResponses.length) + for (var i = 0; i < message.simpleResponses.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.encode(message.simpleResponses[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SimpleResponses message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISimpleResponses} message SimpleResponses message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SimpleResponses.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SimpleResponses message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses} SimpleResponses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleResponses.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.simpleResponses && message.simpleResponses.length)) + message.simpleResponses = []; + message.simpleResponses.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SimpleResponses message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses} SimpleResponses + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SimpleResponses.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SimpleResponses message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SimpleResponses.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.simpleResponses != null && message.hasOwnProperty("simpleResponses")) { + if (!Array.isArray(message.simpleResponses)) + return "simpleResponses: array expected"; + for (var i = 0; i < message.simpleResponses.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.verify(message.simpleResponses[i]); + if (error) + return "simpleResponses." + error; + } + } + return null; + }; + + /** + * Creates a SimpleResponses message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses} SimpleResponses + */ + SimpleResponses.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses(); + if (object.simpleResponses) { + if (!Array.isArray(object.simpleResponses)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.simpleResponses: array expected"); + message.simpleResponses = []; + for (var i = 0; i < object.simpleResponses.length; ++i) { + if (typeof object.simpleResponses[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses.simpleResponses: object expected"); + message.simpleResponses[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.fromObject(object.simpleResponses[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SimpleResponses message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses} message SimpleResponses + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SimpleResponses.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.simpleResponses = []; + if (message.simpleResponses && message.simpleResponses.length) { + object.simpleResponses = []; + for (var j = 0; j < message.simpleResponses.length; ++j) + object.simpleResponses[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponse.toObject(message.simpleResponses[j], options); + } + return object; + }; + + /** + * Converts this SimpleResponses to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @instance + * @returns {Object.} JSON object + */ + SimpleResponses.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SimpleResponses + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SimpleResponses.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.SimpleResponses"; + }; + + return SimpleResponses; + })(); + + Message.BasicCard = (function() { + + /** + * Properties of a BasicCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IBasicCard + * @property {string|null} [title] BasicCard title + * @property {string|null} [subtitle] BasicCard subtitle + * @property {string|null} [formattedText] BasicCard formattedText + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null} [image] BasicCard image + * @property {Array.|null} [buttons] BasicCard buttons + */ + + /** + * Constructs a new BasicCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a BasicCard. + * @implements IBasicCard + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard=} [properties] Properties to set + */ + function BasicCard(properties) { + this.buttons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BasicCard title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.title = ""; + + /** + * BasicCard subtitle. + * @member {string} subtitle + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.subtitle = ""; + + /** + * BasicCard formattedText. + * @member {string} formattedText + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.formattedText = ""; + + /** + * BasicCard image. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.image = null; + + /** + * BasicCard buttons. + * @member {Array.} buttons + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @instance + */ + BasicCard.prototype.buttons = $util.emptyArray; + + /** + * Creates a new BasicCard instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard} BasicCard instance + */ + BasicCard.create = function create(properties) { + return new BasicCard(properties); + }; + + /** + * Encodes the specified BasicCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard} message BasicCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BasicCard.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.subtitle != null && Object.hasOwnProperty.call(message, "subtitle")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subtitle); + if (message.formattedText != null && Object.hasOwnProperty.call(message, "formattedText")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.formattedText); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.encode(message.image, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.buttons != null && message.buttons.length) + for (var i = 0; i < message.buttons.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.encode(message.buttons[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BasicCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IBasicCard} message BasicCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BasicCard.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BasicCard message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard} BasicCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BasicCard.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.subtitle = reader.string(); + break; + } + case 3: { + message.formattedText = reader.string(); + break; + } + case 4: { + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.buttons && message.buttons.length)) + message.buttons = []; + message.buttons.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BasicCard message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard} BasicCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BasicCard.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BasicCard message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BasicCard.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + if (!$util.isString(message.subtitle)) + return "subtitle: string expected"; + if (message.formattedText != null && message.hasOwnProperty("formattedText")) + if (!$util.isString(message.formattedText)) + return "formattedText: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.buttons != null && message.hasOwnProperty("buttons")) { + if (!Array.isArray(message.buttons)) + return "buttons: array expected"; + for (var i = 0; i < message.buttons.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.verify(message.buttons[i]); + if (error) + return "buttons." + error; + } + } + return null; + }; + + /** + * Creates a BasicCard message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard} BasicCard + */ + BasicCard.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard(); + if (object.title != null) + message.title = String(object.title); + if (object.subtitle != null) + message.subtitle = String(object.subtitle); + if (object.formattedText != null) + message.formattedText = String(object.formattedText); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.fromObject(object.image); + } + if (object.buttons) { + if (!Array.isArray(object.buttons)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.buttons: array expected"); + message.buttons = []; + for (var i = 0; i < object.buttons.length; ++i) { + if (typeof object.buttons[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.buttons: object expected"); + message.buttons[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.fromObject(object.buttons[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BasicCard message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard} message BasicCard + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BasicCard.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.buttons = []; + if (options.defaults) { + object.title = ""; + object.subtitle = ""; + object.formattedText = ""; + object.image = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + object.subtitle = message.subtitle; + if (message.formattedText != null && message.hasOwnProperty("formattedText")) + object.formattedText = message.formattedText; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.toObject(message.image, options); + if (message.buttons && message.buttons.length) { + object.buttons = []; + for (var j = 0; j < message.buttons.length; ++j) + object.buttons[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.toObject(message.buttons[j], options); + } + return object; + }; + + /** + * Converts this BasicCard to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @instance + * @returns {Object.} JSON object + */ + BasicCard.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BasicCard + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BasicCard.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard"; + }; + + BasicCard.Button = (function() { + + /** + * Properties of a Button. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @interface IButton + * @property {string|null} [title] Button title + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction|null} [openUriAction] Button openUriAction + */ + + /** + * Constructs a new Button. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard + * @classdesc Represents a Button. + * @implements IButton + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton=} [properties] Properties to set + */ + function Button(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Button title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @instance + */ + Button.prototype.title = ""; + + /** + * Button openUriAction. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction|null|undefined} openUriAction + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @instance + */ + Button.prototype.openUriAction = null; + + /** + * Creates a new Button instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button} Button instance + */ + Button.create = function create(properties) { + return new Button(properties); + }; + + /** + * Encodes the specified Button message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.openUriAction != null && Object.hasOwnProperty.call(message, "openUriAction")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.encode(message.openUriAction, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Button message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.IButton} message Button message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Button.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Button message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.openUriAction = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Button message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button} Button + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Button.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Button message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Button.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.openUriAction != null && message.hasOwnProperty("openUriAction")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.verify(message.openUriAction); + if (error) + return "openUriAction." + error; + } + return null; + }; + + /** + * Creates a Button message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button} Button + */ + Button.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button(); + if (object.title != null) + message.title = String(object.title); + if (object.openUriAction != null) { + if (typeof object.openUriAction !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.openUriAction: object expected"); + message.openUriAction = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.fromObject(object.openUriAction); + } + return message; + }; + + /** + * Creates a plain object from a Button message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button} message Button + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Button.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.title = ""; + object.openUriAction = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.openUriAction != null && message.hasOwnProperty("openUriAction")) + object.openUriAction = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.toObject(message.openUriAction, options); + return object; + }; + + /** + * Converts this Button to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @instance + * @returns {Object.} JSON object + */ + Button.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Button + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Button.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button"; + }; + + Button.OpenUriAction = (function() { + + /** + * Properties of an OpenUriAction. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @interface IOpenUriAction + * @property {string|null} [uri] OpenUriAction uri + */ + + /** + * Constructs a new OpenUriAction. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button + * @classdesc Represents an OpenUriAction. + * @implements IOpenUriAction + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction=} [properties] Properties to set + */ + function OpenUriAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OpenUriAction uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @instance + */ + OpenUriAction.prototype.uri = ""; + + /** + * Creates a new OpenUriAction instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction} OpenUriAction instance + */ + OpenUriAction.create = function create(properties) { + return new OpenUriAction(properties); + }; + + /** + * Encodes the specified OpenUriAction message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction} message OpenUriAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OpenUriAction.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 OpenUriAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.IOpenUriAction} message OpenUriAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OpenUriAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OpenUriAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction} OpenUriAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OpenUriAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction(); + 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 an OpenUriAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction} OpenUriAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OpenUriAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OpenUriAction message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OpenUriAction.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 an OpenUriAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction} OpenUriAction + */ + OpenUriAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from an OpenUriAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction} message OpenUriAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OpenUriAction.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 OpenUriAction to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @instance + * @returns {Object.} JSON object + */ + OpenUriAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OpenUriAction + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OpenUriAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.OpenUriAction"; + }; + + return OpenUriAction; + })(); + + return Button; + })(); + + return BasicCard; + })(); + + Message.Suggestion = (function() { + + /** + * Properties of a Suggestion. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ISuggestion + * @property {string|null} [title] Suggestion title + */ + + /** + * Constructs a new Suggestion. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a Suggestion. + * @implements ISuggestion + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion=} [properties] Properties to set + */ + function Suggestion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Suggestion title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @instance + */ + Suggestion.prototype.title = ""; + + /** + * Creates a new Suggestion instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion} Suggestion instance + */ + Suggestion.create = function create(properties) { + return new Suggestion(properties); + }; + + /** + * Encodes the specified Suggestion message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion} message Suggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + return writer; + }; + + /** + * Encodes the specified Suggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestion} message Suggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Suggestion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion} Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Suggestion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion} Suggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Suggestion message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Suggestion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + return null; + }; + + /** + * Creates a Suggestion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion} Suggestion + */ + Suggestion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion(); + if (object.title != null) + message.title = String(object.title); + return message; + }; + + /** + * Creates a plain object from a Suggestion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion} message Suggestion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Suggestion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.title = ""; + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + return object; + }; + + /** + * Converts this Suggestion to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @instance + * @returns {Object.} JSON object + */ + Suggestion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Suggestion + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Suggestion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion"; + }; + + return Suggestion; + })(); + + Message.Suggestions = (function() { + + /** + * Properties of a Suggestions. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ISuggestions + * @property {Array.|null} [suggestions] Suggestions suggestions + */ + + /** + * Constructs a new Suggestions. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a Suggestions. + * @implements ISuggestions + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions=} [properties] Properties to set + */ + function Suggestions(properties) { + this.suggestions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Suggestions suggestions. + * @member {Array.} suggestions + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @instance + */ + Suggestions.prototype.suggestions = $util.emptyArray; + + /** + * Creates a new Suggestions instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions} Suggestions instance + */ + Suggestions.create = function create(properties) { + return new Suggestions(properties); + }; + + /** + * Encodes the specified Suggestions message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions} message Suggestions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.suggestions != null && message.suggestions.length) + for (var i = 0; i < message.suggestions.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.encode(message.suggestions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Suggestions message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISuggestions} message Suggestions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Suggestions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Suggestions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions} Suggestions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestions.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.suggestions && message.suggestions.length)) + message.suggestions = []; + message.suggestions.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Suggestions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions} Suggestions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Suggestions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Suggestions message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Suggestions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestions != null && message.hasOwnProperty("suggestions")) { + if (!Array.isArray(message.suggestions)) + return "suggestions: array expected"; + for (var i = 0; i < message.suggestions.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.verify(message.suggestions[i]); + if (error) + return "suggestions." + error; + } + } + return null; + }; + + /** + * Creates a Suggestions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions} Suggestions + */ + Suggestions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions(); + if (object.suggestions) { + if (!Array.isArray(object.suggestions)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.suggestions: array expected"); + message.suggestions = []; + for (var i = 0; i < object.suggestions.length; ++i) { + if (typeof object.suggestions[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions.suggestions: object expected"); + message.suggestions[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.fromObject(object.suggestions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Suggestions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions} message Suggestions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Suggestions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.suggestions = []; + if (message.suggestions && message.suggestions.length) { + object.suggestions = []; + for (var j = 0; j < message.suggestions.length; ++j) + object.suggestions[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Suggestion.toObject(message.suggestions[j], options); + } + return object; + }; + + /** + * Converts this Suggestions to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @instance + * @returns {Object.} JSON object + */ + Suggestions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Suggestions + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Suggestions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.Suggestions"; + }; + + return Suggestions; + })(); + + Message.LinkOutSuggestion = (function() { + + /** + * Properties of a LinkOutSuggestion. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ILinkOutSuggestion + * @property {string|null} [destinationName] LinkOutSuggestion destinationName + * @property {string|null} [uri] LinkOutSuggestion uri + */ + + /** + * Constructs a new LinkOutSuggestion. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a LinkOutSuggestion. + * @implements ILinkOutSuggestion + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion=} [properties] Properties to set + */ + function LinkOutSuggestion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LinkOutSuggestion destinationName. + * @member {string} destinationName + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @instance + */ + LinkOutSuggestion.prototype.destinationName = ""; + + /** + * LinkOutSuggestion uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @instance + */ + LinkOutSuggestion.prototype.uri = ""; + + /** + * Creates a new LinkOutSuggestion instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion} LinkOutSuggestion instance + */ + LinkOutSuggestion.create = function create(properties) { + return new LinkOutSuggestion(properties); + }; + + /** + * Encodes the specified LinkOutSuggestion message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion} message LinkOutSuggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkOutSuggestion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.destinationName != null && Object.hasOwnProperty.call(message, "destinationName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.destinationName); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uri); + return writer; + }; + + /** + * Encodes the specified LinkOutSuggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ILinkOutSuggestion} message LinkOutSuggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkOutSuggestion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LinkOutSuggestion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion} LinkOutSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkOutSuggestion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.destinationName = reader.string(); + break; + } + case 2: { + message.uri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LinkOutSuggestion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion} LinkOutSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkOutSuggestion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LinkOutSuggestion message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LinkOutSuggestion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.destinationName != null && message.hasOwnProperty("destinationName")) + if (!$util.isString(message.destinationName)) + return "destinationName: string expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + return null; + }; + + /** + * Creates a LinkOutSuggestion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion} LinkOutSuggestion + */ + LinkOutSuggestion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion(); + if (object.destinationName != null) + message.destinationName = String(object.destinationName); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from a LinkOutSuggestion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion} message LinkOutSuggestion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LinkOutSuggestion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.destinationName = ""; + object.uri = ""; + } + if (message.destinationName != null && message.hasOwnProperty("destinationName")) + object.destinationName = message.destinationName; + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + return object; + }; + + /** + * Converts this LinkOutSuggestion to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @instance + * @returns {Object.} JSON object + */ + LinkOutSuggestion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LinkOutSuggestion + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LinkOutSuggestion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.LinkOutSuggestion"; + }; + + return LinkOutSuggestion; + })(); + + Message.ListSelect = (function() { + + /** + * Properties of a ListSelect. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IListSelect + * @property {string|null} [title] ListSelect title + * @property {Array.|null} [items] ListSelect items + * @property {string|null} [subtitle] ListSelect subtitle + */ + + /** + * Constructs a new ListSelect. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a ListSelect. + * @implements IListSelect + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect=} [properties] Properties to set + */ + function ListSelect(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSelect title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @instance + */ + ListSelect.prototype.title = ""; + + /** + * ListSelect items. + * @member {Array.} items + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @instance + */ + ListSelect.prototype.items = $util.emptyArray; + + /** + * ListSelect subtitle. + * @member {string} subtitle + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @instance + */ + ListSelect.prototype.subtitle = ""; + + /** + * Creates a new ListSelect instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect} ListSelect instance + */ + ListSelect.create = function create(properties) { + return new ListSelect(properties); + }; + + /** + * Encodes the specified ListSelect message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect} message ListSelect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSelect.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.subtitle != null && Object.hasOwnProperty.call(message, "subtitle")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.subtitle); + return writer; + }; + + /** + * Encodes the specified ListSelect message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IListSelect} message ListSelect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSelect.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSelect message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect} ListSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSelect.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.decode(reader, reader.uint32())); + break; + } + case 3: { + message.subtitle = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSelect message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect} ListSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSelect.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSelect message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSelect.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + if (!$util.isString(message.subtitle)) + return "subtitle: string expected"; + return null; + }; + + /** + * Creates a ListSelect message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect} ListSelect + */ + ListSelect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect(); + if (object.title != null) + message.title = String(object.title); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.items: object expected"); + message.items[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.fromObject(object.items[i]); + } + } + if (object.subtitle != null) + message.subtitle = String(object.subtitle); + return message; + }; + + /** + * Creates a plain object from a ListSelect message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect} message ListSelect + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSelect.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) { + object.title = ""; + object.subtitle = ""; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.toObject(message.items[j], options); + } + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + object.subtitle = message.subtitle; + return object; + }; + + /** + * Converts this ListSelect to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @instance + * @returns {Object.} JSON object + */ + ListSelect.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSelect + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSelect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect"; + }; + + ListSelect.Item = (function() { + + /** + * Properties of an Item. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @interface IItem + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo|null} [info] Item info + * @property {string|null} [title] Item title + * @property {string|null} [description] Item description + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null} [image] Item image + */ + + /** + * Constructs a new Item. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect + * @classdesc Represents an Item. + * @implements IItem + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem=} [properties] Properties to set + */ + function Item(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Item info. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo|null|undefined} info + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @instance + */ + Item.prototype.info = null; + + /** + * Item title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @instance + */ + Item.prototype.title = ""; + + /** + * Item description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @instance + */ + Item.prototype.description = ""; + + /** + * Item image. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @instance + */ + Item.prototype.image = null; + + /** + * Creates a new Item instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item} Item instance + */ + Item.create = function create(properties) { + return new Item(properties); + }; + + /** + * Encodes the specified Item message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem} message Item message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Item.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.encode(message.info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.encode(message.image, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Item message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.IItem} message Item message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Item.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Item message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item} Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Item.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.info = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.decode(reader, reader.uint32()); + break; + } + case 2: { + message.title = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Item message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item} Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Item.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Item message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Item.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.info != null && message.hasOwnProperty("info")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.verify(message.info); + if (error) + return "info." + error; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + return null; + }; + + /** + * Creates an Item message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item} Item + */ + Item.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item(); + if (object.info != null) { + if (typeof object.info !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.info: object expected"); + message.info = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.fromObject(object.info); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.fromObject(object.image); + } + return message; + }; + + /** + * Creates a plain object from an Item message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item} message Item + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Item.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.info = null; + object.title = ""; + object.description = ""; + object.image = null; + } + if (message.info != null && message.hasOwnProperty("info")) + object.info = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.toObject(message.info, options); + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.toObject(message.image, options); + return object; + }; + + /** + * Converts this Item to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @instance + * @returns {Object.} JSON object + */ + Item.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Item + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Item.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.ListSelect.Item"; + }; + + return Item; + })(); + + return ListSelect; + })(); + + Message.CarouselSelect = (function() { + + /** + * Properties of a CarouselSelect. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ICarouselSelect + * @property {Array.|null} [items] CarouselSelect items + */ + + /** + * Constructs a new CarouselSelect. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a CarouselSelect. + * @implements ICarouselSelect + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect=} [properties] Properties to set + */ + function CarouselSelect(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CarouselSelect items. + * @member {Array.} items + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @instance + */ + CarouselSelect.prototype.items = $util.emptyArray; + + /** + * Creates a new CarouselSelect instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect} CarouselSelect instance + */ + CarouselSelect.create = function create(properties) { + return new CarouselSelect(properties); + }; + + /** + * Encodes the specified CarouselSelect message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect} message CarouselSelect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CarouselSelect.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CarouselSelect message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ICarouselSelect} message CarouselSelect message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CarouselSelect.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CarouselSelect message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect} CarouselSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CarouselSelect.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CarouselSelect message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect} CarouselSelect + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CarouselSelect.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CarouselSelect message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CarouselSelect.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a CarouselSelect message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect} CarouselSelect + */ + CarouselSelect.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect(); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.items: object expected"); + message.items[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a CarouselSelect message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect} message CarouselSelect + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CarouselSelect.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this CarouselSelect to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @instance + * @returns {Object.} JSON object + */ + CarouselSelect.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CarouselSelect + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CarouselSelect.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect"; + }; + + CarouselSelect.Item = (function() { + + /** + * Properties of an Item. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @interface IItem + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo|null} [info] Item info + * @property {string|null} [title] Item title + * @property {string|null} [description] Item description + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null} [image] Item image + */ + + /** + * Constructs a new Item. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect + * @classdesc Represents an Item. + * @implements IItem + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem=} [properties] Properties to set + */ + function Item(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Item info. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo|null|undefined} info + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @instance + */ + Item.prototype.info = null; + + /** + * Item title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @instance + */ + Item.prototype.title = ""; + + /** + * Item description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @instance + */ + Item.prototype.description = ""; + + /** + * Item image. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @instance + */ + Item.prototype.image = null; + + /** + * Creates a new Item instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item} Item instance + */ + Item.create = function create(properties) { + return new Item(properties); + }; + + /** + * Encodes the specified Item message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem} message Item message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Item.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.info != null && Object.hasOwnProperty.call(message, "info")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.encode(message.info, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.encode(message.image, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Item message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.IItem} message Item message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Item.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Item message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item} Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Item.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.info = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.decode(reader, reader.uint32()); + break; + } + case 2: { + message.title = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Item message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item} Item + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Item.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Item message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Item.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.info != null && message.hasOwnProperty("info")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.verify(message.info); + if (error) + return "info." + error; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + return null; + }; + + /** + * Creates an Item message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item} Item + */ + Item.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item(); + if (object.info != null) { + if (typeof object.info !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.info: object expected"); + message.info = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.fromObject(object.info); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.fromObject(object.image); + } + return message; + }; + + /** + * Creates a plain object from an Item message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item} message Item + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Item.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.info = null; + object.title = ""; + object.description = ""; + object.image = null; + } + if (message.info != null && message.hasOwnProperty("info")) + object.info = $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.toObject(message.info, options); + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.toObject(message.image, options); + return object; + }; + + /** + * Converts this Item to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @instance + * @returns {Object.} JSON object + */ + Item.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Item + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Item.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.CarouselSelect.Item"; + }; + + return Item; + })(); + + return CarouselSelect; + })(); + + Message.SelectItemInfo = (function() { + + /** + * Properties of a SelectItemInfo. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ISelectItemInfo + * @property {string|null} [key] SelectItemInfo key + * @property {Array.|null} [synonyms] SelectItemInfo synonyms + */ + + /** + * Constructs a new SelectItemInfo. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a SelectItemInfo. + * @implements ISelectItemInfo + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo=} [properties] Properties to set + */ + function SelectItemInfo(properties) { + this.synonyms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SelectItemInfo key. + * @member {string} key + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @instance + */ + SelectItemInfo.prototype.key = ""; + + /** + * SelectItemInfo synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @instance + */ + SelectItemInfo.prototype.synonyms = $util.emptyArray; + + /** + * Creates a new SelectItemInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo} SelectItemInfo instance + */ + SelectItemInfo.create = function create(properties) { + return new SelectItemInfo(properties); + }; + + /** + * Encodes the specified SelectItemInfo message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo} message SelectItemInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectItemInfo.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.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.synonyms[i]); + return writer; + }; + + /** + * Encodes the specified SelectItemInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ISelectItemInfo} message SelectItemInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectItemInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectItemInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo} SelectItemInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectItemInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.key = reader.string(); + break; + } + case 2: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectItemInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo} SelectItemInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectItemInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectItemInfo message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectItemInfo.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.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + return null; + }; + + /** + * Creates a SelectItemInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo} SelectItemInfo + */ + SelectItemInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo(); + if (object.key != null) + message.key = String(object.key); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + return message; + }; + + /** + * Creates a plain object from a SelectItemInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo} message SelectItemInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectItemInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (options.defaults) + object.key = ""; + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this SelectItemInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @instance + * @returns {Object.} JSON object + */ + SelectItemInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectItemInfo + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectItemInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.SelectItemInfo"; + }; + + return SelectItemInfo; + })(); + + Message.TelephonyPlayAudio = (function() { + + /** + * Properties of a TelephonyPlayAudio. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ITelephonyPlayAudio + * @property {string|null} [audioUri] TelephonyPlayAudio audioUri + */ + + /** + * Constructs a new TelephonyPlayAudio. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a TelephonyPlayAudio. + * @implements ITelephonyPlayAudio + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio=} [properties] Properties to set + */ + function TelephonyPlayAudio(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TelephonyPlayAudio audioUri. + * @member {string} audioUri + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @instance + */ + TelephonyPlayAudio.prototype.audioUri = ""; + + /** + * Creates a new TelephonyPlayAudio instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio} TelephonyPlayAudio instance + */ + TelephonyPlayAudio.create = function create(properties) { + return new TelephonyPlayAudio(properties); + }; + + /** + * Encodes the specified TelephonyPlayAudio message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio} message TelephonyPlayAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyPlayAudio.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.audioUri != null && Object.hasOwnProperty.call(message, "audioUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.audioUri); + return writer; + }; + + /** + * Encodes the specified TelephonyPlayAudio message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyPlayAudio} message TelephonyPlayAudio message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyPlayAudio.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TelephonyPlayAudio message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio} TelephonyPlayAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyPlayAudio.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.audioUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TelephonyPlayAudio message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio} TelephonyPlayAudio + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyPlayAudio.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TelephonyPlayAudio message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TelephonyPlayAudio.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.audioUri != null && message.hasOwnProperty("audioUri")) + if (!$util.isString(message.audioUri)) + return "audioUri: string expected"; + return null; + }; + + /** + * Creates a TelephonyPlayAudio message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio} TelephonyPlayAudio + */ + TelephonyPlayAudio.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio(); + if (object.audioUri != null) + message.audioUri = String(object.audioUri); + return message; + }; + + /** + * Creates a plain object from a TelephonyPlayAudio message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio} message TelephonyPlayAudio + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TelephonyPlayAudio.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.audioUri = ""; + if (message.audioUri != null && message.hasOwnProperty("audioUri")) + object.audioUri = message.audioUri; + return object; + }; + + /** + * Converts this TelephonyPlayAudio to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @instance + * @returns {Object.} JSON object + */ + TelephonyPlayAudio.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TelephonyPlayAudio + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TelephonyPlayAudio.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyPlayAudio"; + }; + + return TelephonyPlayAudio; + })(); + + Message.TelephonySynthesizeSpeech = (function() { + + /** + * Properties of a TelephonySynthesizeSpeech. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ITelephonySynthesizeSpeech + * @property {string|null} [text] TelephonySynthesizeSpeech text + * @property {string|null} [ssml] TelephonySynthesizeSpeech ssml + */ + + /** + * Constructs a new TelephonySynthesizeSpeech. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a TelephonySynthesizeSpeech. + * @implements ITelephonySynthesizeSpeech + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech=} [properties] Properties to set + */ + function TelephonySynthesizeSpeech(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TelephonySynthesizeSpeech text. + * @member {string|null|undefined} text + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @instance + */ + TelephonySynthesizeSpeech.prototype.text = null; + + /** + * TelephonySynthesizeSpeech ssml. + * @member {string|null|undefined} ssml + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @instance + */ + TelephonySynthesizeSpeech.prototype.ssml = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * TelephonySynthesizeSpeech source. + * @member {"text"|"ssml"|undefined} source + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @instance + */ + Object.defineProperty(TelephonySynthesizeSpeech.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["text", "ssml"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TelephonySynthesizeSpeech instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech} TelephonySynthesizeSpeech instance + */ + TelephonySynthesizeSpeech.create = function create(properties) { + return new TelephonySynthesizeSpeech(properties); + }; + + /** + * Encodes the specified TelephonySynthesizeSpeech message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech} message TelephonySynthesizeSpeech message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonySynthesizeSpeech.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.ssml != null && Object.hasOwnProperty.call(message, "ssml")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ssml); + return writer; + }; + + /** + * Encodes the specified TelephonySynthesizeSpeech message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonySynthesizeSpeech} message TelephonySynthesizeSpeech message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonySynthesizeSpeech.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TelephonySynthesizeSpeech message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech} TelephonySynthesizeSpeech + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonySynthesizeSpeech.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.ssml = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TelephonySynthesizeSpeech message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech} TelephonySynthesizeSpeech + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonySynthesizeSpeech.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TelephonySynthesizeSpeech message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TelephonySynthesizeSpeech.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) { + properties.source = 1; + if (!$util.isString(message.text)) + return "text: string expected"; + } + if (message.ssml != null && message.hasOwnProperty("ssml")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!$util.isString(message.ssml)) + return "ssml: string expected"; + } + return null; + }; + + /** + * Creates a TelephonySynthesizeSpeech message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech} TelephonySynthesizeSpeech + */ + TelephonySynthesizeSpeech.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech(); + if (object.text != null) + message.text = String(object.text); + if (object.ssml != null) + message.ssml = String(object.ssml); + return message; + }; + + /** + * Creates a plain object from a TelephonySynthesizeSpeech message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech} message TelephonySynthesizeSpeech + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TelephonySynthesizeSpeech.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.text != null && message.hasOwnProperty("text")) { + object.text = message.text; + if (options.oneofs) + object.source = "text"; + } + if (message.ssml != null && message.hasOwnProperty("ssml")) { + object.ssml = message.ssml; + if (options.oneofs) + object.source = "ssml"; + } + return object; + }; + + /** + * Converts this TelephonySynthesizeSpeech to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @instance + * @returns {Object.} JSON object + */ + TelephonySynthesizeSpeech.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TelephonySynthesizeSpeech + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TelephonySynthesizeSpeech.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.TelephonySynthesizeSpeech"; + }; + + return TelephonySynthesizeSpeech; + })(); + + Message.TelephonyTransferCall = (function() { + + /** + * Properties of a TelephonyTransferCall. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ITelephonyTransferCall + * @property {string|null} [phoneNumber] TelephonyTransferCall phoneNumber + */ + + /** + * Constructs a new TelephonyTransferCall. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a TelephonyTransferCall. + * @implements ITelephonyTransferCall + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall=} [properties] Properties to set + */ + function TelephonyTransferCall(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TelephonyTransferCall phoneNumber. + * @member {string} phoneNumber + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @instance + */ + TelephonyTransferCall.prototype.phoneNumber = ""; + + /** + * Creates a new TelephonyTransferCall instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall} TelephonyTransferCall instance + */ + TelephonyTransferCall.create = function create(properties) { + return new TelephonyTransferCall(properties); + }; + + /** + * Encodes the specified TelephonyTransferCall message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall} message TelephonyTransferCall message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyTransferCall.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.phoneNumber); + return writer; + }; + + /** + * Encodes the specified TelephonyTransferCall message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITelephonyTransferCall} message TelephonyTransferCall message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TelephonyTransferCall.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall} TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyTransferCall.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.phoneNumber = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TelephonyTransferCall message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall} TelephonyTransferCall + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TelephonyTransferCall.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TelephonyTransferCall message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TelephonyTransferCall.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + if (!$util.isString(message.phoneNumber)) + return "phoneNumber: string expected"; + return null; + }; + + /** + * Creates a TelephonyTransferCall message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall} TelephonyTransferCall + */ + TelephonyTransferCall.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall(); + if (object.phoneNumber != null) + message.phoneNumber = String(object.phoneNumber); + return message; + }; + + /** + * Creates a plain object from a TelephonyTransferCall message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall} message TelephonyTransferCall + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TelephonyTransferCall.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.phoneNumber = ""; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + object.phoneNumber = message.phoneNumber; + return object; + }; + + /** + * Converts this TelephonyTransferCall to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @instance + * @returns {Object.} JSON object + */ + TelephonyTransferCall.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TelephonyTransferCall + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TelephonyTransferCall.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.TelephonyTransferCall"; + }; + + return TelephonyTransferCall; + })(); + + Message.RbmText = (function() { + + /** + * Properties of a RbmText. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IRbmText + * @property {string|null} [text] RbmText text + * @property {Array.|null} [rbmSuggestion] RbmText rbmSuggestion + */ + + /** + * Constructs a new RbmText. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a RbmText. + * @implements IRbmText + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText=} [properties] Properties to set + */ + function RbmText(properties) { + this.rbmSuggestion = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmText text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @instance + */ + RbmText.prototype.text = ""; + + /** + * RbmText rbmSuggestion. + * @member {Array.} rbmSuggestion + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @instance + */ + RbmText.prototype.rbmSuggestion = $util.emptyArray; + + /** + * Creates a new RbmText instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmText} RbmText instance + */ + RbmText.create = function create(properties) { + return new RbmText(properties); + }; + + /** + * Encodes the specified RbmText message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText} message RbmText message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmText.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.rbmSuggestion != null && message.rbmSuggestion.length) + for (var i = 0; i < message.rbmSuggestion.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.encode(message.rbmSuggestion[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RbmText message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmText} message RbmText message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmText.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmText message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmText} RbmText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmText.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmText(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + if (!(message.rbmSuggestion && message.rbmSuggestion.length)) + message.rbmSuggestion = []; + message.rbmSuggestion.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmText message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmText} RbmText + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmText.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmText message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmText.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.rbmSuggestion != null && message.hasOwnProperty("rbmSuggestion")) { + if (!Array.isArray(message.rbmSuggestion)) + return "rbmSuggestion: array expected"; + for (var i = 0; i < message.rbmSuggestion.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.verify(message.rbmSuggestion[i]); + if (error) + return "rbmSuggestion." + error; + } + } + return null; + }; + + /** + * Creates a RbmText message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmText} RbmText + */ + RbmText.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmText) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmText(); + if (object.text != null) + message.text = String(object.text); + if (object.rbmSuggestion) { + if (!Array.isArray(object.rbmSuggestion)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.rbmSuggestion: array expected"); + message.rbmSuggestion = []; + for (var i = 0; i < object.rbmSuggestion.length; ++i) { + if (typeof object.rbmSuggestion[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmText.rbmSuggestion: object expected"); + message.rbmSuggestion[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.fromObject(object.rbmSuggestion[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a RbmText message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmText} message RbmText + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmText.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rbmSuggestion = []; + if (options.defaults) + object.text = ""; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.rbmSuggestion && message.rbmSuggestion.length) { + object.rbmSuggestion = []; + for (var j = 0; j < message.rbmSuggestion.length; ++j) + object.rbmSuggestion[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.toObject(message.rbmSuggestion[j], options); + } + return object; + }; + + /** + * Converts this RbmText to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @instance + * @returns {Object.} JSON object + */ + RbmText.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmText + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmText + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmText.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmText"; + }; + + return RbmText; + })(); + + Message.RbmCarouselCard = (function() { + + /** + * Properties of a RbmCarouselCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IRbmCarouselCard + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth|null} [cardWidth] RbmCarouselCard cardWidth + * @property {Array.|null} [cardContents] RbmCarouselCard cardContents + */ + + /** + * Constructs a new RbmCarouselCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a RbmCarouselCard. + * @implements IRbmCarouselCard + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard=} [properties] Properties to set + */ + function RbmCarouselCard(properties) { + this.cardContents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmCarouselCard cardWidth. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth} cardWidth + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @instance + */ + RbmCarouselCard.prototype.cardWidth = 0; + + /** + * RbmCarouselCard cardContents. + * @member {Array.} cardContents + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @instance + */ + RbmCarouselCard.prototype.cardContents = $util.emptyArray; + + /** + * Creates a new RbmCarouselCard instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard} RbmCarouselCard instance + */ + RbmCarouselCard.create = function create(properties) { + return new RbmCarouselCard(properties); + }; + + /** + * Encodes the specified RbmCarouselCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard} message RbmCarouselCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmCarouselCard.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cardWidth != null && Object.hasOwnProperty.call(message, "cardWidth")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.cardWidth); + if (message.cardContents != null && message.cardContents.length) + for (var i = 0; i < message.cardContents.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.encode(message.cardContents[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RbmCarouselCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCarouselCard} message RbmCarouselCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmCarouselCard.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmCarouselCard message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard} RbmCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmCarouselCard.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.cardWidth = reader.int32(); + break; + } + case 2: { + if (!(message.cardContents && message.cardContents.length)) + message.cardContents = []; + message.cardContents.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmCarouselCard message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard} RbmCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmCarouselCard.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmCarouselCard message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmCarouselCard.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cardWidth != null && message.hasOwnProperty("cardWidth")) + switch (message.cardWidth) { + default: + return "cardWidth: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.cardContents != null && message.hasOwnProperty("cardContents")) { + if (!Array.isArray(message.cardContents)) + return "cardContents: array expected"; + for (var i = 0; i < message.cardContents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.verify(message.cardContents[i]); + if (error) + return "cardContents." + error; + } + } + return null; + }; + + /** + * Creates a RbmCarouselCard message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard} RbmCarouselCard + */ + RbmCarouselCard.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard(); + switch (object.cardWidth) { + default: + if (typeof object.cardWidth === "number") { + message.cardWidth = object.cardWidth; + break; + } + break; + case "CARD_WIDTH_UNSPECIFIED": + case 0: + message.cardWidth = 0; + break; + case "SMALL": + case 1: + message.cardWidth = 1; + break; + case "MEDIUM": + case 2: + message.cardWidth = 2; + break; + } + if (object.cardContents) { + if (!Array.isArray(object.cardContents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.cardContents: array expected"); + message.cardContents = []; + for (var i = 0; i < object.cardContents.length; ++i) { + if (typeof object.cardContents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.cardContents: object expected"); + message.cardContents[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.fromObject(object.cardContents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a RbmCarouselCard message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard} message RbmCarouselCard + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmCarouselCard.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cardContents = []; + if (options.defaults) + object.cardWidth = options.enums === String ? "CARD_WIDTH_UNSPECIFIED" : 0; + if (message.cardWidth != null && message.hasOwnProperty("cardWidth")) + object.cardWidth = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth[message.cardWidth] === undefined ? message.cardWidth : $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth[message.cardWidth] : message.cardWidth; + if (message.cardContents && message.cardContents.length) { + object.cardContents = []; + for (var j = 0; j < message.cardContents.length; ++j) + object.cardContents[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.toObject(message.cardContents[j], options); + } + return object; + }; + + /** + * Converts this RbmCarouselCard to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @instance + * @returns {Object.} JSON object + */ + RbmCarouselCard.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmCarouselCard + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmCarouselCard.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard"; + }; + + /** + * CardWidth enum. + * @name google.cloud.dialogflow.v2beta1.Intent.Message.RbmCarouselCard.CardWidth + * @enum {number} + * @property {number} CARD_WIDTH_UNSPECIFIED=0 CARD_WIDTH_UNSPECIFIED value + * @property {number} SMALL=1 SMALL value + * @property {number} MEDIUM=2 MEDIUM value + */ + RbmCarouselCard.CardWidth = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CARD_WIDTH_UNSPECIFIED"] = 0; + values[valuesById[1] = "SMALL"] = 1; + values[valuesById[2] = "MEDIUM"] = 2; + return values; + })(); + + return RbmCarouselCard; + })(); + + Message.RbmStandaloneCard = (function() { + + /** + * Properties of a RbmStandaloneCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IRbmStandaloneCard + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation|null} [cardOrientation] RbmStandaloneCard cardOrientation + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment|null} [thumbnailImageAlignment] RbmStandaloneCard thumbnailImageAlignment + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent|null} [cardContent] RbmStandaloneCard cardContent + */ + + /** + * Constructs a new RbmStandaloneCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a RbmStandaloneCard. + * @implements IRbmStandaloneCard + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard=} [properties] Properties to set + */ + function RbmStandaloneCard(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmStandaloneCard cardOrientation. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation} cardOrientation + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @instance + */ + RbmStandaloneCard.prototype.cardOrientation = 0; + + /** + * RbmStandaloneCard thumbnailImageAlignment. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment} thumbnailImageAlignment + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @instance + */ + RbmStandaloneCard.prototype.thumbnailImageAlignment = 0; + + /** + * RbmStandaloneCard cardContent. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent|null|undefined} cardContent + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @instance + */ + RbmStandaloneCard.prototype.cardContent = null; + + /** + * Creates a new RbmStandaloneCard instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard} RbmStandaloneCard instance + */ + RbmStandaloneCard.create = function create(properties) { + return new RbmStandaloneCard(properties); + }; + + /** + * Encodes the specified RbmStandaloneCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard} message RbmStandaloneCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmStandaloneCard.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cardOrientation != null && Object.hasOwnProperty.call(message, "cardOrientation")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.cardOrientation); + if (message.thumbnailImageAlignment != null && Object.hasOwnProperty.call(message, "thumbnailImageAlignment")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.thumbnailImageAlignment); + if (message.cardContent != null && Object.hasOwnProperty.call(message, "cardContent")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.encode(message.cardContent, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RbmStandaloneCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmStandaloneCard} message RbmStandaloneCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmStandaloneCard.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmStandaloneCard message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard} RbmStandaloneCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmStandaloneCard.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.cardOrientation = reader.int32(); + break; + } + case 2: { + message.thumbnailImageAlignment = reader.int32(); + break; + } + case 3: { + message.cardContent = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmStandaloneCard message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard} RbmStandaloneCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmStandaloneCard.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmStandaloneCard message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmStandaloneCard.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cardOrientation != null && message.hasOwnProperty("cardOrientation")) + switch (message.cardOrientation) { + default: + return "cardOrientation: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.thumbnailImageAlignment != null && message.hasOwnProperty("thumbnailImageAlignment")) + switch (message.thumbnailImageAlignment) { + default: + return "thumbnailImageAlignment: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.cardContent != null && message.hasOwnProperty("cardContent")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.verify(message.cardContent); + if (error) + return "cardContent." + error; + } + return null; + }; + + /** + * Creates a RbmStandaloneCard message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard} RbmStandaloneCard + */ + RbmStandaloneCard.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard(); + switch (object.cardOrientation) { + default: + if (typeof object.cardOrientation === "number") { + message.cardOrientation = object.cardOrientation; + break; + } + break; + case "CARD_ORIENTATION_UNSPECIFIED": + case 0: + message.cardOrientation = 0; + break; + case "HORIZONTAL": + case 1: + message.cardOrientation = 1; + break; + case "VERTICAL": + case 2: + message.cardOrientation = 2; + break; + } + switch (object.thumbnailImageAlignment) { + default: + if (typeof object.thumbnailImageAlignment === "number") { + message.thumbnailImageAlignment = object.thumbnailImageAlignment; + break; + } + break; + case "THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED": + case 0: + message.thumbnailImageAlignment = 0; + break; + case "LEFT": + case 1: + message.thumbnailImageAlignment = 1; + break; + case "RIGHT": + case 2: + message.thumbnailImageAlignment = 2; + break; + } + if (object.cardContent != null) { + if (typeof object.cardContent !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.cardContent: object expected"); + message.cardContent = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.fromObject(object.cardContent); + } + return message; + }; + + /** + * Creates a plain object from a RbmStandaloneCard message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard} message RbmStandaloneCard + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmStandaloneCard.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.cardOrientation = options.enums === String ? "CARD_ORIENTATION_UNSPECIFIED" : 0; + object.thumbnailImageAlignment = options.enums === String ? "THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED" : 0; + object.cardContent = null; + } + if (message.cardOrientation != null && message.hasOwnProperty("cardOrientation")) + object.cardOrientation = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation[message.cardOrientation] === undefined ? message.cardOrientation : $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation[message.cardOrientation] : message.cardOrientation; + if (message.thumbnailImageAlignment != null && message.hasOwnProperty("thumbnailImageAlignment")) + object.thumbnailImageAlignment = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment[message.thumbnailImageAlignment] === undefined ? message.thumbnailImageAlignment : $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment[message.thumbnailImageAlignment] : message.thumbnailImageAlignment; + if (message.cardContent != null && message.hasOwnProperty("cardContent")) + object.cardContent = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.toObject(message.cardContent, options); + return object; + }; + + /** + * Converts this RbmStandaloneCard to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @instance + * @returns {Object.} JSON object + */ + RbmStandaloneCard.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmStandaloneCard + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmStandaloneCard.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard"; + }; + + /** + * CardOrientation enum. + * @name google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.CardOrientation + * @enum {number} + * @property {number} CARD_ORIENTATION_UNSPECIFIED=0 CARD_ORIENTATION_UNSPECIFIED value + * @property {number} HORIZONTAL=1 HORIZONTAL value + * @property {number} VERTICAL=2 VERTICAL value + */ + RbmStandaloneCard.CardOrientation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CARD_ORIENTATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "HORIZONTAL"] = 1; + values[valuesById[2] = "VERTICAL"] = 2; + return values; + })(); + + /** + * ThumbnailImageAlignment enum. + * @name google.cloud.dialogflow.v2beta1.Intent.Message.RbmStandaloneCard.ThumbnailImageAlignment + * @enum {number} + * @property {number} THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED=0 THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED value + * @property {number} LEFT=1 LEFT value + * @property {number} RIGHT=2 RIGHT value + */ + RbmStandaloneCard.ThumbnailImageAlignment = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "LEFT"] = 1; + values[valuesById[2] = "RIGHT"] = 2; + return values; + })(); + + return RbmStandaloneCard; + })(); + + Message.RbmCardContent = (function() { + + /** + * Properties of a RbmCardContent. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IRbmCardContent + * @property {string|null} [title] RbmCardContent title + * @property {string|null} [description] RbmCardContent description + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia|null} [media] RbmCardContent media + * @property {Array.|null} [suggestions] RbmCardContent suggestions + */ + + /** + * Constructs a new RbmCardContent. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a RbmCardContent. + * @implements IRbmCardContent + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent=} [properties] Properties to set + */ + function RbmCardContent(properties) { + this.suggestions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmCardContent title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @instance + */ + RbmCardContent.prototype.title = ""; + + /** + * RbmCardContent description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @instance + */ + RbmCardContent.prototype.description = ""; + + /** + * RbmCardContent media. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia|null|undefined} media + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @instance + */ + RbmCardContent.prototype.media = null; + + /** + * RbmCardContent suggestions. + * @member {Array.} suggestions + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @instance + */ + RbmCardContent.prototype.suggestions = $util.emptyArray; + + /** + * Creates a new RbmCardContent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent} RbmCardContent instance + */ + RbmCardContent.create = function create(properties) { + return new RbmCardContent(properties); + }; + + /** + * Encodes the specified RbmCardContent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent} message RbmCardContent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmCardContent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.media != null && Object.hasOwnProperty.call(message, "media")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.encode(message.media, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.suggestions != null && message.suggestions.length) + for (var i = 0; i < message.suggestions.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.encode(message.suggestions[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RbmCardContent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmCardContent} message RbmCardContent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmCardContent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmCardContent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent} RbmCardContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmCardContent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.media = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.suggestions && message.suggestions.length)) + message.suggestions = []; + message.suggestions.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmCardContent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent} RbmCardContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmCardContent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmCardContent message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmCardContent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.media != null && message.hasOwnProperty("media")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.verify(message.media); + if (error) + return "media." + error; + } + if (message.suggestions != null && message.hasOwnProperty("suggestions")) { + if (!Array.isArray(message.suggestions)) + return "suggestions: array expected"; + for (var i = 0; i < message.suggestions.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.verify(message.suggestions[i]); + if (error) + return "suggestions." + error; + } + } + return null; + }; + + /** + * Creates a RbmCardContent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent} RbmCardContent + */ + RbmCardContent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent(); + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.media != null) { + if (typeof object.media !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.media: object expected"); + message.media = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.fromObject(object.media); + } + if (object.suggestions) { + if (!Array.isArray(object.suggestions)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.suggestions: array expected"); + message.suggestions = []; + for (var i = 0; i < object.suggestions.length; ++i) { + if (typeof object.suggestions[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.suggestions: object expected"); + message.suggestions[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.fromObject(object.suggestions[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a RbmCardContent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent} message RbmCardContent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmCardContent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.suggestions = []; + if (options.defaults) { + object.title = ""; + object.description = ""; + object.media = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.media != null && message.hasOwnProperty("media")) + object.media = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.toObject(message.media, options); + if (message.suggestions && message.suggestions.length) { + object.suggestions = []; + for (var j = 0; j < message.suggestions.length; ++j) + object.suggestions[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.toObject(message.suggestions[j], options); + } + return object; + }; + + /** + * Converts this RbmCardContent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @instance + * @returns {Object.} JSON object + */ + RbmCardContent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmCardContent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmCardContent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent"; + }; + + RbmCardContent.RbmMedia = (function() { + + /** + * Properties of a RbmMedia. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @interface IRbmMedia + * @property {string|null} [fileUri] RbmMedia fileUri + * @property {string|null} [thumbnailUri] RbmMedia thumbnailUri + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height|null} [height] RbmMedia height + */ + + /** + * Constructs a new RbmMedia. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent + * @classdesc Represents a RbmMedia. + * @implements IRbmMedia + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia=} [properties] Properties to set + */ + function RbmMedia(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmMedia fileUri. + * @member {string} fileUri + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @instance + */ + RbmMedia.prototype.fileUri = ""; + + /** + * RbmMedia thumbnailUri. + * @member {string} thumbnailUri + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @instance + */ + RbmMedia.prototype.thumbnailUri = ""; + + /** + * RbmMedia height. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height} height + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @instance + */ + RbmMedia.prototype.height = 0; + + /** + * Creates a new RbmMedia instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia} RbmMedia instance + */ + RbmMedia.create = function create(properties) { + return new RbmMedia(properties); + }; + + /** + * Encodes the specified RbmMedia message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia} message RbmMedia message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmMedia.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fileUri != null && Object.hasOwnProperty.call(message, "fileUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fileUri); + if (message.thumbnailUri != null && Object.hasOwnProperty.call(message, "thumbnailUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.thumbnailUri); + if (message.height != null && Object.hasOwnProperty.call(message, "height")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.height); + return writer; + }; + + /** + * Encodes the specified RbmMedia message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.IRbmMedia} message RbmMedia message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmMedia.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmMedia message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia} RbmMedia + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmMedia.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.fileUri = reader.string(); + break; + } + case 2: { + message.thumbnailUri = reader.string(); + break; + } + case 3: { + message.height = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmMedia message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia} RbmMedia + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmMedia.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmMedia message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmMedia.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fileUri != null && message.hasOwnProperty("fileUri")) + if (!$util.isString(message.fileUri)) + return "fileUri: string expected"; + if (message.thumbnailUri != null && message.hasOwnProperty("thumbnailUri")) + if (!$util.isString(message.thumbnailUri)) + return "thumbnailUri: string expected"; + if (message.height != null && message.hasOwnProperty("height")) + switch (message.height) { + default: + return "height: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a RbmMedia message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia} RbmMedia + */ + RbmMedia.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia(); + if (object.fileUri != null) + message.fileUri = String(object.fileUri); + if (object.thumbnailUri != null) + message.thumbnailUri = String(object.thumbnailUri); + switch (object.height) { + default: + if (typeof object.height === "number") { + message.height = object.height; + break; + } + break; + case "HEIGHT_UNSPECIFIED": + case 0: + message.height = 0; + break; + case "SHORT": + case 1: + message.height = 1; + break; + case "MEDIUM": + case 2: + message.height = 2; + break; + case "TALL": + case 3: + message.height = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a RbmMedia message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia} message RbmMedia + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmMedia.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fileUri = ""; + object.thumbnailUri = ""; + object.height = options.enums === String ? "HEIGHT_UNSPECIFIED" : 0; + } + if (message.fileUri != null && message.hasOwnProperty("fileUri")) + object.fileUri = message.fileUri; + if (message.thumbnailUri != null && message.hasOwnProperty("thumbnailUri")) + object.thumbnailUri = message.thumbnailUri; + if (message.height != null && message.hasOwnProperty("height")) + object.height = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height[message.height] === undefined ? message.height : $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height[message.height] : message.height; + return object; + }; + + /** + * Converts this RbmMedia to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @instance + * @returns {Object.} JSON object + */ + RbmMedia.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmMedia + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmMedia.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia"; + }; + + /** + * Height enum. + * @name google.cloud.dialogflow.v2beta1.Intent.Message.RbmCardContent.RbmMedia.Height + * @enum {number} + * @property {number} HEIGHT_UNSPECIFIED=0 HEIGHT_UNSPECIFIED value + * @property {number} SHORT=1 SHORT value + * @property {number} MEDIUM=2 MEDIUM value + * @property {number} TALL=3 TALL value + */ + RbmMedia.Height = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HEIGHT_UNSPECIFIED"] = 0; + values[valuesById[1] = "SHORT"] = 1; + values[valuesById[2] = "MEDIUM"] = 2; + values[valuesById[3] = "TALL"] = 3; + return values; + })(); + + return RbmMedia; + })(); + + return RbmCardContent; + })(); + + Message.RbmSuggestion = (function() { + + /** + * Properties of a RbmSuggestion. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IRbmSuggestion + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply|null} [reply] RbmSuggestion reply + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction|null} [action] RbmSuggestion action + */ + + /** + * Constructs a new RbmSuggestion. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a RbmSuggestion. + * @implements IRbmSuggestion + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion=} [properties] Properties to set + */ + function RbmSuggestion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmSuggestion reply. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply|null|undefined} reply + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @instance + */ + RbmSuggestion.prototype.reply = null; + + /** + * RbmSuggestion action. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction|null|undefined} action + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @instance + */ + RbmSuggestion.prototype.action = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RbmSuggestion suggestion. + * @member {"reply"|"action"|undefined} suggestion + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @instance + */ + Object.defineProperty(RbmSuggestion.prototype, "suggestion", { + get: $util.oneOfGetter($oneOfFields = ["reply", "action"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RbmSuggestion instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion} RbmSuggestion instance + */ + RbmSuggestion.create = function create(properties) { + return new RbmSuggestion(properties); + }; + + /** + * Encodes the specified RbmSuggestion message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion} message RbmSuggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.reply != null && Object.hasOwnProperty.call(message, "reply")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.encode(message.reply, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.action != null && Object.hasOwnProperty.call(message, "action")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.encode(message.action, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RbmSuggestion message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestion} message RbmSuggestion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmSuggestion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion} RbmSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestion.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.reply = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.decode(reader, reader.uint32()); + break; + } + case 2: { + message.action = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmSuggestion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion} RbmSuggestion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmSuggestion message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmSuggestion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.reply != null && message.hasOwnProperty("reply")) { + properties.suggestion = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.verify(message.reply); + if (error) + return "reply." + error; + } + } + if (message.action != null && message.hasOwnProperty("action")) { + if (properties.suggestion === 1) + return "suggestion: multiple values"; + properties.suggestion = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.verify(message.action); + if (error) + return "action." + error; + } + } + return null; + }; + + /** + * Creates a RbmSuggestion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion} RbmSuggestion + */ + RbmSuggestion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion(); + if (object.reply != null) { + if (typeof object.reply !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.reply: object expected"); + message.reply = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.fromObject(object.reply); + } + if (object.action != null) { + if (typeof object.action !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion.action: object expected"); + message.action = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.fromObject(object.action); + } + return message; + }; + + /** + * Creates a plain object from a RbmSuggestion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion} message RbmSuggestion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmSuggestion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.reply != null && message.hasOwnProperty("reply")) { + object.reply = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.toObject(message.reply, options); + if (options.oneofs) + object.suggestion = "reply"; + } + if (message.action != null && message.hasOwnProperty("action")) { + object.action = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.toObject(message.action, options); + if (options.oneofs) + object.suggestion = "action"; + } + return object; + }; + + /** + * Converts this RbmSuggestion to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @instance + * @returns {Object.} JSON object + */ + RbmSuggestion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmSuggestion + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmSuggestion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestion"; + }; + + return RbmSuggestion; + })(); + + Message.RbmSuggestedReply = (function() { + + /** + * Properties of a RbmSuggestedReply. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IRbmSuggestedReply + * @property {string|null} [text] RbmSuggestedReply text + * @property {string|null} [postbackData] RbmSuggestedReply postbackData + */ + + /** + * Constructs a new RbmSuggestedReply. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a RbmSuggestedReply. + * @implements IRbmSuggestedReply + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply=} [properties] Properties to set + */ + function RbmSuggestedReply(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmSuggestedReply text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @instance + */ + RbmSuggestedReply.prototype.text = ""; + + /** + * RbmSuggestedReply postbackData. + * @member {string} postbackData + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @instance + */ + RbmSuggestedReply.prototype.postbackData = ""; + + /** + * Creates a new RbmSuggestedReply instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply} RbmSuggestedReply instance + */ + RbmSuggestedReply.create = function create(properties) { + return new RbmSuggestedReply(properties); + }; + + /** + * Encodes the specified RbmSuggestedReply message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply} message RbmSuggestedReply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedReply.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.postbackData != null && Object.hasOwnProperty.call(message, "postbackData")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.postbackData); + return writer; + }; + + /** + * Encodes the specified RbmSuggestedReply message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedReply} message RbmSuggestedReply message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedReply.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmSuggestedReply message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply} RbmSuggestedReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedReply.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.postbackData = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmSuggestedReply message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply} RbmSuggestedReply + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedReply.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmSuggestedReply message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmSuggestedReply.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.postbackData != null && message.hasOwnProperty("postbackData")) + if (!$util.isString(message.postbackData)) + return "postbackData: string expected"; + return null; + }; + + /** + * Creates a RbmSuggestedReply message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply} RbmSuggestedReply + */ + RbmSuggestedReply.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply(); + if (object.text != null) + message.text = String(object.text); + if (object.postbackData != null) + message.postbackData = String(object.postbackData); + return message; + }; + + /** + * Creates a plain object from a RbmSuggestedReply message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply} message RbmSuggestedReply + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmSuggestedReply.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.postbackData = ""; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.postbackData != null && message.hasOwnProperty("postbackData")) + object.postbackData = message.postbackData; + return object; + }; + + /** + * Converts this RbmSuggestedReply to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @instance + * @returns {Object.} JSON object + */ + RbmSuggestedReply.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmSuggestedReply + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmSuggestedReply.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedReply"; + }; + + return RbmSuggestedReply; + })(); + + Message.RbmSuggestedAction = (function() { + + /** + * Properties of a RbmSuggestedAction. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IRbmSuggestedAction + * @property {string|null} [text] RbmSuggestedAction text + * @property {string|null} [postbackData] RbmSuggestedAction postbackData + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial|null} [dial] RbmSuggestedAction dial + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri|null} [openUrl] RbmSuggestedAction openUrl + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation|null} [shareLocation] RbmSuggestedAction shareLocation + */ + + /** + * Constructs a new RbmSuggestedAction. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a RbmSuggestedAction. + * @implements IRbmSuggestedAction + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction=} [properties] Properties to set + */ + function RbmSuggestedAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmSuggestedAction text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @instance + */ + RbmSuggestedAction.prototype.text = ""; + + /** + * RbmSuggestedAction postbackData. + * @member {string} postbackData + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @instance + */ + RbmSuggestedAction.prototype.postbackData = ""; + + /** + * RbmSuggestedAction dial. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial|null|undefined} dial + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @instance + */ + RbmSuggestedAction.prototype.dial = null; + + /** + * RbmSuggestedAction openUrl. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri|null|undefined} openUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @instance + */ + RbmSuggestedAction.prototype.openUrl = null; + + /** + * RbmSuggestedAction shareLocation. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation|null|undefined} shareLocation + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @instance + */ + RbmSuggestedAction.prototype.shareLocation = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * RbmSuggestedAction action. + * @member {"dial"|"openUrl"|"shareLocation"|undefined} action + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @instance + */ + Object.defineProperty(RbmSuggestedAction.prototype, "action", { + get: $util.oneOfGetter($oneOfFields = ["dial", "openUrl", "shareLocation"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new RbmSuggestedAction instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction} RbmSuggestedAction instance + */ + RbmSuggestedAction.create = function create(properties) { + return new RbmSuggestedAction(properties); + }; + + /** + * Encodes the specified RbmSuggestedAction message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction} message RbmSuggestedAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedAction.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.postbackData != null && Object.hasOwnProperty.call(message, "postbackData")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.postbackData); + if (message.dial != null && Object.hasOwnProperty.call(message, "dial")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.encode(message.dial, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.openUrl != null && Object.hasOwnProperty.call(message, "openUrl")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.encode(message.openUrl, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.shareLocation != null && Object.hasOwnProperty.call(message, "shareLocation")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation.encode(message.shareLocation, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RbmSuggestedAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IRbmSuggestedAction} message RbmSuggestedAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmSuggestedAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction} RbmSuggestedAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 2: { + message.postbackData = reader.string(); + break; + } + case 3: { + message.dial = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.decode(reader, reader.uint32()); + break; + } + case 4: { + message.openUrl = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.decode(reader, reader.uint32()); + break; + } + case 5: { + message.shareLocation = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmSuggestedAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction} RbmSuggestedAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmSuggestedAction message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmSuggestedAction.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.postbackData != null && message.hasOwnProperty("postbackData")) + if (!$util.isString(message.postbackData)) + return "postbackData: string expected"; + if (message.dial != null && message.hasOwnProperty("dial")) { + properties.action = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.verify(message.dial); + if (error) + return "dial." + error; + } + } + if (message.openUrl != null && message.hasOwnProperty("openUrl")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.verify(message.openUrl); + if (error) + return "openUrl." + error; + } + } + if (message.shareLocation != null && message.hasOwnProperty("shareLocation")) { + if (properties.action === 1) + return "action: multiple values"; + properties.action = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation.verify(message.shareLocation); + if (error) + return "shareLocation." + error; + } + } + return null; + }; + + /** + * Creates a RbmSuggestedAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction} RbmSuggestedAction + */ + RbmSuggestedAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction(); + if (object.text != null) + message.text = String(object.text); + if (object.postbackData != null) + message.postbackData = String(object.postbackData); + if (object.dial != null) { + if (typeof object.dial !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.dial: object expected"); + message.dial = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.fromObject(object.dial); + } + if (object.openUrl != null) { + if (typeof object.openUrl !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.openUrl: object expected"); + message.openUrl = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.fromObject(object.openUrl); + } + if (object.shareLocation != null) { + if (typeof object.shareLocation !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.shareLocation: object expected"); + message.shareLocation = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation.fromObject(object.shareLocation); + } + return message; + }; + + /** + * Creates a plain object from a RbmSuggestedAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction} message RbmSuggestedAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmSuggestedAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.text = ""; + object.postbackData = ""; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.postbackData != null && message.hasOwnProperty("postbackData")) + object.postbackData = message.postbackData; + if (message.dial != null && message.hasOwnProperty("dial")) { + object.dial = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.toObject(message.dial, options); + if (options.oneofs) + object.action = "dial"; + } + if (message.openUrl != null && message.hasOwnProperty("openUrl")) { + object.openUrl = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.toObject(message.openUrl, options); + if (options.oneofs) + object.action = "openUrl"; + } + if (message.shareLocation != null && message.hasOwnProperty("shareLocation")) { + object.shareLocation = $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation.toObject(message.shareLocation, options); + if (options.oneofs) + object.action = "shareLocation"; + } + return object; + }; + + /** + * Converts this RbmSuggestedAction to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @instance + * @returns {Object.} JSON object + */ + RbmSuggestedAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmSuggestedAction + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmSuggestedAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction"; + }; + + RbmSuggestedAction.RbmSuggestedActionDial = (function() { + + /** + * Properties of a RbmSuggestedActionDial. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @interface IRbmSuggestedActionDial + * @property {string|null} [phoneNumber] RbmSuggestedActionDial phoneNumber + */ + + /** + * Constructs a new RbmSuggestedActionDial. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @classdesc Represents a RbmSuggestedActionDial. + * @implements IRbmSuggestedActionDial + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial=} [properties] Properties to set + */ + function RbmSuggestedActionDial(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmSuggestedActionDial phoneNumber. + * @member {string} phoneNumber + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @instance + */ + RbmSuggestedActionDial.prototype.phoneNumber = ""; + + /** + * Creates a new RbmSuggestedActionDial instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial} RbmSuggestedActionDial instance + */ + RbmSuggestedActionDial.create = function create(properties) { + return new RbmSuggestedActionDial(properties); + }; + + /** + * Encodes the specified RbmSuggestedActionDial message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial} message RbmSuggestedActionDial message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedActionDial.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.phoneNumber); + return writer; + }; + + /** + * Encodes the specified RbmSuggestedActionDial message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionDial} message RbmSuggestedActionDial message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedActionDial.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmSuggestedActionDial message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial} RbmSuggestedActionDial + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedActionDial.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.phoneNumber = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmSuggestedActionDial message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial} RbmSuggestedActionDial + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedActionDial.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmSuggestedActionDial message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmSuggestedActionDial.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + if (!$util.isString(message.phoneNumber)) + return "phoneNumber: string expected"; + return null; + }; + + /** + * Creates a RbmSuggestedActionDial message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial} RbmSuggestedActionDial + */ + RbmSuggestedActionDial.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial(); + if (object.phoneNumber != null) + message.phoneNumber = String(object.phoneNumber); + return message; + }; + + /** + * Creates a plain object from a RbmSuggestedActionDial message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial} message RbmSuggestedActionDial + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmSuggestedActionDial.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.phoneNumber = ""; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + object.phoneNumber = message.phoneNumber; + return object; + }; + + /** + * Converts this RbmSuggestedActionDial to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @instance + * @returns {Object.} JSON object + */ + RbmSuggestedActionDial.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmSuggestedActionDial + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmSuggestedActionDial.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionDial"; + }; + + return RbmSuggestedActionDial; + })(); + + RbmSuggestedAction.RbmSuggestedActionOpenUri = (function() { + + /** + * Properties of a RbmSuggestedActionOpenUri. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @interface IRbmSuggestedActionOpenUri + * @property {string|null} [uri] RbmSuggestedActionOpenUri uri + */ + + /** + * Constructs a new RbmSuggestedActionOpenUri. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @classdesc Represents a RbmSuggestedActionOpenUri. + * @implements IRbmSuggestedActionOpenUri + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri=} [properties] Properties to set + */ + function RbmSuggestedActionOpenUri(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RbmSuggestedActionOpenUri uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @instance + */ + RbmSuggestedActionOpenUri.prototype.uri = ""; + + /** + * Creates a new RbmSuggestedActionOpenUri instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri} RbmSuggestedActionOpenUri instance + */ + RbmSuggestedActionOpenUri.create = function create(properties) { + return new RbmSuggestedActionOpenUri(properties); + }; + + /** + * Encodes the specified RbmSuggestedActionOpenUri message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri} message RbmSuggestedActionOpenUri message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedActionOpenUri.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 RbmSuggestedActionOpenUri message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionOpenUri} message RbmSuggestedActionOpenUri message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedActionOpenUri.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmSuggestedActionOpenUri message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri} RbmSuggestedActionOpenUri + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedActionOpenUri.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri(); + 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 RbmSuggestedActionOpenUri message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri} RbmSuggestedActionOpenUri + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedActionOpenUri.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmSuggestedActionOpenUri message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmSuggestedActionOpenUri.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 RbmSuggestedActionOpenUri message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri} RbmSuggestedActionOpenUri + */ + RbmSuggestedActionOpenUri.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri(); + if (object.uri != null) + message.uri = String(object.uri); + return message; + }; + + /** + * Creates a plain object from a RbmSuggestedActionOpenUri message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri} message RbmSuggestedActionOpenUri + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmSuggestedActionOpenUri.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 RbmSuggestedActionOpenUri to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @instance + * @returns {Object.} JSON object + */ + RbmSuggestedActionOpenUri.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmSuggestedActionOpenUri + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmSuggestedActionOpenUri.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionOpenUri"; + }; + + return RbmSuggestedActionOpenUri; + })(); + + RbmSuggestedAction.RbmSuggestedActionShareLocation = (function() { + + /** + * Properties of a RbmSuggestedActionShareLocation. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @interface IRbmSuggestedActionShareLocation + */ + + /** + * Constructs a new RbmSuggestedActionShareLocation. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction + * @classdesc Represents a RbmSuggestedActionShareLocation. + * @implements IRbmSuggestedActionShareLocation + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation=} [properties] Properties to set + */ + function RbmSuggestedActionShareLocation(properties) { + if (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 RbmSuggestedActionShareLocation instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation} RbmSuggestedActionShareLocation instance + */ + RbmSuggestedActionShareLocation.create = function create(properties) { + return new RbmSuggestedActionShareLocation(properties); + }; + + /** + * Encodes the specified RbmSuggestedActionShareLocation message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation} message RbmSuggestedActionShareLocation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedActionShareLocation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified RbmSuggestedActionShareLocation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.IRbmSuggestedActionShareLocation} message RbmSuggestedActionShareLocation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RbmSuggestedActionShareLocation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RbmSuggestedActionShareLocation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation} RbmSuggestedActionShareLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedActionShareLocation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RbmSuggestedActionShareLocation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation} RbmSuggestedActionShareLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RbmSuggestedActionShareLocation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RbmSuggestedActionShareLocation message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RbmSuggestedActionShareLocation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a RbmSuggestedActionShareLocation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation} RbmSuggestedActionShareLocation + */ + RbmSuggestedActionShareLocation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation) + return object; + return new $root.google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation(); + }; + + /** + * Creates a plain object from a RbmSuggestedActionShareLocation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation} message RbmSuggestedActionShareLocation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RbmSuggestedActionShareLocation.toObject = function toObject() { + return {}; + }; + + /** + * Converts this RbmSuggestedActionShareLocation to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @instance + * @returns {Object.} JSON object + */ + RbmSuggestedActionShareLocation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RbmSuggestedActionShareLocation + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RbmSuggestedActionShareLocation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.RbmSuggestedAction.RbmSuggestedActionShareLocation"; + }; + + return RbmSuggestedActionShareLocation; + })(); + + return RbmSuggestedAction; + })(); + + Message.MediaContent = (function() { + + /** + * Properties of a MediaContent. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IMediaContent + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType|null} [mediaType] MediaContent mediaType + * @property {Array.|null} [mediaObjects] MediaContent mediaObjects + */ + + /** + * Constructs a new MediaContent. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a MediaContent. + * @implements IMediaContent + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent=} [properties] Properties to set + */ + function MediaContent(properties) { + this.mediaObjects = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MediaContent mediaType. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType} mediaType + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @instance + */ + MediaContent.prototype.mediaType = 0; + + /** + * MediaContent mediaObjects. + * @member {Array.} mediaObjects + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @instance + */ + MediaContent.prototype.mediaObjects = $util.emptyArray; + + /** + * Creates a new MediaContent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent} MediaContent instance + */ + MediaContent.create = function create(properties) { + return new MediaContent(properties); + }; + + /** + * Encodes the specified MediaContent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent} message MediaContent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaContent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mediaType != null && Object.hasOwnProperty.call(message, "mediaType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.mediaType); + if (message.mediaObjects != null && message.mediaObjects.length) + for (var i = 0; i < message.mediaObjects.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.encode(message.mediaObjects[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MediaContent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IMediaContent} message MediaContent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MediaContent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MediaContent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent} MediaContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaContent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mediaType = reader.int32(); + break; + } + case 2: { + if (!(message.mediaObjects && message.mediaObjects.length)) + message.mediaObjects = []; + message.mediaObjects.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MediaContent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent} MediaContent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MediaContent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MediaContent message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MediaContent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mediaType != null && message.hasOwnProperty("mediaType")) + switch (message.mediaType) { + default: + return "mediaType: enum value expected"; + case 0: + case 1: + break; + } + if (message.mediaObjects != null && message.hasOwnProperty("mediaObjects")) { + if (!Array.isArray(message.mediaObjects)) + return "mediaObjects: array expected"; + for (var i = 0; i < message.mediaObjects.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.verify(message.mediaObjects[i]); + if (error) + return "mediaObjects." + error; + } + } + return null; + }; + + /** + * Creates a MediaContent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent} MediaContent + */ + MediaContent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent(); + switch (object.mediaType) { + default: + if (typeof object.mediaType === "number") { + message.mediaType = object.mediaType; + break; + } + break; + case "RESPONSE_MEDIA_TYPE_UNSPECIFIED": + case 0: + message.mediaType = 0; + break; + case "AUDIO": + case 1: + message.mediaType = 1; + break; + } + if (object.mediaObjects) { + if (!Array.isArray(object.mediaObjects)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.mediaObjects: array expected"); + message.mediaObjects = []; + for (var i = 0; i < object.mediaObjects.length; ++i) { + if (typeof object.mediaObjects[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.mediaObjects: object expected"); + message.mediaObjects[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.fromObject(object.mediaObjects[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MediaContent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent} message MediaContent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MediaContent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.mediaObjects = []; + if (options.defaults) + object.mediaType = options.enums === String ? "RESPONSE_MEDIA_TYPE_UNSPECIFIED" : 0; + if (message.mediaType != null && message.hasOwnProperty("mediaType")) + object.mediaType = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType[message.mediaType] === undefined ? message.mediaType : $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType[message.mediaType] : message.mediaType; + if (message.mediaObjects && message.mediaObjects.length) { + object.mediaObjects = []; + for (var j = 0; j < message.mediaObjects.length; ++j) + object.mediaObjects[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.toObject(message.mediaObjects[j], options); + } + return object; + }; + + /** + * Converts this MediaContent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @instance + * @returns {Object.} JSON object + */ + MediaContent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MediaContent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MediaContent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent"; + }; + + /** + * ResponseMediaType enum. + * @name google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaType + * @enum {number} + * @property {number} RESPONSE_MEDIA_TYPE_UNSPECIFIED=0 RESPONSE_MEDIA_TYPE_UNSPECIFIED value + * @property {number} AUDIO=1 AUDIO value + */ + MediaContent.ResponseMediaType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESPONSE_MEDIA_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUDIO"] = 1; + return values; + })(); + + MediaContent.ResponseMediaObject = (function() { + + /** + * Properties of a ResponseMediaObject. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @interface IResponseMediaObject + * @property {string|null} [name] ResponseMediaObject name + * @property {string|null} [description] ResponseMediaObject description + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null} [largeImage] ResponseMediaObject largeImage + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null} [icon] ResponseMediaObject icon + * @property {string|null} [contentUrl] ResponseMediaObject contentUrl + */ + + /** + * Constructs a new ResponseMediaObject. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent + * @classdesc Represents a ResponseMediaObject. + * @implements IResponseMediaObject + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject=} [properties] Properties to set + */ + function ResponseMediaObject(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResponseMediaObject name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.name = ""; + + /** + * ResponseMediaObject description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.description = ""; + + /** + * ResponseMediaObject largeImage. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null|undefined} largeImage + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.largeImage = null; + + /** + * ResponseMediaObject icon. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null|undefined} icon + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.icon = null; + + /** + * ResponseMediaObject contentUrl. + * @member {string} contentUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + ResponseMediaObject.prototype.contentUrl = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ResponseMediaObject image. + * @member {"largeImage"|"icon"|undefined} image + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @instance + */ + Object.defineProperty(ResponseMediaObject.prototype, "image", { + get: $util.oneOfGetter($oneOfFields = ["largeImage", "icon"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ResponseMediaObject instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject} ResponseMediaObject instance + */ + ResponseMediaObject.create = function create(properties) { + return new ResponseMediaObject(properties); + }; + + /** + * Encodes the specified ResponseMediaObject message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject} message ResponseMediaObject message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseMediaObject.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.largeImage != null && Object.hasOwnProperty.call(message, "largeImage")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.encode(message.largeImage, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.icon != null && Object.hasOwnProperty.call(message, "icon")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.encode(message.icon, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.contentUrl != null && Object.hasOwnProperty.call(message, "contentUrl")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.contentUrl); + return writer; + }; + + /** + * Encodes the specified ResponseMediaObject message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.IResponseMediaObject} message ResponseMediaObject message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResponseMediaObject.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResponseMediaObject message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject} ResponseMediaObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseMediaObject.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.largeImage = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 4: { + message.icon = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 5: { + message.contentUrl = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResponseMediaObject message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject} ResponseMediaObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResponseMediaObject.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResponseMediaObject message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResponseMediaObject.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.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.largeImage != null && message.hasOwnProperty("largeImage")) { + properties.image = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify(message.largeImage); + if (error) + return "largeImage." + error; + } + } + if (message.icon != null && message.hasOwnProperty("icon")) { + if (properties.image === 1) + return "image: multiple values"; + properties.image = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify(message.icon); + if (error) + return "icon." + error; + } + } + if (message.contentUrl != null && message.hasOwnProperty("contentUrl")) + if (!$util.isString(message.contentUrl)) + return "contentUrl: string expected"; + return null; + }; + + /** + * Creates a ResponseMediaObject message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject} ResponseMediaObject + */ + ResponseMediaObject.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.largeImage != null) { + if (typeof object.largeImage !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.largeImage: object expected"); + message.largeImage = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.fromObject(object.largeImage); + } + if (object.icon != null) { + if (typeof object.icon !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject.icon: object expected"); + message.icon = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.fromObject(object.icon); + } + if (object.contentUrl != null) + message.contentUrl = String(object.contentUrl); + return message; + }; + + /** + * Creates a plain object from a ResponseMediaObject message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject} message ResponseMediaObject + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResponseMediaObject.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.contentUrl = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.largeImage != null && message.hasOwnProperty("largeImage")) { + object.largeImage = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.toObject(message.largeImage, options); + if (options.oneofs) + object.image = "largeImage"; + } + if (message.icon != null && message.hasOwnProperty("icon")) { + object.icon = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.toObject(message.icon, options); + if (options.oneofs) + object.image = "icon"; + } + if (message.contentUrl != null && message.hasOwnProperty("contentUrl")) + object.contentUrl = message.contentUrl; + return object; + }; + + /** + * Converts this ResponseMediaObject to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @instance + * @returns {Object.} JSON object + */ + ResponseMediaObject.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResponseMediaObject + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResponseMediaObject.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.MediaContent.ResponseMediaObject"; + }; + + return ResponseMediaObject; + })(); + + return MediaContent; + })(); + + Message.BrowseCarouselCard = (function() { + + /** + * Properties of a BrowseCarouselCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IBrowseCarouselCard + * @property {Array.|null} [items] BrowseCarouselCard items + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions|null} [imageDisplayOptions] BrowseCarouselCard imageDisplayOptions + */ + + /** + * Constructs a new BrowseCarouselCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a BrowseCarouselCard. + * @implements IBrowseCarouselCard + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard=} [properties] Properties to set + */ + function BrowseCarouselCard(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BrowseCarouselCard items. + * @member {Array.} items + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @instance + */ + BrowseCarouselCard.prototype.items = $util.emptyArray; + + /** + * BrowseCarouselCard imageDisplayOptions. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions} imageDisplayOptions + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @instance + */ + BrowseCarouselCard.prototype.imageDisplayOptions = 0; + + /** + * Creates a new BrowseCarouselCard instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard} BrowseCarouselCard instance + */ + BrowseCarouselCard.create = function create(properties) { + return new BrowseCarouselCard(properties); + }; + + /** + * Encodes the specified BrowseCarouselCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard} message BrowseCarouselCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BrowseCarouselCard.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.encode(message.items[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.imageDisplayOptions != null && Object.hasOwnProperty.call(message, "imageDisplayOptions")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.imageDisplayOptions); + return writer; + }; + + /** + * Encodes the specified BrowseCarouselCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IBrowseCarouselCard} message BrowseCarouselCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BrowseCarouselCard.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BrowseCarouselCard message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard} BrowseCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BrowseCarouselCard.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.decode(reader, reader.uint32())); + break; + } + case 2: { + message.imageDisplayOptions = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BrowseCarouselCard message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard} BrowseCarouselCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BrowseCarouselCard.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BrowseCarouselCard message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BrowseCarouselCard.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.imageDisplayOptions != null && message.hasOwnProperty("imageDisplayOptions")) + switch (message.imageDisplayOptions) { + default: + return "imageDisplayOptions: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a BrowseCarouselCard message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard} BrowseCarouselCard + */ + BrowseCarouselCard.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard(); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.items: object expected"); + message.items[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.fromObject(object.items[i]); + } + } + switch (object.imageDisplayOptions) { + default: + if (typeof object.imageDisplayOptions === "number") { + message.imageDisplayOptions = object.imageDisplayOptions; + break; + } + break; + case "IMAGE_DISPLAY_OPTIONS_UNSPECIFIED": + case 0: + message.imageDisplayOptions = 0; + break; + case "GRAY": + case 1: + message.imageDisplayOptions = 1; + break; + case "WHITE": + case 2: + message.imageDisplayOptions = 2; + break; + case "CROPPED": + case 3: + message.imageDisplayOptions = 3; + break; + case "BLURRED_BACKGROUND": + case 4: + message.imageDisplayOptions = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a BrowseCarouselCard message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard} message BrowseCarouselCard + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BrowseCarouselCard.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.imageDisplayOptions = options.enums === String ? "IMAGE_DISPLAY_OPTIONS_UNSPECIFIED" : 0; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.toObject(message.items[j], options); + } + if (message.imageDisplayOptions != null && message.hasOwnProperty("imageDisplayOptions")) + object.imageDisplayOptions = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions[message.imageDisplayOptions] === undefined ? message.imageDisplayOptions : $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions[message.imageDisplayOptions] : message.imageDisplayOptions; + return object; + }; + + /** + * Converts this BrowseCarouselCard to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @instance + * @returns {Object.} JSON object + */ + BrowseCarouselCard.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BrowseCarouselCard + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BrowseCarouselCard.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard"; + }; + + BrowseCarouselCard.BrowseCarouselCardItem = (function() { + + /** + * Properties of a BrowseCarouselCardItem. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @interface IBrowseCarouselCardItem + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction|null} [openUriAction] BrowseCarouselCardItem openUriAction + * @property {string|null} [title] BrowseCarouselCardItem title + * @property {string|null} [description] BrowseCarouselCardItem description + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null} [image] BrowseCarouselCardItem image + * @property {string|null} [footer] BrowseCarouselCardItem footer + */ + + /** + * Constructs a new BrowseCarouselCardItem. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard + * @classdesc Represents a BrowseCarouselCardItem. + * @implements IBrowseCarouselCardItem + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem=} [properties] Properties to set + */ + function BrowseCarouselCardItem(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BrowseCarouselCardItem openUriAction. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction|null|undefined} openUriAction + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.openUriAction = null; + + /** + * BrowseCarouselCardItem title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.title = ""; + + /** + * BrowseCarouselCardItem description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.description = ""; + + /** + * BrowseCarouselCardItem image. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.image = null; + + /** + * BrowseCarouselCardItem footer. + * @member {string} footer + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + */ + BrowseCarouselCardItem.prototype.footer = ""; + + /** + * Creates a new BrowseCarouselCardItem instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} BrowseCarouselCardItem instance + */ + BrowseCarouselCardItem.create = function create(properties) { + return new BrowseCarouselCardItem(properties); + }; + + /** + * Encodes the specified BrowseCarouselCardItem message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem} message BrowseCarouselCardItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BrowseCarouselCardItem.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.openUriAction != null && Object.hasOwnProperty.call(message, "openUriAction")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.encode(message.openUriAction, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.title); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.encode(message.image, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.footer != null && Object.hasOwnProperty.call(message, "footer")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.footer); + return writer; + }; + + /** + * Encodes the specified BrowseCarouselCardItem message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.IBrowseCarouselCardItem} message BrowseCarouselCardItem message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BrowseCarouselCardItem.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BrowseCarouselCardItem message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} BrowseCarouselCardItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BrowseCarouselCardItem.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.openUriAction = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.decode(reader, reader.uint32()); + break; + } + case 2: { + message.title = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 5: { + message.footer = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BrowseCarouselCardItem message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} BrowseCarouselCardItem + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BrowseCarouselCardItem.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BrowseCarouselCardItem message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BrowseCarouselCardItem.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.openUriAction != null && message.hasOwnProperty("openUriAction")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify(message.openUriAction); + if (error) + return "openUriAction." + error; + } + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.footer != null && message.hasOwnProperty("footer")) + if (!$util.isString(message.footer)) + return "footer: string expected"; + return null; + }; + + /** + * Creates a BrowseCarouselCardItem message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} BrowseCarouselCardItem + */ + BrowseCarouselCardItem.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem(); + if (object.openUriAction != null) { + if (typeof object.openUriAction !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.openUriAction: object expected"); + message.openUriAction = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.fromObject(object.openUriAction); + } + if (object.title != null) + message.title = String(object.title); + if (object.description != null) + message.description = String(object.description); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.fromObject(object.image); + } + if (object.footer != null) + message.footer = String(object.footer); + return message; + }; + + /** + * Creates a plain object from a BrowseCarouselCardItem message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem} message BrowseCarouselCardItem + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BrowseCarouselCardItem.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.openUriAction = null; + object.title = ""; + object.description = ""; + object.image = null; + object.footer = ""; + } + if (message.openUriAction != null && message.hasOwnProperty("openUriAction")) + object.openUriAction = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.toObject(message.openUriAction, options); + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.toObject(message.image, options); + if (message.footer != null && message.hasOwnProperty("footer")) + object.footer = message.footer; + return object; + }; + + /** + * Converts this BrowseCarouselCardItem to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @instance + * @returns {Object.} JSON object + */ + BrowseCarouselCardItem.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BrowseCarouselCardItem + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BrowseCarouselCardItem.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem"; + }; + + BrowseCarouselCardItem.OpenUrlAction = (function() { + + /** + * Properties of an OpenUrlAction. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @interface IOpenUrlAction + * @property {string|null} [url] OpenUrlAction url + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint|null} [urlTypeHint] OpenUrlAction urlTypeHint + */ + + /** + * Constructs a new OpenUrlAction. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem + * @classdesc Represents an OpenUrlAction. + * @implements IOpenUrlAction + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction=} [properties] Properties to set + */ + function OpenUrlAction(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OpenUrlAction url. + * @member {string} url + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @instance + */ + OpenUrlAction.prototype.url = ""; + + /** + * OpenUrlAction urlTypeHint. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint} urlTypeHint + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @instance + */ + OpenUrlAction.prototype.urlTypeHint = 0; + + /** + * Creates a new OpenUrlAction instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} OpenUrlAction instance + */ + OpenUrlAction.create = function create(properties) { + return new OpenUrlAction(properties); + }; + + /** + * Encodes the specified OpenUrlAction message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction} message OpenUrlAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OpenUrlAction.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.urlTypeHint != null && Object.hasOwnProperty.call(message, "urlTypeHint")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.urlTypeHint); + return writer; + }; + + /** + * Encodes the specified OpenUrlAction message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.IOpenUrlAction} message OpenUrlAction message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OpenUrlAction.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OpenUrlAction message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} OpenUrlAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OpenUrlAction.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.url = reader.string(); + break; + } + case 3: { + message.urlTypeHint = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OpenUrlAction message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} OpenUrlAction + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OpenUrlAction.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OpenUrlAction message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OpenUrlAction.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.urlTypeHint != null && message.hasOwnProperty("urlTypeHint")) + switch (message.urlTypeHint) { + default: + return "urlTypeHint: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an OpenUrlAction message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} OpenUrlAction + */ + OpenUrlAction.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction(); + if (object.url != null) + message.url = String(object.url); + switch (object.urlTypeHint) { + default: + if (typeof object.urlTypeHint === "number") { + message.urlTypeHint = object.urlTypeHint; + break; + } + break; + case "URL_TYPE_HINT_UNSPECIFIED": + case 0: + message.urlTypeHint = 0; + break; + case "AMP_ACTION": + case 1: + message.urlTypeHint = 1; + break; + case "AMP_CONTENT": + case 2: + message.urlTypeHint = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an OpenUrlAction message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction} message OpenUrlAction + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OpenUrlAction.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.url = ""; + object.urlTypeHint = options.enums === String ? "URL_TYPE_HINT_UNSPECIFIED" : 0; + } + if (message.url != null && message.hasOwnProperty("url")) + object.url = message.url; + if (message.urlTypeHint != null && message.hasOwnProperty("urlTypeHint")) + object.urlTypeHint = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint[message.urlTypeHint] === undefined ? message.urlTypeHint : $root.google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint[message.urlTypeHint] : message.urlTypeHint; + return object; + }; + + /** + * Converts this OpenUrlAction to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @instance + * @returns {Object.} JSON object + */ + OpenUrlAction.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OpenUrlAction + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OpenUrlAction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction"; + }; + + /** + * UrlTypeHint enum. + * @name google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.BrowseCarouselCardItem.OpenUrlAction.UrlTypeHint + * @enum {number} + * @property {number} URL_TYPE_HINT_UNSPECIFIED=0 URL_TYPE_HINT_UNSPECIFIED value + * @property {number} AMP_ACTION=1 AMP_ACTION value + * @property {number} AMP_CONTENT=2 AMP_CONTENT value + */ + OpenUrlAction.UrlTypeHint = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "URL_TYPE_HINT_UNSPECIFIED"] = 0; + values[valuesById[1] = "AMP_ACTION"] = 1; + values[valuesById[2] = "AMP_CONTENT"] = 2; + return values; + })(); + + return OpenUrlAction; + })(); + + return BrowseCarouselCardItem; + })(); + + /** + * ImageDisplayOptions enum. + * @name google.cloud.dialogflow.v2beta1.Intent.Message.BrowseCarouselCard.ImageDisplayOptions + * @enum {number} + * @property {number} IMAGE_DISPLAY_OPTIONS_UNSPECIFIED=0 IMAGE_DISPLAY_OPTIONS_UNSPECIFIED value + * @property {number} GRAY=1 GRAY value + * @property {number} WHITE=2 WHITE value + * @property {number} CROPPED=3 CROPPED value + * @property {number} BLURRED_BACKGROUND=4 BLURRED_BACKGROUND value + */ + BrowseCarouselCard.ImageDisplayOptions = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IMAGE_DISPLAY_OPTIONS_UNSPECIFIED"] = 0; + values[valuesById[1] = "GRAY"] = 1; + values[valuesById[2] = "WHITE"] = 2; + values[valuesById[3] = "CROPPED"] = 3; + values[valuesById[4] = "BLURRED_BACKGROUND"] = 4; + return values; + })(); + + return BrowseCarouselCard; + })(); + + Message.TableCard = (function() { + + /** + * Properties of a TableCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ITableCard + * @property {string|null} [title] TableCard title + * @property {string|null} [subtitle] TableCard subtitle + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null} [image] TableCard image + * @property {Array.|null} [columnProperties] TableCard columnProperties + * @property {Array.|null} [rows] TableCard rows + * @property {Array.|null} [buttons] TableCard buttons + */ + + /** + * Constructs a new TableCard. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a TableCard. + * @implements ITableCard + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard=} [properties] Properties to set + */ + function TableCard(properties) { + this.columnProperties = []; + this.rows = []; + this.buttons = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCard title. + * @member {string} title + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.title = ""; + + /** + * TableCard subtitle. + * @member {string} subtitle + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.subtitle = ""; + + /** + * TableCard image. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.IImage|null|undefined} image + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.image = null; + + /** + * TableCard columnProperties. + * @member {Array.} columnProperties + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.columnProperties = $util.emptyArray; + + /** + * TableCard rows. + * @member {Array.} rows + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.rows = $util.emptyArray; + + /** + * TableCard buttons. + * @member {Array.} buttons + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @instance + */ + TableCard.prototype.buttons = $util.emptyArray; + + /** + * Creates a new TableCard instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCard} TableCard instance + */ + TableCard.create = function create(properties) { + return new TableCard(properties); + }; + + /** + * Encodes the specified TableCard message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard} message TableCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCard.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.title != null && Object.hasOwnProperty.call(message, "title")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.title); + if (message.subtitle != null && Object.hasOwnProperty.call(message, "subtitle")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.subtitle); + if (message.image != null && Object.hasOwnProperty.call(message, "image")) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.encode(message.image, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.columnProperties != null && message.columnProperties.length) + for (var i = 0; i < message.columnProperties.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.encode(message.columnProperties[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.rows != null && message.rows.length) + for (var i = 0; i < message.rows.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.encode(message.rows[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.buttons != null && message.buttons.length) + for (var i = 0; i < message.buttons.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.encode(message.buttons[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TableCard message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCard} message TableCard message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCard.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCard message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCard} TableCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCard.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCard(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.title = reader.string(); + break; + } + case 2: { + message.subtitle = reader.string(); + break; + } + case 3: { + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.columnProperties && message.columnProperties.length)) + message.columnProperties = []; + message.columnProperties.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.rows && message.rows.length)) + message.rows = []; + message.rows.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.buttons && message.buttons.length)) + message.buttons = []; + message.buttons.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCard message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCard} TableCard + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCard.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCard message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCard.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.title != null && message.hasOwnProperty("title")) + if (!$util.isString(message.title)) + return "title: string expected"; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + if (!$util.isString(message.subtitle)) + return "subtitle: string expected"; + if (message.image != null && message.hasOwnProperty("image")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.verify(message.image); + if (error) + return "image." + error; + } + if (message.columnProperties != null && message.hasOwnProperty("columnProperties")) { + if (!Array.isArray(message.columnProperties)) + return "columnProperties: array expected"; + for (var i = 0; i < message.columnProperties.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.verify(message.columnProperties[i]); + if (error) + return "columnProperties." + error; + } + } + if (message.rows != null && message.hasOwnProperty("rows")) { + if (!Array.isArray(message.rows)) + return "rows: array expected"; + for (var i = 0; i < message.rows.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.verify(message.rows[i]); + if (error) + return "rows." + error; + } + } + if (message.buttons != null && message.hasOwnProperty("buttons")) { + if (!Array.isArray(message.buttons)) + return "buttons: array expected"; + for (var i = 0; i < message.buttons.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.verify(message.buttons[i]); + if (error) + return "buttons." + error; + } + } + return null; + }; + + /** + * Creates a TableCard message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCard} TableCard + */ + TableCard.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCard) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCard(); + if (object.title != null) + message.title = String(object.title); + if (object.subtitle != null) + message.subtitle = String(object.subtitle); + if (object.image != null) { + if (typeof object.image !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.image: object expected"); + message.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.fromObject(object.image); + } + if (object.columnProperties) { + if (!Array.isArray(object.columnProperties)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.columnProperties: array expected"); + message.columnProperties = []; + for (var i = 0; i < object.columnProperties.length; ++i) { + if (typeof object.columnProperties[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.columnProperties: object expected"); + message.columnProperties[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.fromObject(object.columnProperties[i]); + } + } + if (object.rows) { + if (!Array.isArray(object.rows)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.rows: array expected"); + message.rows = []; + for (var i = 0; i < object.rows.length; ++i) { + if (typeof object.rows[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.rows: object expected"); + message.rows[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.fromObject(object.rows[i]); + } + } + if (object.buttons) { + if (!Array.isArray(object.buttons)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.buttons: array expected"); + message.buttons = []; + for (var i = 0; i < object.buttons.length; ++i) { + if (typeof object.buttons[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.TableCard.buttons: object expected"); + message.buttons[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.fromObject(object.buttons[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TableCard message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.TableCard} message TableCard + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCard.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.columnProperties = []; + object.rows = []; + object.buttons = []; + } + if (options.defaults) { + object.title = ""; + object.subtitle = ""; + object.image = null; + } + if (message.title != null && message.hasOwnProperty("title")) + object.title = message.title; + if (message.subtitle != null && message.hasOwnProperty("subtitle")) + object.subtitle = message.subtitle; + if (message.image != null && message.hasOwnProperty("image")) + object.image = $root.google.cloud.dialogflow.v2beta1.Intent.Message.Image.toObject(message.image, options); + if (message.columnProperties && message.columnProperties.length) { + object.columnProperties = []; + for (var j = 0; j < message.columnProperties.length; ++j) + object.columnProperties[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.toObject(message.columnProperties[j], options); + } + if (message.rows && message.rows.length) { + object.rows = []; + for (var j = 0; j < message.rows.length; ++j) + object.rows[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.toObject(message.rows[j], options); + } + if (message.buttons && message.buttons.length) { + object.buttons = []; + for (var j = 0; j < message.buttons.length; ++j) + object.buttons[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.BasicCard.Button.toObject(message.buttons[j], options); + } + return object; + }; + + /** + * Converts this TableCard to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @instance + * @returns {Object.} JSON object + */ + TableCard.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TableCard + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCard + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCard.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.TableCard"; + }; + + return TableCard; + })(); + + Message.ColumnProperties = (function() { + + /** + * Properties of a ColumnProperties. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface IColumnProperties + * @property {string|null} [header] ColumnProperties header + * @property {google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment|null} [horizontalAlignment] ColumnProperties horizontalAlignment + */ + + /** + * Constructs a new ColumnProperties. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a ColumnProperties. + * @implements IColumnProperties + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties=} [properties] Properties to set + */ + function ColumnProperties(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ColumnProperties header. + * @member {string} header + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @instance + */ + ColumnProperties.prototype.header = ""; + + /** + * ColumnProperties horizontalAlignment. + * @member {google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment} horizontalAlignment + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @instance + */ + ColumnProperties.prototype.horizontalAlignment = 0; + + /** + * Creates a new ColumnProperties instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties} ColumnProperties instance + */ + ColumnProperties.create = function create(properties) { + return new ColumnProperties(properties); + }; + + /** + * Encodes the specified ColumnProperties message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties} message ColumnProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ColumnProperties.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.header != null && Object.hasOwnProperty.call(message, "header")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.header); + if (message.horizontalAlignment != null && Object.hasOwnProperty.call(message, "horizontalAlignment")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.horizontalAlignment); + return writer; + }; + + /** + * Encodes the specified ColumnProperties message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.IColumnProperties} message ColumnProperties message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ColumnProperties.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ColumnProperties message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties} ColumnProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ColumnProperties.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.header = reader.string(); + break; + } + case 2: { + message.horizontalAlignment = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ColumnProperties message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties} ColumnProperties + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ColumnProperties.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ColumnProperties message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ColumnProperties.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.header != null && message.hasOwnProperty("header")) + if (!$util.isString(message.header)) + return "header: string expected"; + if (message.horizontalAlignment != null && message.hasOwnProperty("horizontalAlignment")) + switch (message.horizontalAlignment) { + default: + return "horizontalAlignment: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a ColumnProperties message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties} ColumnProperties + */ + ColumnProperties.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties(); + if (object.header != null) + message.header = String(object.header); + switch (object.horizontalAlignment) { + default: + if (typeof object.horizontalAlignment === "number") { + message.horizontalAlignment = object.horizontalAlignment; + break; + } + break; + case "HORIZONTAL_ALIGNMENT_UNSPECIFIED": + case 0: + message.horizontalAlignment = 0; + break; + case "LEADING": + case 1: + message.horizontalAlignment = 1; + break; + case "CENTER": + case 2: + message.horizontalAlignment = 2; + break; + case "TRAILING": + case 3: + message.horizontalAlignment = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a ColumnProperties message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties} message ColumnProperties + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ColumnProperties.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.header = ""; + object.horizontalAlignment = options.enums === String ? "HORIZONTAL_ALIGNMENT_UNSPECIFIED" : 0; + } + if (message.header != null && message.hasOwnProperty("header")) + object.header = message.header; + if (message.horizontalAlignment != null && message.hasOwnProperty("horizontalAlignment")) + object.horizontalAlignment = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment[message.horizontalAlignment] === undefined ? message.horizontalAlignment : $root.google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment[message.horizontalAlignment] : message.horizontalAlignment; + return object; + }; + + /** + * Converts this ColumnProperties to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @instance + * @returns {Object.} JSON object + */ + ColumnProperties.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ColumnProperties + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ColumnProperties.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties"; + }; + + /** + * HorizontalAlignment enum. + * @name google.cloud.dialogflow.v2beta1.Intent.Message.ColumnProperties.HorizontalAlignment + * @enum {number} + * @property {number} HORIZONTAL_ALIGNMENT_UNSPECIFIED=0 HORIZONTAL_ALIGNMENT_UNSPECIFIED value + * @property {number} LEADING=1 LEADING value + * @property {number} CENTER=2 CENTER value + * @property {number} TRAILING=3 TRAILING value + */ + ColumnProperties.HorizontalAlignment = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HORIZONTAL_ALIGNMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "LEADING"] = 1; + values[valuesById[2] = "CENTER"] = 2; + values[valuesById[3] = "TRAILING"] = 3; + return values; + })(); + + return ColumnProperties; + })(); + + Message.TableCardRow = (function() { + + /** + * Properties of a TableCardRow. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ITableCardRow + * @property {Array.|null} [cells] TableCardRow cells + * @property {boolean|null} [dividerAfter] TableCardRow dividerAfter + */ + + /** + * Constructs a new TableCardRow. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a TableCardRow. + * @implements ITableCardRow + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow=} [properties] Properties to set + */ + function TableCardRow(properties) { + this.cells = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCardRow cells. + * @member {Array.} cells + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @instance + */ + TableCardRow.prototype.cells = $util.emptyArray; + + /** + * TableCardRow dividerAfter. + * @member {boolean} dividerAfter + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @instance + */ + TableCardRow.prototype.dividerAfter = false; + + /** + * Creates a new TableCardRow instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow} TableCardRow instance + */ + TableCardRow.create = function create(properties) { + return new TableCardRow(properties); + }; + + /** + * Encodes the specified TableCardRow message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow} message TableCardRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCardRow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cells != null && message.cells.length) + for (var i = 0; i < message.cells.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.encode(message.cells[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.dividerAfter != null && Object.hasOwnProperty.call(message, "dividerAfter")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.dividerAfter); + return writer; + }; + + /** + * Encodes the specified TableCardRow message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardRow} message TableCardRow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCardRow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCardRow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow} TableCardRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCardRow.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.cells && message.cells.length)) + message.cells = []; + message.cells.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.decode(reader, reader.uint32())); + break; + } + case 2: { + message.dividerAfter = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCardRow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow} TableCardRow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCardRow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCardRow message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCardRow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cells != null && message.hasOwnProperty("cells")) { + if (!Array.isArray(message.cells)) + return "cells: array expected"; + for (var i = 0; i < message.cells.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.verify(message.cells[i]); + if (error) + return "cells." + error; + } + } + if (message.dividerAfter != null && message.hasOwnProperty("dividerAfter")) + if (typeof message.dividerAfter !== "boolean") + return "dividerAfter: boolean expected"; + return null; + }; + + /** + * Creates a TableCardRow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow} TableCardRow + */ + TableCardRow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow(); + if (object.cells) { + if (!Array.isArray(object.cells)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.cells: array expected"); + message.cells = []; + for (var i = 0; i < object.cells.length; ++i) { + if (typeof object.cells[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow.cells: object expected"); + message.cells[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.fromObject(object.cells[i]); + } + } + if (object.dividerAfter != null) + message.dividerAfter = Boolean(object.dividerAfter); + return message; + }; + + /** + * Creates a plain object from a TableCardRow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow} message TableCardRow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCardRow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cells = []; + if (options.defaults) + object.dividerAfter = false; + if (message.cells && message.cells.length) { + object.cells = []; + for (var j = 0; j < message.cells.length; ++j) + object.cells[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.toObject(message.cells[j], options); + } + if (message.dividerAfter != null && message.hasOwnProperty("dividerAfter")) + object.dividerAfter = message.dividerAfter; + return object; + }; + + /** + * Converts this TableCardRow to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @instance + * @returns {Object.} JSON object + */ + TableCardRow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TableCardRow + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCardRow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.TableCardRow"; + }; + + return TableCardRow; + })(); + + Message.TableCardCell = (function() { + + /** + * Properties of a TableCardCell. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @interface ITableCardCell + * @property {string|null} [text] TableCardCell text + */ + + /** + * Constructs a new TableCardCell. + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message + * @classdesc Represents a TableCardCell. + * @implements ITableCardCell + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell=} [properties] Properties to set + */ + function TableCardCell(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TableCardCell text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @instance + */ + TableCardCell.prototype.text = ""; + + /** + * Creates a new TableCardCell instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell} TableCardCell instance + */ + TableCardCell.create = function create(properties) { + return new TableCardCell(properties); + }; + + /** + * Encodes the specified TableCardCell message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell} message TableCardCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCardCell.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + return writer; + }; + + /** + * Encodes the specified TableCardCell message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.ITableCardCell} message TableCardCell message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TableCardCell.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TableCardCell message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell} TableCardCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCardCell.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TableCardCell message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell} TableCardCell + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TableCardCell.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TableCardCell message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TableCardCell.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + return null; + }; + + /** + * Creates a TableCardCell message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell} TableCardCell + */ + TableCardCell.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell(); + if (object.text != null) + message.text = String(object.text); + return message; + }; + + /** + * Creates a plain object from a TableCardCell message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell} message TableCardCell + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TableCardCell.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.text = ""; + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + return object; + }; + + /** + * Converts this TableCardCell to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @instance + * @returns {Object.} JSON object + */ + TableCardCell.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TableCardCell + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TableCardCell.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.Message.TableCardCell"; + }; + + return TableCardCell; + })(); + + return Message; + })(); + + Intent.FollowupIntentInfo = (function() { + + /** + * Properties of a FollowupIntentInfo. + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @interface IFollowupIntentInfo + * @property {string|null} [followupIntentName] FollowupIntentInfo followupIntentName + * @property {string|null} [parentFollowupIntentName] FollowupIntentInfo parentFollowupIntentName + */ + + /** + * Constructs a new FollowupIntentInfo. + * @memberof google.cloud.dialogflow.v2beta1.Intent + * @classdesc Represents a FollowupIntentInfo. + * @implements IFollowupIntentInfo + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo=} [properties] Properties to set + */ + function FollowupIntentInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FollowupIntentInfo followupIntentName. + * @member {string} followupIntentName + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @instance + */ + FollowupIntentInfo.prototype.followupIntentName = ""; + + /** + * FollowupIntentInfo parentFollowupIntentName. + * @member {string} parentFollowupIntentName + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @instance + */ + FollowupIntentInfo.prototype.parentFollowupIntentName = ""; + + /** + * Creates a new FollowupIntentInfo instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo} FollowupIntentInfo instance + */ + FollowupIntentInfo.create = function create(properties) { + return new FollowupIntentInfo(properties); + }; + + /** + * Encodes the specified FollowupIntentInfo message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo} message FollowupIntentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FollowupIntentInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.followupIntentName != null && Object.hasOwnProperty.call(message, "followupIntentName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.followupIntentName); + if (message.parentFollowupIntentName != null && Object.hasOwnProperty.call(message, "parentFollowupIntentName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.parentFollowupIntentName); + return writer; + }; + + /** + * Encodes the specified FollowupIntentInfo message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.IFollowupIntentInfo} message FollowupIntentInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FollowupIntentInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FollowupIntentInfo message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo} FollowupIntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FollowupIntentInfo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.followupIntentName = reader.string(); + break; + } + case 2: { + message.parentFollowupIntentName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FollowupIntentInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo} FollowupIntentInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FollowupIntentInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FollowupIntentInfo message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FollowupIntentInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.followupIntentName != null && message.hasOwnProperty("followupIntentName")) + if (!$util.isString(message.followupIntentName)) + return "followupIntentName: string expected"; + if (message.parentFollowupIntentName != null && message.hasOwnProperty("parentFollowupIntentName")) + if (!$util.isString(message.parentFollowupIntentName)) + return "parentFollowupIntentName: string expected"; + return null; + }; + + /** + * Creates a FollowupIntentInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo} FollowupIntentInfo + */ + FollowupIntentInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo(); + if (object.followupIntentName != null) + message.followupIntentName = String(object.followupIntentName); + if (object.parentFollowupIntentName != null) + message.parentFollowupIntentName = String(object.parentFollowupIntentName); + return message; + }; + + /** + * Creates a plain object from a FollowupIntentInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @static + * @param {google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo} message FollowupIntentInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FollowupIntentInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.followupIntentName = ""; + object.parentFollowupIntentName = ""; + } + if (message.followupIntentName != null && message.hasOwnProperty("followupIntentName")) + object.followupIntentName = message.followupIntentName; + if (message.parentFollowupIntentName != null && message.hasOwnProperty("parentFollowupIntentName")) + object.parentFollowupIntentName = message.parentFollowupIntentName; + return object; + }; + + /** + * Converts this FollowupIntentInfo to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @instance + * @returns {Object.} JSON object + */ + FollowupIntentInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FollowupIntentInfo + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FollowupIntentInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Intent.FollowupIntentInfo"; + }; + + return FollowupIntentInfo; + })(); + + return Intent; + })(); + + v2beta1.ListIntentsRequest = (function() { + + /** + * Properties of a ListIntentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListIntentsRequest + * @property {string|null} [parent] ListIntentsRequest parent + * @property {string|null} [languageCode] ListIntentsRequest languageCode + * @property {google.cloud.dialogflow.v2beta1.IntentView|null} [intentView] ListIntentsRequest intentView + * @property {number|null} [pageSize] ListIntentsRequest pageSize + * @property {string|null} [pageToken] ListIntentsRequest pageToken + */ + + /** + * Constructs a new ListIntentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListIntentsRequest. + * @implements IListIntentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListIntentsRequest=} [properties] Properties to set + */ + function ListIntentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListIntentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.parent = ""; + + /** + * ListIntentsRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.languageCode = ""; + + /** + * ListIntentsRequest intentView. + * @member {google.cloud.dialogflow.v2beta1.IntentView} intentView + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.intentView = 0; + + /** + * ListIntentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.pageSize = 0; + + /** + * ListIntentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @instance + */ + ListIntentsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListIntentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListIntentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListIntentsRequest} ListIntentsRequest instance + */ + ListIntentsRequest.create = function create(properties) { + return new ListIntentsRequest(properties); + }; + + /** + * Encodes the specified ListIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListIntentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListIntentsRequest} message ListIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.intentView); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListIntentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListIntentsRequest} message ListIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListIntentsRequest} ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListIntentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.intentView = reader.int32(); + break; + } + case 4: { + message.pageSize = reader.int32(); + break; + } + case 5: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListIntentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListIntentsRequest} ListIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListIntentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListIntentsRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + 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 ListIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListIntentsRequest} ListIntentsRequest + */ + ListIntentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListIntentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListIntentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + 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 ListIntentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListIntentsRequest} message ListIntentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListIntentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] : message.intentView; + 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 ListIntentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListIntentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListIntentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListIntentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListIntentsRequest"; + }; + + return ListIntentsRequest; + })(); + + v2beta1.ListIntentsResponse = (function() { + + /** + * Properties of a ListIntentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListIntentsResponse + * @property {Array.|null} [intents] ListIntentsResponse intents + * @property {string|null} [nextPageToken] ListIntentsResponse nextPageToken + */ + + /** + * Constructs a new ListIntentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListIntentsResponse. + * @implements IListIntentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListIntentsResponse=} [properties] Properties to set + */ + function ListIntentsResponse(properties) { + this.intents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListIntentsResponse intents. + * @member {Array.} intents + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @instance + */ + ListIntentsResponse.prototype.intents = $util.emptyArray; + + /** + * ListIntentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @instance + */ + ListIntentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListIntentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListIntentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListIntentsResponse} ListIntentsResponse instance + */ + ListIntentsResponse.create = function create(properties) { + return new ListIntentsResponse(properties); + }; + + /** + * Encodes the specified ListIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListIntentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListIntentsResponse} message ListIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intents != null && message.intents.length) + for (var i = 0; i < message.intents.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.encode(message.intents[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 ListIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListIntentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListIntentsResponse} message ListIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListIntentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListIntentsResponse} ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListIntentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.intents && message.intents.length)) + message.intents = []; + message.intents.push($root.google.cloud.dialogflow.v2beta1.Intent.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListIntentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListIntentsResponse} ListIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListIntentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListIntentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListIntentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intents != null && message.hasOwnProperty("intents")) { + if (!Array.isArray(message.intents)) + return "intents: array expected"; + for (var i = 0; i < message.intents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.verify(message.intents[i]); + if (error) + return "intents." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListIntentsResponse} ListIntentsResponse + */ + ListIntentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListIntentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListIntentsResponse(); + if (object.intents) { + if (!Array.isArray(object.intents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListIntentsResponse.intents: array expected"); + message.intents = []; + for (var i = 0; i < object.intents.length; ++i) { + if (typeof object.intents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListIntentsResponse.intents: object expected"); + message.intents[i] = $root.google.cloud.dialogflow.v2beta1.Intent.fromObject(object.intents[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListIntentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListIntentsResponse} message ListIntentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListIntentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.intents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.intents && message.intents.length) { + object.intents = []; + for (var j = 0; j < message.intents.length; ++j) + object.intents[j] = $root.google.cloud.dialogflow.v2beta1.Intent.toObject(message.intents[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListIntentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListIntentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListIntentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListIntentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListIntentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListIntentsResponse"; + }; + + return ListIntentsResponse; + })(); + + v2beta1.GetIntentRequest = (function() { + + /** + * Properties of a GetIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetIntentRequest + * @property {string|null} [name] GetIntentRequest name + * @property {string|null} [languageCode] GetIntentRequest languageCode + * @property {google.cloud.dialogflow.v2beta1.IntentView|null} [intentView] GetIntentRequest intentView + */ + + /** + * Constructs a new GetIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetIntentRequest. + * @implements IGetIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetIntentRequest=} [properties] Properties to set + */ + function GetIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetIntentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @instance + */ + GetIntentRequest.prototype.name = ""; + + /** + * GetIntentRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @instance + */ + GetIntentRequest.prototype.languageCode = ""; + + /** + * GetIntentRequest intentView. + * @member {google.cloud.dialogflow.v2beta1.IntentView} intentView + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @instance + */ + GetIntentRequest.prototype.intentView = 0; + + /** + * Creates a new GetIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetIntentRequest} GetIntentRequest instance + */ + GetIntentRequest.create = function create(properties) { + return new GetIntentRequest(properties); + }; + + /** + * Encodes the specified GetIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetIntentRequest} message GetIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIntentRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.intentView); + return writer; + }; + + /** + * Encodes the specified GetIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetIntentRequest} message GetIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetIntentRequest} GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.intentView = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetIntentRequest} GetIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetIntentRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a GetIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetIntentRequest} GetIntentRequest + */ + GetIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetIntentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a GetIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetIntentRequest} message GetIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.languageCode = ""; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] : message.intentView; + return object; + }; + + /** + * Converts this GetIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @instance + * @returns {Object.} JSON object + */ + GetIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetIntentRequest"; + }; + + return GetIntentRequest; + })(); + + v2beta1.CreateIntentRequest = (function() { + + /** + * Properties of a CreateIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateIntentRequest + * @property {string|null} [parent] CreateIntentRequest parent + * @property {google.cloud.dialogflow.v2beta1.IIntent|null} [intent] CreateIntentRequest intent + * @property {string|null} [languageCode] CreateIntentRequest languageCode + * @property {google.cloud.dialogflow.v2beta1.IntentView|null} [intentView] CreateIntentRequest intentView + */ + + /** + * Constructs a new CreateIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateIntentRequest. + * @implements ICreateIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateIntentRequest=} [properties] Properties to set + */ + function CreateIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateIntentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.parent = ""; + + /** + * CreateIntentRequest intent. + * @member {google.cloud.dialogflow.v2beta1.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.intent = null; + + /** + * CreateIntentRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.languageCode = ""; + + /** + * CreateIntentRequest intentView. + * @member {google.cloud.dialogflow.v2beta1.IntentView} intentView + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @instance + */ + CreateIntentRequest.prototype.intentView = 0; + + /** + * Creates a new CreateIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateIntentRequest} CreateIntentRequest instance + */ + CreateIntentRequest.create = function create(properties) { + return new CreateIntentRequest(properties); + }; + + /** + * Encodes the specified CreateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateIntentRequest} message CreateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateIntentRequest.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.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.v2beta1.Intent.encode(message.intent, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.intentView); + return writer; + }; + + /** + * Encodes the specified CreateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateIntentRequest} message CreateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateIntentRequest} CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.intent = $root.google.cloud.dialogflow.v2beta1.Intent.decode(reader, reader.uint32()); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 4: { + message.intentView = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateIntentRequest} CreateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateIntentRequest.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.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a CreateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateIntentRequest} CreateIntentRequest + */ + CreateIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateIntentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateIntentRequest.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.v2beta1.Intent.fromObject(object.intent); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a CreateIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateIntentRequest} message CreateIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.intent = null; + object.languageCode = ""; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.v2beta1.Intent.toObject(message.intent, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] : message.intentView; + return object; + }; + + /** + * Converts this CreateIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateIntentRequest"; + }; + + return CreateIntentRequest; + })(); + + v2beta1.UpdateIntentRequest = (function() { + + /** + * Properties of an UpdateIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateIntentRequest + * @property {google.cloud.dialogflow.v2beta1.IIntent|null} [intent] UpdateIntentRequest intent + * @property {string|null} [languageCode] UpdateIntentRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateIntentRequest updateMask + * @property {google.cloud.dialogflow.v2beta1.IntentView|null} [intentView] UpdateIntentRequest intentView + */ + + /** + * Constructs a new UpdateIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateIntentRequest. + * @implements IUpdateIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateIntentRequest=} [properties] Properties to set + */ + function UpdateIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateIntentRequest intent. + * @member {google.cloud.dialogflow.v2beta1.IIntent|null|undefined} intent + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.intent = null; + + /** + * UpdateIntentRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.languageCode = ""; + + /** + * UpdateIntentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.updateMask = null; + + /** + * UpdateIntentRequest intentView. + * @member {google.cloud.dialogflow.v2beta1.IntentView} intentView + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @instance + */ + UpdateIntentRequest.prototype.intentView = 0; + + /** + * Creates a new UpdateIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateIntentRequest} UpdateIntentRequest instance + */ + UpdateIntentRequest.create = function create(properties) { + return new UpdateIntentRequest(properties); + }; + + /** + * Encodes the specified UpdateIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateIntentRequest} message UpdateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intent != null && Object.hasOwnProperty.call(message, "intent")) + $root.google.cloud.dialogflow.v2beta1.Intent.encode(message.intent, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.intentView); + return writer; + }; + + /** + * Encodes the specified UpdateIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateIntentRequest} message UpdateIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateIntentRequest} UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.intent = $root.google.cloud.dialogflow.v2beta1.Intent.decode(reader, reader.uint32()); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 4: { + message.intentView = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateIntentRequest} UpdateIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intent != null && message.hasOwnProperty("intent")) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.verify(message.intent); + if (error) + return "intent." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates an UpdateIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateIntentRequest} UpdateIntentRequest + */ + UpdateIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateIntentRequest(); + if (object.intent != null) { + if (typeof object.intent !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateIntentRequest.intent: object expected"); + message.intent = $root.google.cloud.dialogflow.v2beta1.Intent.fromObject(object.intent); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateIntentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from an UpdateIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateIntentRequest} message UpdateIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.intent = null; + object.languageCode = ""; + object.updateMask = null; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + } + if (message.intent != null && message.hasOwnProperty("intent")) + object.intent = $root.google.cloud.dialogflow.v2beta1.Intent.toObject(message.intent, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] : message.intentView; + return object; + }; + + /** + * Converts this UpdateIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateIntentRequest"; + }; + + return UpdateIntentRequest; + })(); + + v2beta1.DeleteIntentRequest = (function() { + + /** + * Properties of a DeleteIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteIntentRequest + * @property {string|null} [name] DeleteIntentRequest name + */ + + /** + * Constructs a new DeleteIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteIntentRequest. + * @implements IDeleteIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteIntentRequest=} [properties] Properties to set + */ + function DeleteIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteIntentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @instance + */ + DeleteIntentRequest.prototype.name = ""; + + /** + * Creates a new DeleteIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteIntentRequest} DeleteIntentRequest instance + */ + DeleteIntentRequest.create = function create(properties) { + return new DeleteIntentRequest(properties); + }; + + /** + * Encodes the specified DeleteIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteIntentRequest} message DeleteIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteIntentRequest.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 DeleteIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteIntentRequest} message DeleteIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteIntentRequest} DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteIntentRequest(); + 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 DeleteIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteIntentRequest} DeleteIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteIntentRequest.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 DeleteIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteIntentRequest} DeleteIntentRequest + */ + DeleteIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteIntentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteIntentRequest} message DeleteIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteIntentRequest.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 DeleteIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteIntentRequest"; + }; + + return DeleteIntentRequest; + })(); + + v2beta1.BatchUpdateIntentsRequest = (function() { + + /** + * Properties of a BatchUpdateIntentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchUpdateIntentsRequest + * @property {string|null} [parent] BatchUpdateIntentsRequest parent + * @property {string|null} [intentBatchUri] BatchUpdateIntentsRequest intentBatchUri + * @property {google.cloud.dialogflow.v2beta1.IIntentBatch|null} [intentBatchInline] BatchUpdateIntentsRequest intentBatchInline + * @property {string|null} [languageCode] BatchUpdateIntentsRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] BatchUpdateIntentsRequest updateMask + * @property {google.cloud.dialogflow.v2beta1.IntentView|null} [intentView] BatchUpdateIntentsRequest intentView + */ + + /** + * Constructs a new BatchUpdateIntentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchUpdateIntentsRequest. + * @implements IBatchUpdateIntentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest=} [properties] Properties to set + */ + function BatchUpdateIntentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateIntentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.parent = ""; + + /** + * BatchUpdateIntentsRequest intentBatchUri. + * @member {string|null|undefined} intentBatchUri + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.intentBatchUri = null; + + /** + * BatchUpdateIntentsRequest intentBatchInline. + * @member {google.cloud.dialogflow.v2beta1.IIntentBatch|null|undefined} intentBatchInline + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.intentBatchInline = null; + + /** + * BatchUpdateIntentsRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.languageCode = ""; + + /** + * BatchUpdateIntentsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.updateMask = null; + + /** + * BatchUpdateIntentsRequest intentView. + * @member {google.cloud.dialogflow.v2beta1.IntentView} intentView + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @instance + */ + BatchUpdateIntentsRequest.prototype.intentView = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchUpdateIntentsRequest intentBatch. + * @member {"intentBatchUri"|"intentBatchInline"|undefined} intentBatch + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @instance + */ + Object.defineProperty(BatchUpdateIntentsRequest.prototype, "intentBatch", { + get: $util.oneOfGetter($oneOfFields = ["intentBatchUri", "intentBatchInline"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchUpdateIntentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest} BatchUpdateIntentsRequest instance + */ + BatchUpdateIntentsRequest.create = function create(properties) { + return new BatchUpdateIntentsRequest(properties); + }; + + /** + * Encodes the specified BatchUpdateIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest} message BatchUpdateIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateIntentsRequest.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.intentBatchUri != null && Object.hasOwnProperty.call(message, "intentBatchUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.intentBatchUri); + if (message.intentBatchInline != null && Object.hasOwnProperty.call(message, "intentBatchInline")) + $root.google.cloud.dialogflow.v2beta1.IntentBatch.encode(message.intentBatchInline, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.intentView != null && Object.hasOwnProperty.call(message, "intentView")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.intentView); + return writer; + }; + + /** + * Encodes the specified BatchUpdateIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest} message BatchUpdateIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateIntentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateIntentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest} BatchUpdateIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateIntentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.intentBatchUri = reader.string(); + break; + } + case 3: { + message.intentBatchInline = $root.google.cloud.dialogflow.v2beta1.IntentBatch.decode(reader, reader.uint32()); + break; + } + case 4: { + message.languageCode = reader.string(); + break; + } + case 5: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 6: { + message.intentView = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateIntentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest} BatchUpdateIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateIntentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateIntentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateIntentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.intentBatchUri != null && message.hasOwnProperty("intentBatchUri")) { + properties.intentBatch = 1; + if (!$util.isString(message.intentBatchUri)) + return "intentBatchUri: string expected"; + } + if (message.intentBatchInline != null && message.hasOwnProperty("intentBatchInline")) { + if (properties.intentBatch === 1) + return "intentBatch: multiple values"; + properties.intentBatch = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.IntentBatch.verify(message.intentBatchInline); + if (error) + return "intentBatchInline." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.intentView != null && message.hasOwnProperty("intentView")) + switch (message.intentView) { + default: + return "intentView: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a BatchUpdateIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest} BatchUpdateIntentsRequest + */ + BatchUpdateIntentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.intentBatchUri != null) + message.intentBatchUri = String(object.intentBatchUri); + if (object.intentBatchInline != null) { + if (typeof object.intentBatchInline !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.intentBatchInline: object expected"); + message.intentBatchInline = $root.google.cloud.dialogflow.v2beta1.IntentBatch.fromObject(object.intentBatchInline); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + switch (object.intentView) { + default: + if (typeof object.intentView === "number") { + message.intentView = object.intentView; + break; + } + break; + case "INTENT_VIEW_UNSPECIFIED": + case 0: + message.intentView = 0; + break; + case "INTENT_VIEW_FULL": + case 1: + message.intentView = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateIntentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest} message BatchUpdateIntentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateIntentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.updateMask = null; + object.intentView = options.enums === String ? "INTENT_VIEW_UNSPECIFIED" : 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.intentBatchUri != null && message.hasOwnProperty("intentBatchUri")) { + object.intentBatchUri = message.intentBatchUri; + if (options.oneofs) + object.intentBatch = "intentBatchUri"; + } + if (message.intentBatchInline != null && message.hasOwnProperty("intentBatchInline")) { + object.intentBatchInline = $root.google.cloud.dialogflow.v2beta1.IntentBatch.toObject(message.intentBatchInline, options); + if (options.oneofs) + object.intentBatch = "intentBatchInline"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.intentView != null && message.hasOwnProperty("intentView")) + object.intentView = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] === undefined ? message.intentView : $root.google.cloud.dialogflow.v2beta1.IntentView[message.intentView] : message.intentView; + return object; + }; + + /** + * Converts this BatchUpdateIntentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateIntentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateIntentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateIntentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest"; + }; + + return BatchUpdateIntentsRequest; + })(); + + v2beta1.BatchUpdateIntentsResponse = (function() { + + /** + * Properties of a BatchUpdateIntentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchUpdateIntentsResponse + * @property {Array.|null} [intents] BatchUpdateIntentsResponse intents + */ + + /** + * Constructs a new BatchUpdateIntentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchUpdateIntentsResponse. + * @implements IBatchUpdateIntentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse=} [properties] Properties to set + */ + function BatchUpdateIntentsResponse(properties) { + this.intents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateIntentsResponse intents. + * @member {Array.} intents + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @instance + */ + BatchUpdateIntentsResponse.prototype.intents = $util.emptyArray; + + /** + * Creates a new BatchUpdateIntentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse} BatchUpdateIntentsResponse instance + */ + BatchUpdateIntentsResponse.create = function create(properties) { + return new BatchUpdateIntentsResponse(properties); + }; + + /** + * Encodes the specified BatchUpdateIntentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse} message BatchUpdateIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateIntentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intents != null && message.intents.length) + for (var i = 0; i < message.intents.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.encode(message.intents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchUpdateIntentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse} message BatchUpdateIntentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateIntentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateIntentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse} BatchUpdateIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateIntentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.intents && message.intents.length)) + message.intents = []; + message.intents.push($root.google.cloud.dialogflow.v2beta1.Intent.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateIntentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse} BatchUpdateIntentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateIntentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateIntentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateIntentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intents != null && message.hasOwnProperty("intents")) { + if (!Array.isArray(message.intents)) + return "intents: array expected"; + for (var i = 0; i < message.intents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.verify(message.intents[i]); + if (error) + return "intents." + error; + } + } + return null; + }; + + /** + * Creates a BatchUpdateIntentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse} BatchUpdateIntentsResponse + */ + BatchUpdateIntentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse(); + if (object.intents) { + if (!Array.isArray(object.intents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse.intents: array expected"); + message.intents = []; + for (var i = 0; i < object.intents.length; ++i) { + if (typeof object.intents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse.intents: object expected"); + message.intents[i] = $root.google.cloud.dialogflow.v2beta1.Intent.fromObject(object.intents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateIntentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse} message BatchUpdateIntentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateIntentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.intents = []; + if (message.intents && message.intents.length) { + object.intents = []; + for (var j = 0; j < message.intents.length; ++j) + object.intents[j] = $root.google.cloud.dialogflow.v2beta1.Intent.toObject(message.intents[j], options); + } + return object; + }; + + /** + * Converts this BatchUpdateIntentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateIntentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateIntentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateIntentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse"; + }; + + return BatchUpdateIntentsResponse; + })(); + + v2beta1.BatchDeleteIntentsRequest = (function() { + + /** + * Properties of a BatchDeleteIntentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchDeleteIntentsRequest + * @property {string|null} [parent] BatchDeleteIntentsRequest parent + * @property {Array.|null} [intents] BatchDeleteIntentsRequest intents + */ + + /** + * Constructs a new BatchDeleteIntentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchDeleteIntentsRequest. + * @implements IBatchDeleteIntentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest=} [properties] Properties to set + */ + function BatchDeleteIntentsRequest(properties) { + this.intents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDeleteIntentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @instance + */ + BatchDeleteIntentsRequest.prototype.parent = ""; + + /** + * BatchDeleteIntentsRequest intents. + * @member {Array.} intents + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @instance + */ + BatchDeleteIntentsRequest.prototype.intents = $util.emptyArray; + + /** + * Creates a new BatchDeleteIntentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest} BatchDeleteIntentsRequest instance + */ + BatchDeleteIntentsRequest.create = function create(properties) { + return new BatchDeleteIntentsRequest(properties); + }; + + /** + * Encodes the specified BatchDeleteIntentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest} message BatchDeleteIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteIntentsRequest.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.intents != null && message.intents.length) + for (var i = 0; i < message.intents.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.encode(message.intents[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchDeleteIntentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest} message BatchDeleteIntentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteIntentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDeleteIntentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest} BatchDeleteIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteIntentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.intents && message.intents.length)) + message.intents = []; + message.intents.push($root.google.cloud.dialogflow.v2beta1.Intent.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDeleteIntentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest} BatchDeleteIntentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteIntentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDeleteIntentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDeleteIntentsRequest.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.intents != null && message.hasOwnProperty("intents")) { + if (!Array.isArray(message.intents)) + return "intents: array expected"; + for (var i = 0; i < message.intents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.verify(message.intents[i]); + if (error) + return "intents." + error; + } + } + return null; + }; + + /** + * Creates a BatchDeleteIntentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest} BatchDeleteIntentsRequest + */ + BatchDeleteIntentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.intents) { + if (!Array.isArray(object.intents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest.intents: array expected"); + message.intents = []; + for (var i = 0; i < object.intents.length; ++i) { + if (typeof object.intents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest.intents: object expected"); + message.intents[i] = $root.google.cloud.dialogflow.v2beta1.Intent.fromObject(object.intents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchDeleteIntentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest} message BatchDeleteIntentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDeleteIntentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.intents = []; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.intents && message.intents.length) { + object.intents = []; + for (var j = 0; j < message.intents.length; ++j) + object.intents[j] = $root.google.cloud.dialogflow.v2beta1.Intent.toObject(message.intents[j], options); + } + return object; + }; + + /** + * Converts this BatchDeleteIntentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @instance + * @returns {Object.} JSON object + */ + BatchDeleteIntentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDeleteIntentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDeleteIntentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest"; + }; + + return BatchDeleteIntentsRequest; + })(); + + /** + * IntentView enum. + * @name google.cloud.dialogflow.v2beta1.IntentView + * @enum {number} + * @property {number} INTENT_VIEW_UNSPECIFIED=0 INTENT_VIEW_UNSPECIFIED value + * @property {number} INTENT_VIEW_FULL=1 INTENT_VIEW_FULL value + */ + v2beta1.IntentView = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INTENT_VIEW_UNSPECIFIED"] = 0; + values[valuesById[1] = "INTENT_VIEW_FULL"] = 1; + return values; + })(); + + v2beta1.IntentBatch = (function() { + + /** + * Properties of an IntentBatch. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IIntentBatch + * @property {Array.|null} [intents] IntentBatch intents + */ + + /** + * Constructs a new IntentBatch. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an IntentBatch. + * @implements IIntentBatch + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IIntentBatch=} [properties] Properties to set + */ + function IntentBatch(properties) { + this.intents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IntentBatch intents. + * @member {Array.} intents + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @instance + */ + IntentBatch.prototype.intents = $util.emptyArray; + + /** + * Creates a new IntentBatch instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @static + * @param {google.cloud.dialogflow.v2beta1.IIntentBatch=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.IntentBatch} IntentBatch instance + */ + IntentBatch.create = function create(properties) { + return new IntentBatch(properties); + }; + + /** + * Encodes the specified IntentBatch message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.IntentBatch.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @static + * @param {google.cloud.dialogflow.v2beta1.IIntentBatch} message IntentBatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentBatch.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.intents != null && message.intents.length) + for (var i = 0; i < message.intents.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.encode(message.intents[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IntentBatch message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.IntentBatch.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @static + * @param {google.cloud.dialogflow.v2beta1.IIntentBatch} message IntentBatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IntentBatch.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IntentBatch message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.IntentBatch} IntentBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentBatch.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.IntentBatch(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.intents && message.intents.length)) + message.intents = []; + message.intents.push($root.google.cloud.dialogflow.v2beta1.Intent.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IntentBatch message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.IntentBatch} IntentBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IntentBatch.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IntentBatch message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IntentBatch.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.intents != null && message.hasOwnProperty("intents")) { + if (!Array.isArray(message.intents)) + return "intents: array expected"; + for (var i = 0; i < message.intents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.verify(message.intents[i]); + if (error) + return "intents." + error; + } + } + return null; + }; + + /** + * Creates an IntentBatch message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.IntentBatch} IntentBatch + */ + IntentBatch.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.IntentBatch) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.IntentBatch(); + if (object.intents) { + if (!Array.isArray(object.intents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.IntentBatch.intents: array expected"); + message.intents = []; + for (var i = 0; i < object.intents.length; ++i) { + if (typeof object.intents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.IntentBatch.intents: object expected"); + message.intents[i] = $root.google.cloud.dialogflow.v2beta1.Intent.fromObject(object.intents[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an IntentBatch message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @static + * @param {google.cloud.dialogflow.v2beta1.IntentBatch} message IntentBatch + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IntentBatch.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.intents = []; + if (message.intents && message.intents.length) { + object.intents = []; + for (var j = 0; j < message.intents.length; ++j) + object.intents[j] = $root.google.cloud.dialogflow.v2beta1.Intent.toObject(message.intents[j], options); + } + return object; + }; + + /** + * Converts this IntentBatch to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @instance + * @returns {Object.} JSON object + */ + IntentBatch.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IntentBatch + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.IntentBatch + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IntentBatch.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.IntentBatch"; + }; + + return IntentBatch; + })(); + + v2beta1.SessionEntityTypes = (function() { + + /** + * Constructs a new SessionEntityTypes service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SessionEntityTypes + * @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 SessionEntityTypes(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SessionEntityTypes.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SessionEntityTypes; + + /** + * Creates new SessionEntityTypes service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @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 {SessionEntityTypes} RPC service. Useful where requests and/or responses are streamed. + */ + SessionEntityTypes.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|listSessionEntityTypes}. + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @typedef ListSessionEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse} [response] ListSessionEntityTypesResponse + */ + + /** + * Calls ListSessionEntityTypes. + * @function listSessionEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest} request ListSessionEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypesCallback} callback Node-style callback called with the error, if any, and ListSessionEntityTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.listSessionEntityTypes = function listSessionEntityTypes(request, callback) { + return this.rpcCall(listSessionEntityTypes, $root.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest, $root.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse, request, callback); + }, "name", { value: "ListSessionEntityTypes" }); + + /** + * Calls ListSessionEntityTypes. + * @function listSessionEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest} request ListSessionEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|getSessionEntityType}. + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @typedef GetSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} [response] SessionEntityType + */ + + /** + * Calls GetSessionEntityType. + * @function getSessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest} request GetSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and SessionEntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.getSessionEntityType = function getSessionEntityType(request, callback) { + return this.rpcCall(getSessionEntityType, $root.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest, $root.google.cloud.dialogflow.v2beta1.SessionEntityType, request, callback); + }, "name", { value: "GetSessionEntityType" }); + + /** + * Calls GetSessionEntityType. + * @function getSessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest} request GetSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|createSessionEntityType}. + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @typedef CreateSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} [response] SessionEntityType + */ + + /** + * Calls CreateSessionEntityType. + * @function createSessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest} request CreateSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and SessionEntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.createSessionEntityType = function createSessionEntityType(request, callback) { + return this.rpcCall(createSessionEntityType, $root.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest, $root.google.cloud.dialogflow.v2beta1.SessionEntityType, request, callback); + }, "name", { value: "CreateSessionEntityType" }); + + /** + * Calls CreateSessionEntityType. + * @function createSessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest} request CreateSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|updateSessionEntityType}. + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @typedef UpdateSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} [response] SessionEntityType + */ + + /** + * Calls UpdateSessionEntityType. + * @function updateSessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest} request UpdateSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and SessionEntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.updateSessionEntityType = function updateSessionEntityType(request, callback) { + return this.rpcCall(updateSessionEntityType, $root.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest, $root.google.cloud.dialogflow.v2beta1.SessionEntityType, request, callback); + }, "name", { value: "UpdateSessionEntityType" }); + + /** + * Calls UpdateSessionEntityType. + * @function updateSessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest} request UpdateSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.SessionEntityTypes|deleteSessionEntityType}. + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @typedef DeleteSessionEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteSessionEntityType. + * @function deleteSessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest} request DeleteSessionEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityTypeCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SessionEntityTypes.prototype.deleteSessionEntityType = function deleteSessionEntityType(request, callback) { + return this.rpcCall(deleteSessionEntityType, $root.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteSessionEntityType" }); + + /** + * Calls DeleteSessionEntityType. + * @function deleteSessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest} request DeleteSessionEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SessionEntityTypes; + })(); + + v2beta1.SessionEntityType = (function() { + + /** + * Properties of a SessionEntityType. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISessionEntityType + * @property {string|null} [name] SessionEntityType name + * @property {google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode|null} [entityOverrideMode] SessionEntityType entityOverrideMode + * @property {Array.|null} [entities] SessionEntityType entities + */ + + /** + * Constructs a new SessionEntityType. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SessionEntityType. + * @implements ISessionEntityType + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISessionEntityType=} [properties] Properties to set + */ + function SessionEntityType(properties) { + this.entities = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SessionEntityType name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @instance + */ + SessionEntityType.prototype.name = ""; + + /** + * SessionEntityType entityOverrideMode. + * @member {google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode} entityOverrideMode + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @instance + */ + SessionEntityType.prototype.entityOverrideMode = 0; + + /** + * SessionEntityType entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @instance + */ + SessionEntityType.prototype.entities = $util.emptyArray; + + /** + * Creates a new SessionEntityType instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @static + * @param {google.cloud.dialogflow.v2beta1.ISessionEntityType=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SessionEntityType} SessionEntityType instance + */ + SessionEntityType.create = function create(properties) { + return new SessionEntityType(properties); + }; + + /** + * Encodes the specified SessionEntityType message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SessionEntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @static + * @param {google.cloud.dialogflow.v2beta1.ISessionEntityType} message SessionEntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionEntityType.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.entityOverrideMode != null && Object.hasOwnProperty.call(message, "entityOverrideMode")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.entityOverrideMode); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SessionEntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SessionEntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @static + * @param {google.cloud.dialogflow.v2beta1.ISessionEntityType} message SessionEntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SessionEntityType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SessionEntityType} SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionEntityType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SessionEntityType(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.entityOverrideMode = reader.int32(); + break; + } + case 3: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.v2beta1.EntityType.Entity.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SessionEntityType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SessionEntityType} SessionEntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SessionEntityType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SessionEntityType message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SessionEntityType.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.entityOverrideMode != null && message.hasOwnProperty("entityOverrideMode")) + switch (message.entityOverrideMode) { + default: + return "entityOverrideMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + return null; + }; + + /** + * Creates a SessionEntityType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SessionEntityType} SessionEntityType + */ + SessionEntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SessionEntityType) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SessionEntityType(); + if (object.name != null) + message.name = String(object.name); + switch (object.entityOverrideMode) { + default: + if (typeof object.entityOverrideMode === "number") { + message.entityOverrideMode = object.entityOverrideMode; + break; + } + break; + case "ENTITY_OVERRIDE_MODE_UNSPECIFIED": + case 0: + message.entityOverrideMode = 0; + break; + case "ENTITY_OVERRIDE_MODE_OVERRIDE": + case 1: + message.entityOverrideMode = 1; + break; + case "ENTITY_OVERRIDE_MODE_SUPPLEMENT": + case 2: + message.entityOverrideMode = 2; + break; + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.v2beta1.SessionEntityType.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SessionEntityType.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.fromObject(object.entities[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SessionEntityType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @static + * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} message SessionEntityType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SessionEntityType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entities = []; + if (options.defaults) { + object.name = ""; + object.entityOverrideMode = options.enums === String ? "ENTITY_OVERRIDE_MODE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.entityOverrideMode != null && message.hasOwnProperty("entityOverrideMode")) + object.entityOverrideMode = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode[message.entityOverrideMode] === undefined ? message.entityOverrideMode : $root.google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode[message.entityOverrideMode] : message.entityOverrideMode; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.toObject(message.entities[j], options); + } + return object; + }; + + /** + * Converts this SessionEntityType to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @instance + * @returns {Object.} JSON object + */ + SessionEntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SessionEntityType + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SessionEntityType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SessionEntityType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SessionEntityType"; + }; + + /** + * EntityOverrideMode enum. + * @name google.cloud.dialogflow.v2beta1.SessionEntityType.EntityOverrideMode + * @enum {number} + * @property {number} ENTITY_OVERRIDE_MODE_UNSPECIFIED=0 ENTITY_OVERRIDE_MODE_UNSPECIFIED value + * @property {number} ENTITY_OVERRIDE_MODE_OVERRIDE=1 ENTITY_OVERRIDE_MODE_OVERRIDE value + * @property {number} ENTITY_OVERRIDE_MODE_SUPPLEMENT=2 ENTITY_OVERRIDE_MODE_SUPPLEMENT value + */ + SessionEntityType.EntityOverrideMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENTITY_OVERRIDE_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENTITY_OVERRIDE_MODE_OVERRIDE"] = 1; + values[valuesById[2] = "ENTITY_OVERRIDE_MODE_SUPPLEMENT"] = 2; + return values; + })(); + + return SessionEntityType; + })(); + + v2beta1.ListSessionEntityTypesRequest = (function() { + + /** + * Properties of a ListSessionEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListSessionEntityTypesRequest + * @property {string|null} [parent] ListSessionEntityTypesRequest parent + * @property {number|null} [pageSize] ListSessionEntityTypesRequest pageSize + * @property {string|null} [pageToken] ListSessionEntityTypesRequest pageToken + */ + + /** + * Constructs a new ListSessionEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListSessionEntityTypesRequest. + * @implements IListSessionEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest=} [properties] Properties to set + */ + function ListSessionEntityTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSessionEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @instance + */ + ListSessionEntityTypesRequest.prototype.parent = ""; + + /** + * ListSessionEntityTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @instance + */ + ListSessionEntityTypesRequest.prototype.pageSize = 0; + + /** + * ListSessionEntityTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @instance + */ + ListSessionEntityTypesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListSessionEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest instance + */ + ListSessionEntityTypesRequest.create = function create(properties) { + return new ListSessionEntityTypesRequest(properties); + }; + + /** + * Encodes the specified ListSessionEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest} message ListSessionEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesRequest.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 ListSessionEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest} message ListSessionEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSessionEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest(); + 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 ListSessionEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSessionEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSessionEntityTypesRequest.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 ListSessionEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest} ListSessionEntityTypesRequest + */ + ListSessionEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest(); + 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 ListSessionEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest} message ListSessionEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSessionEntityTypesRequest.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 ListSessionEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListSessionEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSessionEntityTypesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSessionEntityTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest"; + }; + + return ListSessionEntityTypesRequest; + })(); + + v2beta1.ListSessionEntityTypesResponse = (function() { + + /** + * Properties of a ListSessionEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListSessionEntityTypesResponse + * @property {Array.|null} [sessionEntityTypes] ListSessionEntityTypesResponse sessionEntityTypes + * @property {string|null} [nextPageToken] ListSessionEntityTypesResponse nextPageToken + */ + + /** + * Constructs a new ListSessionEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListSessionEntityTypesResponse. + * @implements IListSessionEntityTypesResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse=} [properties] Properties to set + */ + function ListSessionEntityTypesResponse(properties) { + this.sessionEntityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSessionEntityTypesResponse sessionEntityTypes. + * @member {Array.} sessionEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @instance + */ + ListSessionEntityTypesResponse.prototype.sessionEntityTypes = $util.emptyArray; + + /** + * ListSessionEntityTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @instance + */ + ListSessionEntityTypesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListSessionEntityTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse instance + */ + ListSessionEntityTypesResponse.create = function create(properties) { + return new ListSessionEntityTypesResponse(properties); + }; + + /** + * Encodes the specified ListSessionEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse} message ListSessionEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sessionEntityTypes != null && message.sessionEntityTypes.length) + for (var i = 0; i < message.sessionEntityTypes.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SessionEntityType.encode(message.sessionEntityTypes[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 ListSessionEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse} message ListSessionEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSessionEntityTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.sessionEntityTypes && message.sessionEntityTypes.length)) + message.sessionEntityTypes = []; + message.sessionEntityTypes.push($root.google.cloud.dialogflow.v2beta1.SessionEntityType.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSessionEntityTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSessionEntityTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSessionEntityTypesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSessionEntityTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sessionEntityTypes != null && message.hasOwnProperty("sessionEntityTypes")) { + if (!Array.isArray(message.sessionEntityTypes)) + return "sessionEntityTypes: array expected"; + for (var i = 0; i < message.sessionEntityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.verify(message.sessionEntityTypes[i]); + if (error) + return "sessionEntityTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListSessionEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse} ListSessionEntityTypesResponse + */ + ListSessionEntityTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse(); + if (object.sessionEntityTypes) { + if (!Array.isArray(object.sessionEntityTypes)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse.sessionEntityTypes: array expected"); + message.sessionEntityTypes = []; + for (var i = 0; i < object.sessionEntityTypes.length; ++i) { + if (typeof object.sessionEntityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse.sessionEntityTypes: object expected"); + message.sessionEntityTypes[i] = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.fromObject(object.sessionEntityTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListSessionEntityTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse} message ListSessionEntityTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSessionEntityTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.sessionEntityTypes = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.sessionEntityTypes && message.sessionEntityTypes.length) { + object.sessionEntityTypes = []; + for (var j = 0; j < message.sessionEntityTypes.length; ++j) + object.sessionEntityTypes[j] = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.toObject(message.sessionEntityTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListSessionEntityTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListSessionEntityTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSessionEntityTypesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSessionEntityTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse"; + }; + + return ListSessionEntityTypesResponse; + })(); + + v2beta1.GetSessionEntityTypeRequest = (function() { + + /** + * Properties of a GetSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetSessionEntityTypeRequest + * @property {string|null} [name] GetSessionEntityTypeRequest name + */ + + /** + * Constructs a new GetSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetSessionEntityTypeRequest. + * @implements IGetSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest=} [properties] Properties to set + */ + function GetSessionEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetSessionEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @instance + */ + GetSessionEntityTypeRequest.prototype.name = ""; + + /** + * Creates a new GetSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest instance + */ + GetSessionEntityTypeRequest.create = function create(properties) { + return new GetSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified GetSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest} message GetSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSessionEntityTypeRequest.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 GetSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest} message GetSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSessionEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest(); + 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 GetSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSessionEntityTypeRequest.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 GetSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest} GetSessionEntityTypeRequest + */ + GetSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest} message GetSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSessionEntityTypeRequest.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 GetSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + GetSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetSessionEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetSessionEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest"; + }; + + return GetSessionEntityTypeRequest; + })(); + + v2beta1.CreateSessionEntityTypeRequest = (function() { + + /** + * Properties of a CreateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateSessionEntityTypeRequest + * @property {string|null} [parent] CreateSessionEntityTypeRequest parent + * @property {google.cloud.dialogflow.v2beta1.ISessionEntityType|null} [sessionEntityType] CreateSessionEntityTypeRequest sessionEntityType + */ + + /** + * Constructs a new CreateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateSessionEntityTypeRequest. + * @implements ICreateSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest=} [properties] Properties to set + */ + function CreateSessionEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateSessionEntityTypeRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @instance + */ + CreateSessionEntityTypeRequest.prototype.parent = ""; + + /** + * CreateSessionEntityTypeRequest sessionEntityType. + * @member {google.cloud.dialogflow.v2beta1.ISessionEntityType|null|undefined} sessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @instance + */ + CreateSessionEntityTypeRequest.prototype.sessionEntityType = null; + + /** + * Creates a new CreateSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest instance + */ + CreateSessionEntityTypeRequest.create = function create(properties) { + return new CreateSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest} message CreateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSessionEntityTypeRequest.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.sessionEntityType != null && Object.hasOwnProperty.call(message, "sessionEntityType")) + $root.google.cloud.dialogflow.v2beta1.SessionEntityType.encode(message.sessionEntityType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest} message CreateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSessionEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sessionEntityType = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSessionEntityTypeRequest.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.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) { + var error = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.verify(message.sessionEntityType); + if (error) + return "sessionEntityType." + error; + } + return null; + }; + + /** + * Creates a CreateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest} CreateSessionEntityTypeRequest + */ + CreateSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sessionEntityType != null) { + if (typeof object.sessionEntityType !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest.sessionEntityType: object expected"); + message.sessionEntityType = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.fromObject(object.sessionEntityType); + } + return message; + }; + + /** + * Creates a plain object from a CreateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest} message CreateSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSessionEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.sessionEntityType = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) + object.sessionEntityType = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.toObject(message.sessionEntityType, options); + return object; + }; + + /** + * Converts this CreateSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSessionEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSessionEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest"; + }; + + return CreateSessionEntityTypeRequest; + })(); + + v2beta1.UpdateSessionEntityTypeRequest = (function() { + + /** + * Properties of an UpdateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateSessionEntityTypeRequest + * @property {google.cloud.dialogflow.v2beta1.ISessionEntityType|null} [sessionEntityType] UpdateSessionEntityTypeRequest sessionEntityType + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSessionEntityTypeRequest updateMask + */ + + /** + * Constructs a new UpdateSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateSessionEntityTypeRequest. + * @implements IUpdateSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest=} [properties] Properties to set + */ + function UpdateSessionEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateSessionEntityTypeRequest sessionEntityType. + * @member {google.cloud.dialogflow.v2beta1.ISessionEntityType|null|undefined} sessionEntityType + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @instance + */ + UpdateSessionEntityTypeRequest.prototype.sessionEntityType = null; + + /** + * UpdateSessionEntityTypeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @instance + */ + UpdateSessionEntityTypeRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest instance + */ + UpdateSessionEntityTypeRequest.create = function create(properties) { + return new UpdateSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified UpdateSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest} message UpdateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSessionEntityTypeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sessionEntityType != null && Object.hasOwnProperty.call(message, "sessionEntityType")) + $root.google.cloud.dialogflow.v2beta1.SessionEntityType.encode(message.sessionEntityType, 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 UpdateSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest} message UpdateSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSessionEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.sessionEntityType = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.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 UpdateSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSessionEntityTypeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) { + var error = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.verify(message.sessionEntityType); + if (error) + return "sessionEntityType." + 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 UpdateSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest} UpdateSessionEntityTypeRequest + */ + UpdateSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest(); + if (object.sessionEntityType != null) { + if (typeof object.sessionEntityType !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest.sessionEntityType: object expected"); + message.sessionEntityType = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.fromObject(object.sessionEntityType); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest} message UpdateSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSessionEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sessionEntityType = null; + object.updateMask = null; + } + if (message.sessionEntityType != null && message.hasOwnProperty("sessionEntityType")) + object.sessionEntityType = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.toObject(message.sessionEntityType, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateSessionEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateSessionEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest"; + }; + + return UpdateSessionEntityTypeRequest; + })(); + + v2beta1.DeleteSessionEntityTypeRequest = (function() { + + /** + * Properties of a DeleteSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteSessionEntityTypeRequest + * @property {string|null} [name] DeleteSessionEntityTypeRequest name + */ + + /** + * Constructs a new DeleteSessionEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteSessionEntityTypeRequest. + * @implements IDeleteSessionEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest=} [properties] Properties to set + */ + function DeleteSessionEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteSessionEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @instance + */ + DeleteSessionEntityTypeRequest.prototype.name = ""; + + /** + * Creates a new DeleteSessionEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest instance + */ + DeleteSessionEntityTypeRequest.create = function create(properties) { + return new DeleteSessionEntityTypeRequest(properties); + }; + + /** + * Encodes the specified DeleteSessionEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest} message DeleteSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSessionEntityTypeRequest.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 DeleteSessionEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest} message DeleteSessionEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSessionEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSessionEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSessionEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest(); + 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 DeleteSessionEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSessionEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSessionEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSessionEntityTypeRequest.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 DeleteSessionEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest} DeleteSessionEntityTypeRequest + */ + DeleteSessionEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteSessionEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest} message DeleteSessionEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSessionEntityTypeRequest.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 DeleteSessionEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSessionEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteSessionEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteSessionEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest"; + }; + + return DeleteSessionEntityTypeRequest; + })(); + + v2beta1.EntityTypes = (function() { + + /** + * Constructs a new EntityTypes service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an EntityTypes + * @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 EntityTypes(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (EntityTypes.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = EntityTypes; + + /** + * Creates new EntityTypes service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @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 {EntityTypes} RPC service. Useful where requests and/or responses are streamed. + */ + EntityTypes.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|listEntityTypes}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef ListEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListEntityTypesResponse} [response] ListEntityTypesResponse + */ + + /** + * Calls ListEntityTypes. + * @function listEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesRequest} request ListEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypesCallback} callback Node-style callback called with the error, if any, and ListEntityTypesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.listEntityTypes = function listEntityTypes(request, callback) { + return this.rpcCall(listEntityTypes, $root.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest, $root.google.cloud.dialogflow.v2beta1.ListEntityTypesResponse, request, callback); + }, "name", { value: "ListEntityTypes" }); + + /** + * Calls ListEntityTypes. + * @function listEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesRequest} request ListEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|getEntityType}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef GetEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.EntityType} [response] EntityType + */ + + /** + * Calls GetEntityType. + * @function getEntityType + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest} request GetEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityTypeCallback} callback Node-style callback called with the error, if any, and EntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.getEntityType = function getEntityType(request, callback) { + return this.rpcCall(getEntityType, $root.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest, $root.google.cloud.dialogflow.v2beta1.EntityType, request, callback); + }, "name", { value: "GetEntityType" }); + + /** + * Calls GetEntityType. + * @function getEntityType + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest} request GetEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|createEntityType}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef CreateEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.EntityType} [response] EntityType + */ + + /** + * Calls CreateEntityType. + * @function createEntityType + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest} request CreateEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityTypeCallback} callback Node-style callback called with the error, if any, and EntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.createEntityType = function createEntityType(request, callback) { + return this.rpcCall(createEntityType, $root.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest, $root.google.cloud.dialogflow.v2beta1.EntityType, request, callback); + }, "name", { value: "CreateEntityType" }); + + /** + * Calls CreateEntityType. + * @function createEntityType + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest} request CreateEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|updateEntityType}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef UpdateEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.EntityType} [response] EntityType + */ + + /** + * Calls UpdateEntityType. + * @function updateEntityType + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest} request UpdateEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityTypeCallback} callback Node-style callback called with the error, if any, and EntityType + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.updateEntityType = function updateEntityType(request, callback) { + return this.rpcCall(updateEntityType, $root.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest, $root.google.cloud.dialogflow.v2beta1.EntityType, request, callback); + }, "name", { value: "UpdateEntityType" }); + + /** + * Calls UpdateEntityType. + * @function updateEntityType + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest} request UpdateEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|deleteEntityType}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef DeleteEntityTypeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteEntityType. + * @function deleteEntityType + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest} request DeleteEntityTypeRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityTypeCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.deleteEntityType = function deleteEntityType(request, callback) { + return this.rpcCall(deleteEntityType, $root.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteEntityType" }); + + /** + * Calls DeleteEntityType. + * @function deleteEntityType + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest} request DeleteEntityTypeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchUpdateEntityTypes}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef BatchUpdateEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchUpdateEntityTypes. + * @function batchUpdateEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest} request BatchUpdateEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchUpdateEntityTypes = function batchUpdateEntityTypes(request, callback) { + return this.rpcCall(batchUpdateEntityTypes, $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchUpdateEntityTypes" }); + + /** + * Calls BatchUpdateEntityTypes. + * @function batchUpdateEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest} request BatchUpdateEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchDeleteEntityTypes}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef BatchDeleteEntityTypesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchDeleteEntityTypes. + * @function batchDeleteEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest} request BatchDeleteEntityTypesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchDeleteEntityTypes = function batchDeleteEntityTypes(request, callback) { + return this.rpcCall(batchDeleteEntityTypes, $root.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchDeleteEntityTypes" }); + + /** + * Calls BatchDeleteEntityTypes. + * @function batchDeleteEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest} request BatchDeleteEntityTypesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchCreateEntities}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef BatchCreateEntitiesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchCreateEntities. + * @function batchCreateEntities + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest} request BatchCreateEntitiesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntitiesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchCreateEntities = function batchCreateEntities(request, callback) { + return this.rpcCall(batchCreateEntities, $root.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchCreateEntities" }); + + /** + * Calls BatchCreateEntities. + * @function batchCreateEntities + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest} request BatchCreateEntitiesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchUpdateEntities}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef BatchUpdateEntitiesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchUpdateEntities. + * @function batchUpdateEntities + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest} request BatchUpdateEntitiesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntitiesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchUpdateEntities = function batchUpdateEntities(request, callback) { + return this.rpcCall(batchUpdateEntities, $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchUpdateEntities" }); + + /** + * Calls BatchUpdateEntities. + * @function batchUpdateEntities + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest} request BatchUpdateEntitiesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.EntityTypes|batchDeleteEntities}. + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @typedef BatchDeleteEntitiesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls BatchDeleteEntities. + * @function batchDeleteEntities + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest} request BatchDeleteEntitiesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntitiesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(EntityTypes.prototype.batchDeleteEntities = function batchDeleteEntities(request, callback) { + return this.rpcCall(batchDeleteEntities, $root.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "BatchDeleteEntities" }); + + /** + * Calls BatchDeleteEntities. + * @function batchDeleteEntities + * @memberof google.cloud.dialogflow.v2beta1.EntityTypes + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest} request BatchDeleteEntitiesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return EntityTypes; + })(); + + v2beta1.EntityType = (function() { + + /** + * Properties of an EntityType. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IEntityType + * @property {string|null} [name] EntityType name + * @property {string|null} [displayName] EntityType displayName + * @property {google.cloud.dialogflow.v2beta1.EntityType.Kind|null} [kind] EntityType kind + * @property {google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode|null} [autoExpansionMode] EntityType autoExpansionMode + * @property {Array.|null} [entities] EntityType entities + * @property {boolean|null} [enableFuzzyExtraction] EntityType enableFuzzyExtraction + */ + + /** + * Constructs a new EntityType. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an EntityType. + * @implements IEntityType + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IEntityType=} [properties] Properties to set + */ + function EntityType(properties) { + this.entities = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityType name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @instance + */ + EntityType.prototype.name = ""; + + /** + * EntityType displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @instance + */ + EntityType.prototype.displayName = ""; + + /** + * EntityType kind. + * @member {google.cloud.dialogflow.v2beta1.EntityType.Kind} kind + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @instance + */ + EntityType.prototype.kind = 0; + + /** + * EntityType autoExpansionMode. + * @member {google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode} autoExpansionMode + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @instance + */ + EntityType.prototype.autoExpansionMode = 0; + + /** + * EntityType entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @instance + */ + EntityType.prototype.entities = $util.emptyArray; + + /** + * EntityType enableFuzzyExtraction. + * @member {boolean} enableFuzzyExtraction + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @instance + */ + EntityType.prototype.enableFuzzyExtraction = false; + + /** + * Creates a new EntityType instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @static + * @param {google.cloud.dialogflow.v2beta1.IEntityType=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.EntityType} EntityType instance + */ + EntityType.create = function create(properties) { + return new EntityType(properties); + }; + + /** + * Encodes the specified EntityType message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityType.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @static + * @param {google.cloud.dialogflow.v2beta1.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.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.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.kind); + if (message.autoExpansionMode != null && Object.hasOwnProperty.call(message, "autoExpansionMode")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.autoExpansionMode); + if (message.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.enableFuzzyExtraction != null && Object.hasOwnProperty.call(message, "enableFuzzyExtraction")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.enableFuzzyExtraction); + return writer; + }; + + /** + * Encodes the specified EntityType message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @static + * @param {google.cloud.dialogflow.v2beta1.IEntityType} message EntityType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.EntityType(); + 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.kind = reader.int32(); + break; + } + case 4: { + message.autoExpansionMode = reader.int32(); + break; + } + case 6: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.v2beta1.EntityType.Entity.decode(reader, reader.uint32())); + break; + } + case 7: { + message.enableFuzzyExtraction = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.EntityType} EntityType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityType message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityType.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.kind != null && message.hasOwnProperty("kind")) + switch (message.kind) { + default: + return "kind: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.autoExpansionMode != null && message.hasOwnProperty("autoExpansionMode")) + switch (message.autoExpansionMode) { + default: + return "autoExpansionMode: enum value expected"; + case 0: + case 1: + break; + } + if (message.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.enableFuzzyExtraction != null && message.hasOwnProperty("enableFuzzyExtraction")) + if (typeof message.enableFuzzyExtraction !== "boolean") + return "enableFuzzyExtraction: boolean expected"; + return null; + }; + + /** + * Creates an EntityType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.EntityType} EntityType + */ + EntityType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.EntityType) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.EntityType(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + switch (object.kind) { + default: + if (typeof object.kind === "number") { + message.kind = object.kind; + break; + } + break; + case "KIND_UNSPECIFIED": + case 0: + message.kind = 0; + break; + case "KIND_MAP": + case 1: + message.kind = 1; + break; + case "KIND_LIST": + case 2: + message.kind = 2; + break; + case "KIND_REGEXP": + case 3: + message.kind = 3; + break; + } + switch (object.autoExpansionMode) { + default: + if (typeof object.autoExpansionMode === "number") { + message.autoExpansionMode = object.autoExpansionMode; + break; + } + break; + case "AUTO_EXPANSION_MODE_UNSPECIFIED": + case 0: + message.autoExpansionMode = 0; + break; + case "AUTO_EXPANSION_MODE_DEFAULT": + case 1: + message.autoExpansionMode = 1; + break; + } + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.v2beta1.EntityType.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.EntityType.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.fromObject(object.entities[i]); + } + } + if (object.enableFuzzyExtraction != null) + message.enableFuzzyExtraction = Boolean(object.enableFuzzyExtraction); + return message; + }; + + /** + * Creates a plain object from an EntityType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @static + * @param {google.cloud.dialogflow.v2beta1.EntityType} message EntityType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entities = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.kind = options.enums === String ? "KIND_UNSPECIFIED" : 0; + object.autoExpansionMode = options.enums === String ? "AUTO_EXPANSION_MODE_UNSPECIFIED" : 0; + object.enableFuzzyExtraction = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.EntityType.Kind[message.kind] === undefined ? message.kind : $root.google.cloud.dialogflow.v2beta1.EntityType.Kind[message.kind] : message.kind; + if (message.autoExpansionMode != null && message.hasOwnProperty("autoExpansionMode")) + object.autoExpansionMode = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode[message.autoExpansionMode] === undefined ? message.autoExpansionMode : $root.google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode[message.autoExpansionMode] : message.autoExpansionMode; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.toObject(message.entities[j], options); + } + if (message.enableFuzzyExtraction != null && message.hasOwnProperty("enableFuzzyExtraction")) + object.enableFuzzyExtraction = message.enableFuzzyExtraction; + return object; + }; + + /** + * Converts this EntityType to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @instance + * @returns {Object.} JSON object + */ + EntityType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EntityType + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.EntityType"; + }; + + /** + * Kind enum. + * @name google.cloud.dialogflow.v2beta1.EntityType.Kind + * @enum {number} + * @property {number} KIND_UNSPECIFIED=0 KIND_UNSPECIFIED value + * @property {number} KIND_MAP=1 KIND_MAP value + * @property {number} KIND_LIST=2 KIND_LIST value + * @property {number} KIND_REGEXP=3 KIND_REGEXP value + */ + EntityType.Kind = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "KIND_UNSPECIFIED"] = 0; + values[valuesById[1] = "KIND_MAP"] = 1; + values[valuesById[2] = "KIND_LIST"] = 2; + values[valuesById[3] = "KIND_REGEXP"] = 3; + return values; + })(); + + /** + * AutoExpansionMode enum. + * @name google.cloud.dialogflow.v2beta1.EntityType.AutoExpansionMode + * @enum {number} + * @property {number} AUTO_EXPANSION_MODE_UNSPECIFIED=0 AUTO_EXPANSION_MODE_UNSPECIFIED value + * @property {number} AUTO_EXPANSION_MODE_DEFAULT=1 AUTO_EXPANSION_MODE_DEFAULT value + */ + EntityType.AutoExpansionMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "AUTO_EXPANSION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTO_EXPANSION_MODE_DEFAULT"] = 1; + return values; + })(); + + EntityType.Entity = (function() { + + /** + * Properties of an Entity. + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @interface IEntity + * @property {string|null} [value] Entity value + * @property {Array.|null} [synonyms] Entity synonyms + */ + + /** + * Constructs a new Entity. + * @memberof google.cloud.dialogflow.v2beta1.EntityType + * @classdesc Represents an Entity. + * @implements IEntity + * @constructor + * @param {google.cloud.dialogflow.v2beta1.EntityType.IEntity=} [properties] Properties to set + */ + function Entity(properties) { + this.synonyms = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entity value. + * @member {string} value + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @instance + */ + Entity.prototype.value = ""; + + /** + * Entity synonyms. + * @member {Array.} synonyms + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @instance + */ + Entity.prototype.synonyms = $util.emptyArray; + + /** + * Creates a new Entity instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.v2beta1.EntityType.IEntity=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.EntityType.Entity} Entity instance + */ + Entity.create = function create(properties) { + return new Entity(properties); + }; + + /** + * Encodes the specified Entity message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityType.Entity.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.v2beta1.EntityType.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.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); + if (message.synonyms != null && message.synonyms.length) + for (var i = 0; i < message.synonyms.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.synonyms[i]); + return writer; + }; + + /** + * Encodes the specified Entity message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityType.Entity.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.v2beta1.EntityType.IEntity} message Entity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entity message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.EntityType.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.EntityType.Entity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + case 2: { + if (!(message.synonyms && message.synonyms.length)) + message.synonyms = []; + message.synonyms.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.EntityType.Entity} Entity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entity message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entity.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"; + if (message.synonyms != null && message.hasOwnProperty("synonyms")) { + if (!Array.isArray(message.synonyms)) + return "synonyms: array expected"; + for (var i = 0; i < message.synonyms.length; ++i) + if (!$util.isString(message.synonyms[i])) + return "synonyms: string[] expected"; + } + return null; + }; + + /** + * Creates an Entity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.EntityType.Entity} Entity + */ + Entity.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.EntityType.Entity) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.EntityType.Entity(); + if (object.value != null) + message.value = String(object.value); + if (object.synonyms) { + if (!Array.isArray(object.synonyms)) + throw TypeError(".google.cloud.dialogflow.v2beta1.EntityType.Entity.synonyms: array expected"); + message.synonyms = []; + for (var i = 0; i < object.synonyms.length; ++i) + message.synonyms[i] = String(object.synonyms[i]); + } + return message; + }; + + /** + * Creates a plain object from an Entity message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @static + * @param {google.cloud.dialogflow.v2beta1.EntityType.Entity} message Entity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.synonyms = []; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.synonyms && message.synonyms.length) { + object.synonyms = []; + for (var j = 0; j < message.synonyms.length; ++j) + object.synonyms[j] = message.synonyms[j]; + } + return object; + }; + + /** + * Converts this Entity to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @instance + * @returns {Object.} JSON object + */ + Entity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Entity + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.EntityType.Entity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.EntityType.Entity"; + }; + + return Entity; + })(); + + return EntityType; + })(); + + v2beta1.ListEntityTypesRequest = (function() { + + /** + * Properties of a ListEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListEntityTypesRequest + * @property {string|null} [parent] ListEntityTypesRequest parent + * @property {string|null} [languageCode] ListEntityTypesRequest languageCode + * @property {number|null} [pageSize] ListEntityTypesRequest pageSize + * @property {string|null} [pageToken] ListEntityTypesRequest pageToken + */ + + /** + * Constructs a new ListEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListEntityTypesRequest. + * @implements IListEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesRequest=} [properties] Properties to set + */ + function ListEntityTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.parent = ""; + + /** + * ListEntityTypesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.languageCode = ""; + + /** + * ListEntityTypesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.pageSize = 0; + + /** + * ListEntityTypesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @instance + */ + ListEntityTypesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListEntityTypesRequest} ListEntityTypesRequest instance + */ + ListEntityTypesRequest.create = function create(properties) { + return new ListEntityTypesRequest(properties); + }; + + /** + * Encodes the specified ListEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesRequest} message ListEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesRequest} message ListEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListEntityTypesRequest} ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + case 4: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListEntityTypesRequest} ListEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEntityTypesRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: 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 ListEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListEntityTypesRequest} ListEntityTypesRequest + */ + ListEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + 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 ListEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListEntityTypesRequest} message ListEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEntityTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + 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 ListEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + ListEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEntityTypesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEntityTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListEntityTypesRequest"; + }; + + return ListEntityTypesRequest; + })(); + + v2beta1.ListEntityTypesResponse = (function() { + + /** + * Properties of a ListEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListEntityTypesResponse + * @property {Array.|null} [entityTypes] ListEntityTypesResponse entityTypes + * @property {string|null} [nextPageToken] ListEntityTypesResponse nextPageToken + */ + + /** + * Constructs a new ListEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListEntityTypesResponse. + * @implements IListEntityTypesResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesResponse=} [properties] Properties to set + */ + function ListEntityTypesResponse(properties) { + this.entityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEntityTypesResponse entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @instance + */ + ListEntityTypesResponse.prototype.entityTypes = $util.emptyArray; + + /** + * ListEntityTypesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @instance + */ + ListEntityTypesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListEntityTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListEntityTypesResponse} ListEntityTypesResponse instance + */ + ListEntityTypesResponse.create = function create(properties) { + return new ListEntityTypesResponse(properties); + }; + + /** + * Encodes the specified ListEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEntityTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesResponse} message ListEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.dialogflow.v2beta1.EntityType.encode(message.entityTypes[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 ListEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEntityTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEntityTypesResponse} message ListEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEntityTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListEntityTypesResponse} ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListEntityTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.dialogflow.v2beta1.EntityType.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEntityTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListEntityTypesResponse} ListEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEntityTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEntityTypesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEntityTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListEntityTypesResponse} ListEntityTypesResponse + */ + ListEntityTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListEntityTypesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListEntityTypesResponse(); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListEntityTypesResponse.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListEntityTypesResponse.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.dialogflow.v2beta1.EntityType.fromObject(object.entityTypes[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListEntityTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListEntityTypesResponse} message ListEntityTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEntityTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.dialogflow.v2beta1.EntityType.toObject(message.entityTypes[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListEntityTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @instance + * @returns {Object.} JSON object + */ + ListEntityTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEntityTypesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListEntityTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEntityTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListEntityTypesResponse"; + }; + + return ListEntityTypesResponse; + })(); + + v2beta1.GetEntityTypeRequest = (function() { + + /** + * Properties of a GetEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetEntityTypeRequest + * @property {string|null} [name] GetEntityTypeRequest name + * @property {string|null} [languageCode] GetEntityTypeRequest languageCode + */ + + /** + * Constructs a new GetEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetEntityTypeRequest. + * @implements IGetEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest=} [properties] Properties to set + */ + function GetEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @instance + */ + GetEntityTypeRequest.prototype.name = ""; + + /** + * GetEntityTypeRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @instance + */ + GetEntityTypeRequest.prototype.languageCode = ""; + + /** + * Creates a new GetEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetEntityTypeRequest} GetEntityTypeRequest instance + */ + GetEntityTypeRequest.create = function create(properties) { + return new GetEntityTypeRequest(properties); + }; + + /** + * Encodes the specified GetEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest} message GetEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEntityTypeRequest.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified GetEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest} message GetEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetEntityTypeRequest} GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetEntityTypeRequest} GetEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEntityTypeRequest.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a GetEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetEntityTypeRequest} GetEntityTypeRequest + */ + GetEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a GetEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetEntityTypeRequest} message GetEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this GetEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + GetEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetEntityTypeRequest"; + }; + + return GetEntityTypeRequest; + })(); + + v2beta1.CreateEntityTypeRequest = (function() { + + /** + * Properties of a CreateEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateEntityTypeRequest + * @property {string|null} [parent] CreateEntityTypeRequest parent + * @property {google.cloud.dialogflow.v2beta1.IEntityType|null} [entityType] CreateEntityTypeRequest entityType + * @property {string|null} [languageCode] CreateEntityTypeRequest languageCode + */ + + /** + * Constructs a new CreateEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateEntityTypeRequest. + * @implements ICreateEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest=} [properties] Properties to set + */ + function CreateEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateEntityTypeRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @instance + */ + CreateEntityTypeRequest.prototype.parent = ""; + + /** + * CreateEntityTypeRequest entityType. + * @member {google.cloud.dialogflow.v2beta1.IEntityType|null|undefined} entityType + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @instance + */ + CreateEntityTypeRequest.prototype.entityType = null; + + /** + * CreateEntityTypeRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @instance + */ + CreateEntityTypeRequest.prototype.languageCode = ""; + + /** + * Creates a new CreateEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest} CreateEntityTypeRequest instance + */ + CreateEntityTypeRequest.create = function create(properties) { + return new CreateEntityTypeRequest(properties); + }; + + /** + * Encodes the specified CreateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest} message CreateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEntityTypeRequest.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.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + $root.google.cloud.dialogflow.v2beta1.EntityType.encode(message.entityType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified CreateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest} message CreateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest} CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.entityType = $root.google.cloud.dialogflow.v2beta1.EntityType.decode(reader, reader.uint32()); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest} CreateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateEntityTypeRequest.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.entityType != null && message.hasOwnProperty("entityType")) { + var error = $root.google.cloud.dialogflow.v2beta1.EntityType.verify(message.entityType); + if (error) + return "entityType." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a CreateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest} CreateEntityTypeRequest + */ + CreateEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entityType != null) { + if (typeof object.entityType !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest.entityType: object expected"); + message.entityType = $root.google.cloud.dialogflow.v2beta1.EntityType.fromObject(object.entityType); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a CreateEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest} message CreateEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.entityType = null; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = $root.google.cloud.dialogflow.v2beta1.EntityType.toObject(message.entityType, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this CreateEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + CreateEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest"; + }; + + return CreateEntityTypeRequest; + })(); + + v2beta1.UpdateEntityTypeRequest = (function() { + + /** + * Properties of an UpdateEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateEntityTypeRequest + * @property {google.cloud.dialogflow.v2beta1.IEntityType|null} [entityType] UpdateEntityTypeRequest entityType + * @property {string|null} [languageCode] UpdateEntityTypeRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateEntityTypeRequest updateMask + */ + + /** + * Constructs a new UpdateEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateEntityTypeRequest. + * @implements IUpdateEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest=} [properties] Properties to set + */ + function UpdateEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateEntityTypeRequest entityType. + * @member {google.cloud.dialogflow.v2beta1.IEntityType|null|undefined} entityType + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @instance + */ + UpdateEntityTypeRequest.prototype.entityType = null; + + /** + * UpdateEntityTypeRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @instance + */ + UpdateEntityTypeRequest.prototype.languageCode = ""; + + /** + * UpdateEntityTypeRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @instance + */ + UpdateEntityTypeRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest} UpdateEntityTypeRequest instance + */ + UpdateEntityTypeRequest.create = function create(properties) { + return new UpdateEntityTypeRequest(properties); + }; + + /** + * Encodes the specified UpdateEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest} message UpdateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEntityTypeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityType != null && Object.hasOwnProperty.call(message, "entityType")) + $root.google.cloud.dialogflow.v2beta1.EntityType.encode(message.entityType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest} message UpdateEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest} UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.entityType = $root.google.cloud.dialogflow.v2beta1.EntityType.decode(reader, reader.uint32()); + break; + } + case 2: { + message.languageCode = reader.string(); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest} UpdateEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateEntityTypeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityType != null && message.hasOwnProperty("entityType")) { + var error = $root.google.cloud.dialogflow.v2beta1.EntityType.verify(message.entityType); + if (error) + return "entityType." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + 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 UpdateEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest} UpdateEntityTypeRequest + */ + UpdateEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest(); + if (object.entityType != null) { + if (typeof object.entityType !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest.entityType: object expected"); + message.entityType = $root.google.cloud.dialogflow.v2beta1.EntityType.fromObject(object.entityType); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest} message UpdateEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateEntityTypeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.entityType = null; + object.languageCode = ""; + object.updateMask = null; + } + if (message.entityType != null && message.hasOwnProperty("entityType")) + object.entityType = $root.google.cloud.dialogflow.v2beta1.EntityType.toObject(message.entityType, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest"; + }; + + return UpdateEntityTypeRequest; + })(); + + v2beta1.DeleteEntityTypeRequest = (function() { + + /** + * Properties of a DeleteEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteEntityTypeRequest + * @property {string|null} [name] DeleteEntityTypeRequest name + */ + + /** + * Constructs a new DeleteEntityTypeRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteEntityTypeRequest. + * @implements IDeleteEntityTypeRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest=} [properties] Properties to set + */ + function DeleteEntityTypeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteEntityTypeRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @instance + */ + DeleteEntityTypeRequest.prototype.name = ""; + + /** + * Creates a new DeleteEntityTypeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest} DeleteEntityTypeRequest instance + */ + DeleteEntityTypeRequest.create = function create(properties) { + return new DeleteEntityTypeRequest(properties); + }; + + /** + * Encodes the specified DeleteEntityTypeRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest} message DeleteEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEntityTypeRequest.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 DeleteEntityTypeRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest} message DeleteEntityTypeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEntityTypeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteEntityTypeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest} DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEntityTypeRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest(); + 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 DeleteEntityTypeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest} DeleteEntityTypeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEntityTypeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteEntityTypeRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteEntityTypeRequest.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 DeleteEntityTypeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest} DeleteEntityTypeRequest + */ + DeleteEntityTypeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteEntityTypeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest} message DeleteEntityTypeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteEntityTypeRequest.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 DeleteEntityTypeRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteEntityTypeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteEntityTypeRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteEntityTypeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest"; + }; + + return DeleteEntityTypeRequest; + })(); + + v2beta1.BatchUpdateEntityTypesRequest = (function() { + + /** + * Properties of a BatchUpdateEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchUpdateEntityTypesRequest + * @property {string|null} [parent] BatchUpdateEntityTypesRequest parent + * @property {string|null} [entityTypeBatchUri] BatchUpdateEntityTypesRequest entityTypeBatchUri + * @property {google.cloud.dialogflow.v2beta1.IEntityTypeBatch|null} [entityTypeBatchInline] BatchUpdateEntityTypesRequest entityTypeBatchInline + * @property {string|null} [languageCode] BatchUpdateEntityTypesRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] BatchUpdateEntityTypesRequest updateMask + */ + + /** + * Constructs a new BatchUpdateEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchUpdateEntityTypesRequest. + * @implements IBatchUpdateEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest=} [properties] Properties to set + */ + function BatchUpdateEntityTypesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.parent = ""; + + /** + * BatchUpdateEntityTypesRequest entityTypeBatchUri. + * @member {string|null|undefined} entityTypeBatchUri + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.entityTypeBatchUri = null; + + /** + * BatchUpdateEntityTypesRequest entityTypeBatchInline. + * @member {google.cloud.dialogflow.v2beta1.IEntityTypeBatch|null|undefined} entityTypeBatchInline + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.entityTypeBatchInline = null; + + /** + * BatchUpdateEntityTypesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.languageCode = ""; + + /** + * BatchUpdateEntityTypesRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @instance + */ + BatchUpdateEntityTypesRequest.prototype.updateMask = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BatchUpdateEntityTypesRequest entityTypeBatch. + * @member {"entityTypeBatchUri"|"entityTypeBatchInline"|undefined} entityTypeBatch + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @instance + */ + Object.defineProperty(BatchUpdateEntityTypesRequest.prototype, "entityTypeBatch", { + get: $util.oneOfGetter($oneOfFields = ["entityTypeBatchUri", "entityTypeBatchInline"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BatchUpdateEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest} BatchUpdateEntityTypesRequest instance + */ + BatchUpdateEntityTypesRequest.create = function create(properties) { + return new BatchUpdateEntityTypesRequest(properties); + }; + + /** + * Encodes the specified BatchUpdateEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest} message BatchUpdateEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntityTypesRequest.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.entityTypeBatchUri != null && Object.hasOwnProperty.call(message, "entityTypeBatchUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityTypeBatchUri); + if (message.entityTypeBatchInline != null && Object.hasOwnProperty.call(message, "entityTypeBatchInline")) + $root.google.cloud.dialogflow.v2beta1.EntityTypeBatch.encode(message.entityTypeBatchInline, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchUpdateEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest} message BatchUpdateEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest} BatchUpdateEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntityTypesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.entityTypeBatchUri = reader.string(); + break; + } + case 3: { + message.entityTypeBatchInline = $root.google.cloud.dialogflow.v2beta1.EntityTypeBatch.decode(reader, reader.uint32()); + break; + } + case 4: { + message.languageCode = reader.string(); + break; + } + case 5: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest} BatchUpdateEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateEntityTypesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.entityTypeBatchUri != null && message.hasOwnProperty("entityTypeBatchUri")) { + properties.entityTypeBatch = 1; + if (!$util.isString(message.entityTypeBatchUri)) + return "entityTypeBatchUri: string expected"; + } + if (message.entityTypeBatchInline != null && message.hasOwnProperty("entityTypeBatchInline")) { + if (properties.entityTypeBatch === 1) + return "entityTypeBatch: multiple values"; + properties.entityTypeBatch = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.EntityTypeBatch.verify(message.entityTypeBatchInline); + if (error) + return "entityTypeBatchInline." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates a BatchUpdateEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest} BatchUpdateEntityTypesRequest + */ + BatchUpdateEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entityTypeBatchUri != null) + message.entityTypeBatchUri = String(object.entityTypeBatchUri); + if (object.entityTypeBatchInline != null) { + if (typeof object.entityTypeBatchInline !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.entityTypeBatchInline: object expected"); + message.entityTypeBatchInline = $root.google.cloud.dialogflow.v2beta1.EntityTypeBatch.fromObject(object.entityTypeBatchInline); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest} message BatchUpdateEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateEntityTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.updateMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entityTypeBatchUri != null && message.hasOwnProperty("entityTypeBatchUri")) { + object.entityTypeBatchUri = message.entityTypeBatchUri; + if (options.oneofs) + object.entityTypeBatch = "entityTypeBatchUri"; + } + if (message.entityTypeBatchInline != null && message.hasOwnProperty("entityTypeBatchInline")) { + object.entityTypeBatchInline = $root.google.cloud.dialogflow.v2beta1.EntityTypeBatch.toObject(message.entityTypeBatchInline, options); + if (options.oneofs) + object.entityTypeBatch = "entityTypeBatchInline"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this BatchUpdateEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateEntityTypesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateEntityTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest"; + }; + + return BatchUpdateEntityTypesRequest; + })(); + + v2beta1.BatchUpdateEntityTypesResponse = (function() { + + /** + * Properties of a BatchUpdateEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchUpdateEntityTypesResponse + * @property {Array.|null} [entityTypes] BatchUpdateEntityTypesResponse entityTypes + */ + + /** + * Constructs a new BatchUpdateEntityTypesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchUpdateEntityTypesResponse. + * @implements IBatchUpdateEntityTypesResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse=} [properties] Properties to set + */ + function BatchUpdateEntityTypesResponse(properties) { + this.entityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateEntityTypesResponse entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @instance + */ + BatchUpdateEntityTypesResponse.prototype.entityTypes = $util.emptyArray; + + /** + * Creates a new BatchUpdateEntityTypesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse} BatchUpdateEntityTypesResponse instance + */ + BatchUpdateEntityTypesResponse.create = function create(properties) { + return new BatchUpdateEntityTypesResponse(properties); + }; + + /** + * Encodes the specified BatchUpdateEntityTypesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse} message BatchUpdateEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntityTypesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.dialogflow.v2beta1.EntityType.encode(message.entityTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchUpdateEntityTypesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse} message BatchUpdateEntityTypesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntityTypesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateEntityTypesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse} BatchUpdateEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntityTypesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.dialogflow.v2beta1.EntityType.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateEntityTypesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse} BatchUpdateEntityTypesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntityTypesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateEntityTypesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateEntityTypesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + return null; + }; + + /** + * Creates a BatchUpdateEntityTypesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse} BatchUpdateEntityTypesResponse + */ + BatchUpdateEntityTypesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse(); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.dialogflow.v2beta1.EntityType.fromObject(object.entityTypes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateEntityTypesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse} message BatchUpdateEntityTypesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateEntityTypesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.dialogflow.v2beta1.EntityType.toObject(message.entityTypes[j], options); + } + return object; + }; + + /** + * Converts this BatchUpdateEntityTypesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateEntityTypesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateEntityTypesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateEntityTypesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse"; + }; + + return BatchUpdateEntityTypesResponse; + })(); + + v2beta1.BatchDeleteEntityTypesRequest = (function() { + + /** + * Properties of a BatchDeleteEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchDeleteEntityTypesRequest + * @property {string|null} [parent] BatchDeleteEntityTypesRequest parent + * @property {Array.|null} [entityTypeNames] BatchDeleteEntityTypesRequest entityTypeNames + */ + + /** + * Constructs a new BatchDeleteEntityTypesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchDeleteEntityTypesRequest. + * @implements IBatchDeleteEntityTypesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest=} [properties] Properties to set + */ + function BatchDeleteEntityTypesRequest(properties) { + this.entityTypeNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDeleteEntityTypesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @instance + */ + BatchDeleteEntityTypesRequest.prototype.parent = ""; + + /** + * BatchDeleteEntityTypesRequest entityTypeNames. + * @member {Array.} entityTypeNames + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @instance + */ + BatchDeleteEntityTypesRequest.prototype.entityTypeNames = $util.emptyArray; + + /** + * Creates a new BatchDeleteEntityTypesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest} BatchDeleteEntityTypesRequest instance + */ + BatchDeleteEntityTypesRequest.create = function create(properties) { + return new BatchDeleteEntityTypesRequest(properties); + }; + + /** + * Encodes the specified BatchDeleteEntityTypesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest} message BatchDeleteEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteEntityTypesRequest.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.entityTypeNames != null && message.entityTypeNames.length) + for (var i = 0; i < message.entityTypeNames.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityTypeNames[i]); + return writer; + }; + + /** + * Encodes the specified BatchDeleteEntityTypesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest} message BatchDeleteEntityTypesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteEntityTypesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDeleteEntityTypesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest} BatchDeleteEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteEntityTypesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entityTypeNames && message.entityTypeNames.length)) + message.entityTypeNames = []; + message.entityTypeNames.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDeleteEntityTypesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest} BatchDeleteEntityTypesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteEntityTypesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDeleteEntityTypesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDeleteEntityTypesRequest.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.entityTypeNames != null && message.hasOwnProperty("entityTypeNames")) { + if (!Array.isArray(message.entityTypeNames)) + return "entityTypeNames: array expected"; + for (var i = 0; i < message.entityTypeNames.length; ++i) + if (!$util.isString(message.entityTypeNames[i])) + return "entityTypeNames: string[] expected"; + } + return null; + }; + + /** + * Creates a BatchDeleteEntityTypesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest} BatchDeleteEntityTypesRequest + */ + BatchDeleteEntityTypesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entityTypeNames) { + if (!Array.isArray(object.entityTypeNames)) + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest.entityTypeNames: array expected"); + message.entityTypeNames = []; + for (var i = 0; i < object.entityTypeNames.length; ++i) + message.entityTypeNames[i] = String(object.entityTypeNames[i]); + } + return message; + }; + + /** + * Creates a plain object from a BatchDeleteEntityTypesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest} message BatchDeleteEntityTypesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDeleteEntityTypesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypeNames = []; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entityTypeNames && message.entityTypeNames.length) { + object.entityTypeNames = []; + for (var j = 0; j < message.entityTypeNames.length; ++j) + object.entityTypeNames[j] = message.entityTypeNames[j]; + } + return object; + }; + + /** + * Converts this BatchDeleteEntityTypesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchDeleteEntityTypesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDeleteEntityTypesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDeleteEntityTypesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest"; + }; + + return BatchDeleteEntityTypesRequest; + })(); + + v2beta1.BatchCreateEntitiesRequest = (function() { + + /** + * Properties of a BatchCreateEntitiesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchCreateEntitiesRequest + * @property {string|null} [parent] BatchCreateEntitiesRequest parent + * @property {Array.|null} [entities] BatchCreateEntitiesRequest entities + * @property {string|null} [languageCode] BatchCreateEntitiesRequest languageCode + */ + + /** + * Constructs a new BatchCreateEntitiesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchCreateEntitiesRequest. + * @implements IBatchCreateEntitiesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest=} [properties] Properties to set + */ + function BatchCreateEntitiesRequest(properties) { + this.entities = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchCreateEntitiesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @instance + */ + BatchCreateEntitiesRequest.prototype.parent = ""; + + /** + * BatchCreateEntitiesRequest entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @instance + */ + BatchCreateEntitiesRequest.prototype.entities = $util.emptyArray; + + /** + * BatchCreateEntitiesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @instance + */ + BatchCreateEntitiesRequest.prototype.languageCode = ""; + + /** + * Creates a new BatchCreateEntitiesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest} BatchCreateEntitiesRequest instance + */ + BatchCreateEntitiesRequest.create = function create(properties) { + return new BatchCreateEntitiesRequest(properties); + }; + + /** + * Encodes the specified BatchCreateEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest} message BatchCreateEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchCreateEntitiesRequest.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.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified BatchCreateEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest} message BatchCreateEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchCreateEntitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchCreateEntitiesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest} BatchCreateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchCreateEntitiesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.v2beta1.EntityType.Entity.decode(reader, reader.uint32())); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchCreateEntitiesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest} BatchCreateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchCreateEntitiesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchCreateEntitiesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchCreateEntitiesRequest.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.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a BatchCreateEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest} BatchCreateEntitiesRequest + */ + BatchCreateEntitiesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.fromObject(object.entities[i]); + } + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a BatchCreateEntitiesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest} message BatchCreateEntitiesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchCreateEntitiesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entities = []; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.toObject(message.entities[j], options); + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this BatchCreateEntitiesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchCreateEntitiesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchCreateEntitiesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchCreateEntitiesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest"; + }; + + return BatchCreateEntitiesRequest; + })(); + + v2beta1.BatchUpdateEntitiesRequest = (function() { + + /** + * Properties of a BatchUpdateEntitiesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchUpdateEntitiesRequest + * @property {string|null} [parent] BatchUpdateEntitiesRequest parent + * @property {Array.|null} [entities] BatchUpdateEntitiesRequest entities + * @property {string|null} [languageCode] BatchUpdateEntitiesRequest languageCode + * @property {google.protobuf.IFieldMask|null} [updateMask] BatchUpdateEntitiesRequest updateMask + */ + + /** + * Constructs a new BatchUpdateEntitiesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchUpdateEntitiesRequest. + * @implements IBatchUpdateEntitiesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest=} [properties] Properties to set + */ + function BatchUpdateEntitiesRequest(properties) { + this.entities = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchUpdateEntitiesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @instance + */ + BatchUpdateEntitiesRequest.prototype.parent = ""; + + /** + * BatchUpdateEntitiesRequest entities. + * @member {Array.} entities + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @instance + */ + BatchUpdateEntitiesRequest.prototype.entities = $util.emptyArray; + + /** + * BatchUpdateEntitiesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @instance + */ + BatchUpdateEntitiesRequest.prototype.languageCode = ""; + + /** + * BatchUpdateEntitiesRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @instance + */ + BatchUpdateEntitiesRequest.prototype.updateMask = null; + + /** + * Creates a new BatchUpdateEntitiesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest} BatchUpdateEntitiesRequest instance + */ + BatchUpdateEntitiesRequest.create = function create(properties) { + return new BatchUpdateEntitiesRequest(properties); + }; + + /** + * Encodes the specified BatchUpdateEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest} message BatchUpdateEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntitiesRequest.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.entities != null && message.entities.length) + for (var i = 0; i < message.entities.length; ++i) + $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.encode(message.entities[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchUpdateEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest} message BatchUpdateEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchUpdateEntitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchUpdateEntitiesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest} BatchUpdateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntitiesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entities && message.entities.length)) + message.entities = []; + message.entities.push($root.google.cloud.dialogflow.v2beta1.EntityType.Entity.decode(reader, reader.uint32())); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + case 4: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchUpdateEntitiesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest} BatchUpdateEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchUpdateEntitiesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchUpdateEntitiesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchUpdateEntitiesRequest.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.entities != null && message.hasOwnProperty("entities")) { + if (!Array.isArray(message.entities)) + return "entities: array expected"; + for (var i = 0; i < message.entities.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.verify(message.entities[i]); + if (error) + return "entities." + error; + } + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates a BatchUpdateEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest} BatchUpdateEntitiesRequest + */ + BatchUpdateEntitiesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entities) { + if (!Array.isArray(object.entities)) + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.entities: array expected"); + message.entities = []; + for (var i = 0; i < object.entities.length; ++i) { + if (typeof object.entities[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.entities: object expected"); + message.entities[i] = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.fromObject(object.entities[i]); + } + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from a BatchUpdateEntitiesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest} message BatchUpdateEntitiesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchUpdateEntitiesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entities = []; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + object.updateMask = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entities && message.entities.length) { + object.entities = []; + for (var j = 0; j < message.entities.length; ++j) + object.entities[j] = $root.google.cloud.dialogflow.v2beta1.EntityType.Entity.toObject(message.entities[j], options); + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this BatchUpdateEntitiesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchUpdateEntitiesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchUpdateEntitiesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchUpdateEntitiesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest"; + }; + + return BatchUpdateEntitiesRequest; + })(); + + v2beta1.BatchDeleteEntitiesRequest = (function() { + + /** + * Properties of a BatchDeleteEntitiesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchDeleteEntitiesRequest + * @property {string|null} [parent] BatchDeleteEntitiesRequest parent + * @property {Array.|null} [entityValues] BatchDeleteEntitiesRequest entityValues + * @property {string|null} [languageCode] BatchDeleteEntitiesRequest languageCode + */ + + /** + * Constructs a new BatchDeleteEntitiesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchDeleteEntitiesRequest. + * @implements IBatchDeleteEntitiesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest=} [properties] Properties to set + */ + function BatchDeleteEntitiesRequest(properties) { + this.entityValues = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchDeleteEntitiesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @instance + */ + BatchDeleteEntitiesRequest.prototype.parent = ""; + + /** + * BatchDeleteEntitiesRequest entityValues. + * @member {Array.} entityValues + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @instance + */ + BatchDeleteEntitiesRequest.prototype.entityValues = $util.emptyArray; + + /** + * BatchDeleteEntitiesRequest languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @instance + */ + BatchDeleteEntitiesRequest.prototype.languageCode = ""; + + /** + * Creates a new BatchDeleteEntitiesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest} BatchDeleteEntitiesRequest instance + */ + BatchDeleteEntitiesRequest.create = function create(properties) { + return new BatchDeleteEntitiesRequest(properties); + }; + + /** + * Encodes the specified BatchDeleteEntitiesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest} message BatchDeleteEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteEntitiesRequest.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.entityValues != null && message.entityValues.length) + for (var i = 0; i < message.entityValues.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.entityValues[i]); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified BatchDeleteEntitiesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest} message BatchDeleteEntitiesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchDeleteEntitiesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchDeleteEntitiesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest} BatchDeleteEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteEntitiesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entityValues && message.entityValues.length)) + message.entityValues = []; + message.entityValues.push(reader.string()); + break; + } + case 3: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchDeleteEntitiesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest} BatchDeleteEntitiesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchDeleteEntitiesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchDeleteEntitiesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchDeleteEntitiesRequest.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.entityValues != null && message.hasOwnProperty("entityValues")) { + if (!Array.isArray(message.entityValues)) + return "entityValues: array expected"; + for (var i = 0; i < message.entityValues.length; ++i) + if (!$util.isString(message.entityValues[i])) + return "entityValues: string[] expected"; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a BatchDeleteEntitiesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest} BatchDeleteEntitiesRequest + */ + BatchDeleteEntitiesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entityValues) { + if (!Array.isArray(object.entityValues)) + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest.entityValues: array expected"); + message.entityValues = []; + for (var i = 0; i < object.entityValues.length; ++i) + message.entityValues[i] = String(object.entityValues[i]); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a BatchDeleteEntitiesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest} message BatchDeleteEntitiesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchDeleteEntitiesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityValues = []; + if (options.defaults) { + object.parent = ""; + object.languageCode = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entityValues && message.entityValues.length) { + object.entityValues = []; + for (var j = 0; j < message.entityValues.length; ++j) + object.entityValues[j] = message.entityValues[j]; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this BatchDeleteEntitiesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchDeleteEntitiesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchDeleteEntitiesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchDeleteEntitiesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest"; + }; + + return BatchDeleteEntitiesRequest; + })(); + + v2beta1.EntityTypeBatch = (function() { + + /** + * Properties of an EntityTypeBatch. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IEntityTypeBatch + * @property {Array.|null} [entityTypes] EntityTypeBatch entityTypes + */ + + /** + * Constructs a new EntityTypeBatch. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an EntityTypeBatch. + * @implements IEntityTypeBatch + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IEntityTypeBatch=} [properties] Properties to set + */ + function EntityTypeBatch(properties) { + this.entityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EntityTypeBatch entityTypes. + * @member {Array.} entityTypes + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @instance + */ + EntityTypeBatch.prototype.entityTypes = $util.emptyArray; + + /** + * Creates a new EntityTypeBatch instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @static + * @param {google.cloud.dialogflow.v2beta1.IEntityTypeBatch=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.EntityTypeBatch} EntityTypeBatch instance + */ + EntityTypeBatch.create = function create(properties) { + return new EntityTypeBatch(properties); + }; + + /** + * Encodes the specified EntityTypeBatch message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityTypeBatch.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @static + * @param {google.cloud.dialogflow.v2beta1.IEntityTypeBatch} message EntityTypeBatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityTypeBatch.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entityTypes != null && message.entityTypes.length) + for (var i = 0; i < message.entityTypes.length; ++i) + $root.google.cloud.dialogflow.v2beta1.EntityType.encode(message.entityTypes[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EntityTypeBatch message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EntityTypeBatch.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @static + * @param {google.cloud.dialogflow.v2beta1.IEntityTypeBatch} message EntityTypeBatch message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EntityTypeBatch.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EntityTypeBatch message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.EntityTypeBatch} EntityTypeBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityTypeBatch.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.EntityTypeBatch(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.entityTypes && message.entityTypes.length)) + message.entityTypes = []; + message.entityTypes.push($root.google.cloud.dialogflow.v2beta1.EntityType.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EntityTypeBatch message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.EntityTypeBatch} EntityTypeBatch + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EntityTypeBatch.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EntityTypeBatch message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EntityTypeBatch.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entityTypes != null && message.hasOwnProperty("entityTypes")) { + if (!Array.isArray(message.entityTypes)) + return "entityTypes: array expected"; + for (var i = 0; i < message.entityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.EntityType.verify(message.entityTypes[i]); + if (error) + return "entityTypes." + error; + } + } + return null; + }; + + /** + * Creates an EntityTypeBatch message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.EntityTypeBatch} EntityTypeBatch + */ + EntityTypeBatch.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.EntityTypeBatch) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.EntityTypeBatch(); + if (object.entityTypes) { + if (!Array.isArray(object.entityTypes)) + throw TypeError(".google.cloud.dialogflow.v2beta1.EntityTypeBatch.entityTypes: array expected"); + message.entityTypes = []; + for (var i = 0; i < object.entityTypes.length; ++i) { + if (typeof object.entityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.EntityTypeBatch.entityTypes: object expected"); + message.entityTypes[i] = $root.google.cloud.dialogflow.v2beta1.EntityType.fromObject(object.entityTypes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EntityTypeBatch message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @static + * @param {google.cloud.dialogflow.v2beta1.EntityTypeBatch} message EntityTypeBatch + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EntityTypeBatch.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entityTypes = []; + if (message.entityTypes && message.entityTypes.length) { + object.entityTypes = []; + for (var j = 0; j < message.entityTypes.length; ++j) + object.entityTypes[j] = $root.google.cloud.dialogflow.v2beta1.EntityType.toObject(message.entityTypes[j], options); + } + return object; + }; + + /** + * Converts this EntityTypeBatch to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @instance + * @returns {Object.} JSON object + */ + EntityTypeBatch.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EntityTypeBatch + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.EntityTypeBatch + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EntityTypeBatch.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.EntityTypeBatch"; + }; + + return EntityTypeBatch; + })(); + + v2beta1.Conversations = (function() { + + /** + * Constructs a new Conversations service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Conversations + * @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 Conversations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Conversations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Conversations; + + /** + * Creates new Conversations service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @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 {Conversations} RPC service. Useful where requests and/or responses are streamed. + */ + Conversations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|createConversation}. + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @typedef CreateConversationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Conversation} [response] Conversation + */ + + /** + * Calls CreateConversation. + * @function createConversation + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationRequest} request CreateConversationRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Conversations.CreateConversationCallback} callback Node-style callback called with the error, if any, and Conversation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.createConversation = function createConversation(request, callback) { + return this.rpcCall(createConversation, $root.google.cloud.dialogflow.v2beta1.CreateConversationRequest, $root.google.cloud.dialogflow.v2beta1.Conversation, request, callback); + }, "name", { value: "CreateConversation" }); + + /** + * Calls CreateConversation. + * @function createConversation + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationRequest} request CreateConversationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|listConversations}. + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @typedef ListConversationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListConversationsResponse} [response] ListConversationsResponse + */ + + /** + * Calls ListConversations. + * @function listConversations + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListConversationsRequest} request ListConversationsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Conversations.ListConversationsCallback} callback Node-style callback called with the error, if any, and ListConversationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.listConversations = function listConversations(request, callback) { + return this.rpcCall(listConversations, $root.google.cloud.dialogflow.v2beta1.ListConversationsRequest, $root.google.cloud.dialogflow.v2beta1.ListConversationsResponse, request, callback); + }, "name", { value: "ListConversations" }); + + /** + * Calls ListConversations. + * @function listConversations + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListConversationsRequest} request ListConversationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|getConversation}. + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @typedef GetConversationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Conversation} [response] Conversation + */ + + /** + * Calls GetConversation. + * @function getConversation + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetConversationRequest} request GetConversationRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Conversations.GetConversationCallback} callback Node-style callback called with the error, if any, and Conversation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.getConversation = function getConversation(request, callback) { + return this.rpcCall(getConversation, $root.google.cloud.dialogflow.v2beta1.GetConversationRequest, $root.google.cloud.dialogflow.v2beta1.Conversation, request, callback); + }, "name", { value: "GetConversation" }); + + /** + * Calls GetConversation. + * @function getConversation + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetConversationRequest} request GetConversationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|completeConversation}. + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @typedef CompleteConversationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Conversation} [response] Conversation + */ + + /** + * Calls CompleteConversation. + * @function completeConversation + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICompleteConversationRequest} request CompleteConversationRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Conversations.CompleteConversationCallback} callback Node-style callback called with the error, if any, and Conversation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.completeConversation = function completeConversation(request, callback) { + return this.rpcCall(completeConversation, $root.google.cloud.dialogflow.v2beta1.CompleteConversationRequest, $root.google.cloud.dialogflow.v2beta1.Conversation, request, callback); + }, "name", { value: "CompleteConversation" }); + + /** + * Calls CompleteConversation. + * @function completeConversation + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICompleteConversationRequest} request CompleteConversationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|batchCreateMessages}. + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @typedef BatchCreateMessagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse} [response] BatchCreateMessagesResponse + */ + + /** + * Calls BatchCreateMessages. + * @function batchCreateMessages + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest} request BatchCreateMessagesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Conversations.BatchCreateMessagesCallback} callback Node-style callback called with the error, if any, and BatchCreateMessagesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.batchCreateMessages = function batchCreateMessages(request, callback) { + return this.rpcCall(batchCreateMessages, $root.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest, $root.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse, request, callback); + }, "name", { value: "BatchCreateMessages" }); + + /** + * Calls BatchCreateMessages. + * @function batchCreateMessages + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest} request BatchCreateMessagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|listMessages}. + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @typedef ListMessagesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListMessagesResponse} [response] ListMessagesResponse + */ + + /** + * Calls ListMessages. + * @function listMessages + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListMessagesRequest} request ListMessagesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Conversations.ListMessagesCallback} callback Node-style callback called with the error, if any, and ListMessagesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.listMessages = function listMessages(request, callback) { + return this.rpcCall(listMessages, $root.google.cloud.dialogflow.v2beta1.ListMessagesRequest, $root.google.cloud.dialogflow.v2beta1.ListMessagesResponse, request, callback); + }, "name", { value: "ListMessages" }); + + /** + * Calls ListMessages. + * @function listMessages + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListMessagesRequest} request ListMessagesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Conversations|suggestConversationSummary}. + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @typedef SuggestConversationSummaryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse} [response] SuggestConversationSummaryResponse + */ + + /** + * Calls SuggestConversationSummary. + * @function suggestConversationSummary + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest} request SuggestConversationSummaryRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummaryCallback} callback Node-style callback called with the error, if any, and SuggestConversationSummaryResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Conversations.prototype.suggestConversationSummary = function suggestConversationSummary(request, callback) { + return this.rpcCall(suggestConversationSummary, $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest, $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse, request, callback); + }, "name", { value: "SuggestConversationSummary" }); + + /** + * Calls SuggestConversationSummary. + * @function suggestConversationSummary + * @memberof google.cloud.dialogflow.v2beta1.Conversations + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest} request SuggestConversationSummaryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Conversations; + })(); + + v2beta1.Conversation = (function() { + + /** + * Properties of a Conversation. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IConversation + * @property {string|null} [name] Conversation name + * @property {google.cloud.dialogflow.v2beta1.Conversation.LifecycleState|null} [lifecycleState] Conversation lifecycleState + * @property {string|null} [conversationProfile] Conversation conversationProfile + * @property {google.cloud.dialogflow.v2beta1.IConversationPhoneNumber|null} [phoneNumber] Conversation phoneNumber + * @property {google.cloud.dialogflow.v2beta1.Conversation.ConversationStage|null} [conversationStage] Conversation conversationStage + * @property {google.protobuf.ITimestamp|null} [startTime] Conversation startTime + * @property {google.protobuf.ITimestamp|null} [endTime] Conversation endTime + */ + + /** + * Constructs a new Conversation. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Conversation. + * @implements IConversation + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IConversation=} [properties] Properties to set + */ + function Conversation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Conversation name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @instance + */ + Conversation.prototype.name = ""; + + /** + * Conversation lifecycleState. + * @member {google.cloud.dialogflow.v2beta1.Conversation.LifecycleState} lifecycleState + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @instance + */ + Conversation.prototype.lifecycleState = 0; + + /** + * Conversation conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @instance + */ + Conversation.prototype.conversationProfile = ""; + + /** + * Conversation phoneNumber. + * @member {google.cloud.dialogflow.v2beta1.IConversationPhoneNumber|null|undefined} phoneNumber + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @instance + */ + Conversation.prototype.phoneNumber = null; + + /** + * Conversation conversationStage. + * @member {google.cloud.dialogflow.v2beta1.Conversation.ConversationStage} conversationStage + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @instance + */ + Conversation.prototype.conversationStage = 0; + + /** + * Conversation startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @instance + */ + Conversation.prototype.startTime = null; + + /** + * Conversation endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @instance + */ + Conversation.prototype.endTime = null; + + /** + * Creates a new Conversation instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversation=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Conversation} Conversation instance + */ + Conversation.create = function create(properties) { + return new Conversation(properties); + }; + + /** + * Encodes the specified Conversation message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Conversation.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversation} message Conversation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Conversation.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.lifecycleState != null && Object.hasOwnProperty.call(message, "lifecycleState")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.lifecycleState); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.conversationProfile); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + $root.google.cloud.dialogflow.v2beta1.ConversationPhoneNumber.encode(message.phoneNumber, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.conversationStage != null && Object.hasOwnProperty.call(message, "conversationStage")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.conversationStage); + return writer; + }; + + /** + * Encodes the specified Conversation message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Conversation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversation} message Conversation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Conversation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Conversation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Conversation} Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Conversation.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Conversation(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.lifecycleState = reader.int32(); + break; + } + case 3: { + message.conversationProfile = reader.string(); + break; + } + case 4: { + message.phoneNumber = $root.google.cloud.dialogflow.v2beta1.ConversationPhoneNumber.decode(reader, reader.uint32()); + break; + } + case 7: { + message.conversationStage = reader.int32(); + break; + } + case 5: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Conversation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Conversation} Conversation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Conversation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Conversation message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Conversation.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.lifecycleState != null && message.hasOwnProperty("lifecycleState")) + switch (message.lifecycleState) { + default: + return "lifecycleState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) { + var error = $root.google.cloud.dialogflow.v2beta1.ConversationPhoneNumber.verify(message.phoneNumber); + if (error) + return "phoneNumber." + error; + } + if (message.conversationStage != null && message.hasOwnProperty("conversationStage")) + switch (message.conversationStage) { + default: + return "conversationStage: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + 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 Conversation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Conversation} Conversation + */ + Conversation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Conversation) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Conversation(); + if (object.name != null) + message.name = String(object.name); + switch (object.lifecycleState) { + default: + if (typeof object.lifecycleState === "number") { + message.lifecycleState = object.lifecycleState; + break; + } + break; + case "LIFECYCLE_STATE_UNSPECIFIED": + case 0: + message.lifecycleState = 0; + break; + case "IN_PROGRESS": + case 1: + message.lifecycleState = 1; + break; + case "COMPLETED": + case 2: + message.lifecycleState = 2; + break; + } + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + if (object.phoneNumber != null) { + if (typeof object.phoneNumber !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Conversation.phoneNumber: object expected"); + message.phoneNumber = $root.google.cloud.dialogflow.v2beta1.ConversationPhoneNumber.fromObject(object.phoneNumber); + } + switch (object.conversationStage) { + default: + if (typeof object.conversationStage === "number") { + message.conversationStage = object.conversationStage; + break; + } + break; + case "CONVERSATION_STAGE_UNSPECIFIED": + case 0: + message.conversationStage = 0; + break; + case "VIRTUAL_AGENT_STAGE": + case 1: + message.conversationStage = 1; + break; + case "HUMAN_ASSIST_STAGE": + case 2: + message.conversationStage = 2; + break; + } + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Conversation.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Conversation.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from a Conversation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @static + * @param {google.cloud.dialogflow.v2beta1.Conversation} message Conversation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Conversation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.lifecycleState = options.enums === String ? "LIFECYCLE_STATE_UNSPECIFIED" : 0; + object.conversationProfile = ""; + object.phoneNumber = null; + object.startTime = null; + object.endTime = null; + object.conversationStage = options.enums === String ? "CONVERSATION_STAGE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.lifecycleState != null && message.hasOwnProperty("lifecycleState")) + object.lifecycleState = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Conversation.LifecycleState[message.lifecycleState] === undefined ? message.lifecycleState : $root.google.cloud.dialogflow.v2beta1.Conversation.LifecycleState[message.lifecycleState] : message.lifecycleState; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + object.phoneNumber = $root.google.cloud.dialogflow.v2beta1.ConversationPhoneNumber.toObject(message.phoneNumber, options); + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.conversationStage != null && message.hasOwnProperty("conversationStage")) + object.conversationStage = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Conversation.ConversationStage[message.conversationStage] === undefined ? message.conversationStage : $root.google.cloud.dialogflow.v2beta1.Conversation.ConversationStage[message.conversationStage] : message.conversationStage; + return object; + }; + + /** + * Converts this Conversation to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @instance + * @returns {Object.} JSON object + */ + Conversation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Conversation + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Conversation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Conversation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Conversation"; + }; + + /** + * LifecycleState enum. + * @name google.cloud.dialogflow.v2beta1.Conversation.LifecycleState + * @enum {number} + * @property {number} LIFECYCLE_STATE_UNSPECIFIED=0 LIFECYCLE_STATE_UNSPECIFIED value + * @property {number} IN_PROGRESS=1 IN_PROGRESS value + * @property {number} COMPLETED=2 COMPLETED value + */ + Conversation.LifecycleState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LIFECYCLE_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_PROGRESS"] = 1; + values[valuesById[2] = "COMPLETED"] = 2; + return values; + })(); + + /** + * ConversationStage enum. + * @name google.cloud.dialogflow.v2beta1.Conversation.ConversationStage + * @enum {number} + * @property {number} CONVERSATION_STAGE_UNSPECIFIED=0 CONVERSATION_STAGE_UNSPECIFIED value + * @property {number} VIRTUAL_AGENT_STAGE=1 VIRTUAL_AGENT_STAGE value + * @property {number} HUMAN_ASSIST_STAGE=2 HUMAN_ASSIST_STAGE value + */ + Conversation.ConversationStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONVERSATION_STAGE_UNSPECIFIED"] = 0; + values[valuesById[1] = "VIRTUAL_AGENT_STAGE"] = 1; + values[valuesById[2] = "HUMAN_ASSIST_STAGE"] = 2; + return values; + })(); + + return Conversation; + })(); + + v2beta1.ConversationPhoneNumber = (function() { + + /** + * Properties of a ConversationPhoneNumber. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IConversationPhoneNumber + * @property {string|null} [phoneNumber] ConversationPhoneNumber phoneNumber + */ + + /** + * Constructs a new ConversationPhoneNumber. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ConversationPhoneNumber. + * @implements IConversationPhoneNumber + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IConversationPhoneNumber=} [properties] Properties to set + */ + function ConversationPhoneNumber(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationPhoneNumber phoneNumber. + * @member {string} phoneNumber + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @instance + */ + ConversationPhoneNumber.prototype.phoneNumber = ""; + + /** + * Creates a new ConversationPhoneNumber instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversationPhoneNumber=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ConversationPhoneNumber} ConversationPhoneNumber instance + */ + ConversationPhoneNumber.create = function create(properties) { + return new ConversationPhoneNumber(properties); + }; + + /** + * Encodes the specified ConversationPhoneNumber message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationPhoneNumber.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversationPhoneNumber} message ConversationPhoneNumber message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationPhoneNumber.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.phoneNumber != null && Object.hasOwnProperty.call(message, "phoneNumber")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.phoneNumber); + return writer; + }; + + /** + * Encodes the specified ConversationPhoneNumber message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationPhoneNumber.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversationPhoneNumber} message ConversationPhoneNumber message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationPhoneNumber.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationPhoneNumber message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ConversationPhoneNumber} ConversationPhoneNumber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationPhoneNumber.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ConversationPhoneNumber(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.phoneNumber = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationPhoneNumber message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ConversationPhoneNumber} ConversationPhoneNumber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationPhoneNumber.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationPhoneNumber message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationPhoneNumber.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + if (!$util.isString(message.phoneNumber)) + return "phoneNumber: string expected"; + return null; + }; + + /** + * Creates a ConversationPhoneNumber message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ConversationPhoneNumber} ConversationPhoneNumber + */ + ConversationPhoneNumber.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ConversationPhoneNumber) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ConversationPhoneNumber(); + if (object.phoneNumber != null) + message.phoneNumber = String(object.phoneNumber); + return message; + }; + + /** + * Creates a plain object from a ConversationPhoneNumber message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @static + * @param {google.cloud.dialogflow.v2beta1.ConversationPhoneNumber} message ConversationPhoneNumber + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationPhoneNumber.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.phoneNumber = ""; + if (message.phoneNumber != null && message.hasOwnProperty("phoneNumber")) + object.phoneNumber = message.phoneNumber; + return object; + }; + + /** + * Converts this ConversationPhoneNumber to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @instance + * @returns {Object.} JSON object + */ + ConversationPhoneNumber.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationPhoneNumber + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ConversationPhoneNumber + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationPhoneNumber.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ConversationPhoneNumber"; + }; + + return ConversationPhoneNumber; + })(); + + v2beta1.CreateConversationRequest = (function() { + + /** + * Properties of a CreateConversationRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateConversationRequest + * @property {string|null} [parent] CreateConversationRequest parent + * @property {google.cloud.dialogflow.v2beta1.IConversation|null} [conversation] CreateConversationRequest conversation + * @property {string|null} [conversationId] CreateConversationRequest conversationId + */ + + /** + * Constructs a new CreateConversationRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateConversationRequest. + * @implements ICreateConversationRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationRequest=} [properties] Properties to set + */ + function CreateConversationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @instance + */ + CreateConversationRequest.prototype.parent = ""; + + /** + * CreateConversationRequest conversation. + * @member {google.cloud.dialogflow.v2beta1.IConversation|null|undefined} conversation + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @instance + */ + CreateConversationRequest.prototype.conversation = null; + + /** + * CreateConversationRequest conversationId. + * @member {string} conversationId + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @instance + */ + CreateConversationRequest.prototype.conversationId = ""; + + /** + * Creates a new CreateConversationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateConversationRequest} CreateConversationRequest instance + */ + CreateConversationRequest.create = function create(properties) { + return new CreateConversationRequest(properties); + }; + + /** + * Encodes the specified CreateConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateConversationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationRequest} message CreateConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationRequest.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.conversation != null && Object.hasOwnProperty.call(message, "conversation")) + $root.google.cloud.dialogflow.v2beta1.Conversation.encode(message.conversation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.conversationId != null && Object.hasOwnProperty.call(message, "conversationId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.conversationId); + return writer; + }; + + /** + * Encodes the specified CreateConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateConversationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationRequest} message CreateConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateConversationRequest} CreateConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateConversationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.conversation = $root.google.cloud.dialogflow.v2beta1.Conversation.decode(reader, reader.uint32()); + break; + } + case 3: { + message.conversationId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateConversationRequest} CreateConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationRequest.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.conversation != null && message.hasOwnProperty("conversation")) { + var error = $root.google.cloud.dialogflow.v2beta1.Conversation.verify(message.conversation); + if (error) + return "conversation." + error; + } + if (message.conversationId != null && message.hasOwnProperty("conversationId")) + if (!$util.isString(message.conversationId)) + return "conversationId: string expected"; + return null; + }; + + /** + * Creates a CreateConversationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateConversationRequest} CreateConversationRequest + */ + CreateConversationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateConversationRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateConversationRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.conversation != null) { + if (typeof object.conversation !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateConversationRequest.conversation: object expected"); + message.conversation = $root.google.cloud.dialogflow.v2beta1.Conversation.fromObject(object.conversation); + } + if (object.conversationId != null) + message.conversationId = String(object.conversationId); + return message; + }; + + /** + * Creates a plain object from a CreateConversationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateConversationRequest} message CreateConversationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.conversation = null; + object.conversationId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.conversation != null && message.hasOwnProperty("conversation")) + object.conversation = $root.google.cloud.dialogflow.v2beta1.Conversation.toObject(message.conversation, options); + if (message.conversationId != null && message.hasOwnProperty("conversationId")) + object.conversationId = message.conversationId; + return object; + }; + + /** + * Converts this CreateConversationRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @instance + * @returns {Object.} JSON object + */ + CreateConversationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateConversationRequest"; + }; + + return CreateConversationRequest; + })(); + + v2beta1.ListConversationsRequest = (function() { + + /** + * Properties of a ListConversationsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListConversationsRequest + * @property {string|null} [parent] ListConversationsRequest parent + * @property {number|null} [pageSize] ListConversationsRequest pageSize + * @property {string|null} [pageToken] ListConversationsRequest pageToken + * @property {string|null} [filter] ListConversationsRequest filter + */ + + /** + * Constructs a new ListConversationsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListConversationsRequest. + * @implements IListConversationsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListConversationsRequest=} [properties] Properties to set + */ + function ListConversationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @instance + */ + ListConversationsRequest.prototype.parent = ""; + + /** + * ListConversationsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @instance + */ + ListConversationsRequest.prototype.pageSize = 0; + + /** + * ListConversationsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @instance + */ + ListConversationsRequest.prototype.pageToken = ""; + + /** + * ListConversationsRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @instance + */ + ListConversationsRequest.prototype.filter = ""; + + /** + * Creates a new ListConversationsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListConversationsRequest} ListConversationsRequest instance + */ + ListConversationsRequest.create = function create(properties) { + return new ListConversationsRequest(properties); + }; + + /** + * Encodes the specified ListConversationsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationsRequest} message ListConversationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationsRequest.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); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListConversationsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationsRequest} message ListConversationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListConversationsRequest} ListConversationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListConversationsRequest(); + 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; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListConversationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListConversationsRequest} ListConversationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationsRequest.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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListConversationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListConversationsRequest} ListConversationsRequest + */ + ListConversationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListConversationsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListConversationsRequest(); + 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); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListConversationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListConversationsRequest} message ListConversationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + 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; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListConversationsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListConversationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListConversationsRequest"; + }; + + return ListConversationsRequest; + })(); + + v2beta1.ListConversationsResponse = (function() { + + /** + * Properties of a ListConversationsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListConversationsResponse + * @property {Array.|null} [conversations] ListConversationsResponse conversations + * @property {string|null} [nextPageToken] ListConversationsResponse nextPageToken + */ + + /** + * Constructs a new ListConversationsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListConversationsResponse. + * @implements IListConversationsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListConversationsResponse=} [properties] Properties to set + */ + function ListConversationsResponse(properties) { + this.conversations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationsResponse conversations. + * @member {Array.} conversations + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @instance + */ + ListConversationsResponse.prototype.conversations = $util.emptyArray; + + /** + * ListConversationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @instance + */ + ListConversationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListConversationsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListConversationsResponse} ListConversationsResponse instance + */ + ListConversationsResponse.create = function create(properties) { + return new ListConversationsResponse(properties); + }; + + /** + * Encodes the specified ListConversationsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationsResponse} message ListConversationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversations != null && message.conversations.length) + for (var i = 0; i < message.conversations.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Conversation.encode(message.conversations[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 ListConversationsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationsResponse} message ListConversationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListConversationsResponse} ListConversationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListConversationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.conversations && message.conversations.length)) + message.conversations = []; + message.conversations.push($root.google.cloud.dialogflow.v2beta1.Conversation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListConversationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListConversationsResponse} ListConversationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversations != null && message.hasOwnProperty("conversations")) { + if (!Array.isArray(message.conversations)) + return "conversations: array expected"; + for (var i = 0; i < message.conversations.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Conversation.verify(message.conversations[i]); + if (error) + return "conversations." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListConversationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListConversationsResponse} ListConversationsResponse + */ + ListConversationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListConversationsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListConversationsResponse(); + if (object.conversations) { + if (!Array.isArray(object.conversations)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListConversationsResponse.conversations: array expected"); + message.conversations = []; + for (var i = 0; i < object.conversations.length; ++i) { + if (typeof object.conversations[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListConversationsResponse.conversations: object expected"); + message.conversations[i] = $root.google.cloud.dialogflow.v2beta1.Conversation.fromObject(object.conversations[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListConversationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListConversationsResponse} message ListConversationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conversations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.conversations && message.conversations.length) { + object.conversations = []; + for (var j = 0; j < message.conversations.length; ++j) + object.conversations[j] = $root.google.cloud.dialogflow.v2beta1.Conversation.toObject(message.conversations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListConversationsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListConversationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListConversationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListConversationsResponse"; + }; + + return ListConversationsResponse; + })(); + + v2beta1.GetConversationRequest = (function() { + + /** + * Properties of a GetConversationRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetConversationRequest + * @property {string|null} [name] GetConversationRequest name + */ + + /** + * Constructs a new GetConversationRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetConversationRequest. + * @implements IGetConversationRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetConversationRequest=} [properties] Properties to set + */ + function GetConversationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConversationRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @instance + */ + GetConversationRequest.prototype.name = ""; + + /** + * Creates a new GetConversationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetConversationRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetConversationRequest} GetConversationRequest instance + */ + GetConversationRequest.create = function create(properties) { + return new GetConversationRequest(properties); + }; + + /** + * Encodes the specified GetConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetConversationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetConversationRequest} message GetConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationRequest.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 GetConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetConversationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetConversationRequest} message GetConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConversationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetConversationRequest} GetConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetConversationRequest(); + 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 GetConversationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetConversationRequest} GetConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConversationRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConversationRequest.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 GetConversationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetConversationRequest} GetConversationRequest + */ + GetConversationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetConversationRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetConversationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetConversationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetConversationRequest} message GetConversationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConversationRequest.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 GetConversationRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @instance + * @returns {Object.} JSON object + */ + GetConversationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetConversationRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetConversationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetConversationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetConversationRequest"; + }; + + return GetConversationRequest; + })(); + + v2beta1.CompleteConversationRequest = (function() { + + /** + * Properties of a CompleteConversationRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICompleteConversationRequest + * @property {string|null} [name] CompleteConversationRequest name + */ + + /** + * Constructs a new CompleteConversationRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CompleteConversationRequest. + * @implements ICompleteConversationRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICompleteConversationRequest=} [properties] Properties to set + */ + function CompleteConversationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CompleteConversationRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @instance + */ + CompleteConversationRequest.prototype.name = ""; + + /** + * Creates a new CompleteConversationRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICompleteConversationRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CompleteConversationRequest} CompleteConversationRequest instance + */ + CompleteConversationRequest.create = function create(properties) { + return new CompleteConversationRequest(properties); + }; + + /** + * Encodes the specified CompleteConversationRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompleteConversationRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICompleteConversationRequest} message CompleteConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteConversationRequest.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 CompleteConversationRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CompleteConversationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICompleteConversationRequest} message CompleteConversationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CompleteConversationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CompleteConversationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CompleteConversationRequest} CompleteConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteConversationRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CompleteConversationRequest(); + 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 CompleteConversationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CompleteConversationRequest} CompleteConversationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CompleteConversationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CompleteConversationRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CompleteConversationRequest.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 CompleteConversationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CompleteConversationRequest} CompleteConversationRequest + */ + CompleteConversationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CompleteConversationRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CompleteConversationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a CompleteConversationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CompleteConversationRequest} message CompleteConversationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CompleteConversationRequest.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 CompleteConversationRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @instance + * @returns {Object.} JSON object + */ + CompleteConversationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CompleteConversationRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CompleteConversationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CompleteConversationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CompleteConversationRequest"; + }; + + return CompleteConversationRequest; + })(); + + v2beta1.CreateMessageRequest = (function() { + + /** + * Properties of a CreateMessageRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateMessageRequest + * @property {string|null} [parent] CreateMessageRequest parent + * @property {google.cloud.dialogflow.v2beta1.IMessage|null} [message] CreateMessageRequest message + */ + + /** + * Constructs a new CreateMessageRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateMessageRequest. + * @implements ICreateMessageRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateMessageRequest=} [properties] Properties to set + */ + function CreateMessageRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateMessageRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @instance + */ + CreateMessageRequest.prototype.parent = ""; + + /** + * CreateMessageRequest message. + * @member {google.cloud.dialogflow.v2beta1.IMessage|null|undefined} message + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @instance + */ + CreateMessageRequest.prototype.message = null; + + /** + * Creates a new CreateMessageRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateMessageRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateMessageRequest} CreateMessageRequest instance + */ + CreateMessageRequest.create = function create(properties) { + return new CreateMessageRequest(properties); + }; + + /** + * Encodes the specified CreateMessageRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateMessageRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateMessageRequest} message CreateMessageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateMessageRequest.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.message != null && Object.hasOwnProperty.call(message, "message")) + $root.google.cloud.dialogflow.v2beta1.Message.encode(message.message, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateMessageRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateMessageRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateMessageRequest} message CreateMessageRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateMessageRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateMessageRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateMessageRequest} CreateMessageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateMessageRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateMessageRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.message = $root.google.cloud.dialogflow.v2beta1.Message.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateMessageRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateMessageRequest} CreateMessageRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateMessageRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateMessageRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateMessageRequest.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.message != null && message.hasOwnProperty("message")) { + var error = $root.google.cloud.dialogflow.v2beta1.Message.verify(message.message); + if (error) + return "message." + error; + } + return null; + }; + + /** + * Creates a CreateMessageRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateMessageRequest} CreateMessageRequest + */ + CreateMessageRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateMessageRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateMessageRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.message != null) { + if (typeof object.message !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateMessageRequest.message: object expected"); + message.message = $root.google.cloud.dialogflow.v2beta1.Message.fromObject(object.message); + } + return message; + }; + + /** + * Creates a plain object from a CreateMessageRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateMessageRequest} message CreateMessageRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateMessageRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.message = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.message != null && message.hasOwnProperty("message")) + object.message = $root.google.cloud.dialogflow.v2beta1.Message.toObject(message.message, options); + return object; + }; + + /** + * Converts this CreateMessageRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @instance + * @returns {Object.} JSON object + */ + CreateMessageRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateMessageRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateMessageRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateMessageRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateMessageRequest"; + }; + + return CreateMessageRequest; + })(); + + v2beta1.BatchCreateMessagesRequest = (function() { + + /** + * Properties of a BatchCreateMessagesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchCreateMessagesRequest + * @property {string|null} [parent] BatchCreateMessagesRequest parent + * @property {Array.|null} [requests] BatchCreateMessagesRequest requests + */ + + /** + * Constructs a new BatchCreateMessagesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchCreateMessagesRequest. + * @implements IBatchCreateMessagesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest=} [properties] Properties to set + */ + function BatchCreateMessagesRequest(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]]; + } + + /** + * BatchCreateMessagesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @instance + */ + BatchCreateMessagesRequest.prototype.parent = ""; + + /** + * BatchCreateMessagesRequest requests. + * @member {Array.} requests + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @instance + */ + BatchCreateMessagesRequest.prototype.requests = $util.emptyArray; + + /** + * Creates a new BatchCreateMessagesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest} BatchCreateMessagesRequest instance + */ + BatchCreateMessagesRequest.create = function create(properties) { + return new BatchCreateMessagesRequest(properties); + }; + + /** + * Encodes the specified BatchCreateMessagesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest} message BatchCreateMessagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchCreateMessagesRequest.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.requests != null && message.requests.length) + for (var i = 0; i < message.requests.length; ++i) + $root.google.cloud.dialogflow.v2beta1.CreateMessageRequest.encode(message.requests[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchCreateMessagesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest} message BatchCreateMessagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchCreateMessagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchCreateMessagesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest} BatchCreateMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchCreateMessagesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.requests && message.requests.length)) + message.requests = []; + message.requests.push($root.google.cloud.dialogflow.v2beta1.CreateMessageRequest.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchCreateMessagesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest} BatchCreateMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchCreateMessagesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchCreateMessagesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchCreateMessagesRequest.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.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.dialogflow.v2beta1.CreateMessageRequest.verify(message.requests[i]); + if (error) + return "requests." + error; + } + } + return null; + }; + + /** + * Creates a BatchCreateMessagesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest} BatchCreateMessagesRequest + */ + BatchCreateMessagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.requests) { + if (!Array.isArray(object.requests)) + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest.requests: array expected"); + message.requests = []; + for (var i = 0; i < object.requests.length; ++i) { + if (typeof object.requests[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest.requests: object expected"); + message.requests[i] = $root.google.cloud.dialogflow.v2beta1.CreateMessageRequest.fromObject(object.requests[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchCreateMessagesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest} message BatchCreateMessagesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchCreateMessagesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.requests = []; + if (options.defaults) + object.parent = ""; + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.requests && message.requests.length) { + object.requests = []; + for (var j = 0; j < message.requests.length; ++j) + object.requests[j] = $root.google.cloud.dialogflow.v2beta1.CreateMessageRequest.toObject(message.requests[j], options); + } + return object; + }; + + /** + * Converts this BatchCreateMessagesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @instance + * @returns {Object.} JSON object + */ + BatchCreateMessagesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchCreateMessagesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchCreateMessagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest"; + }; + + return BatchCreateMessagesRequest; + })(); + + v2beta1.BatchCreateMessagesResponse = (function() { + + /** + * Properties of a BatchCreateMessagesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IBatchCreateMessagesResponse + * @property {Array.|null} [messages] BatchCreateMessagesResponse messages + */ + + /** + * Constructs a new BatchCreateMessagesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a BatchCreateMessagesResponse. + * @implements IBatchCreateMessagesResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse=} [properties] Properties to set + */ + function BatchCreateMessagesResponse(properties) { + this.messages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BatchCreateMessagesResponse messages. + * @member {Array.} messages + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @instance + */ + BatchCreateMessagesResponse.prototype.messages = $util.emptyArray; + + /** + * Creates a new BatchCreateMessagesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse} BatchCreateMessagesResponse instance + */ + BatchCreateMessagesResponse.create = function create(properties) { + return new BatchCreateMessagesResponse(properties); + }; + + /** + * Encodes the specified BatchCreateMessagesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse} message BatchCreateMessagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchCreateMessagesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Message.encode(message.messages[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BatchCreateMessagesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse} message BatchCreateMessagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BatchCreateMessagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BatchCreateMessagesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse} BatchCreateMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchCreateMessagesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.dialogflow.v2beta1.Message.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BatchCreateMessagesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse} BatchCreateMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BatchCreateMessagesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BatchCreateMessagesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BatchCreateMessagesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Message.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + return null; + }; + + /** + * Creates a BatchCreateMessagesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse} BatchCreateMessagesResponse + */ + BatchCreateMessagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse(); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse.messages: object expected"); + message.messages[i] = $root.google.cloud.dialogflow.v2beta1.Message.fromObject(object.messages[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a BatchCreateMessagesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse} message BatchCreateMessagesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BatchCreateMessagesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.messages = []; + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.dialogflow.v2beta1.Message.toObject(message.messages[j], options); + } + return object; + }; + + /** + * Converts this BatchCreateMessagesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @instance + * @returns {Object.} JSON object + */ + BatchCreateMessagesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BatchCreateMessagesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BatchCreateMessagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse"; + }; + + return BatchCreateMessagesResponse; + })(); + + v2beta1.ListMessagesRequest = (function() { + + /** + * Properties of a ListMessagesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListMessagesRequest + * @property {string|null} [parent] ListMessagesRequest parent + * @property {string|null} [filter] ListMessagesRequest filter + * @property {number|null} [pageSize] ListMessagesRequest pageSize + * @property {string|null} [pageToken] ListMessagesRequest pageToken + */ + + /** + * Constructs a new ListMessagesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListMessagesRequest. + * @implements IListMessagesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListMessagesRequest=} [properties] Properties to set + */ + function ListMessagesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMessagesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @instance + */ + ListMessagesRequest.prototype.parent = ""; + + /** + * ListMessagesRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @instance + */ + ListMessagesRequest.prototype.filter = ""; + + /** + * ListMessagesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @instance + */ + ListMessagesRequest.prototype.pageSize = 0; + + /** + * ListMessagesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @instance + */ + ListMessagesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListMessagesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListMessagesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListMessagesRequest} ListMessagesRequest instance + */ + ListMessagesRequest.create = function create(properties) { + return new ListMessagesRequest(properties); + }; + + /** + * Encodes the specified ListMessagesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListMessagesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListMessagesRequest} message ListMessagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessagesRequest.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); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListMessagesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListMessagesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListMessagesRequest} message ListMessagesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessagesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMessagesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListMessagesRequest} ListMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessagesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListMessagesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 4: { + 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 ListMessagesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListMessagesRequest} ListMessagesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessagesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMessagesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMessagesRequest.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.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 ListMessagesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListMessagesRequest} ListMessagesRequest + */ + ListMessagesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListMessagesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListMessagesRequest(); + if (object.parent != null) + message.parent = String(object.parent); + 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 ListMessagesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListMessagesRequest} message ListMessagesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMessagesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + 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; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListMessagesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @instance + * @returns {Object.} JSON object + */ + ListMessagesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMessagesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMessagesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListMessagesRequest"; + }; + + return ListMessagesRequest; + })(); + + v2beta1.ListMessagesResponse = (function() { + + /** + * Properties of a ListMessagesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListMessagesResponse + * @property {Array.|null} [messages] ListMessagesResponse messages + * @property {string|null} [nextPageToken] ListMessagesResponse nextPageToken + */ + + /** + * Constructs a new ListMessagesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListMessagesResponse. + * @implements IListMessagesResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListMessagesResponse=} [properties] Properties to set + */ + function ListMessagesResponse(properties) { + this.messages = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMessagesResponse messages. + * @member {Array.} messages + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @instance + */ + ListMessagesResponse.prototype.messages = $util.emptyArray; + + /** + * ListMessagesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @instance + */ + ListMessagesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListMessagesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListMessagesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListMessagesResponse} ListMessagesResponse instance + */ + ListMessagesResponse.create = function create(properties) { + return new ListMessagesResponse(properties); + }; + + /** + * Encodes the specified ListMessagesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListMessagesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListMessagesResponse} message ListMessagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessagesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Message.encode(message.messages[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 ListMessagesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListMessagesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListMessagesResponse} message ListMessagesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMessagesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMessagesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListMessagesResponse} ListMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessagesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListMessagesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.dialogflow.v2beta1.Message.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMessagesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListMessagesResponse} ListMessagesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMessagesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMessagesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMessagesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Message.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListMessagesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListMessagesResponse} ListMessagesResponse + */ + ListMessagesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListMessagesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListMessagesResponse(); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListMessagesResponse.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListMessagesResponse.messages: object expected"); + message.messages[i] = $root.google.cloud.dialogflow.v2beta1.Message.fromObject(object.messages[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListMessagesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListMessagesResponse} message ListMessagesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMessagesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.messages = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.dialogflow.v2beta1.Message.toObject(message.messages[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListMessagesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @instance + * @returns {Object.} JSON object + */ + ListMessagesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMessagesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListMessagesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMessagesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListMessagesResponse"; + }; + + return ListMessagesResponse; + })(); + + v2beta1.SuggestConversationSummaryRequest = (function() { + + /** + * Properties of a SuggestConversationSummaryRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestConversationSummaryRequest + * @property {string|null} [conversation] SuggestConversationSummaryRequest conversation + * @property {string|null} [latestMessage] SuggestConversationSummaryRequest latestMessage + * @property {number|null} [contextSize] SuggestConversationSummaryRequest contextSize + */ + + /** + * Constructs a new SuggestConversationSummaryRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestConversationSummaryRequest. + * @implements ISuggestConversationSummaryRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest=} [properties] Properties to set + */ + function SuggestConversationSummaryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestConversationSummaryRequest conversation. + * @member {string} conversation + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @instance + */ + SuggestConversationSummaryRequest.prototype.conversation = ""; + + /** + * SuggestConversationSummaryRequest latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @instance + */ + SuggestConversationSummaryRequest.prototype.latestMessage = ""; + + /** + * SuggestConversationSummaryRequest contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @instance + */ + SuggestConversationSummaryRequest.prototype.contextSize = 0; + + /** + * Creates a new SuggestConversationSummaryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest} SuggestConversationSummaryRequest instance + */ + SuggestConversationSummaryRequest.create = function create(properties) { + return new SuggestConversationSummaryRequest(properties); + }; + + /** + * Encodes the specified SuggestConversationSummaryRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest} message SuggestConversationSummaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestConversationSummaryRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversation != null && Object.hasOwnProperty.call(message, "conversation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversation); + if (message.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified SuggestConversationSummaryRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest} message SuggestConversationSummaryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestConversationSummaryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestConversationSummaryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest} SuggestConversationSummaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestConversationSummaryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversation = reader.string(); + break; + } + case 3: { + message.latestMessage = reader.string(); + break; + } + case 4: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestConversationSummaryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest} SuggestConversationSummaryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestConversationSummaryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestConversationSummaryRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestConversationSummaryRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversation != null && message.hasOwnProperty("conversation")) + if (!$util.isString(message.conversation)) + return "conversation: string expected"; + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestConversationSummaryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest} SuggestConversationSummaryRequest + */ + SuggestConversationSummaryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest(); + if (object.conversation != null) + message.conversation = String(object.conversation); + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestConversationSummaryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest} message SuggestConversationSummaryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestConversationSummaryRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversation = ""; + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.conversation != null && message.hasOwnProperty("conversation")) + object.conversation = message.conversation; + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this SuggestConversationSummaryRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @instance + * @returns {Object.} JSON object + */ + SuggestConversationSummaryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestConversationSummaryRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestConversationSummaryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest"; + }; + + return SuggestConversationSummaryRequest; + })(); + + v2beta1.SuggestConversationSummaryResponse = (function() { + + /** + * Properties of a SuggestConversationSummaryResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISuggestConversationSummaryResponse + * @property {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary|null} [summary] SuggestConversationSummaryResponse summary + * @property {string|null} [latestMessage] SuggestConversationSummaryResponse latestMessage + * @property {number|null} [contextSize] SuggestConversationSummaryResponse contextSize + */ + + /** + * Constructs a new SuggestConversationSummaryResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SuggestConversationSummaryResponse. + * @implements ISuggestConversationSummaryResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse=} [properties] Properties to set + */ + function SuggestConversationSummaryResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestConversationSummaryResponse summary. + * @member {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary|null|undefined} summary + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @instance + */ + SuggestConversationSummaryResponse.prototype.summary = null; + + /** + * SuggestConversationSummaryResponse latestMessage. + * @member {string} latestMessage + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @instance + */ + SuggestConversationSummaryResponse.prototype.latestMessage = ""; + + /** + * SuggestConversationSummaryResponse contextSize. + * @member {number} contextSize + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @instance + */ + SuggestConversationSummaryResponse.prototype.contextSize = 0; + + /** + * Creates a new SuggestConversationSummaryResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse} SuggestConversationSummaryResponse instance + */ + SuggestConversationSummaryResponse.create = function create(properties) { + return new SuggestConversationSummaryResponse(properties); + }; + + /** + * Encodes the specified SuggestConversationSummaryResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse} message SuggestConversationSummaryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestConversationSummaryResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.summary != null && Object.hasOwnProperty.call(message, "summary")) + $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.encode(message.summary, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.latestMessage != null && Object.hasOwnProperty.call(message, "latestMessage")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.latestMessage); + if (message.contextSize != null && Object.hasOwnProperty.call(message, "contextSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.contextSize); + return writer; + }; + + /** + * Encodes the specified SuggestConversationSummaryResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse} message SuggestConversationSummaryResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestConversationSummaryResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestConversationSummaryResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse} SuggestConversationSummaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestConversationSummaryResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.summary = $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.decode(reader, reader.uint32()); + break; + } + case 2: { + message.latestMessage = reader.string(); + break; + } + case 3: { + message.contextSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestConversationSummaryResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse} SuggestConversationSummaryResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestConversationSummaryResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestConversationSummaryResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestConversationSummaryResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.summary != null && message.hasOwnProperty("summary")) { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.verify(message.summary); + if (error) + return "summary." + error; + } + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + if (!$util.isString(message.latestMessage)) + return "latestMessage: string expected"; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + if (!$util.isInteger(message.contextSize)) + return "contextSize: integer expected"; + return null; + }; + + /** + * Creates a SuggestConversationSummaryResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse} SuggestConversationSummaryResponse + */ + SuggestConversationSummaryResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse(); + if (object.summary != null) { + if (typeof object.summary !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.summary: object expected"); + message.summary = $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.fromObject(object.summary); + } + if (object.latestMessage != null) + message.latestMessage = String(object.latestMessage); + if (object.contextSize != null) + message.contextSize = object.contextSize | 0; + return message; + }; + + /** + * Creates a plain object from a SuggestConversationSummaryResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse} message SuggestConversationSummaryResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestConversationSummaryResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.summary = null; + object.latestMessage = ""; + object.contextSize = 0; + } + if (message.summary != null && message.hasOwnProperty("summary")) + object.summary = $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.toObject(message.summary, options); + if (message.latestMessage != null && message.hasOwnProperty("latestMessage")) + object.latestMessage = message.latestMessage; + if (message.contextSize != null && message.hasOwnProperty("contextSize")) + object.contextSize = message.contextSize; + return object; + }; + + /** + * Converts this SuggestConversationSummaryResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @instance + * @returns {Object.} JSON object + */ + SuggestConversationSummaryResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestConversationSummaryResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestConversationSummaryResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse"; + }; + + SuggestConversationSummaryResponse.Summary = (function() { + + /** + * Properties of a Summary. + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @interface ISummary + * @property {string|null} [text] Summary text + * @property {Object.|null} [textSections] Summary textSections + * @property {string|null} [answerRecord] Summary answerRecord + */ + + /** + * Constructs a new Summary. + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse + * @classdesc Represents a Summary. + * @implements ISummary + * @constructor + * @param {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary=} [properties] Properties to set + */ + function Summary(properties) { + this.textSections = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Summary text. + * @member {string} text + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @instance + */ + Summary.prototype.text = ""; + + /** + * Summary textSections. + * @member {Object.} textSections + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @instance + */ + Summary.prototype.textSections = $util.emptyObject; + + /** + * Summary answerRecord. + * @member {string} answerRecord + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @instance + */ + Summary.prototype.answerRecord = ""; + + /** + * Creates a new Summary instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary} Summary instance + */ + Summary.create = function create(properties) { + return new Summary(properties); + }; + + /** + * Encodes the specified Summary message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary} message Summary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Summary.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.text != null && Object.hasOwnProperty.call(message, "text")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.text); + if (message.answerRecord != null && Object.hasOwnProperty.call(message, "answerRecord")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.answerRecord); + if (message.textSections != null && Object.hasOwnProperty.call(message, "textSections")) + for (var keys = Object.keys(message.textSections), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.textSections[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified Summary message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.ISummary} message Summary message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Summary.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Summary message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary} Summary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Summary.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.text = reader.string(); + break; + } + case 4: { + if (message.textSections === $util.emptyObject) + message.textSections = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.textSections[key] = value; + break; + } + case 3: { + message.answerRecord = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Summary message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary} Summary + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Summary.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Summary message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Summary.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.text != null && message.hasOwnProperty("text")) + if (!$util.isString(message.text)) + return "text: string expected"; + if (message.textSections != null && message.hasOwnProperty("textSections")) { + if (!$util.isObject(message.textSections)) + return "textSections: object expected"; + var key = Object.keys(message.textSections); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.textSections[key[i]])) + return "textSections: string{k:string} expected"; + } + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + if (!$util.isString(message.answerRecord)) + return "answerRecord: string expected"; + return null; + }; + + /** + * Creates a Summary message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary} Summary + */ + Summary.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary(); + if (object.text != null) + message.text = String(object.text); + if (object.textSections) { + if (typeof object.textSections !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary.textSections: object expected"); + message.textSections = {}; + for (var keys = Object.keys(object.textSections), i = 0; i < keys.length; ++i) + message.textSections[keys[i]] = String(object.textSections[keys[i]]); + } + if (object.answerRecord != null) + message.answerRecord = String(object.answerRecord); + return message; + }; + + /** + * Creates a plain object from a Summary message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @static + * @param {google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary} message Summary + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Summary.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.textSections = {}; + if (options.defaults) { + object.text = ""; + object.answerRecord = ""; + } + if (message.text != null && message.hasOwnProperty("text")) + object.text = message.text; + if (message.answerRecord != null && message.hasOwnProperty("answerRecord")) + object.answerRecord = message.answerRecord; + var keys2; + if (message.textSections && (keys2 = Object.keys(message.textSections)).length) { + object.textSections = {}; + for (var j = 0; j < keys2.length; ++j) + object.textSections[keys2[j]] = message.textSections[keys2[j]]; + } + return object; + }; + + /** + * Converts this Summary to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @instance + * @returns {Object.} JSON object + */ + Summary.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Summary + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Summary.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse.Summary"; + }; + + return Summary; + })(); + + return SuggestConversationSummaryResponse; + })(); + + v2beta1.ConversationEvent = (function() { + + /** + * Properties of a ConversationEvent. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IConversationEvent + * @property {string|null} [conversation] ConversationEvent conversation + * @property {google.cloud.dialogflow.v2beta1.ConversationEvent.Type|null} [type] ConversationEvent type + * @property {google.rpc.IStatus|null} [errorStatus] ConversationEvent errorStatus + * @property {google.cloud.dialogflow.v2beta1.IMessage|null} [newMessagePayload] ConversationEvent newMessagePayload + */ + + /** + * Constructs a new ConversationEvent. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ConversationEvent. + * @implements IConversationEvent + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IConversationEvent=} [properties] Properties to set + */ + function ConversationEvent(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationEvent conversation. + * @member {string} conversation + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @instance + */ + ConversationEvent.prototype.conversation = ""; + + /** + * ConversationEvent type. + * @member {google.cloud.dialogflow.v2beta1.ConversationEvent.Type} type + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @instance + */ + ConversationEvent.prototype.type = 0; + + /** + * ConversationEvent errorStatus. + * @member {google.rpc.IStatus|null|undefined} errorStatus + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @instance + */ + ConversationEvent.prototype.errorStatus = null; + + /** + * ConversationEvent newMessagePayload. + * @member {google.cloud.dialogflow.v2beta1.IMessage|null|undefined} newMessagePayload + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @instance + */ + ConversationEvent.prototype.newMessagePayload = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ConversationEvent payload. + * @member {"newMessagePayload"|undefined} payload + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @instance + */ + Object.defineProperty(ConversationEvent.prototype, "payload", { + get: $util.oneOfGetter($oneOfFields = ["newMessagePayload"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConversationEvent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversationEvent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ConversationEvent} ConversationEvent instance + */ + ConversationEvent.create = function create(properties) { + return new ConversationEvent(properties); + }; + + /** + * Encodes the specified ConversationEvent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationEvent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversationEvent} message ConversationEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversation != null && Object.hasOwnProperty.call(message, "conversation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversation); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.errorStatus != null && Object.hasOwnProperty.call(message, "errorStatus")) + $root.google.rpc.Status.encode(message.errorStatus, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.newMessagePayload != null && Object.hasOwnProperty.call(message, "newMessagePayload")) + $root.google.cloud.dialogflow.v2beta1.Message.encode(message.newMessagePayload, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConversationEvent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversationEvent} message ConversationEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationEvent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ConversationEvent} ConversationEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ConversationEvent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversation = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + message.errorStatus = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 4: { + message.newMessagePayload = $root.google.cloud.dialogflow.v2beta1.Message.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ConversationEvent} ConversationEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationEvent message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.conversation != null && message.hasOwnProperty("conversation")) + if (!$util.isString(message.conversation)) + return "conversation: string 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 5: + case 4: + break; + } + if (message.errorStatus != null && message.hasOwnProperty("errorStatus")) { + var error = $root.google.rpc.Status.verify(message.errorStatus); + if (error) + return "errorStatus." + error; + } + if (message.newMessagePayload != null && message.hasOwnProperty("newMessagePayload")) { + properties.payload = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Message.verify(message.newMessagePayload); + if (error) + return "newMessagePayload." + error; + } + } + return null; + }; + + /** + * Creates a ConversationEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ConversationEvent} ConversationEvent + */ + ConversationEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ConversationEvent) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ConversationEvent(); + if (object.conversation != null) + message.conversation = String(object.conversation); + 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 "CONVERSATION_STARTED": + case 1: + message.type = 1; + break; + case "CONVERSATION_FINISHED": + case 2: + message.type = 2; + break; + case "HUMAN_INTERVENTION_NEEDED": + case 3: + message.type = 3; + break; + case "NEW_MESSAGE": + case 5: + message.type = 5; + break; + case "UNRECOVERABLE_ERROR": + case 4: + message.type = 4; + break; + } + if (object.errorStatus != null) { + if (typeof object.errorStatus !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationEvent.errorStatus: object expected"); + message.errorStatus = $root.google.rpc.Status.fromObject(object.errorStatus); + } + if (object.newMessagePayload != null) { + if (typeof object.newMessagePayload !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationEvent.newMessagePayload: object expected"); + message.newMessagePayload = $root.google.cloud.dialogflow.v2beta1.Message.fromObject(object.newMessagePayload); + } + return message; + }; + + /** + * Creates a plain object from a ConversationEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @static + * @param {google.cloud.dialogflow.v2beta1.ConversationEvent} message ConversationEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversation = ""; + object.type = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.errorStatus = null; + } + if (message.conversation != null && message.hasOwnProperty("conversation")) + object.conversation = message.conversation; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.ConversationEvent.Type[message.type] === undefined ? message.type : $root.google.cloud.dialogflow.v2beta1.ConversationEvent.Type[message.type] : message.type; + if (message.errorStatus != null && message.hasOwnProperty("errorStatus")) + object.errorStatus = $root.google.rpc.Status.toObject(message.errorStatus, options); + if (message.newMessagePayload != null && message.hasOwnProperty("newMessagePayload")) { + object.newMessagePayload = $root.google.cloud.dialogflow.v2beta1.Message.toObject(message.newMessagePayload, options); + if (options.oneofs) + object.payload = "newMessagePayload"; + } + return object; + }; + + /** + * Converts this ConversationEvent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @instance + * @returns {Object.} JSON object + */ + ConversationEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationEvent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ConversationEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ConversationEvent"; + }; + + /** + * Type enum. + * @name google.cloud.dialogflow.v2beta1.ConversationEvent.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} CONVERSATION_STARTED=1 CONVERSATION_STARTED value + * @property {number} CONVERSATION_FINISHED=2 CONVERSATION_FINISHED value + * @property {number} HUMAN_INTERVENTION_NEEDED=3 HUMAN_INTERVENTION_NEEDED value + * @property {number} NEW_MESSAGE=5 NEW_MESSAGE value + * @property {number} UNRECOVERABLE_ERROR=4 UNRECOVERABLE_ERROR value + */ + ConversationEvent.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CONVERSATION_STARTED"] = 1; + values[valuesById[2] = "CONVERSATION_FINISHED"] = 2; + values[valuesById[3] = "HUMAN_INTERVENTION_NEEDED"] = 3; + values[valuesById[5] = "NEW_MESSAGE"] = 5; + values[valuesById[4] = "UNRECOVERABLE_ERROR"] = 4; + return values; + })(); + + return ConversationEvent; + })(); + + v2beta1.ConversationProfiles = (function() { + + /** + * Constructs a new ConversationProfiles service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ConversationProfiles + * @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 ConversationProfiles(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ConversationProfiles.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ConversationProfiles; + + /** + * Creates new ConversationProfiles service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @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 {ConversationProfiles} RPC service. Useful where requests and/or responses are streamed. + */ + ConversationProfiles.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|listConversationProfiles}. + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @typedef ListConversationProfilesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse} [response] ListConversationProfilesResponse + */ + + /** + * Calls ListConversationProfiles. + * @function listConversationProfiles + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest} request ListConversationProfilesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfilesCallback} callback Node-style callback called with the error, if any, and ListConversationProfilesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.listConversationProfiles = function listConversationProfiles(request, callback) { + return this.rpcCall(listConversationProfiles, $root.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest, $root.google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse, request, callback); + }, "name", { value: "ListConversationProfiles" }); + + /** + * Calls ListConversationProfiles. + * @function listConversationProfiles + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest} request ListConversationProfilesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|getConversationProfile}. + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @typedef GetConversationProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} [response] ConversationProfile + */ + + /** + * Calls GetConversationProfile. + * @function getConversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest} request GetConversationProfileRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfileCallback} callback Node-style callback called with the error, if any, and ConversationProfile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.getConversationProfile = function getConversationProfile(request, callback) { + return this.rpcCall(getConversationProfile, $root.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest, $root.google.cloud.dialogflow.v2beta1.ConversationProfile, request, callback); + }, "name", { value: "GetConversationProfile" }); + + /** + * Calls GetConversationProfile. + * @function getConversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest} request GetConversationProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|createConversationProfile}. + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @typedef CreateConversationProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} [response] ConversationProfile + */ + + /** + * Calls CreateConversationProfile. + * @function createConversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest} request CreateConversationProfileRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfileCallback} callback Node-style callback called with the error, if any, and ConversationProfile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.createConversationProfile = function createConversationProfile(request, callback) { + return this.rpcCall(createConversationProfile, $root.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest, $root.google.cloud.dialogflow.v2beta1.ConversationProfile, request, callback); + }, "name", { value: "CreateConversationProfile" }); + + /** + * Calls CreateConversationProfile. + * @function createConversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest} request CreateConversationProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|updateConversationProfile}. + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @typedef UpdateConversationProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} [response] ConversationProfile + */ + + /** + * Calls UpdateConversationProfile. + * @function updateConversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest} request UpdateConversationProfileRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfileCallback} callback Node-style callback called with the error, if any, and ConversationProfile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.updateConversationProfile = function updateConversationProfile(request, callback) { + return this.rpcCall(updateConversationProfile, $root.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest, $root.google.cloud.dialogflow.v2beta1.ConversationProfile, request, callback); + }, "name", { value: "UpdateConversationProfile" }); + + /** + * Calls UpdateConversationProfile. + * @function updateConversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest} request UpdateConversationProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|deleteConversationProfile}. + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @typedef DeleteConversationProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteConversationProfile. + * @function deleteConversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest} request DeleteConversationProfileRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfileCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.deleteConversationProfile = function deleteConversationProfile(request, callback) { + return this.rpcCall(deleteConversationProfile, $root.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteConversationProfile" }); + + /** + * Calls DeleteConversationProfile. + * @function deleteConversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest} request DeleteConversationProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|setSuggestionFeatureConfig}. + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @typedef SetSuggestionFeatureConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls SetSuggestionFeatureConfig. + * @function setSuggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest} request SetSuggestionFeatureConfigRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.ConversationProfiles.SetSuggestionFeatureConfigCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.setSuggestionFeatureConfig = function setSuggestionFeatureConfig(request, callback) { + return this.rpcCall(setSuggestionFeatureConfig, $root.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "SetSuggestionFeatureConfig" }); + + /** + * Calls SetSuggestionFeatureConfig. + * @function setSuggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest} request SetSuggestionFeatureConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.ConversationProfiles|clearSuggestionFeatureConfig}. + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @typedef ClearSuggestionFeatureConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ClearSuggestionFeatureConfig. + * @function clearSuggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest} request ClearSuggestionFeatureConfigRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.ConversationProfiles.ClearSuggestionFeatureConfigCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConversationProfiles.prototype.clearSuggestionFeatureConfig = function clearSuggestionFeatureConfig(request, callback) { + return this.rpcCall(clearSuggestionFeatureConfig, $root.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ClearSuggestionFeatureConfig" }); + + /** + * Calls ClearSuggestionFeatureConfig. + * @function clearSuggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfiles + * @instance + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest} request ClearSuggestionFeatureConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ConversationProfiles; + })(); + + v2beta1.ConversationProfile = (function() { + + /** + * Properties of a ConversationProfile. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IConversationProfile + * @property {string|null} [name] ConversationProfile name + * @property {string|null} [displayName] ConversationProfile displayName + * @property {google.protobuf.ITimestamp|null} [createTime] ConversationProfile createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] ConversationProfile updateTime + * @property {google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig|null} [automatedAgentConfig] ConversationProfile automatedAgentConfig + * @property {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig|null} [humanAgentAssistantConfig] ConversationProfile humanAgentAssistantConfig + * @property {google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig|null} [humanAgentHandoffConfig] ConversationProfile humanAgentHandoffConfig + * @property {google.cloud.dialogflow.v2beta1.INotificationConfig|null} [notificationConfig] ConversationProfile notificationConfig + * @property {google.cloud.dialogflow.v2beta1.ILoggingConfig|null} [loggingConfig] ConversationProfile loggingConfig + * @property {google.cloud.dialogflow.v2beta1.INotificationConfig|null} [newMessageEventNotificationConfig] ConversationProfile newMessageEventNotificationConfig + * @property {google.cloud.dialogflow.v2beta1.ISpeechToTextConfig|null} [sttConfig] ConversationProfile sttConfig + * @property {string|null} [languageCode] ConversationProfile languageCode + * @property {string|null} [timeZone] ConversationProfile timeZone + * @property {string|null} [securitySettings] ConversationProfile securitySettings + */ + + /** + * Constructs a new ConversationProfile. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ConversationProfile. + * @implements IConversationProfile + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IConversationProfile=} [properties] Properties to set + */ + function ConversationProfile(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationProfile name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.name = ""; + + /** + * ConversationProfile displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.displayName = ""; + + /** + * ConversationProfile createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.createTime = null; + + /** + * ConversationProfile updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.updateTime = null; + + /** + * ConversationProfile automatedAgentConfig. + * @member {google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig|null|undefined} automatedAgentConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.automatedAgentConfig = null; + + /** + * ConversationProfile humanAgentAssistantConfig. + * @member {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig|null|undefined} humanAgentAssistantConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.humanAgentAssistantConfig = null; + + /** + * ConversationProfile humanAgentHandoffConfig. + * @member {google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig|null|undefined} humanAgentHandoffConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.humanAgentHandoffConfig = null; + + /** + * ConversationProfile notificationConfig. + * @member {google.cloud.dialogflow.v2beta1.INotificationConfig|null|undefined} notificationConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.notificationConfig = null; + + /** + * ConversationProfile loggingConfig. + * @member {google.cloud.dialogflow.v2beta1.ILoggingConfig|null|undefined} loggingConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.loggingConfig = null; + + /** + * ConversationProfile newMessageEventNotificationConfig. + * @member {google.cloud.dialogflow.v2beta1.INotificationConfig|null|undefined} newMessageEventNotificationConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.newMessageEventNotificationConfig = null; + + /** + * ConversationProfile sttConfig. + * @member {google.cloud.dialogflow.v2beta1.ISpeechToTextConfig|null|undefined} sttConfig + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.sttConfig = null; + + /** + * ConversationProfile languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.languageCode = ""; + + /** + * ConversationProfile timeZone. + * @member {string} timeZone + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.timeZone = ""; + + /** + * ConversationProfile securitySettings. + * @member {string} securitySettings + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + */ + ConversationProfile.prototype.securitySettings = ""; + + /** + * Creates a new ConversationProfile instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversationProfile=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ConversationProfile} ConversationProfile instance + */ + ConversationProfile.create = function create(properties) { + return new ConversationProfile(properties); + }; + + /** + * Encodes the specified ConversationProfile message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationProfile.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversationProfile} message ConversationProfile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationProfile.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.automatedAgentConfig != null && Object.hasOwnProperty.call(message, "automatedAgentConfig")) + $root.google.cloud.dialogflow.v2beta1.AutomatedAgentConfig.encode(message.automatedAgentConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.humanAgentAssistantConfig != null && Object.hasOwnProperty.call(message, "humanAgentAssistantConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.encode(message.humanAgentAssistantConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.humanAgentHandoffConfig != null && Object.hasOwnProperty.call(message, "humanAgentHandoffConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.encode(message.humanAgentHandoffConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.notificationConfig != null && Object.hasOwnProperty.call(message, "notificationConfig")) + $root.google.cloud.dialogflow.v2beta1.NotificationConfig.encode(message.notificationConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.loggingConfig != null && Object.hasOwnProperty.call(message, "loggingConfig")) + $root.google.cloud.dialogflow.v2beta1.LoggingConfig.encode(message.loggingConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.newMessageEventNotificationConfig != null && Object.hasOwnProperty.call(message, "newMessageEventNotificationConfig")) + $root.google.cloud.dialogflow.v2beta1.NotificationConfig.encode(message.newMessageEventNotificationConfig, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sttConfig != null && Object.hasOwnProperty.call(message, "sttConfig")) + $root.google.cloud.dialogflow.v2beta1.SpeechToTextConfig.encode(message.sttConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.languageCode); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.securitySettings != null && Object.hasOwnProperty.call(message, "securitySettings")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.securitySettings); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.timeZone); + return writer; + }; + + /** + * Encodes the specified ConversationProfile message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ConversationProfile.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @static + * @param {google.cloud.dialogflow.v2beta1.IConversationProfile} message ConversationProfile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationProfile.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationProfile message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ConversationProfile} ConversationProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationProfile.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ConversationProfile(); + 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 11: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 12: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.automatedAgentConfig = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.humanAgentAssistantConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.humanAgentHandoffConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.decode(reader, reader.uint32()); + break; + } + case 6: { + message.notificationConfig = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.loggingConfig = $root.google.cloud.dialogflow.v2beta1.LoggingConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + message.newMessageEventNotificationConfig = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sttConfig = $root.google.cloud.dialogflow.v2beta1.SpeechToTextConfig.decode(reader, reader.uint32()); + break; + } + case 10: { + message.languageCode = reader.string(); + break; + } + case 14: { + message.timeZone = reader.string(); + break; + } + case 13: { + message.securitySettings = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationProfile message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ConversationProfile} ConversationProfile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationProfile.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationProfile message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationProfile.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.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; + } + if (message.automatedAgentConfig != null && message.hasOwnProperty("automatedAgentConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentConfig.verify(message.automatedAgentConfig); + if (error) + return "automatedAgentConfig." + error; + } + if (message.humanAgentAssistantConfig != null && message.hasOwnProperty("humanAgentAssistantConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.verify(message.humanAgentAssistantConfig); + if (error) + return "humanAgentAssistantConfig." + error; + } + if (message.humanAgentHandoffConfig != null && message.hasOwnProperty("humanAgentHandoffConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.verify(message.humanAgentHandoffConfig); + if (error) + return "humanAgentHandoffConfig." + error; + } + if (message.notificationConfig != null && message.hasOwnProperty("notificationConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.verify(message.notificationConfig); + if (error) + return "notificationConfig." + error; + } + if (message.loggingConfig != null && message.hasOwnProperty("loggingConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.LoggingConfig.verify(message.loggingConfig); + if (error) + return "loggingConfig." + error; + } + if (message.newMessageEventNotificationConfig != null && message.hasOwnProperty("newMessageEventNotificationConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.verify(message.newMessageEventNotificationConfig); + if (error) + return "newMessageEventNotificationConfig." + error; + } + if (message.sttConfig != null && message.hasOwnProperty("sttConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.SpeechToTextConfig.verify(message.sttConfig); + if (error) + return "sttConfig." + error; + } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.securitySettings != null && message.hasOwnProperty("securitySettings")) + if (!$util.isString(message.securitySettings)) + return "securitySettings: string expected"; + return null; + }; + + /** + * Creates a ConversationProfile message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ConversationProfile} ConversationProfile + */ + ConversationProfile.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ConversationProfile) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ConversationProfile(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationProfile.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.dialogflow.v2beta1.ConversationProfile.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.automatedAgentConfig != null) { + if (typeof object.automatedAgentConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationProfile.automatedAgentConfig: object expected"); + message.automatedAgentConfig = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentConfig.fromObject(object.automatedAgentConfig); + } + if (object.humanAgentAssistantConfig != null) { + if (typeof object.humanAgentAssistantConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationProfile.humanAgentAssistantConfig: object expected"); + message.humanAgentAssistantConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.fromObject(object.humanAgentAssistantConfig); + } + if (object.humanAgentHandoffConfig != null) { + if (typeof object.humanAgentHandoffConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationProfile.humanAgentHandoffConfig: object expected"); + message.humanAgentHandoffConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.fromObject(object.humanAgentHandoffConfig); + } + if (object.notificationConfig != null) { + if (typeof object.notificationConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationProfile.notificationConfig: object expected"); + message.notificationConfig = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.fromObject(object.notificationConfig); + } + if (object.loggingConfig != null) { + if (typeof object.loggingConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationProfile.loggingConfig: object expected"); + message.loggingConfig = $root.google.cloud.dialogflow.v2beta1.LoggingConfig.fromObject(object.loggingConfig); + } + if (object.newMessageEventNotificationConfig != null) { + if (typeof object.newMessageEventNotificationConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationProfile.newMessageEventNotificationConfig: object expected"); + message.newMessageEventNotificationConfig = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.fromObject(object.newMessageEventNotificationConfig); + } + if (object.sttConfig != null) { + if (typeof object.sttConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ConversationProfile.sttConfig: object expected"); + message.sttConfig = $root.google.cloud.dialogflow.v2beta1.SpeechToTextConfig.fromObject(object.sttConfig); + } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.securitySettings != null) + message.securitySettings = String(object.securitySettings); + return message; + }; + + /** + * Creates a plain object from a ConversationProfile message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @static + * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} message ConversationProfile + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationProfile.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.automatedAgentConfig = null; + object.humanAgentAssistantConfig = null; + object.humanAgentHandoffConfig = null; + object.notificationConfig = null; + object.loggingConfig = null; + object.newMessageEventNotificationConfig = null; + object.sttConfig = null; + object.languageCode = ""; + object.createTime = null; + object.updateTime = null; + object.securitySettings = ""; + object.timeZone = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.automatedAgentConfig != null && message.hasOwnProperty("automatedAgentConfig")) + object.automatedAgentConfig = $root.google.cloud.dialogflow.v2beta1.AutomatedAgentConfig.toObject(message.automatedAgentConfig, options); + if (message.humanAgentAssistantConfig != null && message.hasOwnProperty("humanAgentAssistantConfig")) + object.humanAgentAssistantConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.toObject(message.humanAgentAssistantConfig, options); + if (message.humanAgentHandoffConfig != null && message.hasOwnProperty("humanAgentHandoffConfig")) + object.humanAgentHandoffConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.toObject(message.humanAgentHandoffConfig, options); + if (message.notificationConfig != null && message.hasOwnProperty("notificationConfig")) + object.notificationConfig = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.toObject(message.notificationConfig, options); + if (message.loggingConfig != null && message.hasOwnProperty("loggingConfig")) + object.loggingConfig = $root.google.cloud.dialogflow.v2beta1.LoggingConfig.toObject(message.loggingConfig, options); + if (message.newMessageEventNotificationConfig != null && message.hasOwnProperty("newMessageEventNotificationConfig")) + object.newMessageEventNotificationConfig = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.toObject(message.newMessageEventNotificationConfig, options); + if (message.sttConfig != null && message.hasOwnProperty("sttConfig")) + object.sttConfig = $root.google.cloud.dialogflow.v2beta1.SpeechToTextConfig.toObject(message.sttConfig, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.securitySettings != null && message.hasOwnProperty("securitySettings")) + object.securitySettings = message.securitySettings; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + return object; + }; + + /** + * Converts this ConversationProfile to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @instance + * @returns {Object.} JSON object + */ + ConversationProfile.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationProfile + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ConversationProfile + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationProfile.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ConversationProfile"; + }; + + return ConversationProfile; + })(); + + v2beta1.AutomatedAgentConfig = (function() { + + /** + * Properties of an AutomatedAgentConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IAutomatedAgentConfig + * @property {string|null} [agent] AutomatedAgentConfig agent + */ + + /** + * Constructs a new AutomatedAgentConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an AutomatedAgentConfig. + * @implements IAutomatedAgentConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig=} [properties] Properties to set + */ + function AutomatedAgentConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AutomatedAgentConfig agent. + * @member {string} agent + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @instance + */ + AutomatedAgentConfig.prototype.agent = ""; + + /** + * Creates a new AutomatedAgentConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.AutomatedAgentConfig} AutomatedAgentConfig instance + */ + AutomatedAgentConfig.create = function create(properties) { + return new AutomatedAgentConfig(properties); + }; + + /** + * Encodes the specified AutomatedAgentConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AutomatedAgentConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig} message AutomatedAgentConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutomatedAgentConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agent != null && Object.hasOwnProperty.call(message, "agent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.agent); + return writer; + }; + + /** + * Encodes the specified AutomatedAgentConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.AutomatedAgentConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IAutomatedAgentConfig} message AutomatedAgentConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AutomatedAgentConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AutomatedAgentConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.AutomatedAgentConfig} AutomatedAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutomatedAgentConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.AutomatedAgentConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AutomatedAgentConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.AutomatedAgentConfig} AutomatedAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AutomatedAgentConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AutomatedAgentConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AutomatedAgentConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agent != null && message.hasOwnProperty("agent")) + if (!$util.isString(message.agent)) + return "agent: string expected"; + return null; + }; + + /** + * Creates an AutomatedAgentConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.AutomatedAgentConfig} AutomatedAgentConfig + */ + AutomatedAgentConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.AutomatedAgentConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.AutomatedAgentConfig(); + if (object.agent != null) + message.agent = String(object.agent); + return message; + }; + + /** + * Creates a plain object from an AutomatedAgentConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.AutomatedAgentConfig} message AutomatedAgentConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AutomatedAgentConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.agent = ""; + if (message.agent != null && message.hasOwnProperty("agent")) + object.agent = message.agent; + return object; + }; + + /** + * Converts this AutomatedAgentConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @instance + * @returns {Object.} JSON object + */ + AutomatedAgentConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AutomatedAgentConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.AutomatedAgentConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AutomatedAgentConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.AutomatedAgentConfig"; + }; + + return AutomatedAgentConfig; + })(); + + v2beta1.HumanAgentAssistantConfig = (function() { + + /** + * Properties of a HumanAgentAssistantConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IHumanAgentAssistantConfig + * @property {google.cloud.dialogflow.v2beta1.INotificationConfig|null} [notificationConfig] HumanAgentAssistantConfig notificationConfig + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig|null} [humanAgentSuggestionConfig] HumanAgentAssistantConfig humanAgentSuggestionConfig + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig|null} [endUserSuggestionConfig] HumanAgentAssistantConfig endUserSuggestionConfig + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig|null} [messageAnalysisConfig] HumanAgentAssistantConfig messageAnalysisConfig + */ + + /** + * Constructs a new HumanAgentAssistantConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a HumanAgentAssistantConfig. + * @implements IHumanAgentAssistantConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig=} [properties] Properties to set + */ + function HumanAgentAssistantConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HumanAgentAssistantConfig notificationConfig. + * @member {google.cloud.dialogflow.v2beta1.INotificationConfig|null|undefined} notificationConfig + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @instance + */ + HumanAgentAssistantConfig.prototype.notificationConfig = null; + + /** + * HumanAgentAssistantConfig humanAgentSuggestionConfig. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig|null|undefined} humanAgentSuggestionConfig + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @instance + */ + HumanAgentAssistantConfig.prototype.humanAgentSuggestionConfig = null; + + /** + * HumanAgentAssistantConfig endUserSuggestionConfig. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig|null|undefined} endUserSuggestionConfig + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @instance + */ + HumanAgentAssistantConfig.prototype.endUserSuggestionConfig = null; + + /** + * HumanAgentAssistantConfig messageAnalysisConfig. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig|null|undefined} messageAnalysisConfig + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @instance + */ + HumanAgentAssistantConfig.prototype.messageAnalysisConfig = null; + + /** + * Creates a new HumanAgentAssistantConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig} HumanAgentAssistantConfig instance + */ + HumanAgentAssistantConfig.create = function create(properties) { + return new HumanAgentAssistantConfig(properties); + }; + + /** + * Encodes the specified HumanAgentAssistantConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig} message HumanAgentAssistantConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentAssistantConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.notificationConfig != null && Object.hasOwnProperty.call(message, "notificationConfig")) + $root.google.cloud.dialogflow.v2beta1.NotificationConfig.encode(message.notificationConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.humanAgentSuggestionConfig != null && Object.hasOwnProperty.call(message, "humanAgentSuggestionConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.encode(message.humanAgentSuggestionConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.endUserSuggestionConfig != null && Object.hasOwnProperty.call(message, "endUserSuggestionConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.encode(message.endUserSuggestionConfig, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.messageAnalysisConfig != null && Object.hasOwnProperty.call(message, "messageAnalysisConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig.encode(message.messageAnalysisConfig, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HumanAgentAssistantConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantConfig} message HumanAgentAssistantConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentAssistantConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HumanAgentAssistantConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig} HumanAgentAssistantConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentAssistantConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.notificationConfig = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.decode(reader, reader.uint32()); + break; + } + case 3: { + message.humanAgentSuggestionConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.decode(reader, reader.uint32()); + break; + } + case 4: { + message.endUserSuggestionConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.decode(reader, reader.uint32()); + break; + } + case 5: { + message.messageAnalysisConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HumanAgentAssistantConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig} HumanAgentAssistantConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentAssistantConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HumanAgentAssistantConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HumanAgentAssistantConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.notificationConfig != null && message.hasOwnProperty("notificationConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.verify(message.notificationConfig); + if (error) + return "notificationConfig." + error; + } + if (message.humanAgentSuggestionConfig != null && message.hasOwnProperty("humanAgentSuggestionConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.verify(message.humanAgentSuggestionConfig); + if (error) + return "humanAgentSuggestionConfig." + error; + } + if (message.endUserSuggestionConfig != null && message.hasOwnProperty("endUserSuggestionConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.verify(message.endUserSuggestionConfig); + if (error) + return "endUserSuggestionConfig." + error; + } + if (message.messageAnalysisConfig != null && message.hasOwnProperty("messageAnalysisConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig.verify(message.messageAnalysisConfig); + if (error) + return "messageAnalysisConfig." + error; + } + return null; + }; + + /** + * Creates a HumanAgentAssistantConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig} HumanAgentAssistantConfig + */ + HumanAgentAssistantConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig(); + if (object.notificationConfig != null) { + if (typeof object.notificationConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.notificationConfig: object expected"); + message.notificationConfig = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.fromObject(object.notificationConfig); + } + if (object.humanAgentSuggestionConfig != null) { + if (typeof object.humanAgentSuggestionConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.humanAgentSuggestionConfig: object expected"); + message.humanAgentSuggestionConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.fromObject(object.humanAgentSuggestionConfig); + } + if (object.endUserSuggestionConfig != null) { + if (typeof object.endUserSuggestionConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.endUserSuggestionConfig: object expected"); + message.endUserSuggestionConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.fromObject(object.endUserSuggestionConfig); + } + if (object.messageAnalysisConfig != null) { + if (typeof object.messageAnalysisConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.messageAnalysisConfig: object expected"); + message.messageAnalysisConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig.fromObject(object.messageAnalysisConfig); + } + return message; + }; + + /** + * Creates a plain object from a HumanAgentAssistantConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig} message HumanAgentAssistantConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HumanAgentAssistantConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.notificationConfig = null; + object.humanAgentSuggestionConfig = null; + object.endUserSuggestionConfig = null; + object.messageAnalysisConfig = null; + } + if (message.notificationConfig != null && message.hasOwnProperty("notificationConfig")) + object.notificationConfig = $root.google.cloud.dialogflow.v2beta1.NotificationConfig.toObject(message.notificationConfig, options); + if (message.humanAgentSuggestionConfig != null && message.hasOwnProperty("humanAgentSuggestionConfig")) + object.humanAgentSuggestionConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.toObject(message.humanAgentSuggestionConfig, options); + if (message.endUserSuggestionConfig != null && message.hasOwnProperty("endUserSuggestionConfig")) + object.endUserSuggestionConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.toObject(message.endUserSuggestionConfig, options); + if (message.messageAnalysisConfig != null && message.hasOwnProperty("messageAnalysisConfig")) + object.messageAnalysisConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig.toObject(message.messageAnalysisConfig, options); + return object; + }; + + /** + * Converts this HumanAgentAssistantConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @instance + * @returns {Object.} JSON object + */ + HumanAgentAssistantConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HumanAgentAssistantConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanAgentAssistantConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig"; + }; + + HumanAgentAssistantConfig.SuggestionTriggerSettings = (function() { + + /** + * Properties of a SuggestionTriggerSettings. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @interface ISuggestionTriggerSettings + * @property {boolean|null} [noSmallTalk] SuggestionTriggerSettings noSmallTalk + * @property {boolean|null} [onlyEndUser] SuggestionTriggerSettings onlyEndUser + */ + + /** + * Constructs a new SuggestionTriggerSettings. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @classdesc Represents a SuggestionTriggerSettings. + * @implements ISuggestionTriggerSettings + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings=} [properties] Properties to set + */ + function SuggestionTriggerSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionTriggerSettings noSmallTalk. + * @member {boolean} noSmallTalk + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @instance + */ + SuggestionTriggerSettings.prototype.noSmallTalk = false; + + /** + * SuggestionTriggerSettings onlyEndUser. + * @member {boolean} onlyEndUser + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @instance + */ + SuggestionTriggerSettings.prototype.onlyEndUser = false; + + /** + * Creates a new SuggestionTriggerSettings instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings} SuggestionTriggerSettings instance + */ + SuggestionTriggerSettings.create = function create(properties) { + return new SuggestionTriggerSettings(properties); + }; + + /** + * Encodes the specified SuggestionTriggerSettings message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings} message SuggestionTriggerSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionTriggerSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.noSmallTalk != null && Object.hasOwnProperty.call(message, "noSmallTalk")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.noSmallTalk); + if (message.onlyEndUser != null && Object.hasOwnProperty.call(message, "onlyEndUser")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.onlyEndUser); + return writer; + }; + + /** + * Encodes the specified SuggestionTriggerSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings} message SuggestionTriggerSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionTriggerSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionTriggerSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings} SuggestionTriggerSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionTriggerSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.noSmallTalk = reader.bool(); + break; + } + case 2: { + message.onlyEndUser = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionTriggerSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings} SuggestionTriggerSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionTriggerSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionTriggerSettings message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionTriggerSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.noSmallTalk != null && message.hasOwnProperty("noSmallTalk")) + if (typeof message.noSmallTalk !== "boolean") + return "noSmallTalk: boolean expected"; + if (message.onlyEndUser != null && message.hasOwnProperty("onlyEndUser")) + if (typeof message.onlyEndUser !== "boolean") + return "onlyEndUser: boolean expected"; + return null; + }; + + /** + * Creates a SuggestionTriggerSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings} SuggestionTriggerSettings + */ + SuggestionTriggerSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings(); + if (object.noSmallTalk != null) + message.noSmallTalk = Boolean(object.noSmallTalk); + if (object.onlyEndUser != null) + message.onlyEndUser = Boolean(object.onlyEndUser); + return message; + }; + + /** + * Creates a plain object from a SuggestionTriggerSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings} message SuggestionTriggerSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionTriggerSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.noSmallTalk = false; + object.onlyEndUser = false; + } + if (message.noSmallTalk != null && message.hasOwnProperty("noSmallTalk")) + object.noSmallTalk = message.noSmallTalk; + if (message.onlyEndUser != null && message.hasOwnProperty("onlyEndUser")) + object.onlyEndUser = message.onlyEndUser; + return object; + }; + + /** + * Converts this SuggestionTriggerSettings to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @instance + * @returns {Object.} JSON object + */ + SuggestionTriggerSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionTriggerSettings + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionTriggerSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings"; + }; + + return SuggestionTriggerSettings; + })(); + + HumanAgentAssistantConfig.SuggestionFeatureConfig = (function() { + + /** + * Properties of a SuggestionFeatureConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @interface ISuggestionFeatureConfig + * @property {google.cloud.dialogflow.v2beta1.ISuggestionFeature|null} [suggestionFeature] SuggestionFeatureConfig suggestionFeature + * @property {boolean|null} [enableEventBasedSuggestion] SuggestionFeatureConfig enableEventBasedSuggestion + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings|null} [suggestionTriggerSettings] SuggestionFeatureConfig suggestionTriggerSettings + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig|null} [queryConfig] SuggestionFeatureConfig queryConfig + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig|null} [conversationModelConfig] SuggestionFeatureConfig conversationModelConfig + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig|null} [conversationProcessConfig] SuggestionFeatureConfig conversationProcessConfig + */ + + /** + * Constructs a new SuggestionFeatureConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @classdesc Represents a SuggestionFeatureConfig. + * @implements ISuggestionFeatureConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig=} [properties] Properties to set + */ + function SuggestionFeatureConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionFeatureConfig suggestionFeature. + * @member {google.cloud.dialogflow.v2beta1.ISuggestionFeature|null|undefined} suggestionFeature + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.suggestionFeature = null; + + /** + * SuggestionFeatureConfig enableEventBasedSuggestion. + * @member {boolean} enableEventBasedSuggestion + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.enableEventBasedSuggestion = false; + + /** + * SuggestionFeatureConfig suggestionTriggerSettings. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionTriggerSettings|null|undefined} suggestionTriggerSettings + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.suggestionTriggerSettings = null; + + /** + * SuggestionFeatureConfig queryConfig. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig|null|undefined} queryConfig + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.queryConfig = null; + + /** + * SuggestionFeatureConfig conversationModelConfig. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig|null|undefined} conversationModelConfig + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.conversationModelConfig = null; + + /** + * SuggestionFeatureConfig conversationProcessConfig. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig|null|undefined} conversationProcessConfig + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + */ + SuggestionFeatureConfig.prototype.conversationProcessConfig = null; + + /** + * Creates a new SuggestionFeatureConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig} SuggestionFeatureConfig instance + */ + SuggestionFeatureConfig.create = function create(properties) { + return new SuggestionFeatureConfig(properties); + }; + + /** + * Encodes the specified SuggestionFeatureConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig} message SuggestionFeatureConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionFeatureConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableEventBasedSuggestion != null && Object.hasOwnProperty.call(message, "enableEventBasedSuggestion")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableEventBasedSuggestion); + if (message.suggestionFeature != null && Object.hasOwnProperty.call(message, "suggestionFeature")) + $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.encode(message.suggestionFeature, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.queryConfig != null && Object.hasOwnProperty.call(message, "queryConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.encode(message.queryConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.conversationModelConfig != null && Object.hasOwnProperty.call(message, "conversationModelConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig.encode(message.conversationModelConfig, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.conversationProcessConfig != null && Object.hasOwnProperty.call(message, "conversationProcessConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig.encode(message.conversationProcessConfig, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.suggestionTriggerSettings != null && Object.hasOwnProperty.call(message, "suggestionTriggerSettings")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings.encode(message.suggestionTriggerSettings, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestionFeatureConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig} message SuggestionFeatureConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionFeatureConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionFeatureConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig} SuggestionFeatureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionFeatureConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 5: { + message.suggestionFeature = $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.decode(reader, reader.uint32()); + break; + } + case 3: { + message.enableEventBasedSuggestion = reader.bool(); + break; + } + case 10: { + message.suggestionTriggerSettings = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings.decode(reader, reader.uint32()); + break; + } + case 6: { + message.queryConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.conversationModelConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig.decode(reader, reader.uint32()); + break; + } + case 8: { + message.conversationProcessConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionFeatureConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig} SuggestionFeatureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionFeatureConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionFeatureConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionFeatureConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.suggestionFeature != null && message.hasOwnProperty("suggestionFeature")) { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.verify(message.suggestionFeature); + if (error) + return "suggestionFeature." + error; + } + if (message.enableEventBasedSuggestion != null && message.hasOwnProperty("enableEventBasedSuggestion")) + if (typeof message.enableEventBasedSuggestion !== "boolean") + return "enableEventBasedSuggestion: boolean expected"; + if (message.suggestionTriggerSettings != null && message.hasOwnProperty("suggestionTriggerSettings")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings.verify(message.suggestionTriggerSettings); + if (error) + return "suggestionTriggerSettings." + error; + } + if (message.queryConfig != null && message.hasOwnProperty("queryConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.verify(message.queryConfig); + if (error) + return "queryConfig." + error; + } + if (message.conversationModelConfig != null && message.hasOwnProperty("conversationModelConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig.verify(message.conversationModelConfig); + if (error) + return "conversationModelConfig." + error; + } + if (message.conversationProcessConfig != null && message.hasOwnProperty("conversationProcessConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig.verify(message.conversationProcessConfig); + if (error) + return "conversationProcessConfig." + error; + } + return null; + }; + + /** + * Creates a SuggestionFeatureConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig} SuggestionFeatureConfig + */ + SuggestionFeatureConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig(); + if (object.suggestionFeature != null) { + if (typeof object.suggestionFeature !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.suggestionFeature: object expected"); + message.suggestionFeature = $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.fromObject(object.suggestionFeature); + } + if (object.enableEventBasedSuggestion != null) + message.enableEventBasedSuggestion = Boolean(object.enableEventBasedSuggestion); + if (object.suggestionTriggerSettings != null) { + if (typeof object.suggestionTriggerSettings !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.suggestionTriggerSettings: object expected"); + message.suggestionTriggerSettings = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings.fromObject(object.suggestionTriggerSettings); + } + if (object.queryConfig != null) { + if (typeof object.queryConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.queryConfig: object expected"); + message.queryConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.fromObject(object.queryConfig); + } + if (object.conversationModelConfig != null) { + if (typeof object.conversationModelConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.conversationModelConfig: object expected"); + message.conversationModelConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig.fromObject(object.conversationModelConfig); + } + if (object.conversationProcessConfig != null) { + if (typeof object.conversationProcessConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.conversationProcessConfig: object expected"); + message.conversationProcessConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig.fromObject(object.conversationProcessConfig); + } + return message; + }; + + /** + * Creates a plain object from a SuggestionFeatureConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig} message SuggestionFeatureConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionFeatureConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.enableEventBasedSuggestion = false; + object.suggestionFeature = null; + object.queryConfig = null; + object.conversationModelConfig = null; + object.conversationProcessConfig = null; + object.suggestionTriggerSettings = null; + } + if (message.enableEventBasedSuggestion != null && message.hasOwnProperty("enableEventBasedSuggestion")) + object.enableEventBasedSuggestion = message.enableEventBasedSuggestion; + if (message.suggestionFeature != null && message.hasOwnProperty("suggestionFeature")) + object.suggestionFeature = $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.toObject(message.suggestionFeature, options); + if (message.queryConfig != null && message.hasOwnProperty("queryConfig")) + object.queryConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.toObject(message.queryConfig, options); + if (message.conversationModelConfig != null && message.hasOwnProperty("conversationModelConfig")) + object.conversationModelConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig.toObject(message.conversationModelConfig, options); + if (message.conversationProcessConfig != null && message.hasOwnProperty("conversationProcessConfig")) + object.conversationProcessConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig.toObject(message.conversationProcessConfig, options); + if (message.suggestionTriggerSettings != null && message.hasOwnProperty("suggestionTriggerSettings")) + object.suggestionTriggerSettings = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionTriggerSettings.toObject(message.suggestionTriggerSettings, options); + return object; + }; + + /** + * Converts this SuggestionFeatureConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @instance + * @returns {Object.} JSON object + */ + SuggestionFeatureConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionFeatureConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionFeatureConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig"; + }; + + return SuggestionFeatureConfig; + })(); + + HumanAgentAssistantConfig.SuggestionConfig = (function() { + + /** + * Properties of a SuggestionConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @interface ISuggestionConfig + * @property {Array.|null} [featureConfigs] SuggestionConfig featureConfigs + * @property {boolean|null} [groupSuggestionResponses] SuggestionConfig groupSuggestionResponses + */ + + /** + * Constructs a new SuggestionConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @classdesc Represents a SuggestionConfig. + * @implements ISuggestionConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig=} [properties] Properties to set + */ + function SuggestionConfig(properties) { + this.featureConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionConfig featureConfigs. + * @member {Array.} featureConfigs + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @instance + */ + SuggestionConfig.prototype.featureConfigs = $util.emptyArray; + + /** + * SuggestionConfig groupSuggestionResponses. + * @member {boolean} groupSuggestionResponses + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @instance + */ + SuggestionConfig.prototype.groupSuggestionResponses = false; + + /** + * Creates a new SuggestionConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig} SuggestionConfig instance + */ + SuggestionConfig.create = function create(properties) { + return new SuggestionConfig(properties); + }; + + /** + * Encodes the specified SuggestionConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig} message SuggestionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.featureConfigs != null && message.featureConfigs.length) + for (var i = 0; i < message.featureConfigs.length; ++i) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.encode(message.featureConfigs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.groupSuggestionResponses != null && Object.hasOwnProperty.call(message, "groupSuggestionResponses")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.groupSuggestionResponses); + return writer; + }; + + /** + * Encodes the specified SuggestionConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionConfig} message SuggestionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig} SuggestionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (!(message.featureConfigs && message.featureConfigs.length)) + message.featureConfigs = []; + message.featureConfigs.push($root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.decode(reader, reader.uint32())); + break; + } + case 3: { + message.groupSuggestionResponses = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig} SuggestionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.featureConfigs != null && message.hasOwnProperty("featureConfigs")) { + if (!Array.isArray(message.featureConfigs)) + return "featureConfigs: array expected"; + for (var i = 0; i < message.featureConfigs.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify(message.featureConfigs[i]); + if (error) + return "featureConfigs." + error; + } + } + if (message.groupSuggestionResponses != null && message.hasOwnProperty("groupSuggestionResponses")) + if (typeof message.groupSuggestionResponses !== "boolean") + return "groupSuggestionResponses: boolean expected"; + return null; + }; + + /** + * Creates a SuggestionConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig} SuggestionConfig + */ + SuggestionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig(); + if (object.featureConfigs) { + if (!Array.isArray(object.featureConfigs)) + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.featureConfigs: array expected"); + message.featureConfigs = []; + for (var i = 0; i < object.featureConfigs.length; ++i) { + if (typeof object.featureConfigs[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig.featureConfigs: object expected"); + message.featureConfigs[i] = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.fromObject(object.featureConfigs[i]); + } + } + if (object.groupSuggestionResponses != null) + message.groupSuggestionResponses = Boolean(object.groupSuggestionResponses); + return message; + }; + + /** + * Creates a plain object from a SuggestionConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig} message SuggestionConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.featureConfigs = []; + if (options.defaults) + object.groupSuggestionResponses = false; + if (message.featureConfigs && message.featureConfigs.length) { + object.featureConfigs = []; + for (var j = 0; j < message.featureConfigs.length; ++j) + object.featureConfigs[j] = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.toObject(message.featureConfigs[j], options); + } + if (message.groupSuggestionResponses != null && message.hasOwnProperty("groupSuggestionResponses")) + object.groupSuggestionResponses = message.groupSuggestionResponses; + return object; + }; + + /** + * Converts this SuggestionConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @instance + * @returns {Object.} JSON object + */ + SuggestionConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionConfig"; + }; + + return SuggestionConfig; + })(); + + HumanAgentAssistantConfig.SuggestionQueryConfig = (function() { + + /** + * Properties of a SuggestionQueryConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @interface ISuggestionQueryConfig + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource|null} [knowledgeBaseQuerySource] SuggestionQueryConfig knowledgeBaseQuerySource + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource|null} [documentQuerySource] SuggestionQueryConfig documentQuerySource + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource|null} [dialogflowQuerySource] SuggestionQueryConfig dialogflowQuerySource + * @property {number|null} [maxResults] SuggestionQueryConfig maxResults + * @property {number|null} [confidenceThreshold] SuggestionQueryConfig confidenceThreshold + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings|null} [contextFilterSettings] SuggestionQueryConfig contextFilterSettings + */ + + /** + * Constructs a new SuggestionQueryConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @classdesc Represents a SuggestionQueryConfig. + * @implements ISuggestionQueryConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig=} [properties] Properties to set + */ + function SuggestionQueryConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuggestionQueryConfig knowledgeBaseQuerySource. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource|null|undefined} knowledgeBaseQuerySource + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.knowledgeBaseQuerySource = null; + + /** + * SuggestionQueryConfig documentQuerySource. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource|null|undefined} documentQuerySource + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.documentQuerySource = null; + + /** + * SuggestionQueryConfig dialogflowQuerySource. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource|null|undefined} dialogflowQuerySource + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.dialogflowQuerySource = null; + + /** + * SuggestionQueryConfig maxResults. + * @member {number} maxResults + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.maxResults = 0; + + /** + * SuggestionQueryConfig confidenceThreshold. + * @member {number} confidenceThreshold + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.confidenceThreshold = 0; + + /** + * SuggestionQueryConfig contextFilterSettings. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings|null|undefined} contextFilterSettings + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + SuggestionQueryConfig.prototype.contextFilterSettings = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SuggestionQueryConfig querySource. + * @member {"knowledgeBaseQuerySource"|"documentQuerySource"|"dialogflowQuerySource"|undefined} querySource + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + */ + Object.defineProperty(SuggestionQueryConfig.prototype, "querySource", { + get: $util.oneOfGetter($oneOfFields = ["knowledgeBaseQuerySource", "documentQuerySource", "dialogflowQuerySource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SuggestionQueryConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig} SuggestionQueryConfig instance + */ + SuggestionQueryConfig.create = function create(properties) { + return new SuggestionQueryConfig(properties); + }; + + /** + * Encodes the specified SuggestionQueryConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig} message SuggestionQueryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionQueryConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.knowledgeBaseQuerySource != null && Object.hasOwnProperty.call(message, "knowledgeBaseQuerySource")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.encode(message.knowledgeBaseQuerySource, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.documentQuerySource != null && Object.hasOwnProperty.call(message, "documentQuerySource")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.encode(message.documentQuerySource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dialogflowQuerySource != null && Object.hasOwnProperty.call(message, "dialogflowQuerySource")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.encode(message.dialogflowQuerySource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.maxResults); + if (message.confidenceThreshold != null && Object.hasOwnProperty.call(message, "confidenceThreshold")) + writer.uint32(/* id 5, wireType 5 =*/45).float(message.confidenceThreshold); + if (message.contextFilterSettings != null && Object.hasOwnProperty.call(message, "contextFilterSettings")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.encode(message.contextFilterSettings, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SuggestionQueryConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionQueryConfig} message SuggestionQueryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuggestionQueryConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuggestionQueryConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig} SuggestionQueryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionQueryConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.knowledgeBaseQuerySource = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.documentQuerySource = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.decode(reader, reader.uint32()); + break; + } + case 3: { + message.dialogflowQuerySource = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.decode(reader, reader.uint32()); + break; + } + case 4: { + message.maxResults = reader.int32(); + break; + } + case 5: { + message.confidenceThreshold = reader.float(); + break; + } + case 7: { + message.contextFilterSettings = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuggestionQueryConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig} SuggestionQueryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuggestionQueryConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuggestionQueryConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuggestionQueryConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.knowledgeBaseQuerySource != null && message.hasOwnProperty("knowledgeBaseQuerySource")) { + properties.querySource = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify(message.knowledgeBaseQuerySource); + if (error) + return "knowledgeBaseQuerySource." + error; + } + } + if (message.documentQuerySource != null && message.hasOwnProperty("documentQuerySource")) { + if (properties.querySource === 1) + return "querySource: multiple values"; + properties.querySource = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify(message.documentQuerySource); + if (error) + return "documentQuerySource." + error; + } + } + if (message.dialogflowQuerySource != null && message.hasOwnProperty("dialogflowQuerySource")) { + if (properties.querySource === 1) + return "querySource: multiple values"; + properties.querySource = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify(message.dialogflowQuerySource); + if (error) + return "dialogflowQuerySource." + error; + } + } + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.confidenceThreshold != null && message.hasOwnProperty("confidenceThreshold")) + if (typeof message.confidenceThreshold !== "number") + return "confidenceThreshold: number expected"; + if (message.contextFilterSettings != null && message.hasOwnProperty("contextFilterSettings")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify(message.contextFilterSettings); + if (error) + return "contextFilterSettings." + error; + } + return null; + }; + + /** + * Creates a SuggestionQueryConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig} SuggestionQueryConfig + */ + SuggestionQueryConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig(); + if (object.knowledgeBaseQuerySource != null) { + if (typeof object.knowledgeBaseQuerySource !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.knowledgeBaseQuerySource: object expected"); + message.knowledgeBaseQuerySource = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.fromObject(object.knowledgeBaseQuerySource); + } + if (object.documentQuerySource != null) { + if (typeof object.documentQuerySource !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.documentQuerySource: object expected"); + message.documentQuerySource = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.fromObject(object.documentQuerySource); + } + if (object.dialogflowQuerySource != null) { + if (typeof object.dialogflowQuerySource !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.dialogflowQuerySource: object expected"); + message.dialogflowQuerySource = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.fromObject(object.dialogflowQuerySource); + } + if (object.maxResults != null) + message.maxResults = object.maxResults | 0; + if (object.confidenceThreshold != null) + message.confidenceThreshold = Number(object.confidenceThreshold); + if (object.contextFilterSettings != null) { + if (typeof object.contextFilterSettings !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.contextFilterSettings: object expected"); + message.contextFilterSettings = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.fromObject(object.contextFilterSettings); + } + return message; + }; + + /** + * Creates a plain object from a SuggestionQueryConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig} message SuggestionQueryConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuggestionQueryConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.maxResults = 0; + object.confidenceThreshold = 0; + object.contextFilterSettings = null; + } + if (message.knowledgeBaseQuerySource != null && message.hasOwnProperty("knowledgeBaseQuerySource")) { + object.knowledgeBaseQuerySource = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.toObject(message.knowledgeBaseQuerySource, options); + if (options.oneofs) + object.querySource = "knowledgeBaseQuerySource"; + } + if (message.documentQuerySource != null && message.hasOwnProperty("documentQuerySource")) { + object.documentQuerySource = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.toObject(message.documentQuerySource, options); + if (options.oneofs) + object.querySource = "documentQuerySource"; + } + if (message.dialogflowQuerySource != null && message.hasOwnProperty("dialogflowQuerySource")) { + object.dialogflowQuerySource = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.toObject(message.dialogflowQuerySource, options); + if (options.oneofs) + object.querySource = "dialogflowQuerySource"; + } + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.confidenceThreshold != null && message.hasOwnProperty("confidenceThreshold")) + object.confidenceThreshold = options.json && !isFinite(message.confidenceThreshold) ? String(message.confidenceThreshold) : message.confidenceThreshold; + if (message.contextFilterSettings != null && message.hasOwnProperty("contextFilterSettings")) + object.contextFilterSettings = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.toObject(message.contextFilterSettings, options); + return object; + }; + + /** + * Converts this SuggestionQueryConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @instance + * @returns {Object.} JSON object + */ + SuggestionQueryConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuggestionQueryConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuggestionQueryConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig"; + }; + + SuggestionQueryConfig.KnowledgeBaseQuerySource = (function() { + + /** + * Properties of a KnowledgeBaseQuerySource. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @interface IKnowledgeBaseQuerySource + * @property {Array.|null} [knowledgeBases] KnowledgeBaseQuerySource knowledgeBases + */ + + /** + * Constructs a new KnowledgeBaseQuerySource. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @classdesc Represents a KnowledgeBaseQuerySource. + * @implements IKnowledgeBaseQuerySource + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource=} [properties] Properties to set + */ + function KnowledgeBaseQuerySource(properties) { + this.knowledgeBases = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KnowledgeBaseQuerySource knowledgeBases. + * @member {Array.} knowledgeBases + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @instance + */ + KnowledgeBaseQuerySource.prototype.knowledgeBases = $util.emptyArray; + + /** + * Creates a new KnowledgeBaseQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} KnowledgeBaseQuerySource instance + */ + KnowledgeBaseQuerySource.create = function create(properties) { + return new KnowledgeBaseQuerySource(properties); + }; + + /** + * Encodes the specified KnowledgeBaseQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource} message KnowledgeBaseQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeBaseQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.knowledgeBases != null && message.knowledgeBases.length) + for (var i = 0; i < message.knowledgeBases.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.knowledgeBases[i]); + return writer; + }; + + /** + * Encodes the specified KnowledgeBaseQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IKnowledgeBaseQuerySource} message KnowledgeBaseQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeBaseQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KnowledgeBaseQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} KnowledgeBaseQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeBaseQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.knowledgeBases && message.knowledgeBases.length)) + message.knowledgeBases = []; + message.knowledgeBases.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KnowledgeBaseQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} KnowledgeBaseQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeBaseQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KnowledgeBaseQuerySource message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KnowledgeBaseQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.knowledgeBases != null && message.hasOwnProperty("knowledgeBases")) { + if (!Array.isArray(message.knowledgeBases)) + return "knowledgeBases: array expected"; + for (var i = 0; i < message.knowledgeBases.length; ++i) + if (!$util.isString(message.knowledgeBases[i])) + return "knowledgeBases: string[] expected"; + } + return null; + }; + + /** + * Creates a KnowledgeBaseQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} KnowledgeBaseQuerySource + */ + KnowledgeBaseQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource(); + if (object.knowledgeBases) { + if (!Array.isArray(object.knowledgeBases)) + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource.knowledgeBases: array expected"); + message.knowledgeBases = []; + for (var i = 0; i < object.knowledgeBases.length; ++i) + message.knowledgeBases[i] = String(object.knowledgeBases[i]); + } + return message; + }; + + /** + * Creates a plain object from a KnowledgeBaseQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource} message KnowledgeBaseQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KnowledgeBaseQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.knowledgeBases = []; + if (message.knowledgeBases && message.knowledgeBases.length) { + object.knowledgeBases = []; + for (var j = 0; j < message.knowledgeBases.length; ++j) + object.knowledgeBases[j] = message.knowledgeBases[j]; + } + return object; + }; + + /** + * Converts this KnowledgeBaseQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @instance + * @returns {Object.} JSON object + */ + KnowledgeBaseQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for KnowledgeBaseQuerySource + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KnowledgeBaseQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.KnowledgeBaseQuerySource"; + }; + + return KnowledgeBaseQuerySource; + })(); + + SuggestionQueryConfig.DocumentQuerySource = (function() { + + /** + * Properties of a DocumentQuerySource. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @interface IDocumentQuerySource + * @property {Array.|null} [documents] DocumentQuerySource documents + */ + + /** + * Constructs a new DocumentQuerySource. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @classdesc Represents a DocumentQuerySource. + * @implements IDocumentQuerySource + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource=} [properties] Properties to set + */ + function DocumentQuerySource(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DocumentQuerySource documents. + * @member {Array.} documents + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @instance + */ + DocumentQuerySource.prototype.documents = $util.emptyArray; + + /** + * Creates a new DocumentQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} DocumentQuerySource instance + */ + DocumentQuerySource.create = function create(properties) { + return new DocumentQuerySource(properties); + }; + + /** + * Encodes the specified DocumentQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource} message DocumentQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.documents[i]); + return writer; + }; + + /** + * Encodes the specified DocumentQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDocumentQuerySource} message DocumentQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DocumentQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DocumentQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} DocumentQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DocumentQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} DocumentQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DocumentQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DocumentQuerySource message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DocumentQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documents != null && message.hasOwnProperty("documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) + if (!$util.isString(message.documents[i])) + return "documents: string[] expected"; + } + return null; + }; + + /** + * Creates a DocumentQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} DocumentQuerySource + */ + DocumentQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) + message.documents[i] = String(object.documents[i]); + } + return message; + }; + + /** + * Creates a plain object from a DocumentQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource} message DocumentQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DocumentQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = message.documents[j]; + } + return object; + }; + + /** + * Converts this DocumentQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @instance + * @returns {Object.} JSON object + */ + DocumentQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DocumentQuerySource + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DocumentQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DocumentQuerySource"; + }; + + return DocumentQuerySource; + })(); + + SuggestionQueryConfig.DialogflowQuerySource = (function() { + + /** + * Properties of a DialogflowQuerySource. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @interface IDialogflowQuerySource + * @property {string|null} [agent] DialogflowQuerySource agent + */ + + /** + * Constructs a new DialogflowQuerySource. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @classdesc Represents a DialogflowQuerySource. + * @implements IDialogflowQuerySource + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource=} [properties] Properties to set + */ + function DialogflowQuerySource(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DialogflowQuerySource agent. + * @member {string} agent + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @instance + */ + DialogflowQuerySource.prototype.agent = ""; + + /** + * Creates a new DialogflowQuerySource instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} DialogflowQuerySource instance + */ + DialogflowQuerySource.create = function create(properties) { + return new DialogflowQuerySource(properties); + }; + + /** + * Encodes the specified DialogflowQuerySource message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource} message DialogflowQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DialogflowQuerySource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agent != null && Object.hasOwnProperty.call(message, "agent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.agent); + return writer; + }; + + /** + * Encodes the specified DialogflowQuerySource message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IDialogflowQuerySource} message DialogflowQuerySource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DialogflowQuerySource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DialogflowQuerySource message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} DialogflowQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DialogflowQuerySource.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agent = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DialogflowQuerySource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} DialogflowQuerySource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DialogflowQuerySource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DialogflowQuerySource message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DialogflowQuerySource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agent != null && message.hasOwnProperty("agent")) + if (!$util.isString(message.agent)) + return "agent: string expected"; + return null; + }; + + /** + * Creates a DialogflowQuerySource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} DialogflowQuerySource + */ + DialogflowQuerySource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource(); + if (object.agent != null) + message.agent = String(object.agent); + return message; + }; + + /** + * Creates a plain object from a DialogflowQuerySource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource} message DialogflowQuerySource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DialogflowQuerySource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.agent = ""; + if (message.agent != null && message.hasOwnProperty("agent")) + object.agent = message.agent; + return object; + }; + + /** + * Converts this DialogflowQuerySource to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @instance + * @returns {Object.} JSON object + */ + DialogflowQuerySource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DialogflowQuerySource + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DialogflowQuerySource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource"; + }; + + return DialogflowQuerySource; + })(); + + SuggestionQueryConfig.ContextFilterSettings = (function() { + + /** + * Properties of a ContextFilterSettings. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @interface IContextFilterSettings + * @property {boolean|null} [dropHandoffMessages] ContextFilterSettings dropHandoffMessages + * @property {boolean|null} [dropVirtualAgentMessages] ContextFilterSettings dropVirtualAgentMessages + * @property {boolean|null} [dropIvrMessages] ContextFilterSettings dropIvrMessages + */ + + /** + * Constructs a new ContextFilterSettings. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig + * @classdesc Represents a ContextFilterSettings. + * @implements IContextFilterSettings + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings=} [properties] Properties to set + */ + function ContextFilterSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ContextFilterSettings dropHandoffMessages. + * @member {boolean} dropHandoffMessages + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @instance + */ + ContextFilterSettings.prototype.dropHandoffMessages = false; + + /** + * ContextFilterSettings dropVirtualAgentMessages. + * @member {boolean} dropVirtualAgentMessages + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @instance + */ + ContextFilterSettings.prototype.dropVirtualAgentMessages = false; + + /** + * ContextFilterSettings dropIvrMessages. + * @member {boolean} dropIvrMessages + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @instance + */ + ContextFilterSettings.prototype.dropIvrMessages = false; + + /** + * Creates a new ContextFilterSettings instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} ContextFilterSettings instance + */ + ContextFilterSettings.create = function create(properties) { + return new ContextFilterSettings(properties); + }; + + /** + * Encodes the specified ContextFilterSettings message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings} message ContextFilterSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContextFilterSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dropHandoffMessages != null && Object.hasOwnProperty.call(message, "dropHandoffMessages")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.dropHandoffMessages); + if (message.dropVirtualAgentMessages != null && Object.hasOwnProperty.call(message, "dropVirtualAgentMessages")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.dropVirtualAgentMessages); + if (message.dropIvrMessages != null && Object.hasOwnProperty.call(message, "dropIvrMessages")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.dropIvrMessages); + return writer; + }; + + /** + * Encodes the specified ContextFilterSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.IContextFilterSettings} message ContextFilterSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ContextFilterSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ContextFilterSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} ContextFilterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContextFilterSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.dropHandoffMessages = reader.bool(); + break; + } + case 2: { + message.dropVirtualAgentMessages = reader.bool(); + break; + } + case 3: { + message.dropIvrMessages = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ContextFilterSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} ContextFilterSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ContextFilterSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ContextFilterSettings message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ContextFilterSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dropHandoffMessages != null && message.hasOwnProperty("dropHandoffMessages")) + if (typeof message.dropHandoffMessages !== "boolean") + return "dropHandoffMessages: boolean expected"; + if (message.dropVirtualAgentMessages != null && message.hasOwnProperty("dropVirtualAgentMessages")) + if (typeof message.dropVirtualAgentMessages !== "boolean") + return "dropVirtualAgentMessages: boolean expected"; + if (message.dropIvrMessages != null && message.hasOwnProperty("dropIvrMessages")) + if (typeof message.dropIvrMessages !== "boolean") + return "dropIvrMessages: boolean expected"; + return null; + }; + + /** + * Creates a ContextFilterSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} ContextFilterSettings + */ + ContextFilterSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings(); + if (object.dropHandoffMessages != null) + message.dropHandoffMessages = Boolean(object.dropHandoffMessages); + if (object.dropVirtualAgentMessages != null) + message.dropVirtualAgentMessages = Boolean(object.dropVirtualAgentMessages); + if (object.dropIvrMessages != null) + message.dropIvrMessages = Boolean(object.dropIvrMessages); + return message; + }; + + /** + * Creates a plain object from a ContextFilterSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings} message ContextFilterSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ContextFilterSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.dropHandoffMessages = false; + object.dropVirtualAgentMessages = false; + object.dropIvrMessages = false; + } + if (message.dropHandoffMessages != null && message.hasOwnProperty("dropHandoffMessages")) + object.dropHandoffMessages = message.dropHandoffMessages; + if (message.dropVirtualAgentMessages != null && message.hasOwnProperty("dropVirtualAgentMessages")) + object.dropVirtualAgentMessages = message.dropVirtualAgentMessages; + if (message.dropIvrMessages != null && message.hasOwnProperty("dropIvrMessages")) + object.dropIvrMessages = message.dropIvrMessages; + return object; + }; + + /** + * Converts this ContextFilterSettings to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @instance + * @returns {Object.} JSON object + */ + ContextFilterSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ContextFilterSettings + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ContextFilterSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings"; + }; + + return ContextFilterSettings; + })(); + + return SuggestionQueryConfig; + })(); + + HumanAgentAssistantConfig.ConversationModelConfig = (function() { + + /** + * Properties of a ConversationModelConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @interface IConversationModelConfig + * @property {string|null} [model] ConversationModelConfig model + */ + + /** + * Constructs a new ConversationModelConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @classdesc Represents a ConversationModelConfig. + * @implements IConversationModelConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig=} [properties] Properties to set + */ + function ConversationModelConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationModelConfig model. + * @member {string} model + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @instance + */ + ConversationModelConfig.prototype.model = ""; + + /** + * Creates a new ConversationModelConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig} ConversationModelConfig instance + */ + ConversationModelConfig.create = function create(properties) { + return new ConversationModelConfig(properties); + }; + + /** + * Encodes the specified ConversationModelConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig} message ConversationModelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationModelConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.model != null && Object.hasOwnProperty.call(message, "model")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.model); + return writer; + }; + + /** + * Encodes the specified ConversationModelConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationModelConfig} message ConversationModelConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationModelConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationModelConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig} ConversationModelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationModelConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.model = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationModelConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig} ConversationModelConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationModelConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationModelConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationModelConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.model != null && message.hasOwnProperty("model")) + if (!$util.isString(message.model)) + return "model: string expected"; + return null; + }; + + /** + * Creates a ConversationModelConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig} ConversationModelConfig + */ + ConversationModelConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig(); + if (object.model != null) + message.model = String(object.model); + return message; + }; + + /** + * Creates a plain object from a ConversationModelConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig} message ConversationModelConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationModelConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.model = ""; + if (message.model != null && message.hasOwnProperty("model")) + object.model = message.model; + return object; + }; + + /** + * Converts this ConversationModelConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @instance + * @returns {Object.} JSON object + */ + ConversationModelConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationModelConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationModelConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationModelConfig"; + }; + + return ConversationModelConfig; + })(); + + HumanAgentAssistantConfig.ConversationProcessConfig = (function() { + + /** + * Properties of a ConversationProcessConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @interface IConversationProcessConfig + * @property {number|null} [recentSentencesCount] ConversationProcessConfig recentSentencesCount + */ + + /** + * Constructs a new ConversationProcessConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @classdesc Represents a ConversationProcessConfig. + * @implements IConversationProcessConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig=} [properties] Properties to set + */ + function ConversationProcessConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConversationProcessConfig recentSentencesCount. + * @member {number} recentSentencesCount + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @instance + */ + ConversationProcessConfig.prototype.recentSentencesCount = 0; + + /** + * Creates a new ConversationProcessConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig} ConversationProcessConfig instance + */ + ConversationProcessConfig.create = function create(properties) { + return new ConversationProcessConfig(properties); + }; + + /** + * Encodes the specified ConversationProcessConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig} message ConversationProcessConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationProcessConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.recentSentencesCount != null && Object.hasOwnProperty.call(message, "recentSentencesCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.recentSentencesCount); + return writer; + }; + + /** + * Encodes the specified ConversationProcessConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IConversationProcessConfig} message ConversationProcessConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConversationProcessConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConversationProcessConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig} ConversationProcessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationProcessConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.recentSentencesCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConversationProcessConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig} ConversationProcessConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConversationProcessConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConversationProcessConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConversationProcessConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.recentSentencesCount != null && message.hasOwnProperty("recentSentencesCount")) + if (!$util.isInteger(message.recentSentencesCount)) + return "recentSentencesCount: integer expected"; + return null; + }; + + /** + * Creates a ConversationProcessConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig} ConversationProcessConfig + */ + ConversationProcessConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig(); + if (object.recentSentencesCount != null) + message.recentSentencesCount = object.recentSentencesCount | 0; + return message; + }; + + /** + * Creates a plain object from a ConversationProcessConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig} message ConversationProcessConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConversationProcessConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.recentSentencesCount = 0; + if (message.recentSentencesCount != null && message.hasOwnProperty("recentSentencesCount")) + object.recentSentencesCount = message.recentSentencesCount; + return object; + }; + + /** + * Converts this ConversationProcessConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @instance + * @returns {Object.} JSON object + */ + ConversationProcessConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConversationProcessConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConversationProcessConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ConversationProcessConfig"; + }; + + return ConversationProcessConfig; + })(); + + HumanAgentAssistantConfig.MessageAnalysisConfig = (function() { + + /** + * Properties of a MessageAnalysisConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @interface IMessageAnalysisConfig + * @property {boolean|null} [enableEntityExtraction] MessageAnalysisConfig enableEntityExtraction + * @property {boolean|null} [enableSentimentAnalysis] MessageAnalysisConfig enableSentimentAnalysis + */ + + /** + * Constructs a new MessageAnalysisConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig + * @classdesc Represents a MessageAnalysisConfig. + * @implements IMessageAnalysisConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig=} [properties] Properties to set + */ + function MessageAnalysisConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageAnalysisConfig enableEntityExtraction. + * @member {boolean} enableEntityExtraction + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @instance + */ + MessageAnalysisConfig.prototype.enableEntityExtraction = false; + + /** + * MessageAnalysisConfig enableSentimentAnalysis. + * @member {boolean} enableSentimentAnalysis + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @instance + */ + MessageAnalysisConfig.prototype.enableSentimentAnalysis = false; + + /** + * Creates a new MessageAnalysisConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig} MessageAnalysisConfig instance + */ + MessageAnalysisConfig.create = function create(properties) { + return new MessageAnalysisConfig(properties); + }; + + /** + * Encodes the specified MessageAnalysisConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig} message MessageAnalysisConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageAnalysisConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableEntityExtraction != null && Object.hasOwnProperty.call(message, "enableEntityExtraction")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.enableEntityExtraction); + if (message.enableSentimentAnalysis != null && Object.hasOwnProperty.call(message, "enableSentimentAnalysis")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableSentimentAnalysis); + return writer; + }; + + /** + * Encodes the specified MessageAnalysisConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.IMessageAnalysisConfig} message MessageAnalysisConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageAnalysisConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageAnalysisConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig} MessageAnalysisConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageAnalysisConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + message.enableEntityExtraction = reader.bool(); + break; + } + case 3: { + message.enableSentimentAnalysis = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageAnalysisConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig} MessageAnalysisConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageAnalysisConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageAnalysisConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageAnalysisConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enableEntityExtraction != null && message.hasOwnProperty("enableEntityExtraction")) + if (typeof message.enableEntityExtraction !== "boolean") + return "enableEntityExtraction: boolean expected"; + if (message.enableSentimentAnalysis != null && message.hasOwnProperty("enableSentimentAnalysis")) + if (typeof message.enableSentimentAnalysis !== "boolean") + return "enableSentimentAnalysis: boolean expected"; + return null; + }; + + /** + * Creates a MessageAnalysisConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig} MessageAnalysisConfig + */ + MessageAnalysisConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig(); + if (object.enableEntityExtraction != null) + message.enableEntityExtraction = Boolean(object.enableEntityExtraction); + if (object.enableSentimentAnalysis != null) + message.enableSentimentAnalysis = Boolean(object.enableSentimentAnalysis); + return message; + }; + + /** + * Creates a plain object from a MessageAnalysisConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig} message MessageAnalysisConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageAnalysisConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.enableEntityExtraction = false; + object.enableSentimentAnalysis = false; + } + if (message.enableEntityExtraction != null && message.hasOwnProperty("enableEntityExtraction")) + object.enableEntityExtraction = message.enableEntityExtraction; + if (message.enableSentimentAnalysis != null && message.hasOwnProperty("enableSentimentAnalysis")) + object.enableSentimentAnalysis = message.enableSentimentAnalysis; + return object; + }; + + /** + * Converts this MessageAnalysisConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @instance + * @returns {Object.} JSON object + */ + MessageAnalysisConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageAnalysisConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageAnalysisConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.MessageAnalysisConfig"; + }; + + return MessageAnalysisConfig; + })(); + + return HumanAgentAssistantConfig; + })(); + + v2beta1.HumanAgentHandoffConfig = (function() { + + /** + * Properties of a HumanAgentHandoffConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IHumanAgentHandoffConfig + * @property {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig|null} [livePersonConfig] HumanAgentHandoffConfig livePersonConfig + * @property {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig|null} [salesforceLiveAgentConfig] HumanAgentHandoffConfig salesforceLiveAgentConfig + */ + + /** + * Constructs a new HumanAgentHandoffConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a HumanAgentHandoffConfig. + * @implements IHumanAgentHandoffConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig=} [properties] Properties to set + */ + function HumanAgentHandoffConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HumanAgentHandoffConfig livePersonConfig. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig|null|undefined} livePersonConfig + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @instance + */ + HumanAgentHandoffConfig.prototype.livePersonConfig = null; + + /** + * HumanAgentHandoffConfig salesforceLiveAgentConfig. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig|null|undefined} salesforceLiveAgentConfig + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @instance + */ + HumanAgentHandoffConfig.prototype.salesforceLiveAgentConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HumanAgentHandoffConfig agentService. + * @member {"livePersonConfig"|"salesforceLiveAgentConfig"|undefined} agentService + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @instance + */ + Object.defineProperty(HumanAgentHandoffConfig.prototype, "agentService", { + get: $util.oneOfGetter($oneOfFields = ["livePersonConfig", "salesforceLiveAgentConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HumanAgentHandoffConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig} HumanAgentHandoffConfig instance + */ + HumanAgentHandoffConfig.create = function create(properties) { + return new HumanAgentHandoffConfig(properties); + }; + + /** + * Encodes the specified HumanAgentHandoffConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig} message HumanAgentHandoffConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentHandoffConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.livePersonConfig != null && Object.hasOwnProperty.call(message, "livePersonConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig.encode(message.livePersonConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.salesforceLiveAgentConfig != null && Object.hasOwnProperty.call(message, "salesforceLiveAgentConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.encode(message.salesforceLiveAgentConfig, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HumanAgentHandoffConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentHandoffConfig} message HumanAgentHandoffConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentHandoffConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HumanAgentHandoffConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig} HumanAgentHandoffConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentHandoffConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.livePersonConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig.decode(reader, reader.uint32()); + break; + } + case 2: { + message.salesforceLiveAgentConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HumanAgentHandoffConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig} HumanAgentHandoffConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentHandoffConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HumanAgentHandoffConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HumanAgentHandoffConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.livePersonConfig != null && message.hasOwnProperty("livePersonConfig")) { + properties.agentService = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig.verify(message.livePersonConfig); + if (error) + return "livePersonConfig." + error; + } + } + if (message.salesforceLiveAgentConfig != null && message.hasOwnProperty("salesforceLiveAgentConfig")) { + if (properties.agentService === 1) + return "agentService: multiple values"; + properties.agentService = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify(message.salesforceLiveAgentConfig); + if (error) + return "salesforceLiveAgentConfig." + error; + } + } + return null; + }; + + /** + * Creates a HumanAgentHandoffConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig} HumanAgentHandoffConfig + */ + HumanAgentHandoffConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig(); + if (object.livePersonConfig != null) { + if (typeof object.livePersonConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.livePersonConfig: object expected"); + message.livePersonConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig.fromObject(object.livePersonConfig); + } + if (object.salesforceLiveAgentConfig != null) { + if (typeof object.salesforceLiveAgentConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.salesforceLiveAgentConfig: object expected"); + message.salesforceLiveAgentConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.fromObject(object.salesforceLiveAgentConfig); + } + return message; + }; + + /** + * Creates a plain object from a HumanAgentHandoffConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig} message HumanAgentHandoffConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HumanAgentHandoffConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.livePersonConfig != null && message.hasOwnProperty("livePersonConfig")) { + object.livePersonConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig.toObject(message.livePersonConfig, options); + if (options.oneofs) + object.agentService = "livePersonConfig"; + } + if (message.salesforceLiveAgentConfig != null && message.hasOwnProperty("salesforceLiveAgentConfig")) { + object.salesforceLiveAgentConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.toObject(message.salesforceLiveAgentConfig, options); + if (options.oneofs) + object.agentService = "salesforceLiveAgentConfig"; + } + return object; + }; + + /** + * Converts this HumanAgentHandoffConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @instance + * @returns {Object.} JSON object + */ + HumanAgentHandoffConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HumanAgentHandoffConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanAgentHandoffConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig"; + }; + + HumanAgentHandoffConfig.LivePersonConfig = (function() { + + /** + * Properties of a LivePersonConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @interface ILivePersonConfig + * @property {string|null} [accountNumber] LivePersonConfig accountNumber + */ + + /** + * Constructs a new LivePersonConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @classdesc Represents a LivePersonConfig. + * @implements ILivePersonConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig=} [properties] Properties to set + */ + function LivePersonConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LivePersonConfig accountNumber. + * @member {string} accountNumber + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @instance + */ + LivePersonConfig.prototype.accountNumber = ""; + + /** + * Creates a new LivePersonConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig} LivePersonConfig instance + */ + LivePersonConfig.create = function create(properties) { + return new LivePersonConfig(properties); + }; + + /** + * Encodes the specified LivePersonConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig} message LivePersonConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LivePersonConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.accountNumber != null && Object.hasOwnProperty.call(message, "accountNumber")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.accountNumber); + return writer; + }; + + /** + * Encodes the specified LivePersonConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ILivePersonConfig} message LivePersonConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LivePersonConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LivePersonConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig} LivePersonConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LivePersonConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.accountNumber = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LivePersonConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig} LivePersonConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LivePersonConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LivePersonConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LivePersonConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.accountNumber != null && message.hasOwnProperty("accountNumber")) + if (!$util.isString(message.accountNumber)) + return "accountNumber: string expected"; + return null; + }; + + /** + * Creates a LivePersonConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig} LivePersonConfig + */ + LivePersonConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig(); + if (object.accountNumber != null) + message.accountNumber = String(object.accountNumber); + return message; + }; + + /** + * Creates a plain object from a LivePersonConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig} message LivePersonConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LivePersonConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.accountNumber = ""; + if (message.accountNumber != null && message.hasOwnProperty("accountNumber")) + object.accountNumber = message.accountNumber; + return object; + }; + + /** + * Converts this LivePersonConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @instance + * @returns {Object.} JSON object + */ + LivePersonConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LivePersonConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LivePersonConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.LivePersonConfig"; + }; + + return LivePersonConfig; + })(); + + HumanAgentHandoffConfig.SalesforceLiveAgentConfig = (function() { + + /** + * Properties of a SalesforceLiveAgentConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @interface ISalesforceLiveAgentConfig + * @property {string|null} [organizationId] SalesforceLiveAgentConfig organizationId + * @property {string|null} [deploymentId] SalesforceLiveAgentConfig deploymentId + * @property {string|null} [buttonId] SalesforceLiveAgentConfig buttonId + * @property {string|null} [endpointDomain] SalesforceLiveAgentConfig endpointDomain + */ + + /** + * Constructs a new SalesforceLiveAgentConfig. + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig + * @classdesc Represents a SalesforceLiveAgentConfig. + * @implements ISalesforceLiveAgentConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig=} [properties] Properties to set + */ + function SalesforceLiveAgentConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SalesforceLiveAgentConfig organizationId. + * @member {string} organizationId + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + */ + SalesforceLiveAgentConfig.prototype.organizationId = ""; + + /** + * SalesforceLiveAgentConfig deploymentId. + * @member {string} deploymentId + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + */ + SalesforceLiveAgentConfig.prototype.deploymentId = ""; + + /** + * SalesforceLiveAgentConfig buttonId. + * @member {string} buttonId + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + */ + SalesforceLiveAgentConfig.prototype.buttonId = ""; + + /** + * SalesforceLiveAgentConfig endpointDomain. + * @member {string} endpointDomain + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + */ + SalesforceLiveAgentConfig.prototype.endpointDomain = ""; + + /** + * Creates a new SalesforceLiveAgentConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} SalesforceLiveAgentConfig instance + */ + SalesforceLiveAgentConfig.create = function create(properties) { + return new SalesforceLiveAgentConfig(properties); + }; + + /** + * Encodes the specified SalesforceLiveAgentConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig} message SalesforceLiveAgentConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SalesforceLiveAgentConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.organizationId != null && Object.hasOwnProperty.call(message, "organizationId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.organizationId); + if (message.deploymentId != null && Object.hasOwnProperty.call(message, "deploymentId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.deploymentId); + if (message.buttonId != null && Object.hasOwnProperty.call(message, "buttonId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.buttonId); + if (message.endpointDomain != null && Object.hasOwnProperty.call(message, "endpointDomain")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.endpointDomain); + return writer; + }; + + /** + * Encodes the specified SalesforceLiveAgentConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.ISalesforceLiveAgentConfig} message SalesforceLiveAgentConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SalesforceLiveAgentConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SalesforceLiveAgentConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} SalesforceLiveAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SalesforceLiveAgentConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.organizationId = reader.string(); + break; + } + case 2: { + message.deploymentId = reader.string(); + break; + } + case 3: { + message.buttonId = reader.string(); + break; + } + case 4: { + message.endpointDomain = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SalesforceLiveAgentConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} SalesforceLiveAgentConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SalesforceLiveAgentConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SalesforceLiveAgentConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SalesforceLiveAgentConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.organizationId != null && message.hasOwnProperty("organizationId")) + if (!$util.isString(message.organizationId)) + return "organizationId: string expected"; + if (message.deploymentId != null && message.hasOwnProperty("deploymentId")) + if (!$util.isString(message.deploymentId)) + return "deploymentId: string expected"; + if (message.buttonId != null && message.hasOwnProperty("buttonId")) + if (!$util.isString(message.buttonId)) + return "buttonId: string expected"; + if (message.endpointDomain != null && message.hasOwnProperty("endpointDomain")) + if (!$util.isString(message.endpointDomain)) + return "endpointDomain: string expected"; + return null; + }; + + /** + * Creates a SalesforceLiveAgentConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} SalesforceLiveAgentConfig + */ + SalesforceLiveAgentConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig(); + if (object.organizationId != null) + message.organizationId = String(object.organizationId); + if (object.deploymentId != null) + message.deploymentId = String(object.deploymentId); + if (object.buttonId != null) + message.buttonId = String(object.buttonId); + if (object.endpointDomain != null) + message.endpointDomain = String(object.endpointDomain); + return message; + }; + + /** + * Creates a plain object from a SalesforceLiveAgentConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig} message SalesforceLiveAgentConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SalesforceLiveAgentConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.organizationId = ""; + object.deploymentId = ""; + object.buttonId = ""; + object.endpointDomain = ""; + } + if (message.organizationId != null && message.hasOwnProperty("organizationId")) + object.organizationId = message.organizationId; + if (message.deploymentId != null && message.hasOwnProperty("deploymentId")) + object.deploymentId = message.deploymentId; + if (message.buttonId != null && message.hasOwnProperty("buttonId")) + object.buttonId = message.buttonId; + if (message.endpointDomain != null && message.hasOwnProperty("endpointDomain")) + object.endpointDomain = message.endpointDomain; + return object; + }; + + /** + * Converts this SalesforceLiveAgentConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @instance + * @returns {Object.} JSON object + */ + SalesforceLiveAgentConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SalesforceLiveAgentConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SalesforceLiveAgentConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentHandoffConfig.SalesforceLiveAgentConfig"; + }; + + return SalesforceLiveAgentConfig; + })(); + + return HumanAgentHandoffConfig; + })(); + + v2beta1.NotificationConfig = (function() { + + /** + * Properties of a NotificationConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface INotificationConfig + * @property {string|null} [topic] NotificationConfig topic + * @property {google.cloud.dialogflow.v2beta1.NotificationConfig.MessageFormat|null} [messageFormat] NotificationConfig messageFormat + */ + + /** + * Constructs a new NotificationConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a NotificationConfig. + * @implements INotificationConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.INotificationConfig=} [properties] Properties to set + */ + function NotificationConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NotificationConfig topic. + * @member {string} topic + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @instance + */ + NotificationConfig.prototype.topic = ""; + + /** + * NotificationConfig messageFormat. + * @member {google.cloud.dialogflow.v2beta1.NotificationConfig.MessageFormat} messageFormat + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @instance + */ + NotificationConfig.prototype.messageFormat = 0; + + /** + * Creates a new NotificationConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.INotificationConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.NotificationConfig} NotificationConfig instance + */ + NotificationConfig.create = function create(properties) { + return new NotificationConfig(properties); + }; + + /** + * Encodes the specified NotificationConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.NotificationConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.INotificationConfig} message NotificationConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.topic != null && Object.hasOwnProperty.call(message, "topic")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.topic); + if (message.messageFormat != null && Object.hasOwnProperty.call(message, "messageFormat")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.messageFormat); + return writer; + }; + + /** + * Encodes the specified NotificationConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.NotificationConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.INotificationConfig} message NotificationConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NotificationConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NotificationConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.NotificationConfig} NotificationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.NotificationConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.topic = reader.string(); + break; + } + case 2: { + message.messageFormat = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NotificationConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.NotificationConfig} NotificationConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NotificationConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NotificationConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NotificationConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.topic != null && message.hasOwnProperty("topic")) + if (!$util.isString(message.topic)) + return "topic: string expected"; + if (message.messageFormat != null && message.hasOwnProperty("messageFormat")) + switch (message.messageFormat) { + default: + return "messageFormat: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a NotificationConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.NotificationConfig} NotificationConfig + */ + NotificationConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.NotificationConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.NotificationConfig(); + if (object.topic != null) + message.topic = String(object.topic); + switch (object.messageFormat) { + default: + if (typeof object.messageFormat === "number") { + message.messageFormat = object.messageFormat; + break; + } + break; + case "MESSAGE_FORMAT_UNSPECIFIED": + case 0: + message.messageFormat = 0; + break; + case "PROTO": + case 1: + message.messageFormat = 1; + break; + case "JSON": + case 2: + message.messageFormat = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a NotificationConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.NotificationConfig} message NotificationConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NotificationConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.topic = ""; + object.messageFormat = options.enums === String ? "MESSAGE_FORMAT_UNSPECIFIED" : 0; + } + if (message.topic != null && message.hasOwnProperty("topic")) + object.topic = message.topic; + if (message.messageFormat != null && message.hasOwnProperty("messageFormat")) + object.messageFormat = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.NotificationConfig.MessageFormat[message.messageFormat] === undefined ? message.messageFormat : $root.google.cloud.dialogflow.v2beta1.NotificationConfig.MessageFormat[message.messageFormat] : message.messageFormat; + return object; + }; + + /** + * Converts this NotificationConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @instance + * @returns {Object.} JSON object + */ + NotificationConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NotificationConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.NotificationConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NotificationConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.NotificationConfig"; + }; + + /** + * MessageFormat enum. + * @name google.cloud.dialogflow.v2beta1.NotificationConfig.MessageFormat + * @enum {number} + * @property {number} MESSAGE_FORMAT_UNSPECIFIED=0 MESSAGE_FORMAT_UNSPECIFIED value + * @property {number} PROTO=1 PROTO value + * @property {number} JSON=2 JSON value + */ + NotificationConfig.MessageFormat = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_FORMAT_UNSPECIFIED"] = 0; + values[valuesById[1] = "PROTO"] = 1; + values[valuesById[2] = "JSON"] = 2; + return values; + })(); + + return NotificationConfig; + })(); + + v2beta1.LoggingConfig = (function() { + + /** + * Properties of a LoggingConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ILoggingConfig + * @property {boolean|null} [enableStackdriverLogging] LoggingConfig enableStackdriverLogging + */ + + /** + * Constructs a new LoggingConfig. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a LoggingConfig. + * @implements ILoggingConfig + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ILoggingConfig=} [properties] Properties to set + */ + function LoggingConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LoggingConfig enableStackdriverLogging. + * @member {boolean} enableStackdriverLogging + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @instance + */ + LoggingConfig.prototype.enableStackdriverLogging = false; + + /** + * Creates a new LoggingConfig instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ILoggingConfig=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.LoggingConfig} LoggingConfig instance + */ + LoggingConfig.create = function create(properties) { + return new LoggingConfig(properties); + }; + + /** + * Encodes the specified LoggingConfig message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.LoggingConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ILoggingConfig} message LoggingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LoggingConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableStackdriverLogging != null && Object.hasOwnProperty.call(message, "enableStackdriverLogging")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableStackdriverLogging); + return writer; + }; + + /** + * Encodes the specified LoggingConfig message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.LoggingConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.ILoggingConfig} message LoggingConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LoggingConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LoggingConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.LoggingConfig} LoggingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LoggingConfig.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.LoggingConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 3: { + message.enableStackdriverLogging = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LoggingConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.LoggingConfig} LoggingConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LoggingConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LoggingConfig message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LoggingConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enableStackdriverLogging != null && message.hasOwnProperty("enableStackdriverLogging")) + if (typeof message.enableStackdriverLogging !== "boolean") + return "enableStackdriverLogging: boolean expected"; + return null; + }; + + /** + * Creates a LoggingConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.LoggingConfig} LoggingConfig + */ + LoggingConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.LoggingConfig) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.LoggingConfig(); + if (object.enableStackdriverLogging != null) + message.enableStackdriverLogging = Boolean(object.enableStackdriverLogging); + return message; + }; + + /** + * Creates a plain object from a LoggingConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @static + * @param {google.cloud.dialogflow.v2beta1.LoggingConfig} message LoggingConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LoggingConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.enableStackdriverLogging = false; + if (message.enableStackdriverLogging != null && message.hasOwnProperty("enableStackdriverLogging")) + object.enableStackdriverLogging = message.enableStackdriverLogging; + return object; + }; + + /** + * Converts this LoggingConfig to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @instance + * @returns {Object.} JSON object + */ + LoggingConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LoggingConfig + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.LoggingConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LoggingConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.LoggingConfig"; + }; + + return LoggingConfig; + })(); + + v2beta1.ListConversationProfilesRequest = (function() { + + /** + * Properties of a ListConversationProfilesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListConversationProfilesRequest + * @property {string|null} [parent] ListConversationProfilesRequest parent + * @property {number|null} [pageSize] ListConversationProfilesRequest pageSize + * @property {string|null} [pageToken] ListConversationProfilesRequest pageToken + */ + + /** + * Constructs a new ListConversationProfilesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListConversationProfilesRequest. + * @implements IListConversationProfilesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest=} [properties] Properties to set + */ + function ListConversationProfilesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationProfilesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @instance + */ + ListConversationProfilesRequest.prototype.parent = ""; + + /** + * ListConversationProfilesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @instance + */ + ListConversationProfilesRequest.prototype.pageSize = 0; + + /** + * ListConversationProfilesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @instance + */ + ListConversationProfilesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListConversationProfilesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest} ListConversationProfilesRequest instance + */ + ListConversationProfilesRequest.create = function create(properties) { + return new ListConversationProfilesRequest(properties); + }; + + /** + * Encodes the specified ListConversationProfilesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest} message ListConversationProfilesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationProfilesRequest.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 ListConversationProfilesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest} message ListConversationProfilesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationProfilesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationProfilesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest} ListConversationProfilesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationProfilesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest(); + 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 ListConversationProfilesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest} ListConversationProfilesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationProfilesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationProfilesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationProfilesRequest.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 ListConversationProfilesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest} ListConversationProfilesRequest + */ + ListConversationProfilesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest(); + 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 ListConversationProfilesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest} message ListConversationProfilesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationProfilesRequest.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 ListConversationProfilesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @instance + * @returns {Object.} JSON object + */ + ListConversationProfilesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationProfilesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationProfilesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest"; + }; + + return ListConversationProfilesRequest; + })(); + + v2beta1.ListConversationProfilesResponse = (function() { + + /** + * Properties of a ListConversationProfilesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListConversationProfilesResponse + * @property {Array.|null} [conversationProfiles] ListConversationProfilesResponse conversationProfiles + * @property {string|null} [nextPageToken] ListConversationProfilesResponse nextPageToken + */ + + /** + * Constructs a new ListConversationProfilesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListConversationProfilesResponse. + * @implements IListConversationProfilesResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse=} [properties] Properties to set + */ + function ListConversationProfilesResponse(properties) { + this.conversationProfiles = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListConversationProfilesResponse conversationProfiles. + * @member {Array.} conversationProfiles + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @instance + */ + ListConversationProfilesResponse.prototype.conversationProfiles = $util.emptyArray; + + /** + * ListConversationProfilesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @instance + */ + ListConversationProfilesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListConversationProfilesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse} ListConversationProfilesResponse instance + */ + ListConversationProfilesResponse.create = function create(properties) { + return new ListConversationProfilesResponse(properties); + }; + + /** + * Encodes the specified ListConversationProfilesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse} message ListConversationProfilesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationProfilesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfiles != null && message.conversationProfiles.length) + for (var i = 0; i < message.conversationProfiles.length; ++i) + $root.google.cloud.dialogflow.v2beta1.ConversationProfile.encode(message.conversationProfiles[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 ListConversationProfilesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse} message ListConversationProfilesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListConversationProfilesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListConversationProfilesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse} ListConversationProfilesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationProfilesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.conversationProfiles && message.conversationProfiles.length)) + message.conversationProfiles = []; + message.conversationProfiles.push($root.google.cloud.dialogflow.v2beta1.ConversationProfile.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListConversationProfilesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse} ListConversationProfilesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListConversationProfilesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListConversationProfilesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListConversationProfilesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfiles != null && message.hasOwnProperty("conversationProfiles")) { + if (!Array.isArray(message.conversationProfiles)) + return "conversationProfiles: array expected"; + for (var i = 0; i < message.conversationProfiles.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.verify(message.conversationProfiles[i]); + if (error) + return "conversationProfiles." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListConversationProfilesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse} ListConversationProfilesResponse + */ + ListConversationProfilesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse(); + if (object.conversationProfiles) { + if (!Array.isArray(object.conversationProfiles)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse.conversationProfiles: array expected"); + message.conversationProfiles = []; + for (var i = 0; i < object.conversationProfiles.length; ++i) { + if (typeof object.conversationProfiles[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse.conversationProfiles: object expected"); + message.conversationProfiles[i] = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.fromObject(object.conversationProfiles[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListConversationProfilesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse} message ListConversationProfilesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListConversationProfilesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.conversationProfiles = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.conversationProfiles && message.conversationProfiles.length) { + object.conversationProfiles = []; + for (var j = 0; j < message.conversationProfiles.length; ++j) + object.conversationProfiles[j] = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.toObject(message.conversationProfiles[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListConversationProfilesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @instance + * @returns {Object.} JSON object + */ + ListConversationProfilesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListConversationProfilesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListConversationProfilesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse"; + }; + + return ListConversationProfilesResponse; + })(); + + v2beta1.GetConversationProfileRequest = (function() { + + /** + * Properties of a GetConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetConversationProfileRequest + * @property {string|null} [name] GetConversationProfileRequest name + */ + + /** + * Constructs a new GetConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetConversationProfileRequest. + * @implements IGetConversationProfileRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest=} [properties] Properties to set + */ + function GetConversationProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConversationProfileRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @instance + */ + GetConversationProfileRequest.prototype.name = ""; + + /** + * Creates a new GetConversationProfileRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetConversationProfileRequest} GetConversationProfileRequest instance + */ + GetConversationProfileRequest.create = function create(properties) { + return new GetConversationProfileRequest(properties); + }; + + /** + * Encodes the specified GetConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetConversationProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest} message GetConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationProfileRequest.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 GetConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetConversationProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest} message GetConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConversationProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConversationProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetConversationProfileRequest} GetConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest(); + 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 GetConversationProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetConversationProfileRequest} GetConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConversationProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConversationProfileRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConversationProfileRequest.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 GetConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetConversationProfileRequest} GetConversationProfileRequest + */ + GetConversationProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetConversationProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetConversationProfileRequest} message GetConversationProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConversationProfileRequest.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 GetConversationProfileRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @instance + * @returns {Object.} JSON object + */ + GetConversationProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetConversationProfileRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetConversationProfileRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetConversationProfileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetConversationProfileRequest"; + }; + + return GetConversationProfileRequest; + })(); + + v2beta1.CreateConversationProfileRequest = (function() { + + /** + * Properties of a CreateConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateConversationProfileRequest + * @property {string|null} [parent] CreateConversationProfileRequest parent + * @property {google.cloud.dialogflow.v2beta1.IConversationProfile|null} [conversationProfile] CreateConversationProfileRequest conversationProfile + */ + + /** + * Constructs a new CreateConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateConversationProfileRequest. + * @implements ICreateConversationProfileRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest=} [properties] Properties to set + */ + function CreateConversationProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateConversationProfileRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @instance + */ + CreateConversationProfileRequest.prototype.parent = ""; + + /** + * CreateConversationProfileRequest conversationProfile. + * @member {google.cloud.dialogflow.v2beta1.IConversationProfile|null|undefined} conversationProfile + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @instance + */ + CreateConversationProfileRequest.prototype.conversationProfile = null; + + /** + * Creates a new CreateConversationProfileRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest} CreateConversationProfileRequest instance + */ + CreateConversationProfileRequest.create = function create(properties) { + return new CreateConversationProfileRequest(properties); + }; + + /** + * Encodes the specified CreateConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest} message CreateConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationProfileRequest.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.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + $root.google.cloud.dialogflow.v2beta1.ConversationProfile.encode(message.conversationProfile, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest} message CreateConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateConversationProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateConversationProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest} CreateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.conversationProfile = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateConversationProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest} CreateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateConversationProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateConversationProfileRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateConversationProfileRequest.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.conversationProfile != null && message.hasOwnProperty("conversationProfile")) { + var error = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.verify(message.conversationProfile); + if (error) + return "conversationProfile." + error; + } + return null; + }; + + /** + * Creates a CreateConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest} CreateConversationProfileRequest + */ + CreateConversationProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.conversationProfile != null) { + if (typeof object.conversationProfile !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest.conversationProfile: object expected"); + message.conversationProfile = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.fromObject(object.conversationProfile); + } + return message; + }; + + /** + * Creates a plain object from a CreateConversationProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest} message CreateConversationProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateConversationProfileRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.conversationProfile = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.toObject(message.conversationProfile, options); + return object; + }; + + /** + * Converts this CreateConversationProfileRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @instance + * @returns {Object.} JSON object + */ + CreateConversationProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateConversationProfileRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateConversationProfileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest"; + }; + + return CreateConversationProfileRequest; + })(); + + v2beta1.UpdateConversationProfileRequest = (function() { + + /** + * Properties of an UpdateConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateConversationProfileRequest + * @property {google.cloud.dialogflow.v2beta1.IConversationProfile|null} [conversationProfile] UpdateConversationProfileRequest conversationProfile + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateConversationProfileRequest updateMask + */ + + /** + * Constructs a new UpdateConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateConversationProfileRequest. + * @implements IUpdateConversationProfileRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest=} [properties] Properties to set + */ + function UpdateConversationProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateConversationProfileRequest conversationProfile. + * @member {google.cloud.dialogflow.v2beta1.IConversationProfile|null|undefined} conversationProfile + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @instance + */ + UpdateConversationProfileRequest.prototype.conversationProfile = null; + + /** + * UpdateConversationProfileRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @instance + */ + UpdateConversationProfileRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateConversationProfileRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest} UpdateConversationProfileRequest instance + */ + UpdateConversationProfileRequest.create = function create(properties) { + return new UpdateConversationProfileRequest(properties); + }; + + /** + * Encodes the specified UpdateConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest} message UpdateConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateConversationProfileRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + $root.google.cloud.dialogflow.v2beta1.ConversationProfile.encode(message.conversationProfile, 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 UpdateConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest} message UpdateConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateConversationProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateConversationProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest} UpdateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateConversationProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.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 UpdateConversationProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest} UpdateConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateConversationProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateConversationProfileRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateConversationProfileRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) { + var error = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.verify(message.conversationProfile); + if (error) + return "conversationProfile." + 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 UpdateConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest} UpdateConversationProfileRequest + */ + UpdateConversationProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest(); + if (object.conversationProfile != null) { + if (typeof object.conversationProfile !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest.conversationProfile: object expected"); + message.conversationProfile = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.fromObject(object.conversationProfile); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateConversationProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest} message UpdateConversationProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateConversationProfileRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = null; + object.updateMask = null; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = $root.google.cloud.dialogflow.v2beta1.ConversationProfile.toObject(message.conversationProfile, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateConversationProfileRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateConversationProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateConversationProfileRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateConversationProfileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest"; + }; + + return UpdateConversationProfileRequest; + })(); + + v2beta1.DeleteConversationProfileRequest = (function() { + + /** + * Properties of a DeleteConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteConversationProfileRequest + * @property {string|null} [name] DeleteConversationProfileRequest name + */ + + /** + * Constructs a new DeleteConversationProfileRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteConversationProfileRequest. + * @implements IDeleteConversationProfileRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest=} [properties] Properties to set + */ + function DeleteConversationProfileRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteConversationProfileRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @instance + */ + DeleteConversationProfileRequest.prototype.name = ""; + + /** + * Creates a new DeleteConversationProfileRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest} DeleteConversationProfileRequest instance + */ + DeleteConversationProfileRequest.create = function create(properties) { + return new DeleteConversationProfileRequest(properties); + }; + + /** + * Encodes the specified DeleteConversationProfileRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest} message DeleteConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationProfileRequest.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 DeleteConversationProfileRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest} message DeleteConversationProfileRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteConversationProfileRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteConversationProfileRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest} DeleteConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationProfileRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest(); + 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 DeleteConversationProfileRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest} DeleteConversationProfileRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteConversationProfileRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteConversationProfileRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteConversationProfileRequest.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 DeleteConversationProfileRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest} DeleteConversationProfileRequest + */ + DeleteConversationProfileRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteConversationProfileRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest} message DeleteConversationProfileRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteConversationProfileRequest.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 DeleteConversationProfileRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteConversationProfileRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteConversationProfileRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteConversationProfileRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest"; + }; + + return DeleteConversationProfileRequest; + })(); + + v2beta1.SetSuggestionFeatureConfigRequest = (function() { + + /** + * Properties of a SetSuggestionFeatureConfigRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISetSuggestionFeatureConfigRequest + * @property {string|null} [conversationProfile] SetSuggestionFeatureConfigRequest conversationProfile + * @property {google.cloud.dialogflow.v2beta1.Participant.Role|null} [participantRole] SetSuggestionFeatureConfigRequest participantRole + * @property {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig|null} [suggestionFeatureConfig] SetSuggestionFeatureConfigRequest suggestionFeatureConfig + */ + + /** + * Constructs a new SetSuggestionFeatureConfigRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SetSuggestionFeatureConfigRequest. + * @implements ISetSuggestionFeatureConfigRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest=} [properties] Properties to set + */ + function SetSuggestionFeatureConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetSuggestionFeatureConfigRequest conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @instance + */ + SetSuggestionFeatureConfigRequest.prototype.conversationProfile = ""; + + /** + * SetSuggestionFeatureConfigRequest participantRole. + * @member {google.cloud.dialogflow.v2beta1.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @instance + */ + SetSuggestionFeatureConfigRequest.prototype.participantRole = 0; + + /** + * SetSuggestionFeatureConfigRequest suggestionFeatureConfig. + * @member {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.ISuggestionFeatureConfig|null|undefined} suggestionFeatureConfig + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @instance + */ + SetSuggestionFeatureConfigRequest.prototype.suggestionFeatureConfig = null; + + /** + * Creates a new SetSuggestionFeatureConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest} SetSuggestionFeatureConfigRequest instance + */ + SetSuggestionFeatureConfigRequest.create = function create(properties) { + return new SetSuggestionFeatureConfigRequest(properties); + }; + + /** + * Encodes the specified SetSuggestionFeatureConfigRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest} message SetSuggestionFeatureConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetSuggestionFeatureConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationProfile); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.participantRole); + if (message.suggestionFeatureConfig != null && Object.hasOwnProperty.call(message, "suggestionFeatureConfig")) + $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.encode(message.suggestionFeatureConfig, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetSuggestionFeatureConfigRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest} message SetSuggestionFeatureConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetSuggestionFeatureConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetSuggestionFeatureConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest} SetSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetSuggestionFeatureConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = reader.string(); + break; + } + case 2: { + message.participantRole = reader.int32(); + break; + } + case 3: { + message.suggestionFeatureConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetSuggestionFeatureConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest} SetSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetSuggestionFeatureConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetSuggestionFeatureConfigRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetSuggestionFeatureConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.suggestionFeatureConfig != null && message.hasOwnProperty("suggestionFeatureConfig")) { + var error = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.verify(message.suggestionFeatureConfig); + if (error) + return "suggestionFeatureConfig." + error; + } + return null; + }; + + /** + * Creates a SetSuggestionFeatureConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest} SetSuggestionFeatureConfigRequest + */ + SetSuggestionFeatureConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest(); + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + if (object.suggestionFeatureConfig != null) { + if (typeof object.suggestionFeatureConfig !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest.suggestionFeatureConfig: object expected"); + message.suggestionFeatureConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.fromObject(object.suggestionFeatureConfig); + } + return message; + }; + + /** + * Creates a plain object from a SetSuggestionFeatureConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest} message SetSuggestionFeatureConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetSuggestionFeatureConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.suggestionFeatureConfig = null; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] : message.participantRole; + if (message.suggestionFeatureConfig != null && message.hasOwnProperty("suggestionFeatureConfig")) + object.suggestionFeatureConfig = $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig.toObject(message.suggestionFeatureConfig, options); + return object; + }; + + /** + * Converts this SetSuggestionFeatureConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @instance + * @returns {Object.} JSON object + */ + SetSuggestionFeatureConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SetSuggestionFeatureConfigRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetSuggestionFeatureConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest"; + }; + + return SetSuggestionFeatureConfigRequest; + })(); + + v2beta1.ClearSuggestionFeatureConfigRequest = (function() { + + /** + * Properties of a ClearSuggestionFeatureConfigRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IClearSuggestionFeatureConfigRequest + * @property {string|null} [conversationProfile] ClearSuggestionFeatureConfigRequest conversationProfile + * @property {google.cloud.dialogflow.v2beta1.Participant.Role|null} [participantRole] ClearSuggestionFeatureConfigRequest participantRole + * @property {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|null} [suggestionFeatureType] ClearSuggestionFeatureConfigRequest suggestionFeatureType + */ + + /** + * Constructs a new ClearSuggestionFeatureConfigRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ClearSuggestionFeatureConfigRequest. + * @implements IClearSuggestionFeatureConfigRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest=} [properties] Properties to set + */ + function ClearSuggestionFeatureConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClearSuggestionFeatureConfigRequest conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @instance + */ + ClearSuggestionFeatureConfigRequest.prototype.conversationProfile = ""; + + /** + * ClearSuggestionFeatureConfigRequest participantRole. + * @member {google.cloud.dialogflow.v2beta1.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @instance + */ + ClearSuggestionFeatureConfigRequest.prototype.participantRole = 0; + + /** + * ClearSuggestionFeatureConfigRequest suggestionFeatureType. + * @member {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type} suggestionFeatureType + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @instance + */ + ClearSuggestionFeatureConfigRequest.prototype.suggestionFeatureType = 0; + + /** + * Creates a new ClearSuggestionFeatureConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest} ClearSuggestionFeatureConfigRequest instance + */ + ClearSuggestionFeatureConfigRequest.create = function create(properties) { + return new ClearSuggestionFeatureConfigRequest(properties); + }; + + /** + * Encodes the specified ClearSuggestionFeatureConfigRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest} message ClearSuggestionFeatureConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearSuggestionFeatureConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationProfile); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.participantRole); + if (message.suggestionFeatureType != null && Object.hasOwnProperty.call(message, "suggestionFeatureType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.suggestionFeatureType); + return writer; + }; + + /** + * Encodes the specified ClearSuggestionFeatureConfigRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest} message ClearSuggestionFeatureConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearSuggestionFeatureConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClearSuggestionFeatureConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest} ClearSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearSuggestionFeatureConfigRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = reader.string(); + break; + } + case 2: { + message.participantRole = reader.int32(); + break; + } + case 3: { + message.suggestionFeatureType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClearSuggestionFeatureConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest} ClearSuggestionFeatureConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearSuggestionFeatureConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClearSuggestionFeatureConfigRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClearSuggestionFeatureConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + switch (message.suggestionFeatureType) { + default: + return "suggestionFeatureType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 8: + break; + } + return null; + }; + + /** + * Creates a ClearSuggestionFeatureConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest} ClearSuggestionFeatureConfigRequest + */ + ClearSuggestionFeatureConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest(); + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + switch (object.suggestionFeatureType) { + default: + if (typeof object.suggestionFeatureType === "number") { + message.suggestionFeatureType = object.suggestionFeatureType; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.suggestionFeatureType = 0; + break; + case "ARTICLE_SUGGESTION": + case 1: + message.suggestionFeatureType = 1; + break; + case "FAQ": + case 2: + message.suggestionFeatureType = 2; + break; + case "SMART_REPLY": + case 3: + message.suggestionFeatureType = 3; + break; + case "CONVERSATION_SUMMARIZATION": + case 8: + message.suggestionFeatureType = 8; + break; + } + return message; + }; + + /** + * Creates a plain object from a ClearSuggestionFeatureConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest} message ClearSuggestionFeatureConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClearSuggestionFeatureConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.suggestionFeatureType = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] : message.participantRole; + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + object.suggestionFeatureType = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.Type[message.suggestionFeatureType] === undefined ? message.suggestionFeatureType : $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.Type[message.suggestionFeatureType] : message.suggestionFeatureType; + return object; + }; + + /** + * Converts this ClearSuggestionFeatureConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @instance + * @returns {Object.} JSON object + */ + ClearSuggestionFeatureConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ClearSuggestionFeatureConfigRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClearSuggestionFeatureConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest"; + }; + + return ClearSuggestionFeatureConfigRequest; + })(); + + v2beta1.SetSuggestionFeatureConfigOperationMetadata = (function() { + + /** + * Properties of a SetSuggestionFeatureConfigOperationMetadata. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ISetSuggestionFeatureConfigOperationMetadata + * @property {string|null} [conversationProfile] SetSuggestionFeatureConfigOperationMetadata conversationProfile + * @property {google.cloud.dialogflow.v2beta1.Participant.Role|null} [participantRole] SetSuggestionFeatureConfigOperationMetadata participantRole + * @property {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|null} [suggestionFeatureType] SetSuggestionFeatureConfigOperationMetadata suggestionFeatureType + * @property {google.protobuf.ITimestamp|null} [createTime] SetSuggestionFeatureConfigOperationMetadata createTime + */ + + /** + * Constructs a new SetSuggestionFeatureConfigOperationMetadata. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a SetSuggestionFeatureConfigOperationMetadata. + * @implements ISetSuggestionFeatureConfigOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata=} [properties] Properties to set + */ + function SetSuggestionFeatureConfigOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SetSuggestionFeatureConfigOperationMetadata conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @instance + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.conversationProfile = ""; + + /** + * SetSuggestionFeatureConfigOperationMetadata participantRole. + * @member {google.cloud.dialogflow.v2beta1.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @instance + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.participantRole = 0; + + /** + * SetSuggestionFeatureConfigOperationMetadata suggestionFeatureType. + * @member {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type} suggestionFeatureType + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @instance + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.suggestionFeatureType = 0; + + /** + * SetSuggestionFeatureConfigOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @instance + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.createTime = null; + + /** + * Creates a new SetSuggestionFeatureConfigOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata} SetSuggestionFeatureConfigOperationMetadata instance + */ + SetSuggestionFeatureConfigOperationMetadata.create = function create(properties) { + return new SetSuggestionFeatureConfigOperationMetadata(properties); + }; + + /** + * Encodes the specified SetSuggestionFeatureConfigOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata} message SetSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetSuggestionFeatureConfigOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationProfile); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.participantRole); + if (message.suggestionFeatureType != null && Object.hasOwnProperty.call(message, "suggestionFeatureType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.suggestionFeatureType); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SetSuggestionFeatureConfigOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata} message SetSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SetSuggestionFeatureConfigOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SetSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata} SetSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetSuggestionFeatureConfigOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = reader.string(); + break; + } + case 2: { + message.participantRole = reader.int32(); + break; + } + case 3: { + message.suggestionFeatureType = reader.int32(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SetSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata} SetSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SetSuggestionFeatureConfigOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SetSuggestionFeatureConfigOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SetSuggestionFeatureConfigOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + switch (message.suggestionFeatureType) { + default: + return "suggestionFeatureType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 8: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a SetSuggestionFeatureConfigOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata} SetSuggestionFeatureConfigOperationMetadata + */ + SetSuggestionFeatureConfigOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata(); + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + switch (object.suggestionFeatureType) { + default: + if (typeof object.suggestionFeatureType === "number") { + message.suggestionFeatureType = object.suggestionFeatureType; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.suggestionFeatureType = 0; + break; + case "ARTICLE_SUGGESTION": + case 1: + message.suggestionFeatureType = 1; + break; + case "FAQ": + case 2: + message.suggestionFeatureType = 2; + break; + case "SMART_REPLY": + case 3: + message.suggestionFeatureType = 3; + break; + case "CONVERSATION_SUMMARIZATION": + case 8: + message.suggestionFeatureType = 8; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a SetSuggestionFeatureConfigOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata} message SetSuggestionFeatureConfigOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SetSuggestionFeatureConfigOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.suggestionFeatureType = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.createTime = null; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] : message.participantRole; + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + object.suggestionFeatureType = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.Type[message.suggestionFeatureType] === undefined ? message.suggestionFeatureType : $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.Type[message.suggestionFeatureType] : message.suggestionFeatureType; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this SetSuggestionFeatureConfigOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + SetSuggestionFeatureConfigOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SetSuggestionFeatureConfigOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SetSuggestionFeatureConfigOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata"; + }; + + return SetSuggestionFeatureConfigOperationMetadata; + })(); + + v2beta1.ClearSuggestionFeatureConfigOperationMetadata = (function() { + + /** + * Properties of a ClearSuggestionFeatureConfigOperationMetadata. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IClearSuggestionFeatureConfigOperationMetadata + * @property {string|null} [conversationProfile] ClearSuggestionFeatureConfigOperationMetadata conversationProfile + * @property {google.cloud.dialogflow.v2beta1.Participant.Role|null} [participantRole] ClearSuggestionFeatureConfigOperationMetadata participantRole + * @property {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type|null} [suggestionFeatureType] ClearSuggestionFeatureConfigOperationMetadata suggestionFeatureType + * @property {google.protobuf.ITimestamp|null} [createTime] ClearSuggestionFeatureConfigOperationMetadata createTime + */ + + /** + * Constructs a new ClearSuggestionFeatureConfigOperationMetadata. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ClearSuggestionFeatureConfigOperationMetadata. + * @implements IClearSuggestionFeatureConfigOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata=} [properties] Properties to set + */ + function ClearSuggestionFeatureConfigOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClearSuggestionFeatureConfigOperationMetadata conversationProfile. + * @member {string} conversationProfile + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @instance + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.conversationProfile = ""; + + /** + * ClearSuggestionFeatureConfigOperationMetadata participantRole. + * @member {google.cloud.dialogflow.v2beta1.Participant.Role} participantRole + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @instance + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.participantRole = 0; + + /** + * ClearSuggestionFeatureConfigOperationMetadata suggestionFeatureType. + * @member {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type} suggestionFeatureType + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @instance + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.suggestionFeatureType = 0; + + /** + * ClearSuggestionFeatureConfigOperationMetadata createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @instance + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.createTime = null; + + /** + * Creates a new ClearSuggestionFeatureConfigOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata} ClearSuggestionFeatureConfigOperationMetadata instance + */ + ClearSuggestionFeatureConfigOperationMetadata.create = function create(properties) { + return new ClearSuggestionFeatureConfigOperationMetadata(properties); + }; + + /** + * Encodes the specified ClearSuggestionFeatureConfigOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata} message ClearSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearSuggestionFeatureConfigOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversationProfile != null && Object.hasOwnProperty.call(message, "conversationProfile")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversationProfile); + if (message.participantRole != null && Object.hasOwnProperty.call(message, "participantRole")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.participantRole); + if (message.suggestionFeatureType != null && Object.hasOwnProperty.call(message, "suggestionFeatureType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.suggestionFeatureType); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClearSuggestionFeatureConfigOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata} message ClearSuggestionFeatureConfigOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClearSuggestionFeatureConfigOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClearSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata} ClearSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearSuggestionFeatureConfigOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversationProfile = reader.string(); + break; + } + case 2: { + message.participantRole = reader.int32(); + break; + } + case 3: { + message.suggestionFeatureType = reader.int32(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClearSuggestionFeatureConfigOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata} ClearSuggestionFeatureConfigOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClearSuggestionFeatureConfigOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClearSuggestionFeatureConfigOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClearSuggestionFeatureConfigOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + if (!$util.isString(message.conversationProfile)) + return "conversationProfile: string expected"; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + switch (message.participantRole) { + default: + return "participantRole: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + switch (message.suggestionFeatureType) { + default: + return "suggestionFeatureType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 8: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates a ClearSuggestionFeatureConfigOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata} ClearSuggestionFeatureConfigOperationMetadata + */ + ClearSuggestionFeatureConfigOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata(); + if (object.conversationProfile != null) + message.conversationProfile = String(object.conversationProfile); + switch (object.participantRole) { + default: + if (typeof object.participantRole === "number") { + message.participantRole = object.participantRole; + break; + } + break; + case "ROLE_UNSPECIFIED": + case 0: + message.participantRole = 0; + break; + case "HUMAN_AGENT": + case 1: + message.participantRole = 1; + break; + case "AUTOMATED_AGENT": + case 2: + message.participantRole = 2; + break; + case "END_USER": + case 3: + message.participantRole = 3; + break; + } + switch (object.suggestionFeatureType) { + default: + if (typeof object.suggestionFeatureType === "number") { + message.suggestionFeatureType = object.suggestionFeatureType; + break; + } + break; + case "TYPE_UNSPECIFIED": + case 0: + message.suggestionFeatureType = 0; + break; + case "ARTICLE_SUGGESTION": + case 1: + message.suggestionFeatureType = 1; + break; + case "FAQ": + case 2: + message.suggestionFeatureType = 2; + break; + case "SMART_REPLY": + case 3: + message.suggestionFeatureType = 3; + break; + case "CONVERSATION_SUMMARIZATION": + case 8: + message.suggestionFeatureType = 8; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from a ClearSuggestionFeatureConfigOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata} message ClearSuggestionFeatureConfigOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClearSuggestionFeatureConfigOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.conversationProfile = ""; + object.participantRole = options.enums === String ? "ROLE_UNSPECIFIED" : 0; + object.suggestionFeatureType = options.enums === String ? "TYPE_UNSPECIFIED" : 0; + object.createTime = null; + } + if (message.conversationProfile != null && message.hasOwnProperty("conversationProfile")) + object.conversationProfile = message.conversationProfile; + if (message.participantRole != null && message.hasOwnProperty("participantRole")) + object.participantRole = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] === undefined ? message.participantRole : $root.google.cloud.dialogflow.v2beta1.Participant.Role[message.participantRole] : message.participantRole; + if (message.suggestionFeatureType != null && message.hasOwnProperty("suggestionFeatureType")) + object.suggestionFeatureType = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.Type[message.suggestionFeatureType] === undefined ? message.suggestionFeatureType : $root.google.cloud.dialogflow.v2beta1.SuggestionFeature.Type[message.suggestionFeatureType] : message.suggestionFeatureType; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this ClearSuggestionFeatureConfigOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ClearSuggestionFeatureConfigOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ClearSuggestionFeatureConfigOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClearSuggestionFeatureConfigOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata"; + }; + + return ClearSuggestionFeatureConfigOperationMetadata; + })(); + + v2beta1.Documents = (function() { + + /** + * Constructs a new Documents service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Documents + * @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 Documents(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Documents.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Documents; + + /** + * Creates new Documents service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @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 {Documents} RPC service. Useful where requests and/or responses are streamed. + */ + Documents.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|listDocuments}. + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @typedef ListDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListDocumentsResponse} [response] ListDocumentsResponse + */ + + /** + * Calls ListDocuments. + * @function listDocuments + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsRequest} request ListDocumentsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Documents.ListDocumentsCallback} callback Node-style callback called with the error, if any, and ListDocumentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.listDocuments = function listDocuments(request, callback) { + return this.rpcCall(listDocuments, $root.google.cloud.dialogflow.v2beta1.ListDocumentsRequest, $root.google.cloud.dialogflow.v2beta1.ListDocumentsResponse, request, callback); + }, "name", { value: "ListDocuments" }); + + /** + * Calls ListDocuments. + * @function listDocuments + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsRequest} request ListDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|getDocument}. + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @typedef GetDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Document} [response] Document + */ + + /** + * Calls GetDocument. + * @function getDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetDocumentRequest} request GetDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Documents.GetDocumentCallback} callback Node-style callback called with the error, if any, and Document + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.getDocument = function getDocument(request, callback) { + return this.rpcCall(getDocument, $root.google.cloud.dialogflow.v2beta1.GetDocumentRequest, $root.google.cloud.dialogflow.v2beta1.Document, request, callback); + }, "name", { value: "GetDocument" }); + + /** + * Calls GetDocument. + * @function getDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetDocumentRequest} request GetDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|createDocument}. + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @typedef CreateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateDocument. + * @function createDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateDocumentRequest} request CreateDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Documents.CreateDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.createDocument = function createDocument(request, callback) { + return this.rpcCall(createDocument, $root.google.cloud.dialogflow.v2beta1.CreateDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateDocument" }); + + /** + * Calls CreateDocument. + * @function createDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateDocumentRequest} request CreateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|importDocuments}. + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @typedef ImportDocumentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ImportDocuments. + * @function importDocuments + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsRequest} request ImportDocumentsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Documents.ImportDocumentsCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.importDocuments = function importDocuments(request, callback) { + return this.rpcCall(importDocuments, $root.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ImportDocuments" }); + + /** + * Calls ImportDocuments. + * @function importDocuments + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsRequest} request ImportDocumentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|deleteDocument}. + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @typedef DeleteDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteDocument. + * @function deleteDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest} request DeleteDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Documents.DeleteDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.deleteDocument = function deleteDocument(request, callback) { + return this.rpcCall(deleteDocument, $root.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteDocument" }); + + /** + * Calls DeleteDocument. + * @function deleteDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest} request DeleteDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|updateDocument}. + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @typedef UpdateDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateDocument. + * @function updateDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest} request UpdateDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Documents.UpdateDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.updateDocument = function updateDocument(request, callback) { + return this.rpcCall(updateDocument, $root.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateDocument" }); + + /** + * Calls UpdateDocument. + * @function updateDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest} request UpdateDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Documents|reloadDocument}. + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @typedef ReloadDocumentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls ReloadDocument. + * @function reloadDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IReloadDocumentRequest} request ReloadDocumentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Documents.ReloadDocumentCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Documents.prototype.reloadDocument = function reloadDocument(request, callback) { + return this.rpcCall(reloadDocument, $root.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "ReloadDocument" }); + + /** + * Calls ReloadDocument. + * @function reloadDocument + * @memberof google.cloud.dialogflow.v2beta1.Documents + * @instance + * @param {google.cloud.dialogflow.v2beta1.IReloadDocumentRequest} request ReloadDocumentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Documents; + })(); + + v2beta1.Document = (function() { + + /** + * Properties of a Document. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDocument + * @property {string|null} [name] Document name + * @property {string|null} [displayName] Document displayName + * @property {string|null} [mimeType] Document mimeType + * @property {Array.|null} [knowledgeTypes] Document knowledgeTypes + * @property {string|null} [contentUri] Document contentUri + * @property {string|null} [content] Document content + * @property {Uint8Array|null} [rawContent] Document rawContent + * @property {boolean|null} [enableAutoReload] Document enableAutoReload + * @property {google.cloud.dialogflow.v2beta1.Document.IReloadStatus|null} [latestReloadStatus] Document latestReloadStatus + * @property {Object.|null} [metadata] Document metadata + * @property {google.cloud.dialogflow.v2beta1.Document.State|null} [state] Document state + */ + + /** + * Constructs a new Document. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Document. + * @implements IDocument + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDocument=} [properties] Properties to set + */ + function Document(properties) { + this.knowledgeTypes = []; + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Document name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.name = ""; + + /** + * Document displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.displayName = ""; + + /** + * Document mimeType. + * @member {string} mimeType + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.mimeType = ""; + + /** + * Document knowledgeTypes. + * @member {Array.} knowledgeTypes + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.knowledgeTypes = $util.emptyArray; + + /** + * Document contentUri. + * @member {string|null|undefined} contentUri + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.contentUri = null; + + /** + * Document content. + * @member {string|null|undefined} content + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.content = null; + + /** + * Document rawContent. + * @member {Uint8Array|null|undefined} rawContent + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.rawContent = null; + + /** + * Document enableAutoReload. + * @member {boolean} enableAutoReload + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.enableAutoReload = false; + + /** + * Document latestReloadStatus. + * @member {google.cloud.dialogflow.v2beta1.Document.IReloadStatus|null|undefined} latestReloadStatus + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.latestReloadStatus = null; + + /** + * Document metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.metadata = $util.emptyObject; + + /** + * Document state. + * @member {google.cloud.dialogflow.v2beta1.Document.State} state + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Document.prototype.state = 0; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Document source. + * @member {"contentUri"|"content"|"rawContent"|undefined} source + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + */ + Object.defineProperty(Document.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["contentUri", "content", "rawContent"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Document instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Document + * @static + * @param {google.cloud.dialogflow.v2beta1.IDocument=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Document} Document instance + */ + Document.create = function create(properties) { + return new Document(properties); + }; + + /** + * Encodes the specified Document message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Document.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Document + * @static + * @param {google.cloud.dialogflow.v2beta1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.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.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.mimeType); + if (message.knowledgeTypes != null && message.knowledgeTypes.length) { + writer.uint32(/* id 4, wireType 2 =*/34).fork(); + for (var i = 0; i < message.knowledgeTypes.length; ++i) + writer.int32(message.knowledgeTypes[i]); + writer.ldelim(); + } + if (message.contentUri != null && Object.hasOwnProperty.call(message, "contentUri")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.contentUri); + if (message.content != null && Object.hasOwnProperty.call(message, "content")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.content); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + if (message.rawContent != null && Object.hasOwnProperty.call(message, "rawContent")) + writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.rawContent); + if (message.enableAutoReload != null && Object.hasOwnProperty.call(message, "enableAutoReload")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.enableAutoReload); + if (message.latestReloadStatus != null && Object.hasOwnProperty.call(message, "latestReloadStatus")) + $root.google.cloud.dialogflow.v2beta1.Document.ReloadStatus.encode(message.latestReloadStatus, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.state); + return writer; + }; + + /** + * Encodes the specified Document message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Document.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Document + * @static + * @param {google.cloud.dialogflow.v2beta1.IDocument} message Document message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Document.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Document message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Document(), key, value; + 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.mimeType = reader.string(); + break; + } + case 4: { + if (!(message.knowledgeTypes && message.knowledgeTypes.length)) + message.knowledgeTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.knowledgeTypes.push(reader.int32()); + } else + message.knowledgeTypes.push(reader.int32()); + break; + } + case 5: { + message.contentUri = reader.string(); + break; + } + case 6: { + message.content = reader.string(); + break; + } + case 9: { + message.rawContent = reader.bytes(); + break; + } + case 11: { + message.enableAutoReload = reader.bool(); + break; + } + case 12: { + message.latestReloadStatus = $root.google.cloud.dialogflow.v2beta1.Document.ReloadStatus.decode(reader, reader.uint32()); + break; + } + case 7: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + case 13: { + message.state = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Document message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Document + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Document} Document + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Document.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Document message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Document + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Document.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.knowledgeTypes != null && message.hasOwnProperty("knowledgeTypes")) { + if (!Array.isArray(message.knowledgeTypes)) + return "knowledgeTypes: array expected"; + for (var i = 0; i < message.knowledgeTypes.length; ++i) + switch (message.knowledgeTypes[i]) { + default: + return "knowledgeTypes: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 4: + break; + } + } + if (message.contentUri != null && message.hasOwnProperty("contentUri")) { + properties.source = 1; + if (!$util.isString(message.contentUri)) + return "contentUri: string expected"; + } + if (message.content != null && message.hasOwnProperty("content")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!$util.isString(message.content)) + return "content: string expected"; + } + if (message.rawContent != null && message.hasOwnProperty("rawContent")) { + if (properties.source === 1) + return "source: multiple values"; + properties.source = 1; + if (!(message.rawContent && typeof message.rawContent.length === "number" || $util.isString(message.rawContent))) + return "rawContent: buffer expected"; + } + if (message.enableAutoReload != null && message.hasOwnProperty("enableAutoReload")) + if (typeof message.enableAutoReload !== "boolean") + return "enableAutoReload: boolean expected"; + if (message.latestReloadStatus != null && message.hasOwnProperty("latestReloadStatus")) { + var error = $root.google.cloud.dialogflow.v2beta1.Document.ReloadStatus.verify(message.latestReloadStatus); + if (error) + return "latestReloadStatus." + error; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} 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: + case 5: + break; + } + return null; + }; + + /** + * Creates a Document message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Document + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Document} Document + */ + Document.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Document) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Document(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.knowledgeTypes) { + if (!Array.isArray(object.knowledgeTypes)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Document.knowledgeTypes: array expected"); + message.knowledgeTypes = []; + for (var i = 0; i < object.knowledgeTypes.length; ++i) + switch (object.knowledgeTypes[i]) { + default: + if (typeof object.knowledgeTypes[i] === "number") { + message.knowledgeTypes[i] = object.knowledgeTypes[i]; + break; + } + case "KNOWLEDGE_TYPE_UNSPECIFIED": + case 0: + message.knowledgeTypes[i] = 0; + break; + case "FAQ": + case 1: + message.knowledgeTypes[i] = 1; + break; + case "EXTRACTIVE_QA": + case 2: + message.knowledgeTypes[i] = 2; + break; + case "ARTICLE_SUGGESTION": + case 3: + message.knowledgeTypes[i] = 3; + break; + case "AGENT_FACING_SMART_REPLY": + case 4: + message.knowledgeTypes[i] = 4; + break; + case "SMART_REPLY": + case 4: + message.knowledgeTypes[i] = 4; + break; + } + } + if (object.contentUri != null) + message.contentUri = String(object.contentUri); + if (object.content != null) + message.content = String(object.content); + if (object.rawContent != null) + if (typeof object.rawContent === "string") + $util.base64.decode(object.rawContent, message.rawContent = $util.newBuffer($util.base64.length(object.rawContent)), 0); + else if (object.rawContent.length >= 0) + message.rawContent = object.rawContent; + if (object.enableAutoReload != null) + message.enableAutoReload = Boolean(object.enableAutoReload); + if (object.latestReloadStatus != null) { + if (typeof object.latestReloadStatus !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Document.latestReloadStatus: object expected"); + message.latestReloadStatus = $root.google.cloud.dialogflow.v2beta1.Document.ReloadStatus.fromObject(object.latestReloadStatus); + } + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Document.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + 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 "CREATING": + case 1: + message.state = 1; + break; + case "ACTIVE": + case 2: + message.state = 2; + break; + case "UPDATING": + case 3: + message.state = 3; + break; + case "RELOADING": + case 4: + message.state = 4; + break; + case "DELETING": + case 5: + message.state = 5; + break; + } + return message; + }; + + /** + * Creates a plain object from a Document message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Document + * @static + * @param {google.cloud.dialogflow.v2beta1.Document} message Document + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Document.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.knowledgeTypes = []; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.mimeType = ""; + object.enableAutoReload = false; + object.latestReloadStatus = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.knowledgeTypes && message.knowledgeTypes.length) { + object.knowledgeTypes = []; + for (var j = 0; j < message.knowledgeTypes.length; ++j) + object.knowledgeTypes[j] = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Document.KnowledgeType[message.knowledgeTypes[j]] === undefined ? message.knowledgeTypes[j] : $root.google.cloud.dialogflow.v2beta1.Document.KnowledgeType[message.knowledgeTypes[j]] : message.knowledgeTypes[j]; + } + if (message.contentUri != null && message.hasOwnProperty("contentUri")) { + object.contentUri = message.contentUri; + if (options.oneofs) + object.source = "contentUri"; + } + if (message.content != null && message.hasOwnProperty("content")) { + object.content = message.content; + if (options.oneofs) + object.source = "content"; + } + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + if (message.rawContent != null && message.hasOwnProperty("rawContent")) { + object.rawContent = options.bytes === String ? $util.base64.encode(message.rawContent, 0, message.rawContent.length) : options.bytes === Array ? Array.prototype.slice.call(message.rawContent) : message.rawContent; + if (options.oneofs) + object.source = "rawContent"; + } + if (message.enableAutoReload != null && message.hasOwnProperty("enableAutoReload")) + object.enableAutoReload = message.enableAutoReload; + if (message.latestReloadStatus != null && message.hasOwnProperty("latestReloadStatus")) + object.latestReloadStatus = $root.google.cloud.dialogflow.v2beta1.Document.ReloadStatus.toObject(message.latestReloadStatus, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Document.State[message.state] === undefined ? message.state : $root.google.cloud.dialogflow.v2beta1.Document.State[message.state] : message.state; + return object; + }; + + /** + * Converts this Document to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Document + * @instance + * @returns {Object.} JSON object + */ + Document.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Document + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Document + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Document.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Document"; + }; + + /** + * KnowledgeType enum. + * @name google.cloud.dialogflow.v2beta1.Document.KnowledgeType + * @enum {number} + * @property {number} KNOWLEDGE_TYPE_UNSPECIFIED=0 KNOWLEDGE_TYPE_UNSPECIFIED value + * @property {number} FAQ=1 FAQ value + * @property {number} EXTRACTIVE_QA=2 EXTRACTIVE_QA value + * @property {number} ARTICLE_SUGGESTION=3 ARTICLE_SUGGESTION value + * @property {number} AGENT_FACING_SMART_REPLY=4 AGENT_FACING_SMART_REPLY value + * @property {number} SMART_REPLY=4 SMART_REPLY value + */ + Document.KnowledgeType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "KNOWLEDGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FAQ"] = 1; + values[valuesById[2] = "EXTRACTIVE_QA"] = 2; + values[valuesById[3] = "ARTICLE_SUGGESTION"] = 3; + values[valuesById[4] = "AGENT_FACING_SMART_REPLY"] = 4; + values["SMART_REPLY"] = 4; + return values; + })(); + + Document.ReloadStatus = (function() { + + /** + * Properties of a ReloadStatus. + * @memberof google.cloud.dialogflow.v2beta1.Document + * @interface IReloadStatus + * @property {google.protobuf.ITimestamp|null} [time] ReloadStatus time + * @property {google.rpc.IStatus|null} [status] ReloadStatus status + */ + + /** + * Constructs a new ReloadStatus. + * @memberof google.cloud.dialogflow.v2beta1.Document + * @classdesc Represents a ReloadStatus. + * @implements IReloadStatus + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Document.IReloadStatus=} [properties] Properties to set + */ + function ReloadStatus(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReloadStatus time. + * @member {google.protobuf.ITimestamp|null|undefined} time + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @instance + */ + ReloadStatus.prototype.time = null; + + /** + * ReloadStatus status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @instance + */ + ReloadStatus.prototype.status = null; + + /** + * Creates a new ReloadStatus instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @static + * @param {google.cloud.dialogflow.v2beta1.Document.IReloadStatus=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Document.ReloadStatus} ReloadStatus instance + */ + ReloadStatus.create = function create(properties) { + return new ReloadStatus(properties); + }; + + /** + * Encodes the specified ReloadStatus message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Document.ReloadStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @static + * @param {google.cloud.dialogflow.v2beta1.Document.IReloadStatus} message ReloadStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReloadStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + $root.google.protobuf.Timestamp.encode(message.time, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReloadStatus message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Document.ReloadStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @static + * @param {google.cloud.dialogflow.v2beta1.Document.IReloadStatus} message ReloadStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReloadStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReloadStatus message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Document.ReloadStatus} ReloadStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReloadStatus.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Document.ReloadStatus(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.time = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReloadStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Document.ReloadStatus} ReloadStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReloadStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReloadStatus message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReloadStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.time != null && message.hasOwnProperty("time")) { + var error = $root.google.protobuf.Timestamp.verify(message.time); + if (error) + return "time." + error; + } + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + return null; + }; + + /** + * Creates a ReloadStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Document.ReloadStatus} ReloadStatus + */ + ReloadStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Document.ReloadStatus) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Document.ReloadStatus(); + if (object.time != null) { + if (typeof object.time !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Document.ReloadStatus.time: object expected"); + message.time = $root.google.protobuf.Timestamp.fromObject(object.time); + } + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Document.ReloadStatus.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + return message; + }; + + /** + * Creates a plain object from a ReloadStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @static + * @param {google.cloud.dialogflow.v2beta1.Document.ReloadStatus} message ReloadStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReloadStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.time = null; + object.status = null; + } + if (message.time != null && message.hasOwnProperty("time")) + object.time = $root.google.protobuf.Timestamp.toObject(message.time, options); + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + return object; + }; + + /** + * Converts this ReloadStatus to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @instance + * @returns {Object.} JSON object + */ + ReloadStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReloadStatus + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Document.ReloadStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReloadStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Document.ReloadStatus"; + }; + + return ReloadStatus; + })(); + + /** + * State enum. + * @name google.cloud.dialogflow.v2beta1.Document.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} CREATING=1 CREATING value + * @property {number} ACTIVE=2 ACTIVE value + * @property {number} UPDATING=3 UPDATING value + * @property {number} RELOADING=4 RELOADING value + * @property {number} DELETING=5 DELETING value + */ + Document.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CREATING"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + values[valuesById[3] = "UPDATING"] = 3; + values[valuesById[4] = "RELOADING"] = 4; + values[valuesById[5] = "DELETING"] = 5; + return values; + })(); + + return Document; + })(); + + v2beta1.GetDocumentRequest = (function() { + + /** + * Properties of a GetDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetDocumentRequest + * @property {string|null} [name] GetDocumentRequest name + */ + + /** + * Constructs a new GetDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetDocumentRequest. + * @implements IGetDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetDocumentRequest=} [properties] Properties to set + */ + function GetDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetDocumentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @instance + */ + GetDocumentRequest.prototype.name = ""; + + /** + * Creates a new GetDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetDocumentRequest} GetDocumentRequest instance + */ + GetDocumentRequest.create = function create(properties) { + return new GetDocumentRequest(properties); + }; + + /** + * Encodes the specified GetDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetDocumentRequest} message GetDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentRequest.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 GetDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetDocumentRequest} message GetDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetDocumentRequest} GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetDocumentRequest(); + 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 GetDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetDocumentRequest} GetDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetDocumentRequest.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 GetDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetDocumentRequest} GetDocumentRequest + */ + GetDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetDocumentRequest} message GetDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetDocumentRequest.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 GetDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + GetDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetDocumentRequest"; + }; + + return GetDocumentRequest; + })(); + + v2beta1.ListDocumentsRequest = (function() { + + /** + * Properties of a ListDocumentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListDocumentsRequest + * @property {string|null} [parent] ListDocumentsRequest parent + * @property {number|null} [pageSize] ListDocumentsRequest pageSize + * @property {string|null} [pageToken] ListDocumentsRequest pageToken + * @property {string|null} [filter] ListDocumentsRequest filter + */ + + /** + * Constructs a new ListDocumentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListDocumentsRequest. + * @implements IListDocumentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsRequest=} [properties] Properties to set + */ + function ListDocumentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDocumentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.parent = ""; + + /** + * ListDocumentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.pageSize = 0; + + /** + * ListDocumentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.pageToken = ""; + + /** + * ListDocumentsRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @instance + */ + ListDocumentsRequest.prototype.filter = ""; + + /** + * Creates a new ListDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListDocumentsRequest} ListDocumentsRequest instance + */ + ListDocumentsRequest.create = function create(properties) { + return new ListDocumentsRequest(properties); + }; + + /** + * Encodes the specified ListDocumentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsRequest} message ListDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsRequest.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); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsRequest} message ListDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListDocumentsRequest} ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListDocumentsRequest(); + 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; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListDocumentsRequest} ListDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDocumentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDocumentsRequest.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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListDocumentsRequest} ListDocumentsRequest + */ + ListDocumentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListDocumentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListDocumentsRequest(); + 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); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListDocumentsRequest} message ListDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDocumentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + 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; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListDocumentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDocumentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListDocumentsRequest"; + }; + + return ListDocumentsRequest; + })(); + + v2beta1.ListDocumentsResponse = (function() { + + /** + * Properties of a ListDocumentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListDocumentsResponse + * @property {Array.|null} [documents] ListDocumentsResponse documents + * @property {string|null} [nextPageToken] ListDocumentsResponse nextPageToken + */ + + /** + * Constructs a new ListDocumentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListDocumentsResponse. + * @implements IListDocumentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsResponse=} [properties] Properties to set + */ + function ListDocumentsResponse(properties) { + this.documents = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListDocumentsResponse documents. + * @member {Array.} documents + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @instance + */ + ListDocumentsResponse.prototype.documents = $util.emptyArray; + + /** + * ListDocumentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @instance + */ + ListDocumentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListDocumentsResponse} ListDocumentsResponse instance + */ + ListDocumentsResponse.create = function create(properties) { + return new ListDocumentsResponse(properties); + }; + + /** + * Encodes the specified ListDocumentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsResponse} message ListDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.documents != null && message.documents.length) + for (var i = 0; i < message.documents.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Document.encode(message.documents[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 ListDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListDocumentsResponse} message ListDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListDocumentsResponse} ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.documents && message.documents.length)) + message.documents = []; + message.documents.push($root.google.cloud.dialogflow.v2beta1.Document.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListDocumentsResponse} ListDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListDocumentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListDocumentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.documents != null && message.hasOwnProperty("documents")) { + if (!Array.isArray(message.documents)) + return "documents: array expected"; + for (var i = 0; i < message.documents.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Document.verify(message.documents[i]); + if (error) + return "documents." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListDocumentsResponse} ListDocumentsResponse + */ + ListDocumentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListDocumentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListDocumentsResponse(); + if (object.documents) { + if (!Array.isArray(object.documents)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListDocumentsResponse.documents: array expected"); + message.documents = []; + for (var i = 0; i < object.documents.length; ++i) { + if (typeof object.documents[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListDocumentsResponse.documents: object expected"); + message.documents[i] = $root.google.cloud.dialogflow.v2beta1.Document.fromObject(object.documents[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListDocumentsResponse} message ListDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListDocumentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.documents = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.documents && message.documents.length) { + object.documents = []; + for (var j = 0; j < message.documents.length; ++j) + object.documents[j] = $root.google.cloud.dialogflow.v2beta1.Document.toObject(message.documents[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListDocumentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListDocumentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListDocumentsResponse"; + }; + + return ListDocumentsResponse; + })(); + + v2beta1.CreateDocumentRequest = (function() { + + /** + * Properties of a CreateDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateDocumentRequest + * @property {string|null} [parent] CreateDocumentRequest parent + * @property {google.cloud.dialogflow.v2beta1.IDocument|null} [document] CreateDocumentRequest document + * @property {boolean|null} [importGcsCustomMetadata] CreateDocumentRequest importGcsCustomMetadata + */ + + /** + * Constructs a new CreateDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateDocumentRequest. + * @implements ICreateDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateDocumentRequest=} [properties] Properties to set + */ + function CreateDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateDocumentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.parent = ""; + + /** + * CreateDocumentRequest document. + * @member {google.cloud.dialogflow.v2beta1.IDocument|null|undefined} document + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.document = null; + + /** + * CreateDocumentRequest importGcsCustomMetadata. + * @member {boolean} importGcsCustomMetadata + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @instance + */ + CreateDocumentRequest.prototype.importGcsCustomMetadata = false; + + /** + * Creates a new CreateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateDocumentRequest} CreateDocumentRequest instance + */ + CreateDocumentRequest.create = function create(properties) { + return new CreateDocumentRequest(properties); + }; + + /** + * Encodes the specified CreateDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateDocumentRequest} message CreateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDocumentRequest.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.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.dialogflow.v2beta1.Document.encode(message.document, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.importGcsCustomMetadata != null && Object.hasOwnProperty.call(message, "importGcsCustomMetadata")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.importGcsCustomMetadata); + return writer; + }; + + /** + * Encodes the specified CreateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateDocumentRequest} message CreateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateDocumentRequest} CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.document = $root.google.cloud.dialogflow.v2beta1.Document.decode(reader, reader.uint32()); + break; + } + case 3: { + message.importGcsCustomMetadata = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateDocumentRequest} CreateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateDocumentRequest.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.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.dialogflow.v2beta1.Document.verify(message.document); + if (error) + return "document." + error; + } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + if (typeof message.importGcsCustomMetadata !== "boolean") + return "importGcsCustomMetadata: boolean expected"; + return null; + }; + + /** + * Creates a CreateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateDocumentRequest} CreateDocumentRequest + */ + CreateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateDocumentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateDocumentRequest.document: object expected"); + message.document = $root.google.cloud.dialogflow.v2beta1.Document.fromObject(object.document); + } + if (object.importGcsCustomMetadata != null) + message.importGcsCustomMetadata = Boolean(object.importGcsCustomMetadata); + return message; + }; + + /** + * Creates a plain object from a CreateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateDocumentRequest} message CreateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.document = null; + object.importGcsCustomMetadata = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.dialogflow.v2beta1.Document.toObject(message.document, options); + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + object.importGcsCustomMetadata = message.importGcsCustomMetadata; + return object; + }; + + /** + * Converts this CreateDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateDocumentRequest"; + }; + + return CreateDocumentRequest; + })(); + + v2beta1.ImportDocumentsRequest = (function() { + + /** + * Properties of an ImportDocumentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IImportDocumentsRequest + * @property {string|null} [parent] ImportDocumentsRequest parent + * @property {google.cloud.dialogflow.v2beta1.IGcsSources|null} [gcsSource] ImportDocumentsRequest gcsSource + * @property {google.cloud.dialogflow.v2beta1.IImportDocumentTemplate|null} [documentTemplate] ImportDocumentsRequest documentTemplate + * @property {boolean|null} [importGcsCustomMetadata] ImportDocumentsRequest importGcsCustomMetadata + */ + + /** + * Constructs a new ImportDocumentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an ImportDocumentsRequest. + * @implements IImportDocumentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsRequest=} [properties] Properties to set + */ + function ImportDocumentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportDocumentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.parent = ""; + + /** + * ImportDocumentsRequest gcsSource. + * @member {google.cloud.dialogflow.v2beta1.IGcsSources|null|undefined} gcsSource + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.gcsSource = null; + + /** + * ImportDocumentsRequest documentTemplate. + * @member {google.cloud.dialogflow.v2beta1.IImportDocumentTemplate|null|undefined} documentTemplate + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.documentTemplate = null; + + /** + * ImportDocumentsRequest importGcsCustomMetadata. + * @member {boolean} importGcsCustomMetadata + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @instance + */ + ImportDocumentsRequest.prototype.importGcsCustomMetadata = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ImportDocumentsRequest source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @instance + */ + Object.defineProperty(ImportDocumentsRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ImportDocumentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentsRequest} ImportDocumentsRequest instance + */ + ImportDocumentsRequest.create = function create(properties) { + return new ImportDocumentsRequest(properties); + }; + + /** + * Encodes the specified ImportDocumentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsRequest} message ImportDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsRequest.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.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.dialogflow.v2beta1.GcsSources.encode(message.gcsSource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.documentTemplate != null && Object.hasOwnProperty.call(message, "documentTemplate")) + $root.google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.encode(message.documentTemplate, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.importGcsCustomMetadata != null && Object.hasOwnProperty.call(message, "importGcsCustomMetadata")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.importGcsCustomMetadata); + return writer; + }; + + /** + * Encodes the specified ImportDocumentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsRequest} message ImportDocumentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentsRequest} ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.gcsSource = $root.google.cloud.dialogflow.v2beta1.GcsSources.decode(reader, reader.uint32()); + break; + } + case 3: { + message.documentTemplate = $root.google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.decode(reader, reader.uint32()); + break; + } + case 4: { + message.importGcsCustomMetadata = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportDocumentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentsRequest} ImportDocumentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportDocumentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportDocumentsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.GcsSources.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.documentTemplate != null && message.hasOwnProperty("documentTemplate")) { + var error = $root.google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.verify(message.documentTemplate); + if (error) + return "documentTemplate." + error; + } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + if (typeof message.importGcsCustomMetadata !== "boolean") + return "importGcsCustomMetadata: boolean expected"; + return null; + }; + + /** + * Creates an ImportDocumentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentsRequest} ImportDocumentsRequest + */ + ImportDocumentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ImportDocumentsRequest.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.dialogflow.v2beta1.GcsSources.fromObject(object.gcsSource); + } + if (object.documentTemplate != null) { + if (typeof object.documentTemplate !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ImportDocumentsRequest.documentTemplate: object expected"); + message.documentTemplate = $root.google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.fromObject(object.documentTemplate); + } + if (object.importGcsCustomMetadata != null) + message.importGcsCustomMetadata = Boolean(object.importGcsCustomMetadata); + return message; + }; + + /** + * Creates a plain object from an ImportDocumentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ImportDocumentsRequest} message ImportDocumentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportDocumentsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.documentTemplate = null; + object.importGcsCustomMetadata = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.dialogflow.v2beta1.GcsSources.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.documentTemplate != null && message.hasOwnProperty("documentTemplate")) + object.documentTemplate = $root.google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.toObject(message.documentTemplate, options); + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + object.importGcsCustomMetadata = message.importGcsCustomMetadata; + return object; + }; + + /** + * Converts this ImportDocumentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @instance + * @returns {Object.} JSON object + */ + ImportDocumentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportDocumentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportDocumentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ImportDocumentsRequest"; + }; + + return ImportDocumentsRequest; + })(); + + v2beta1.ImportDocumentTemplate = (function() { + + /** + * Properties of an ImportDocumentTemplate. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IImportDocumentTemplate + * @property {string|null} [mimeType] ImportDocumentTemplate mimeType + * @property {Array.|null} [knowledgeTypes] ImportDocumentTemplate knowledgeTypes + * @property {Object.|null} [metadata] ImportDocumentTemplate metadata + */ + + /** + * Constructs a new ImportDocumentTemplate. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an ImportDocumentTemplate. + * @implements IImportDocumentTemplate + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentTemplate=} [properties] Properties to set + */ + function ImportDocumentTemplate(properties) { + this.knowledgeTypes = []; + this.metadata = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportDocumentTemplate mimeType. + * @member {string} mimeType + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @instance + */ + ImportDocumentTemplate.prototype.mimeType = ""; + + /** + * ImportDocumentTemplate knowledgeTypes. + * @member {Array.} knowledgeTypes + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @instance + */ + ImportDocumentTemplate.prototype.knowledgeTypes = $util.emptyArray; + + /** + * ImportDocumentTemplate metadata. + * @member {Object.} metadata + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @instance + */ + ImportDocumentTemplate.prototype.metadata = $util.emptyObject; + + /** + * Creates a new ImportDocumentTemplate instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentTemplate=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentTemplate} ImportDocumentTemplate instance + */ + ImportDocumentTemplate.create = function create(properties) { + return new ImportDocumentTemplate(properties); + }; + + /** + * Encodes the specified ImportDocumentTemplate message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentTemplate} message ImportDocumentTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentTemplate.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mimeType != null && Object.hasOwnProperty.call(message, "mimeType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.mimeType); + if (message.knowledgeTypes != null && message.knowledgeTypes.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.knowledgeTypes.length; ++i) + writer.int32(message.knowledgeTypes[i]); + writer.ldelim(); + } + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + for (var keys = Object.keys(message.metadata), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.metadata[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportDocumentTemplate message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentTemplate} message ImportDocumentTemplate message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentTemplate.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportDocumentTemplate message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentTemplate} ImportDocumentTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentTemplate.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ImportDocumentTemplate(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.mimeType = reader.string(); + break; + } + case 2: { + if (!(message.knowledgeTypes && message.knowledgeTypes.length)) + message.knowledgeTypes = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.knowledgeTypes.push(reader.int32()); + } else + message.knowledgeTypes.push(reader.int32()); + break; + } + case 3: { + if (message.metadata === $util.emptyObject) + message.metadata = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.metadata[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportDocumentTemplate message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentTemplate} ImportDocumentTemplate + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentTemplate.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportDocumentTemplate message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportDocumentTemplate.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + if (!$util.isString(message.mimeType)) + return "mimeType: string expected"; + if (message.knowledgeTypes != null && message.hasOwnProperty("knowledgeTypes")) { + if (!Array.isArray(message.knowledgeTypes)) + return "knowledgeTypes: array expected"; + for (var i = 0; i < message.knowledgeTypes.length; ++i) + switch (message.knowledgeTypes[i]) { + default: + return "knowledgeTypes: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 4: + break; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + if (!$util.isObject(message.metadata)) + return "metadata: object expected"; + var key = Object.keys(message.metadata); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.metadata[key[i]])) + return "metadata: string{k:string} expected"; + } + return null; + }; + + /** + * Creates an ImportDocumentTemplate message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentTemplate} ImportDocumentTemplate + */ + ImportDocumentTemplate.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ImportDocumentTemplate) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ImportDocumentTemplate(); + if (object.mimeType != null) + message.mimeType = String(object.mimeType); + if (object.knowledgeTypes) { + if (!Array.isArray(object.knowledgeTypes)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.knowledgeTypes: array expected"); + message.knowledgeTypes = []; + for (var i = 0; i < object.knowledgeTypes.length; ++i) + switch (object.knowledgeTypes[i]) { + default: + if (typeof object.knowledgeTypes[i] === "number") { + message.knowledgeTypes[i] = object.knowledgeTypes[i]; + break; + } + case "KNOWLEDGE_TYPE_UNSPECIFIED": + case 0: + message.knowledgeTypes[i] = 0; + break; + case "FAQ": + case 1: + message.knowledgeTypes[i] = 1; + break; + case "EXTRACTIVE_QA": + case 2: + message.knowledgeTypes[i] = 2; + break; + case "ARTICLE_SUGGESTION": + case 3: + message.knowledgeTypes[i] = 3; + break; + case "AGENT_FACING_SMART_REPLY": + case 4: + message.knowledgeTypes[i] = 4; + break; + case "SMART_REPLY": + case 4: + message.knowledgeTypes[i] = 4; + break; + } + } + if (object.metadata) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ImportDocumentTemplate.metadata: object expected"); + message.metadata = {}; + for (var keys = Object.keys(object.metadata), i = 0; i < keys.length; ++i) + message.metadata[keys[i]] = String(object.metadata[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from an ImportDocumentTemplate message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @static + * @param {google.cloud.dialogflow.v2beta1.ImportDocumentTemplate} message ImportDocumentTemplate + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportDocumentTemplate.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.knowledgeTypes = []; + if (options.objects || options.defaults) + object.metadata = {}; + if (options.defaults) + object.mimeType = ""; + if (message.mimeType != null && message.hasOwnProperty("mimeType")) + object.mimeType = message.mimeType; + if (message.knowledgeTypes && message.knowledgeTypes.length) { + object.knowledgeTypes = []; + for (var j = 0; j < message.knowledgeTypes.length; ++j) + object.knowledgeTypes[j] = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Document.KnowledgeType[message.knowledgeTypes[j]] === undefined ? message.knowledgeTypes[j] : $root.google.cloud.dialogflow.v2beta1.Document.KnowledgeType[message.knowledgeTypes[j]] : message.knowledgeTypes[j]; + } + var keys2; + if (message.metadata && (keys2 = Object.keys(message.metadata)).length) { + object.metadata = {}; + for (var j = 0; j < keys2.length; ++j) + object.metadata[keys2[j]] = message.metadata[keys2[j]]; + } + return object; + }; + + /** + * Converts this ImportDocumentTemplate to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @instance + * @returns {Object.} JSON object + */ + ImportDocumentTemplate.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportDocumentTemplate + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentTemplate + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportDocumentTemplate.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ImportDocumentTemplate"; + }; + + return ImportDocumentTemplate; + })(); + + v2beta1.ImportDocumentsResponse = (function() { + + /** + * Properties of an ImportDocumentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IImportDocumentsResponse + * @property {Array.|null} [warnings] ImportDocumentsResponse warnings + */ + + /** + * Constructs a new ImportDocumentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an ImportDocumentsResponse. + * @implements IImportDocumentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsResponse=} [properties] Properties to set + */ + function ImportDocumentsResponse(properties) { + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportDocumentsResponse warnings. + * @member {Array.} warnings + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @instance + */ + ImportDocumentsResponse.prototype.warnings = $util.emptyArray; + + /** + * Creates a new ImportDocumentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentsResponse} ImportDocumentsResponse instance + */ + ImportDocumentsResponse.create = function create(properties) { + return new ImportDocumentsResponse(properties); + }; + + /** + * Encodes the specified ImportDocumentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsResponse} message ImportDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + $root.google.rpc.Status.encode(message.warnings[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportDocumentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ImportDocumentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IImportDocumentsResponse} message ImportDocumentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportDocumentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportDocumentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentsResponse} ImportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ImportDocumentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push($root.google.rpc.Status.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportDocumentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentsResponse} ImportDocumentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportDocumentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportDocumentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportDocumentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) { + var error = $root.google.rpc.Status.verify(message.warnings[i]); + if (error) + return "warnings." + error; + } + } + return null; + }; + + /** + * Creates an ImportDocumentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ImportDocumentsResponse} ImportDocumentsResponse + */ + ImportDocumentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ImportDocumentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ImportDocumentsResponse(); + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ImportDocumentsResponse.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) { + if (typeof object.warnings[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ImportDocumentsResponse.warnings: object expected"); + message.warnings[i] = $root.google.rpc.Status.fromObject(object.warnings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an ImportDocumentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ImportDocumentsResponse} message ImportDocumentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportDocumentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.warnings = []; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = $root.google.rpc.Status.toObject(message.warnings[j], options); + } + return object; + }; + + /** + * Converts this ImportDocumentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @instance + * @returns {Object.} JSON object + */ + ImportDocumentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportDocumentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ImportDocumentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportDocumentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ImportDocumentsResponse"; + }; + + return ImportDocumentsResponse; + })(); + + v2beta1.DeleteDocumentRequest = (function() { + + /** + * Properties of a DeleteDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteDocumentRequest + * @property {string|null} [name] DeleteDocumentRequest name + */ + + /** + * Constructs a new DeleteDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteDocumentRequest. + * @implements IDeleteDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest=} [properties] Properties to set + */ + function DeleteDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteDocumentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @instance + */ + DeleteDocumentRequest.prototype.name = ""; + + /** + * Creates a new DeleteDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteDocumentRequest} DeleteDocumentRequest instance + */ + DeleteDocumentRequest.create = function create(properties) { + return new DeleteDocumentRequest(properties); + }; + + /** + * Encodes the specified DeleteDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest} message DeleteDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDocumentRequest.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 DeleteDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest} message DeleteDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteDocumentRequest} DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest(); + 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 DeleteDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteDocumentRequest} DeleteDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteDocumentRequest.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 DeleteDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteDocumentRequest} DeleteDocumentRequest + */ + DeleteDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteDocumentRequest} message DeleteDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteDocumentRequest.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 DeleteDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteDocumentRequest"; + }; + + return DeleteDocumentRequest; + })(); + + v2beta1.UpdateDocumentRequest = (function() { + + /** + * Properties of an UpdateDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateDocumentRequest + * @property {google.cloud.dialogflow.v2beta1.IDocument|null} [document] UpdateDocumentRequest document + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateDocumentRequest updateMask + */ + + /** + * Constructs a new UpdateDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateDocumentRequest. + * @implements IUpdateDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest=} [properties] Properties to set + */ + function UpdateDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateDocumentRequest document. + * @member {google.cloud.dialogflow.v2beta1.IDocument|null|undefined} document + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.document = null; + + /** + * UpdateDocumentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @instance + */ + UpdateDocumentRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateDocumentRequest} UpdateDocumentRequest instance + */ + UpdateDocumentRequest.create = function create(properties) { + return new UpdateDocumentRequest(properties); + }; + + /** + * Encodes the specified UpdateDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest} message UpdateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDocumentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.document != null && Object.hasOwnProperty.call(message, "document")) + $root.google.cloud.dialogflow.v2beta1.Document.encode(message.document, 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 UpdateDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest} message UpdateDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateDocumentRequest} UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.document = $root.google.cloud.dialogflow.v2beta1.Document.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 UpdateDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateDocumentRequest} UpdateDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateDocumentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.document != null && message.hasOwnProperty("document")) { + var error = $root.google.cloud.dialogflow.v2beta1.Document.verify(message.document); + if (error) + return "document." + 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 UpdateDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateDocumentRequest} UpdateDocumentRequest + */ + UpdateDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest(); + if (object.document != null) { + if (typeof object.document !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateDocumentRequest.document: object expected"); + message.document = $root.google.cloud.dialogflow.v2beta1.Document.fromObject(object.document); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateDocumentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateDocumentRequest} message UpdateDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.document = null; + object.updateMask = null; + } + if (message.document != null && message.hasOwnProperty("document")) + object.document = $root.google.cloud.dialogflow.v2beta1.Document.toObject(message.document, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateDocumentRequest"; + }; + + return UpdateDocumentRequest; + })(); + + v2beta1.ExportOperationMetadata = (function() { + + /** + * Properties of an ExportOperationMetadata. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IExportOperationMetadata + * @property {google.cloud.dialogflow.v2beta1.IGcsDestination|null} [exportedGcsDestination] ExportOperationMetadata exportedGcsDestination + */ + + /** + * Constructs a new ExportOperationMetadata. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an ExportOperationMetadata. + * @implements IExportOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IExportOperationMetadata=} [properties] Properties to set + */ + function ExportOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportOperationMetadata exportedGcsDestination. + * @member {google.cloud.dialogflow.v2beta1.IGcsDestination|null|undefined} exportedGcsDestination + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @instance + */ + ExportOperationMetadata.prototype.exportedGcsDestination = null; + + /** + * Creates a new ExportOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.IExportOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ExportOperationMetadata} ExportOperationMetadata instance + */ + ExportOperationMetadata.create = function create(properties) { + return new ExportOperationMetadata(properties); + }; + + /** + * Encodes the specified ExportOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.IExportOperationMetadata} message ExportOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportOperationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exportedGcsDestination != null && Object.hasOwnProperty.call(message, "exportedGcsDestination")) + $root.google.cloud.dialogflow.v2beta1.GcsDestination.encode(message.exportedGcsDestination, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ExportOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.IExportOperationMetadata} message ExportOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ExportOperationMetadata} ExportOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ExportOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.exportedGcsDestination = $root.google.cloud.dialogflow.v2beta1.GcsDestination.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ExportOperationMetadata} ExportOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.exportedGcsDestination != null && message.hasOwnProperty("exportedGcsDestination")) { + var error = $root.google.cloud.dialogflow.v2beta1.GcsDestination.verify(message.exportedGcsDestination); + if (error) + return "exportedGcsDestination." + error; + } + return null; + }; + + /** + * Creates an ExportOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ExportOperationMetadata} ExportOperationMetadata + */ + ExportOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ExportOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ExportOperationMetadata(); + if (object.exportedGcsDestination != null) { + if (typeof object.exportedGcsDestination !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ExportOperationMetadata.exportedGcsDestination: object expected"); + message.exportedGcsDestination = $root.google.cloud.dialogflow.v2beta1.GcsDestination.fromObject(object.exportedGcsDestination); + } + return message; + }; + + /** + * Creates a plain object from an ExportOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.ExportOperationMetadata} message ExportOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.exportedGcsDestination = null; + if (message.exportedGcsDestination != null && message.hasOwnProperty("exportedGcsDestination")) + object.exportedGcsDestination = $root.google.cloud.dialogflow.v2beta1.GcsDestination.toObject(message.exportedGcsDestination, options); + return object; + }; + + /** + * Converts this ExportOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + ExportOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ExportOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ExportOperationMetadata"; + }; + + return ExportOperationMetadata; + })(); + + v2beta1.KnowledgeOperationMetadata = (function() { + + /** + * Properties of a KnowledgeOperationMetadata. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IKnowledgeOperationMetadata + * @property {google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State|null} [state] KnowledgeOperationMetadata state + * @property {string|null} [knowledgeBase] KnowledgeOperationMetadata knowledgeBase + * @property {google.cloud.dialogflow.v2beta1.IExportOperationMetadata|null} [exportOperationMetadata] KnowledgeOperationMetadata exportOperationMetadata + */ + + /** + * Constructs a new KnowledgeOperationMetadata. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a KnowledgeOperationMetadata. + * @implements IKnowledgeOperationMetadata + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata=} [properties] Properties to set + */ + function KnowledgeOperationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KnowledgeOperationMetadata state. + * @member {google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State} state + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @instance + */ + KnowledgeOperationMetadata.prototype.state = 0; + + /** + * KnowledgeOperationMetadata knowledgeBase. + * @member {string} knowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @instance + */ + KnowledgeOperationMetadata.prototype.knowledgeBase = ""; + + /** + * KnowledgeOperationMetadata exportOperationMetadata. + * @member {google.cloud.dialogflow.v2beta1.IExportOperationMetadata|null|undefined} exportOperationMetadata + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @instance + */ + KnowledgeOperationMetadata.prototype.exportOperationMetadata = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * KnowledgeOperationMetadata operationMetadata. + * @member {"exportOperationMetadata"|undefined} operationMetadata + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @instance + */ + Object.defineProperty(KnowledgeOperationMetadata.prototype, "operationMetadata", { + get: $util.oneOfGetter($oneOfFields = ["exportOperationMetadata"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new KnowledgeOperationMetadata instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata} KnowledgeOperationMetadata instance + */ + KnowledgeOperationMetadata.create = function create(properties) { + return new KnowledgeOperationMetadata(properties); + }; + + /** + * Encodes the specified KnowledgeOperationMetadata message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata} message KnowledgeOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeOperationMetadata.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.knowledgeBase != null && Object.hasOwnProperty.call(message, "knowledgeBase")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.knowledgeBase); + if (message.exportOperationMetadata != null && Object.hasOwnProperty.call(message, "exportOperationMetadata")) + $root.google.cloud.dialogflow.v2beta1.ExportOperationMetadata.encode(message.exportOperationMetadata, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified KnowledgeOperationMetadata message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata} message KnowledgeOperationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeOperationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KnowledgeOperationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata} KnowledgeOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeOperationMetadata.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.state = reader.int32(); + break; + } + case 3: { + message.knowledgeBase = reader.string(); + break; + } + case 4: { + message.exportOperationMetadata = $root.google.cloud.dialogflow.v2beta1.ExportOperationMetadata.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KnowledgeOperationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata} KnowledgeOperationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeOperationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KnowledgeOperationMetadata message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KnowledgeOperationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + if (!$util.isString(message.knowledgeBase)) + return "knowledgeBase: string expected"; + if (message.exportOperationMetadata != null && message.hasOwnProperty("exportOperationMetadata")) { + properties.operationMetadata = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.ExportOperationMetadata.verify(message.exportOperationMetadata); + if (error) + return "exportOperationMetadata." + error; + } + } + return null; + }; + + /** + * Creates a KnowledgeOperationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata} KnowledgeOperationMetadata + */ + KnowledgeOperationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata(); + 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 "PENDING": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "DONE": + case 3: + message.state = 3; + break; + } + if (object.knowledgeBase != null) + message.knowledgeBase = String(object.knowledgeBase); + if (object.exportOperationMetadata != null) { + if (typeof object.exportOperationMetadata !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.exportOperationMetadata: object expected"); + message.exportOperationMetadata = $root.google.cloud.dialogflow.v2beta1.ExportOperationMetadata.fromObject(object.exportOperationMetadata); + } + return message; + }; + + /** + * Creates a plain object from a KnowledgeOperationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @static + * @param {google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata} message KnowledgeOperationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KnowledgeOperationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.knowledgeBase = ""; + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State[message.state] === undefined ? message.state : $root.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State[message.state] : message.state; + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + object.knowledgeBase = message.knowledgeBase; + if (message.exportOperationMetadata != null && message.hasOwnProperty("exportOperationMetadata")) { + object.exportOperationMetadata = $root.google.cloud.dialogflow.v2beta1.ExportOperationMetadata.toObject(message.exportOperationMetadata, options); + if (options.oneofs) + object.operationMetadata = "exportOperationMetadata"; + } + return object; + }; + + /** + * Converts this KnowledgeOperationMetadata to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @instance + * @returns {Object.} JSON object + */ + KnowledgeOperationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for KnowledgeOperationMetadata + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KnowledgeOperationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata"; + }; + + /** + * State enum. + * @name google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} PENDING=1 PENDING value + * @property {number} RUNNING=2 RUNNING value + * @property {number} DONE=3 DONE value + */ + KnowledgeOperationMetadata.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PENDING"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "DONE"] = 3; + return values; + })(); + + return KnowledgeOperationMetadata; + })(); + + v2beta1.ReloadDocumentRequest = (function() { + + /** + * Properties of a ReloadDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IReloadDocumentRequest + * @property {string|null} [name] ReloadDocumentRequest name + * @property {google.cloud.dialogflow.v2beta1.IGcsSource|null} [gcsSource] ReloadDocumentRequest gcsSource + * @property {boolean|null} [importGcsCustomMetadata] ReloadDocumentRequest importGcsCustomMetadata + */ + + /** + * Constructs a new ReloadDocumentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ReloadDocumentRequest. + * @implements IReloadDocumentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IReloadDocumentRequest=} [properties] Properties to set + */ + function ReloadDocumentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReloadDocumentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.name = ""; + + /** + * ReloadDocumentRequest gcsSource. + * @member {google.cloud.dialogflow.v2beta1.IGcsSource|null|undefined} gcsSource + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.gcsSource = null; + + /** + * ReloadDocumentRequest importGcsCustomMetadata. + * @member {boolean} importGcsCustomMetadata + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @instance + */ + ReloadDocumentRequest.prototype.importGcsCustomMetadata = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ReloadDocumentRequest source. + * @member {"gcsSource"|undefined} source + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @instance + */ + Object.defineProperty(ReloadDocumentRequest.prototype, "source", { + get: $util.oneOfGetter($oneOfFields = ["gcsSource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReloadDocumentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IReloadDocumentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ReloadDocumentRequest} ReloadDocumentRequest instance + */ + ReloadDocumentRequest.create = function create(properties) { + return new ReloadDocumentRequest(properties); + }; + + /** + * Encodes the specified ReloadDocumentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ReloadDocumentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IReloadDocumentRequest} message ReloadDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReloadDocumentRequest.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.gcsSource != null && Object.hasOwnProperty.call(message, "gcsSource")) + $root.google.cloud.dialogflow.v2beta1.GcsSource.encode(message.gcsSource, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.importGcsCustomMetadata != null && Object.hasOwnProperty.call(message, "importGcsCustomMetadata")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.importGcsCustomMetadata); + return writer; + }; + + /** + * Encodes the specified ReloadDocumentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ReloadDocumentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IReloadDocumentRequest} message ReloadDocumentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReloadDocumentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReloadDocumentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ReloadDocumentRequest} ReloadDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReloadDocumentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.gcsSource = $root.google.cloud.dialogflow.v2beta1.GcsSource.decode(reader, reader.uint32()); + break; + } + case 4: { + message.importGcsCustomMetadata = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReloadDocumentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ReloadDocumentRequest} ReloadDocumentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReloadDocumentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReloadDocumentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReloadDocumentRequest.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.gcsSource != null && message.hasOwnProperty("gcsSource")) { + properties.source = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.GcsSource.verify(message.gcsSource); + if (error) + return "gcsSource." + error; + } + } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + if (typeof message.importGcsCustomMetadata !== "boolean") + return "importGcsCustomMetadata: boolean expected"; + return null; + }; + + /** + * Creates a ReloadDocumentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ReloadDocumentRequest} ReloadDocumentRequest + */ + ReloadDocumentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.gcsSource != null) { + if (typeof object.gcsSource !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ReloadDocumentRequest.gcsSource: object expected"); + message.gcsSource = $root.google.cloud.dialogflow.v2beta1.GcsSource.fromObject(object.gcsSource); + } + if (object.importGcsCustomMetadata != null) + message.importGcsCustomMetadata = Boolean(object.importGcsCustomMetadata); + return message; + }; + + /** + * Creates a plain object from a ReloadDocumentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ReloadDocumentRequest} message ReloadDocumentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReloadDocumentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.importGcsCustomMetadata = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.gcsSource != null && message.hasOwnProperty("gcsSource")) { + object.gcsSource = $root.google.cloud.dialogflow.v2beta1.GcsSource.toObject(message.gcsSource, options); + if (options.oneofs) + object.source = "gcsSource"; + } + if (message.importGcsCustomMetadata != null && message.hasOwnProperty("importGcsCustomMetadata")) + object.importGcsCustomMetadata = message.importGcsCustomMetadata; + return object; + }; + + /** + * Converts this ReloadDocumentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @instance + * @returns {Object.} JSON object + */ + ReloadDocumentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReloadDocumentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ReloadDocumentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReloadDocumentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ReloadDocumentRequest"; + }; + + return ReloadDocumentRequest; + })(); + + v2beta1.GcsSources = (function() { + + /** + * Properties of a GcsSources. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGcsSources + * @property {Array.|null} [uris] GcsSources uris + */ + + /** + * Constructs a new GcsSources. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GcsSources. + * @implements IGcsSources + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGcsSources=} [properties] Properties to set + */ + function GcsSources(properties) { + this.uris = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GcsSources uris. + * @member {Array.} uris + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @instance + */ + GcsSources.prototype.uris = $util.emptyArray; + + /** + * Creates a new GcsSources instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @static + * @param {google.cloud.dialogflow.v2beta1.IGcsSources=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GcsSources} GcsSources instance + */ + GcsSources.create = function create(properties) { + return new GcsSources(properties); + }; + + /** + * Encodes the specified GcsSources message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GcsSources.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @static + * @param {google.cloud.dialogflow.v2beta1.IGcsSources} message GcsSources message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSources.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uris != null && message.uris.length) + for (var i = 0; i < message.uris.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.uris[i]); + return writer; + }; + + /** + * Encodes the specified GcsSources message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GcsSources.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @static + * @param {google.cloud.dialogflow.v2beta1.IGcsSources} message GcsSources message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GcsSources.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GcsSources message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GcsSources} GcsSources + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSources.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GcsSources(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 2: { + if (!(message.uris && message.uris.length)) + message.uris = []; + message.uris.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GcsSources message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GcsSources} GcsSources + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GcsSources.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GcsSources message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GcsSources.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uris != null && message.hasOwnProperty("uris")) { + if (!Array.isArray(message.uris)) + return "uris: array expected"; + for (var i = 0; i < message.uris.length; ++i) + if (!$util.isString(message.uris[i])) + return "uris: string[] expected"; + } + return null; + }; + + /** + * Creates a GcsSources message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GcsSources} GcsSources + */ + GcsSources.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GcsSources) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GcsSources(); + if (object.uris) { + if (!Array.isArray(object.uris)) + throw TypeError(".google.cloud.dialogflow.v2beta1.GcsSources.uris: array expected"); + message.uris = []; + for (var i = 0; i < object.uris.length; ++i) + message.uris[i] = String(object.uris[i]); + } + return message; + }; + + /** + * Creates a plain object from a GcsSources message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @static + * @param {google.cloud.dialogflow.v2beta1.GcsSources} message GcsSources + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GcsSources.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uris = []; + if (message.uris && message.uris.length) { + object.uris = []; + for (var j = 0; j < message.uris.length; ++j) + object.uris[j] = message.uris[j]; + } + return object; + }; + + /** + * Converts this GcsSources to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @instance + * @returns {Object.} JSON object + */ + GcsSources.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GcsSources + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GcsSources + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GcsSources.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GcsSources"; + }; + + return GcsSources; + })(); + + v2beta1.GcsSource = (function() { + + /** + * Properties of a GcsSource. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGcsSource + * @property {string|null} [uri] GcsSource uri + */ + + /** + * Constructs a new GcsSource. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GcsSource. + * @implements IGcsSource + * @constructor + * @param {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsSource + * @instance + */ + GcsSource.prototype.uri = ""; + + /** + * Creates a new GcsSource instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GcsSource + * @static + * @param {google.cloud.dialogflow.v2beta1.IGcsSource=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GcsSource} GcsSource instance + */ + GcsSource.create = function create(properties) { + return new GcsSource(properties); + }; + + /** + * Encodes the specified GcsSource message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GcsSource.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GcsSource + * @static + * @param {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsSource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GcsSource + * @static + * @param {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsSource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsSource + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GcsSource} GcsSource + */ + GcsSource.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GcsSource) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsSource + * @static + * @param {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsSource"; + }; + + return GcsSource; + })(); + + v2beta1.GcsDestination = (function() { + + /** + * Properties of a GcsDestination. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGcsDestination + * @property {string|null} [uri] GcsDestination uri + */ + + /** + * Constructs a new GcsDestination. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GcsDestination. + * @implements IGcsDestination + * @constructor + * @param {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsDestination + * @instance + */ + GcsDestination.prototype.uri = ""; + + /** + * Creates a new GcsDestination instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2beta1.IGcsDestination=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GcsDestination} GcsDestination instance + */ + GcsDestination.create = function create(properties) { + return new GcsDestination(properties); + }; + + /** + * Encodes the specified GcsDestination message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GcsDestination.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsDestination.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsDestination + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsDestination + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GcsDestination} GcsDestination + */ + GcsDestination.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GcsDestination) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsDestination + * @static + * @param {google.cloud.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.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.dialogflow.v2beta1.GcsDestination"; + }; + + return GcsDestination; + })(); + + v2beta1.Environments = (function() { + + /** + * Constructs a new Environments service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an Environments + * @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 Environments(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Environments.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Environments; + + /** + * Creates new Environments service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @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 {Environments} RPC service. Useful where requests and/or responses are streamed. + */ + Environments.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|listEnvironments}. + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @typedef ListEnvironmentsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse} [response] ListEnvironmentsResponse + */ + + /** + * Calls ListEnvironments. + * @function listEnvironments + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest} request ListEnvironmentsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Environments.ListEnvironmentsCallback} callback Node-style callback called with the error, if any, and ListEnvironmentsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.listEnvironments = function listEnvironments(request, callback) { + return this.rpcCall(listEnvironments, $root.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest, $root.google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse, request, callback); + }, "name", { value: "ListEnvironments" }); + + /** + * Calls ListEnvironments. + * @function listEnvironments + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest} request ListEnvironmentsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|getEnvironment}. + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @typedef GetEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Environment} [response] Environment + */ + + /** + * Calls GetEnvironment. + * @function getEnvironment + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest} request GetEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentCallback} callback Node-style callback called with the error, if any, and Environment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.getEnvironment = function getEnvironment(request, callback) { + return this.rpcCall(getEnvironment, $root.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest, $root.google.cloud.dialogflow.v2beta1.Environment, request, callback); + }, "name", { value: "GetEnvironment" }); + + /** + * Calls GetEnvironment. + * @function getEnvironment + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest} request GetEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|createEnvironment}. + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @typedef CreateEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Environment} [response] Environment + */ + + /** + * Calls CreateEnvironment. + * @function createEnvironment + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest} request CreateEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Environments.CreateEnvironmentCallback} callback Node-style callback called with the error, if any, and Environment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.createEnvironment = function createEnvironment(request, callback) { + return this.rpcCall(createEnvironment, $root.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest, $root.google.cloud.dialogflow.v2beta1.Environment, request, callback); + }, "name", { value: "CreateEnvironment" }); + + /** + * Calls CreateEnvironment. + * @function createEnvironment + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest} request CreateEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|updateEnvironment}. + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @typedef UpdateEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Environment} [response] Environment + */ + + /** + * Calls UpdateEnvironment. + * @function updateEnvironment + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest} request UpdateEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironmentCallback} callback Node-style callback called with the error, if any, and Environment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.updateEnvironment = function updateEnvironment(request, callback) { + return this.rpcCall(updateEnvironment, $root.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest, $root.google.cloud.dialogflow.v2beta1.Environment, request, callback); + }, "name", { value: "UpdateEnvironment" }); + + /** + * Calls UpdateEnvironment. + * @function updateEnvironment + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest} request UpdateEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|deleteEnvironment}. + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @typedef DeleteEnvironmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteEnvironment. + * @function deleteEnvironment + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest} request DeleteEnvironmentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironmentCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.deleteEnvironment = function deleteEnvironment(request, callback) { + return this.rpcCall(deleteEnvironment, $root.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteEnvironment" }); + + /** + * Calls DeleteEnvironment. + * @function deleteEnvironment + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest} request DeleteEnvironmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Environments|getEnvironmentHistory}. + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @typedef GetEnvironmentHistoryCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.EnvironmentHistory} [response] EnvironmentHistory + */ + + /** + * Calls GetEnvironmentHistory. + * @function getEnvironmentHistory + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest} request GetEnvironmentHistoryRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistoryCallback} callback Node-style callback called with the error, if any, and EnvironmentHistory + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Environments.prototype.getEnvironmentHistory = function getEnvironmentHistory(request, callback) { + return this.rpcCall(getEnvironmentHistory, $root.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest, $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory, request, callback); + }, "name", { value: "GetEnvironmentHistory" }); + + /** + * Calls GetEnvironmentHistory. + * @function getEnvironmentHistory + * @memberof google.cloud.dialogflow.v2beta1.Environments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest} request GetEnvironmentHistoryRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Environments; + })(); + + v2beta1.Environment = (function() { + + /** + * Properties of an Environment. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IEnvironment + * @property {string|null} [name] Environment name + * @property {string|null} [description] Environment description + * @property {string|null} [agentVersion] Environment agentVersion + * @property {google.cloud.dialogflow.v2beta1.Environment.State|null} [state] Environment state + * @property {google.protobuf.ITimestamp|null} [updateTime] Environment updateTime + * @property {google.cloud.dialogflow.v2beta1.ITextToSpeechSettings|null} [textToSpeechSettings] Environment textToSpeechSettings + * @property {google.cloud.dialogflow.v2beta1.IFulfillment|null} [fulfillment] Environment fulfillment + */ + + /** + * Constructs a new Environment. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an Environment. + * @implements IEnvironment + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IEnvironment=} [properties] Properties to set + */ + function Environment(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Environment name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @instance + */ + Environment.prototype.name = ""; + + /** + * Environment description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @instance + */ + Environment.prototype.description = ""; + + /** + * Environment agentVersion. + * @member {string} agentVersion + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @instance + */ + Environment.prototype.agentVersion = ""; + + /** + * Environment state. + * @member {google.cloud.dialogflow.v2beta1.Environment.State} state + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @instance + */ + Environment.prototype.state = 0; + + /** + * Environment updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @instance + */ + Environment.prototype.updateTime = null; + + /** + * Environment textToSpeechSettings. + * @member {google.cloud.dialogflow.v2beta1.ITextToSpeechSettings|null|undefined} textToSpeechSettings + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @instance + */ + Environment.prototype.textToSpeechSettings = null; + + /** + * Environment fulfillment. + * @member {google.cloud.dialogflow.v2beta1.IFulfillment|null|undefined} fulfillment + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @instance + */ + Environment.prototype.fulfillment = null; + + /** + * Creates a new Environment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @static + * @param {google.cloud.dialogflow.v2beta1.IEnvironment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Environment} Environment instance + */ + Environment.create = function create(properties) { + return new Environment(properties); + }; + + /** + * Encodes the specified Environment message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Environment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @static + * @param {google.cloud.dialogflow.v2beta1.IEnvironment} message Environment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Environment.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.agentVersion != null && Object.hasOwnProperty.call(message, "agentVersion")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.agentVersion); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.state); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.textToSpeechSettings != null && Object.hasOwnProperty.call(message, "textToSpeechSettings")) + $root.google.cloud.dialogflow.v2beta1.TextToSpeechSettings.encode(message.textToSpeechSettings, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.fulfillment != null && Object.hasOwnProperty.call(message, "fulfillment")) + $root.google.cloud.dialogflow.v2beta1.Fulfillment.encode(message.fulfillment, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Environment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Environment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @static + * @param {google.cloud.dialogflow.v2beta1.IEnvironment} message Environment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Environment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Environment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Environment} Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Environment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Environment(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.agentVersion = reader.string(); + break; + } + case 4: { + message.state = reader.int32(); + break; + } + case 5: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.textToSpeechSettings = $root.google.cloud.dialogflow.v2beta1.TextToSpeechSettings.decode(reader, reader.uint32()); + break; + } + case 8: { + message.fulfillment = $root.google.cloud.dialogflow.v2beta1.Fulfillment.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Environment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Environment} Environment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Environment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Environment message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Environment.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.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.agentVersion != null && message.hasOwnProperty("agentVersion")) + if (!$util.isString(message.agentVersion)) + return "agentVersion: string 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: + break; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.textToSpeechSettings != null && message.hasOwnProperty("textToSpeechSettings")) { + var error = $root.google.cloud.dialogflow.v2beta1.TextToSpeechSettings.verify(message.textToSpeechSettings); + if (error) + return "textToSpeechSettings." + error; + } + if (message.fulfillment != null && message.hasOwnProperty("fulfillment")) { + var error = $root.google.cloud.dialogflow.v2beta1.Fulfillment.verify(message.fulfillment); + if (error) + return "fulfillment." + error; + } + return null; + }; + + /** + * Creates an Environment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Environment} Environment + */ + Environment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Environment) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Environment(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.agentVersion != null) + message.agentVersion = String(object.agentVersion); + 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 "STOPPED": + case 1: + message.state = 1; + break; + case "LOADING": + case 2: + message.state = 2; + break; + case "RUNNING": + case 3: + message.state = 3; + break; + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Environment.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.textToSpeechSettings != null) { + if (typeof object.textToSpeechSettings !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Environment.textToSpeechSettings: object expected"); + message.textToSpeechSettings = $root.google.cloud.dialogflow.v2beta1.TextToSpeechSettings.fromObject(object.textToSpeechSettings); + } + if (object.fulfillment != null) { + if (typeof object.fulfillment !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Environment.fulfillment: object expected"); + message.fulfillment = $root.google.cloud.dialogflow.v2beta1.Fulfillment.fromObject(object.fulfillment); + } + return message; + }; + + /** + * Creates a plain object from an Environment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @static + * @param {google.cloud.dialogflow.v2beta1.Environment} message Environment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Environment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.agentVersion = ""; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.updateTime = null; + object.textToSpeechSettings = null; + object.fulfillment = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.agentVersion != null && message.hasOwnProperty("agentVersion")) + object.agentVersion = message.agentVersion; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Environment.State[message.state] === undefined ? message.state : $root.google.cloud.dialogflow.v2beta1.Environment.State[message.state] : message.state; + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.textToSpeechSettings != null && message.hasOwnProperty("textToSpeechSettings")) + object.textToSpeechSettings = $root.google.cloud.dialogflow.v2beta1.TextToSpeechSettings.toObject(message.textToSpeechSettings, options); + if (message.fulfillment != null && message.hasOwnProperty("fulfillment")) + object.fulfillment = $root.google.cloud.dialogflow.v2beta1.Fulfillment.toObject(message.fulfillment, options); + return object; + }; + + /** + * Converts this Environment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @instance + * @returns {Object.} JSON object + */ + Environment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Environment + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Environment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Environment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Environment"; + }; + + /** + * State enum. + * @name google.cloud.dialogflow.v2beta1.Environment.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} STOPPED=1 STOPPED value + * @property {number} LOADING=2 LOADING value + * @property {number} RUNNING=3 RUNNING value + */ + Environment.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "STOPPED"] = 1; + values[valuesById[2] = "LOADING"] = 2; + values[valuesById[3] = "RUNNING"] = 3; + return values; + })(); + + return Environment; + })(); + + v2beta1.TextToSpeechSettings = (function() { + + /** + * Properties of a TextToSpeechSettings. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ITextToSpeechSettings + * @property {boolean|null} [enableTextToSpeech] TextToSpeechSettings enableTextToSpeech + * @property {google.cloud.dialogflow.v2beta1.OutputAudioEncoding|null} [outputAudioEncoding] TextToSpeechSettings outputAudioEncoding + * @property {number|null} [sampleRateHertz] TextToSpeechSettings sampleRateHertz + * @property {Object.|null} [synthesizeSpeechConfigs] TextToSpeechSettings synthesizeSpeechConfigs + */ + + /** + * Constructs a new TextToSpeechSettings. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a TextToSpeechSettings. + * @implements ITextToSpeechSettings + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ITextToSpeechSettings=} [properties] Properties to set + */ + function TextToSpeechSettings(properties) { + this.synthesizeSpeechConfigs = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TextToSpeechSettings enableTextToSpeech. + * @member {boolean} enableTextToSpeech + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @instance + */ + TextToSpeechSettings.prototype.enableTextToSpeech = false; + + /** + * TextToSpeechSettings outputAudioEncoding. + * @member {google.cloud.dialogflow.v2beta1.OutputAudioEncoding} outputAudioEncoding + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @instance + */ + TextToSpeechSettings.prototype.outputAudioEncoding = 0; + + /** + * TextToSpeechSettings sampleRateHertz. + * @member {number} sampleRateHertz + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @instance + */ + TextToSpeechSettings.prototype.sampleRateHertz = 0; + + /** + * TextToSpeechSettings synthesizeSpeechConfigs. + * @member {Object.} synthesizeSpeechConfigs + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @instance + */ + TextToSpeechSettings.prototype.synthesizeSpeechConfigs = $util.emptyObject; + + /** + * Creates a new TextToSpeechSettings instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.ITextToSpeechSettings=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.TextToSpeechSettings} TextToSpeechSettings instance + */ + TextToSpeechSettings.create = function create(properties) { + return new TextToSpeechSettings(properties); + }; + + /** + * Encodes the specified TextToSpeechSettings message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TextToSpeechSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.ITextToSpeechSettings} message TextToSpeechSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextToSpeechSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enableTextToSpeech != null && Object.hasOwnProperty.call(message, "enableTextToSpeech")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enableTextToSpeech); + if (message.outputAudioEncoding != null && Object.hasOwnProperty.call(message, "outputAudioEncoding")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.outputAudioEncoding); + if (message.sampleRateHertz != null && Object.hasOwnProperty.call(message, "sampleRateHertz")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.sampleRateHertz); + if (message.synthesizeSpeechConfigs != null && Object.hasOwnProperty.call(message, "synthesizeSpeechConfigs")) + for (var keys = Object.keys(message.synthesizeSpeechConfigs), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.encode(message.synthesizeSpeechConfigs[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified TextToSpeechSettings message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.TextToSpeechSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.ITextToSpeechSettings} message TextToSpeechSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TextToSpeechSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TextToSpeechSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.TextToSpeechSettings} TextToSpeechSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextToSpeechSettings.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.TextToSpeechSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.enableTextToSpeech = reader.bool(); + break; + } + case 2: { + message.outputAudioEncoding = reader.int32(); + break; + } + case 3: { + message.sampleRateHertz = reader.int32(); + break; + } + case 4: { + if (message.synthesizeSpeechConfigs === $util.emptyObject) + message.synthesizeSpeechConfigs = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.synthesizeSpeechConfigs[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TextToSpeechSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.TextToSpeechSettings} TextToSpeechSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TextToSpeechSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TextToSpeechSettings message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TextToSpeechSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.enableTextToSpeech != null && message.hasOwnProperty("enableTextToSpeech")) + if (typeof message.enableTextToSpeech !== "boolean") + return "enableTextToSpeech: boolean expected"; + if (message.outputAudioEncoding != null && message.hasOwnProperty("outputAudioEncoding")) + switch (message.outputAudioEncoding) { + default: + return "outputAudioEncoding: enum value expected"; + case 0: + case 1: + case 2: + case 4: + case 3: + case 5: + break; + } + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + if (!$util.isInteger(message.sampleRateHertz)) + return "sampleRateHertz: integer expected"; + if (message.synthesizeSpeechConfigs != null && message.hasOwnProperty("synthesizeSpeechConfigs")) { + if (!$util.isObject(message.synthesizeSpeechConfigs)) + return "synthesizeSpeechConfigs: object expected"; + var key = Object.keys(message.synthesizeSpeechConfigs); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.verify(message.synthesizeSpeechConfigs[key[i]]); + if (error) + return "synthesizeSpeechConfigs." + error; + } + } + return null; + }; + + /** + * Creates a TextToSpeechSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.TextToSpeechSettings} TextToSpeechSettings + */ + TextToSpeechSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.TextToSpeechSettings) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.TextToSpeechSettings(); + if (object.enableTextToSpeech != null) + message.enableTextToSpeech = Boolean(object.enableTextToSpeech); + switch (object.outputAudioEncoding) { + default: + if (typeof object.outputAudioEncoding === "number") { + message.outputAudioEncoding = object.outputAudioEncoding; + break; + } + break; + case "OUTPUT_AUDIO_ENCODING_UNSPECIFIED": + case 0: + message.outputAudioEncoding = 0; + break; + case "OUTPUT_AUDIO_ENCODING_LINEAR_16": + case 1: + message.outputAudioEncoding = 1; + break; + case "OUTPUT_AUDIO_ENCODING_MP3": + case 2: + message.outputAudioEncoding = 2; + break; + case "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS": + case 4: + message.outputAudioEncoding = 4; + break; + case "OUTPUT_AUDIO_ENCODING_OGG_OPUS": + case 3: + message.outputAudioEncoding = 3; + break; + case "OUTPUT_AUDIO_ENCODING_MULAW": + case 5: + message.outputAudioEncoding = 5; + break; + } + if (object.sampleRateHertz != null) + message.sampleRateHertz = object.sampleRateHertz | 0; + if (object.synthesizeSpeechConfigs) { + if (typeof object.synthesizeSpeechConfigs !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.TextToSpeechSettings.synthesizeSpeechConfigs: object expected"); + message.synthesizeSpeechConfigs = {}; + for (var keys = Object.keys(object.synthesizeSpeechConfigs), i = 0; i < keys.length; ++i) { + if (typeof object.synthesizeSpeechConfigs[keys[i]] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.TextToSpeechSettings.synthesizeSpeechConfigs: object expected"); + message.synthesizeSpeechConfigs[keys[i]] = $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.fromObject(object.synthesizeSpeechConfigs[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a TextToSpeechSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @static + * @param {google.cloud.dialogflow.v2beta1.TextToSpeechSettings} message TextToSpeechSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TextToSpeechSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.synthesizeSpeechConfigs = {}; + if (options.defaults) { + object.enableTextToSpeech = false; + object.outputAudioEncoding = options.enums === String ? "OUTPUT_AUDIO_ENCODING_UNSPECIFIED" : 0; + object.sampleRateHertz = 0; + } + if (message.enableTextToSpeech != null && message.hasOwnProperty("enableTextToSpeech")) + object.enableTextToSpeech = message.enableTextToSpeech; + if (message.outputAudioEncoding != null && message.hasOwnProperty("outputAudioEncoding")) + object.outputAudioEncoding = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.OutputAudioEncoding[message.outputAudioEncoding] === undefined ? message.outputAudioEncoding : $root.google.cloud.dialogflow.v2beta1.OutputAudioEncoding[message.outputAudioEncoding] : message.outputAudioEncoding; + if (message.sampleRateHertz != null && message.hasOwnProperty("sampleRateHertz")) + object.sampleRateHertz = message.sampleRateHertz; + var keys2; + if (message.synthesizeSpeechConfigs && (keys2 = Object.keys(message.synthesizeSpeechConfigs)).length) { + object.synthesizeSpeechConfigs = {}; + for (var j = 0; j < keys2.length; ++j) + object.synthesizeSpeechConfigs[keys2[j]] = $root.google.cloud.dialogflow.v2beta1.SynthesizeSpeechConfig.toObject(message.synthesizeSpeechConfigs[keys2[j]], options); + } + return object; + }; + + /** + * Converts this TextToSpeechSettings to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @instance + * @returns {Object.} JSON object + */ + TextToSpeechSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TextToSpeechSettings + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.TextToSpeechSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TextToSpeechSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.TextToSpeechSettings"; + }; + + return TextToSpeechSettings; + })(); + + v2beta1.ListEnvironmentsRequest = (function() { + + /** + * Properties of a ListEnvironmentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListEnvironmentsRequest + * @property {string|null} [parent] ListEnvironmentsRequest parent + * @property {number|null} [pageSize] ListEnvironmentsRequest pageSize + * @property {string|null} [pageToken] ListEnvironmentsRequest pageToken + */ + + /** + * Constructs a new ListEnvironmentsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListEnvironmentsRequest. + * @implements IListEnvironmentsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest=} [properties] Properties to set + */ + function ListEnvironmentsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEnvironmentsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @instance + */ + ListEnvironmentsRequest.prototype.parent = ""; + + /** + * ListEnvironmentsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @instance + */ + ListEnvironmentsRequest.prototype.pageSize = 0; + + /** + * ListEnvironmentsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @instance + */ + ListEnvironmentsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListEnvironmentsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest} ListEnvironmentsRequest instance + */ + ListEnvironmentsRequest.create = function create(properties) { + return new ListEnvironmentsRequest(properties); + }; + + /** + * Encodes the specified ListEnvironmentsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest} message ListEnvironmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsRequest.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 ListEnvironmentsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest} message ListEnvironmentsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEnvironmentsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest} ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest(); + 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 ListEnvironmentsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest} ListEnvironmentsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEnvironmentsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEnvironmentsRequest.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 ListEnvironmentsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest} ListEnvironmentsRequest + */ + ListEnvironmentsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest(); + 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 ListEnvironmentsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest} message ListEnvironmentsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEnvironmentsRequest.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 ListEnvironmentsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @instance + * @returns {Object.} JSON object + */ + ListEnvironmentsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEnvironmentsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEnvironmentsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest"; + }; + + return ListEnvironmentsRequest; + })(); + + v2beta1.ListEnvironmentsResponse = (function() { + + /** + * Properties of a ListEnvironmentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListEnvironmentsResponse + * @property {Array.|null} [environments] ListEnvironmentsResponse environments + * @property {string|null} [nextPageToken] ListEnvironmentsResponse nextPageToken + */ + + /** + * Constructs a new ListEnvironmentsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListEnvironmentsResponse. + * @implements IListEnvironmentsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse=} [properties] Properties to set + */ + function ListEnvironmentsResponse(properties) { + this.environments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListEnvironmentsResponse environments. + * @member {Array.} environments + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @instance + */ + ListEnvironmentsResponse.prototype.environments = $util.emptyArray; + + /** + * ListEnvironmentsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @instance + */ + ListEnvironmentsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListEnvironmentsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse} ListEnvironmentsResponse instance + */ + ListEnvironmentsResponse.create = function create(properties) { + return new ListEnvironmentsResponse(properties); + }; + + /** + * Encodes the specified ListEnvironmentsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse} message ListEnvironmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.environments != null && message.environments.length) + for (var i = 0; i < message.environments.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Environment.encode(message.environments[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 ListEnvironmentsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse} message ListEnvironmentsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListEnvironmentsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse} ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.environments && message.environments.length)) + message.environments = []; + message.environments.push($root.google.cloud.dialogflow.v2beta1.Environment.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListEnvironmentsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse} ListEnvironmentsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListEnvironmentsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListEnvironmentsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListEnvironmentsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.environments != null && message.hasOwnProperty("environments")) { + if (!Array.isArray(message.environments)) + return "environments: array expected"; + for (var i = 0; i < message.environments.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Environment.verify(message.environments[i]); + if (error) + return "environments." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListEnvironmentsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse} ListEnvironmentsResponse + */ + ListEnvironmentsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse(); + if (object.environments) { + if (!Array.isArray(object.environments)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse.environments: array expected"); + message.environments = []; + for (var i = 0; i < object.environments.length; ++i) { + if (typeof object.environments[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse.environments: object expected"); + message.environments[i] = $root.google.cloud.dialogflow.v2beta1.Environment.fromObject(object.environments[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListEnvironmentsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse} message ListEnvironmentsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListEnvironmentsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.environments = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.environments && message.environments.length) { + object.environments = []; + for (var j = 0; j < message.environments.length; ++j) + object.environments[j] = $root.google.cloud.dialogflow.v2beta1.Environment.toObject(message.environments[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListEnvironmentsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @instance + * @returns {Object.} JSON object + */ + ListEnvironmentsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListEnvironmentsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListEnvironmentsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse"; + }; + + return ListEnvironmentsResponse; + })(); + + v2beta1.GetEnvironmentRequest = (function() { + + /** + * Properties of a GetEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetEnvironmentRequest + * @property {string|null} [name] GetEnvironmentRequest name + */ + + /** + * Constructs a new GetEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetEnvironmentRequest. + * @implements IGetEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest=} [properties] Properties to set + */ + function GetEnvironmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEnvironmentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @instance + */ + GetEnvironmentRequest.prototype.name = ""; + + /** + * Creates a new GetEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetEnvironmentRequest} GetEnvironmentRequest instance + */ + GetEnvironmentRequest.create = function create(properties) { + return new GetEnvironmentRequest(properties); + }; + + /** + * Encodes the specified GetEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest} message GetEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentRequest.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 GetEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest} message GetEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetEnvironmentRequest} GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest(); + 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 GetEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetEnvironmentRequest} GetEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEnvironmentRequest.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 GetEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetEnvironmentRequest} GetEnvironmentRequest + */ + GetEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetEnvironmentRequest} message GetEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEnvironmentRequest.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 GetEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + GetEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetEnvironmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetEnvironmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetEnvironmentRequest"; + }; + + return GetEnvironmentRequest; + })(); + + v2beta1.CreateEnvironmentRequest = (function() { + + /** + * Properties of a CreateEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateEnvironmentRequest + * @property {string|null} [parent] CreateEnvironmentRequest parent + * @property {google.cloud.dialogflow.v2beta1.IEnvironment|null} [environment] CreateEnvironmentRequest environment + * @property {string|null} [environmentId] CreateEnvironmentRequest environmentId + */ + + /** + * Constructs a new CreateEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateEnvironmentRequest. + * @implements ICreateEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest=} [properties] Properties to set + */ + function CreateEnvironmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateEnvironmentRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @instance + */ + CreateEnvironmentRequest.prototype.parent = ""; + + /** + * CreateEnvironmentRequest environment. + * @member {google.cloud.dialogflow.v2beta1.IEnvironment|null|undefined} environment + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @instance + */ + CreateEnvironmentRequest.prototype.environment = null; + + /** + * CreateEnvironmentRequest environmentId. + * @member {string} environmentId + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @instance + */ + CreateEnvironmentRequest.prototype.environmentId = ""; + + /** + * Creates a new CreateEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest} CreateEnvironmentRequest instance + */ + CreateEnvironmentRequest.create = function create(properties) { + return new CreateEnvironmentRequest(properties); + }; + + /** + * Encodes the specified CreateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest} message CreateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEnvironmentRequest.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.environment != null && Object.hasOwnProperty.call(message, "environment")) + $root.google.cloud.dialogflow.v2beta1.Environment.encode(message.environment, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.environmentId != null && Object.hasOwnProperty.call(message, "environmentId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.environmentId); + return writer; + }; + + /** + * Encodes the specified CreateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest} message CreateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest} CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEnvironmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.environment = $root.google.cloud.dialogflow.v2beta1.Environment.decode(reader, reader.uint32()); + break; + } + case 3: { + message.environmentId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest} CreateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateEnvironmentRequest.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.environment != null && message.hasOwnProperty("environment")) { + var error = $root.google.cloud.dialogflow.v2beta1.Environment.verify(message.environment); + if (error) + return "environment." + error; + } + if (message.environmentId != null && message.hasOwnProperty("environmentId")) + if (!$util.isString(message.environmentId)) + return "environmentId: string expected"; + return null; + }; + + /** + * Creates a CreateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest} CreateEnvironmentRequest + */ + CreateEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.environment != null) { + if (typeof object.environment !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest.environment: object expected"); + message.environment = $root.google.cloud.dialogflow.v2beta1.Environment.fromObject(object.environment); + } + if (object.environmentId != null) + message.environmentId = String(object.environmentId); + return message; + }; + + /** + * Creates a plain object from a CreateEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest} message CreateEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateEnvironmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.environment = null; + object.environmentId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = $root.google.cloud.dialogflow.v2beta1.Environment.toObject(message.environment, options); + if (message.environmentId != null && message.hasOwnProperty("environmentId")) + object.environmentId = message.environmentId; + return object; + }; + + /** + * Converts this CreateEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + CreateEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateEnvironmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateEnvironmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest"; + }; + + return CreateEnvironmentRequest; + })(); + + v2beta1.UpdateEnvironmentRequest = (function() { + + /** + * Properties of an UpdateEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateEnvironmentRequest + * @property {google.cloud.dialogflow.v2beta1.IEnvironment|null} [environment] UpdateEnvironmentRequest environment + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateEnvironmentRequest updateMask + * @property {boolean|null} [allowLoadToDraftAndDiscardChanges] UpdateEnvironmentRequest allowLoadToDraftAndDiscardChanges + */ + + /** + * Constructs a new UpdateEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateEnvironmentRequest. + * @implements IUpdateEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest=} [properties] Properties to set + */ + function UpdateEnvironmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateEnvironmentRequest environment. + * @member {google.cloud.dialogflow.v2beta1.IEnvironment|null|undefined} environment + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @instance + */ + UpdateEnvironmentRequest.prototype.environment = null; + + /** + * UpdateEnvironmentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @instance + */ + UpdateEnvironmentRequest.prototype.updateMask = null; + + /** + * UpdateEnvironmentRequest allowLoadToDraftAndDiscardChanges. + * @member {boolean} allowLoadToDraftAndDiscardChanges + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @instance + */ + UpdateEnvironmentRequest.prototype.allowLoadToDraftAndDiscardChanges = false; + + /** + * Creates a new UpdateEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest} UpdateEnvironmentRequest instance + */ + UpdateEnvironmentRequest.create = function create(properties) { + return new UpdateEnvironmentRequest(properties); + }; + + /** + * Encodes the specified UpdateEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest} message UpdateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEnvironmentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.environment != null && Object.hasOwnProperty.call(message, "environment")) + $root.google.cloud.dialogflow.v2beta1.Environment.encode(message.environment, 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(); + if (message.allowLoadToDraftAndDiscardChanges != null && Object.hasOwnProperty.call(message, "allowLoadToDraftAndDiscardChanges")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.allowLoadToDraftAndDiscardChanges); + return writer; + }; + + /** + * Encodes the specified UpdateEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest} message UpdateEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest} UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEnvironmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.environment = $root.google.cloud.dialogflow.v2beta1.Environment.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + case 3: { + message.allowLoadToDraftAndDiscardChanges = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest} UpdateEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateEnvironmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.environment != null && message.hasOwnProperty("environment")) { + var error = $root.google.cloud.dialogflow.v2beta1.Environment.verify(message.environment); + if (error) + return "environment." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + if (message.allowLoadToDraftAndDiscardChanges != null && message.hasOwnProperty("allowLoadToDraftAndDiscardChanges")) + if (typeof message.allowLoadToDraftAndDiscardChanges !== "boolean") + return "allowLoadToDraftAndDiscardChanges: boolean expected"; + return null; + }; + + /** + * Creates an UpdateEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest} UpdateEnvironmentRequest + */ + UpdateEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest(); + if (object.environment != null) { + if (typeof object.environment !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest.environment: object expected"); + message.environment = $root.google.cloud.dialogflow.v2beta1.Environment.fromObject(object.environment); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + if (object.allowLoadToDraftAndDiscardChanges != null) + message.allowLoadToDraftAndDiscardChanges = Boolean(object.allowLoadToDraftAndDiscardChanges); + return message; + }; + + /** + * Creates a plain object from an UpdateEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest} message UpdateEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateEnvironmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.environment = null; + object.updateMask = null; + object.allowLoadToDraftAndDiscardChanges = false; + } + if (message.environment != null && message.hasOwnProperty("environment")) + object.environment = $root.google.cloud.dialogflow.v2beta1.Environment.toObject(message.environment, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + if (message.allowLoadToDraftAndDiscardChanges != null && message.hasOwnProperty("allowLoadToDraftAndDiscardChanges")) + object.allowLoadToDraftAndDiscardChanges = message.allowLoadToDraftAndDiscardChanges; + return object; + }; + + /** + * Converts this UpdateEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateEnvironmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateEnvironmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest"; + }; + + return UpdateEnvironmentRequest; + })(); + + v2beta1.DeleteEnvironmentRequest = (function() { + + /** + * Properties of a DeleteEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteEnvironmentRequest + * @property {string|null} [name] DeleteEnvironmentRequest name + */ + + /** + * Constructs a new DeleteEnvironmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteEnvironmentRequest. + * @implements IDeleteEnvironmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest=} [properties] Properties to set + */ + function DeleteEnvironmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteEnvironmentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @instance + */ + DeleteEnvironmentRequest.prototype.name = ""; + + /** + * Creates a new DeleteEnvironmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest} DeleteEnvironmentRequest instance + */ + DeleteEnvironmentRequest.create = function create(properties) { + return new DeleteEnvironmentRequest(properties); + }; + + /** + * Encodes the specified DeleteEnvironmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest} message DeleteEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEnvironmentRequest.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 DeleteEnvironmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest} message DeleteEnvironmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteEnvironmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteEnvironmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest} DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEnvironmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest(); + 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 DeleteEnvironmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest} DeleteEnvironmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteEnvironmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteEnvironmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteEnvironmentRequest.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 DeleteEnvironmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest} DeleteEnvironmentRequest + */ + DeleteEnvironmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteEnvironmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest} message DeleteEnvironmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteEnvironmentRequest.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 DeleteEnvironmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteEnvironmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteEnvironmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteEnvironmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest"; + }; + + return DeleteEnvironmentRequest; + })(); + + v2beta1.GetEnvironmentHistoryRequest = (function() { + + /** + * Properties of a GetEnvironmentHistoryRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetEnvironmentHistoryRequest + * @property {string|null} [parent] GetEnvironmentHistoryRequest parent + * @property {number|null} [pageSize] GetEnvironmentHistoryRequest pageSize + * @property {string|null} [pageToken] GetEnvironmentHistoryRequest pageToken + */ + + /** + * Constructs a new GetEnvironmentHistoryRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetEnvironmentHistoryRequest. + * @implements IGetEnvironmentHistoryRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest=} [properties] Properties to set + */ + function GetEnvironmentHistoryRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetEnvironmentHistoryRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @instance + */ + GetEnvironmentHistoryRequest.prototype.parent = ""; + + /** + * GetEnvironmentHistoryRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @instance + */ + GetEnvironmentHistoryRequest.prototype.pageSize = 0; + + /** + * GetEnvironmentHistoryRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @instance + */ + GetEnvironmentHistoryRequest.prototype.pageToken = ""; + + /** + * Creates a new GetEnvironmentHistoryRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest} GetEnvironmentHistoryRequest instance + */ + GetEnvironmentHistoryRequest.create = function create(properties) { + return new GetEnvironmentHistoryRequest(properties); + }; + + /** + * Encodes the specified GetEnvironmentHistoryRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest} message GetEnvironmentHistoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentHistoryRequest.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 GetEnvironmentHistoryRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest} message GetEnvironmentHistoryRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetEnvironmentHistoryRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetEnvironmentHistoryRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest} GetEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentHistoryRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest(); + 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 GetEnvironmentHistoryRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest} GetEnvironmentHistoryRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetEnvironmentHistoryRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetEnvironmentHistoryRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetEnvironmentHistoryRequest.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 GetEnvironmentHistoryRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest} GetEnvironmentHistoryRequest + */ + GetEnvironmentHistoryRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest(); + 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 GetEnvironmentHistoryRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest} message GetEnvironmentHistoryRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetEnvironmentHistoryRequest.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 GetEnvironmentHistoryRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @instance + * @returns {Object.} JSON object + */ + GetEnvironmentHistoryRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetEnvironmentHistoryRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetEnvironmentHistoryRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest"; + }; + + return GetEnvironmentHistoryRequest; + })(); + + v2beta1.EnvironmentHistory = (function() { + + /** + * Properties of an EnvironmentHistory. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IEnvironmentHistory + * @property {string|null} [parent] EnvironmentHistory parent + * @property {Array.|null} [entries] EnvironmentHistory entries + * @property {string|null} [nextPageToken] EnvironmentHistory nextPageToken + */ + + /** + * Constructs a new EnvironmentHistory. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an EnvironmentHistory. + * @implements IEnvironmentHistory + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IEnvironmentHistory=} [properties] Properties to set + */ + function EnvironmentHistory(properties) { + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnvironmentHistory parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @instance + */ + EnvironmentHistory.prototype.parent = ""; + + /** + * EnvironmentHistory entries. + * @member {Array.} entries + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @instance + */ + EnvironmentHistory.prototype.entries = $util.emptyArray; + + /** + * EnvironmentHistory nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @instance + */ + EnvironmentHistory.prototype.nextPageToken = ""; + + /** + * Creates a new EnvironmentHistory instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @static + * @param {google.cloud.dialogflow.v2beta1.IEnvironmentHistory=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.EnvironmentHistory} EnvironmentHistory instance + */ + EnvironmentHistory.create = function create(properties) { + return new EnvironmentHistory(properties); + }; + + /** + * Encodes the specified EnvironmentHistory message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @static + * @param {google.cloud.dialogflow.v2beta1.IEnvironmentHistory} message EnvironmentHistory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnvironmentHistory.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.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.encode(message.entries[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified EnvironmentHistory message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @static + * @param {google.cloud.dialogflow.v2beta1.IEnvironmentHistory} message EnvironmentHistory message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnvironmentHistory.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnvironmentHistory message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.EnvironmentHistory} EnvironmentHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnvironmentHistory.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.decode(reader, reader.uint32())); + break; + } + case 3: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnvironmentHistory message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.EnvironmentHistory} EnvironmentHistory + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnvironmentHistory.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnvironmentHistory message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnvironmentHistory.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.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates an EnvironmentHistory message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.EnvironmentHistory} EnvironmentHistory + */ + EnvironmentHistory.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".google.cloud.dialogflow.v2beta1.EnvironmentHistory.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.EnvironmentHistory.entries: object expected"); + message.entries[i] = $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.fromObject(object.entries[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from an EnvironmentHistory message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @static + * @param {google.cloud.dialogflow.v2beta1.EnvironmentHistory} message EnvironmentHistory + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnvironmentHistory.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (options.defaults) { + object.parent = ""; + object.nextPageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.toObject(message.entries[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this EnvironmentHistory to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @instance + * @returns {Object.} JSON object + */ + EnvironmentHistory.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnvironmentHistory + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnvironmentHistory.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.EnvironmentHistory"; + }; + + EnvironmentHistory.Entry = (function() { + + /** + * Properties of an Entry. + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @interface IEntry + * @property {string|null} [agentVersion] Entry agentVersion + * @property {string|null} [description] Entry description + * @property {google.protobuf.ITimestamp|null} [createTime] Entry createTime + */ + + /** + * Constructs a new Entry. + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory + * @classdesc Represents an Entry. + * @implements IEntry + * @constructor + * @param {google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry=} [properties] Properties to set + */ + function Entry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Entry agentVersion. + * @member {string} agentVersion + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @instance + */ + Entry.prototype.agentVersion = ""; + + /** + * Entry description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @instance + */ + Entry.prototype.description = ""; + + /** + * Entry createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @instance + */ + Entry.prototype.createTime = null; + + /** + * Creates a new Entry instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @static + * @param {google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry} Entry instance + */ + Entry.create = function create(properties) { + return new Entry(properties); + }; + + /** + * Encodes the specified Entry message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @static + * @param {google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry} message Entry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.agentVersion != null && Object.hasOwnProperty.call(message, "agentVersion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.agentVersion); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Entry message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @static + * @param {google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry} message Entry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Entry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Entry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry} Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entry.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.agentVersion = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Entry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry} Entry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Entry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Entry message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Entry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.agentVersion != null && message.hasOwnProperty("agentVersion")) + if (!$util.isString(message.agentVersion)) + return "agentVersion: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates an Entry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry} Entry + */ + Entry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry(); + if (object.agentVersion != null) + message.agentVersion = String(object.agentVersion); + if (object.description != null) + message.description = String(object.description); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from an Entry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @static + * @param {google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry} message Entry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Entry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.agentVersion = ""; + object.description = ""; + object.createTime = null; + } + if (message.agentVersion != null && message.hasOwnProperty("agentVersion")) + object.agentVersion = message.agentVersion; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this Entry to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @instance + * @returns {Object.} JSON object + */ + Entry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Entry + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Entry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry"; + }; + + return Entry; + })(); + + return EnvironmentHistory; + })(); + + v2beta1.Fulfillments = (function() { + + /** + * Constructs a new Fulfillments service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Fulfillments + * @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 Fulfillments(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Fulfillments.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Fulfillments; + + /** + * Creates new Fulfillments service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Fulfillments + * @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 {Fulfillments} RPC service. Useful where requests and/or responses are streamed. + */ + Fulfillments.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Fulfillments|getFulfillment}. + * @memberof google.cloud.dialogflow.v2beta1.Fulfillments + * @typedef GetFulfillmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Fulfillment} [response] Fulfillment + */ + + /** + * Calls GetFulfillment. + * @function getFulfillment + * @memberof google.cloud.dialogflow.v2beta1.Fulfillments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest} request GetFulfillmentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillmentCallback} callback Node-style callback called with the error, if any, and Fulfillment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Fulfillments.prototype.getFulfillment = function getFulfillment(request, callback) { + return this.rpcCall(getFulfillment, $root.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest, $root.google.cloud.dialogflow.v2beta1.Fulfillment, request, callback); + }, "name", { value: "GetFulfillment" }); + + /** + * Calls GetFulfillment. + * @function getFulfillment + * @memberof google.cloud.dialogflow.v2beta1.Fulfillments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest} request GetFulfillmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Fulfillments|updateFulfillment}. + * @memberof google.cloud.dialogflow.v2beta1.Fulfillments + * @typedef UpdateFulfillmentCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Fulfillment} [response] Fulfillment + */ + + /** + * Calls UpdateFulfillment. + * @function updateFulfillment + * @memberof google.cloud.dialogflow.v2beta1.Fulfillments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest} request UpdateFulfillmentRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillmentCallback} callback Node-style callback called with the error, if any, and Fulfillment + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Fulfillments.prototype.updateFulfillment = function updateFulfillment(request, callback) { + return this.rpcCall(updateFulfillment, $root.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest, $root.google.cloud.dialogflow.v2beta1.Fulfillment, request, callback); + }, "name", { value: "UpdateFulfillment" }); + + /** + * Calls UpdateFulfillment. + * @function updateFulfillment + * @memberof google.cloud.dialogflow.v2beta1.Fulfillments + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest} request UpdateFulfillmentRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Fulfillments; + })(); + + v2beta1.Fulfillment = (function() { + + /** + * Properties of a Fulfillment. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IFulfillment + * @property {string|null} [name] Fulfillment name + * @property {string|null} [displayName] Fulfillment displayName + * @property {google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService|null} [genericWebService] Fulfillment genericWebService + * @property {boolean|null} [enabled] Fulfillment enabled + * @property {Array.|null} [features] Fulfillment features + */ + + /** + * Constructs a new Fulfillment. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Fulfillment. + * @implements IFulfillment + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IFulfillment=} [properties] Properties to set + */ + function Fulfillment(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]]; + } + + /** + * Fulfillment name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.name = ""; + + /** + * Fulfillment displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.displayName = ""; + + /** + * Fulfillment genericWebService. + * @member {google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService|null|undefined} genericWebService + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.genericWebService = null; + + /** + * Fulfillment enabled. + * @member {boolean} enabled + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.enabled = false; + + /** + * Fulfillment features. + * @member {Array.} features + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @instance + */ + Fulfillment.prototype.features = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Fulfillment fulfillment. + * @member {"genericWebService"|undefined} fulfillment + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @instance + */ + Object.defineProperty(Fulfillment.prototype, "fulfillment", { + get: $util.oneOfGetter($oneOfFields = ["genericWebService"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Fulfillment instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @static + * @param {google.cloud.dialogflow.v2beta1.IFulfillment=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment} Fulfillment instance + */ + Fulfillment.create = function create(properties) { + return new Fulfillment(properties); + }; + + /** + * Encodes the specified Fulfillment message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @static + * @param {google.cloud.dialogflow.v2beta1.IFulfillment} message Fulfillment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fulfillment.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.genericWebService != null && Object.hasOwnProperty.call(message, "genericWebService")) + $root.google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.encode(message.genericWebService, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.enabled); + if (message.features != null && message.features.length) + for (var i = 0; i < message.features.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Fulfillment.Feature.encode(message.features[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Fulfillment message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @static + * @param {google.cloud.dialogflow.v2beta1.IFulfillment} message Fulfillment message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Fulfillment.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Fulfillment message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment} Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fulfillment.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Fulfillment(); + 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.genericWebService = $root.google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.decode(reader, reader.uint32()); + break; + } + case 4: { + message.enabled = reader.bool(); + break; + } + case 5: { + if (!(message.features && message.features.length)) + message.features = []; + message.features.push($root.google.cloud.dialogflow.v2beta1.Fulfillment.Feature.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Fulfillment message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment} Fulfillment + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Fulfillment.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Fulfillment message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Fulfillment.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.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.genericWebService != null && message.hasOwnProperty("genericWebService")) { + properties.fulfillment = 1; + { + var error = $root.google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.verify(message.genericWebService); + if (error) + return "genericWebService." + error; + } + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + 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.dialogflow.v2beta1.Fulfillment.Feature.verify(message.features[i]); + if (error) + return "features." + error; + } + } + return null; + }; + + /** + * Creates a Fulfillment message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment} Fulfillment + */ + Fulfillment.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Fulfillment) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Fulfillment(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.genericWebService != null) { + if (typeof object.genericWebService !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Fulfillment.genericWebService: object expected"); + message.genericWebService = $root.google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.fromObject(object.genericWebService); + } + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.features) { + if (!Array.isArray(object.features)) + throw TypeError(".google.cloud.dialogflow.v2beta1.Fulfillment.features: array expected"); + message.features = []; + for (var i = 0; i < object.features.length; ++i) { + if (typeof object.features[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Fulfillment.features: object expected"); + message.features[i] = $root.google.cloud.dialogflow.v2beta1.Fulfillment.Feature.fromObject(object.features[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Fulfillment message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @static + * @param {google.cloud.dialogflow.v2beta1.Fulfillment} message Fulfillment + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Fulfillment.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.features = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.enabled = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.genericWebService != null && message.hasOwnProperty("genericWebService")) { + object.genericWebService = $root.google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.toObject(message.genericWebService, options); + if (options.oneofs) + object.fulfillment = "genericWebService"; + } + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = message.enabled; + if (message.features && message.features.length) { + object.features = []; + for (var j = 0; j < message.features.length; ++j) + object.features[j] = $root.google.cloud.dialogflow.v2beta1.Fulfillment.Feature.toObject(message.features[j], options); + } + return object; + }; + + /** + * Converts this Fulfillment to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @instance + * @returns {Object.} JSON object + */ + Fulfillment.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Fulfillment + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Fulfillment.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Fulfillment"; + }; + + Fulfillment.GenericWebService = (function() { + + /** + * Properties of a GenericWebService. + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @interface IGenericWebService + * @property {string|null} [uri] GenericWebService uri + * @property {string|null} [username] GenericWebService username + * @property {string|null} [password] GenericWebService password + * @property {Object.|null} [requestHeaders] GenericWebService requestHeaders + * @property {boolean|null} [isCloudFunction] GenericWebService isCloudFunction + */ + + /** + * Constructs a new GenericWebService. + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @classdesc Represents a GenericWebService. + * @implements IGenericWebService + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService=} [properties] Properties to set + */ + function GenericWebService(properties) { + this.requestHeaders = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenericWebService uri. + * @member {string} uri + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.uri = ""; + + /** + * GenericWebService username. + * @member {string} username + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.username = ""; + + /** + * GenericWebService password. + * @member {string} password + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.password = ""; + + /** + * GenericWebService requestHeaders. + * @member {Object.} requestHeaders + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.requestHeaders = $util.emptyObject; + + /** + * GenericWebService isCloudFunction. + * @member {boolean} isCloudFunction + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @instance + */ + GenericWebService.prototype.isCloudFunction = false; + + /** + * Creates a new GenericWebService instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @static + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService} GenericWebService instance + */ + GenericWebService.create = function create(properties) { + return new GenericWebService(properties); + }; + + /** + * Encodes the specified GenericWebService message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @static + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService} message GenericWebService message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenericWebService.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.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); + if (message.requestHeaders != null && Object.hasOwnProperty.call(message, "requestHeaders")) + for (var keys = Object.keys(message.requestHeaders), i = 0; i < keys.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.requestHeaders[keys[i]]).ldelim(); + if (message.isCloudFunction != null && Object.hasOwnProperty.call(message, "isCloudFunction")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.isCloudFunction); + return writer; + }; + + /** + * Encodes the specified GenericWebService message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @static + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.IGenericWebService} message GenericWebService message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenericWebService.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenericWebService message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService} GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenericWebService.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.username = reader.string(); + break; + } + case 3: { + message.password = reader.string(); + break; + } + case 4: { + if (message.requestHeaders === $util.emptyObject) + message.requestHeaders = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.requestHeaders[key] = value; + break; + } + case 5: { + message.isCloudFunction = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenericWebService message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService} GenericWebService + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenericWebService.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenericWebService message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenericWebService.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.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.requestHeaders != null && message.hasOwnProperty("requestHeaders")) { + if (!$util.isObject(message.requestHeaders)) + return "requestHeaders: object expected"; + var key = Object.keys(message.requestHeaders); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.requestHeaders[key[i]])) + return "requestHeaders: string{k:string} expected"; + } + if (message.isCloudFunction != null && message.hasOwnProperty("isCloudFunction")) + if (typeof message.isCloudFunction !== "boolean") + return "isCloudFunction: boolean expected"; + return null; + }; + + /** + * Creates a GenericWebService message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService} GenericWebService + */ + GenericWebService.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + if (object.requestHeaders) { + if (typeof object.requestHeaders !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService.requestHeaders: object expected"); + message.requestHeaders = {}; + for (var keys = Object.keys(object.requestHeaders), i = 0; i < keys.length; ++i) + message.requestHeaders[keys[i]] = String(object.requestHeaders[keys[i]]); + } + if (object.isCloudFunction != null) + message.isCloudFunction = Boolean(object.isCloudFunction); + return message; + }; + + /** + * Creates a plain object from a GenericWebService message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @static + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService} message GenericWebService + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenericWebService.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.requestHeaders = {}; + if (options.defaults) { + object.uri = ""; + object.username = ""; + object.password = ""; + object.isCloudFunction = false; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + var keys2; + if (message.requestHeaders && (keys2 = Object.keys(message.requestHeaders)).length) { + object.requestHeaders = {}; + for (var j = 0; j < keys2.length; ++j) + object.requestHeaders[keys2[j]] = message.requestHeaders[keys2[j]]; + } + if (message.isCloudFunction != null && message.hasOwnProperty("isCloudFunction")) + object.isCloudFunction = message.isCloudFunction; + return object; + }; + + /** + * Converts this GenericWebService to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @instance + * @returns {Object.} JSON object + */ + GenericWebService.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenericWebService + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenericWebService.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Fulfillment.GenericWebService"; + }; + + return GenericWebService; + })(); + + Fulfillment.Feature = (function() { + + /** + * Properties of a Feature. + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @interface IFeature + * @property {google.cloud.dialogflow.v2beta1.Fulfillment.Feature.Type|null} [type] Feature type + */ + + /** + * Constructs a new Feature. + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment + * @classdesc Represents a Feature. + * @implements IFeature + * @constructor + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.Feature.Type} type + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.Feature + * @instance + */ + Feature.prototype.type = 0; + + /** + * Creates a new Feature instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.Feature + * @static + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.IFeature=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment.Feature} Feature instance + */ + Feature.create = function create(properties) { + return new Feature(properties); + }; + + /** + * Encodes the specified Feature message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.Feature.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.Feature + * @static + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.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); + return writer; + }; + + /** + * Encodes the specified Feature message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Fulfillment.Feature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.Feature + * @static + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.Feature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.Feature(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.type = reader.int32(); + 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.dialogflow.v2beta1.Fulfillment.Feature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.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: + break; + } + return null; + }; + + /** + * Creates a Feature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.Feature + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Fulfillment.Feature} Feature + */ + Feature.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Fulfillment.Feature) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Fulfillment.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 "SMALLTALK": + case 1: + message.type = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a Feature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.Feature + * @static + * @param {google.cloud.dialogflow.v2beta1.Fulfillment.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; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Fulfillment.Feature.Type[message.type] === undefined ? message.type : $root.google.cloud.dialogflow.v2beta1.Fulfillment.Feature.Type[message.type] : message.type; + return object; + }; + + /** + * Converts this Feature to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.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.dialogflow.v2beta1.Fulfillment.Feature"; + }; + + /** + * Type enum. + * @name google.cloud.dialogflow.v2beta1.Fulfillment.Feature.Type + * @enum {number} + * @property {number} TYPE_UNSPECIFIED=0 TYPE_UNSPECIFIED value + * @property {number} SMALLTALK=1 SMALLTALK value + */ + Feature.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SMALLTALK"] = 1; + return values; + })(); + + return Feature; + })(); + + return Fulfillment; + })(); + + v2beta1.GetFulfillmentRequest = (function() { + + /** + * Properties of a GetFulfillmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetFulfillmentRequest + * @property {string|null} [name] GetFulfillmentRequest name + */ + + /** + * Constructs a new GetFulfillmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetFulfillmentRequest. + * @implements IGetFulfillmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest=} [properties] Properties to set + */ + function GetFulfillmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetFulfillmentRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @instance + */ + GetFulfillmentRequest.prototype.name = ""; + + /** + * Creates a new GetFulfillmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetFulfillmentRequest} GetFulfillmentRequest instance + */ + GetFulfillmentRequest.create = function create(properties) { + return new GetFulfillmentRequest(properties); + }; + + /** + * Encodes the specified GetFulfillmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetFulfillmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest} message GetFulfillmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFulfillmentRequest.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 GetFulfillmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetFulfillmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest} message GetFulfillmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetFulfillmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetFulfillmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetFulfillmentRequest} GetFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFulfillmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest(); + 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 GetFulfillmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetFulfillmentRequest} GetFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetFulfillmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetFulfillmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetFulfillmentRequest.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 GetFulfillmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetFulfillmentRequest} GetFulfillmentRequest + */ + GetFulfillmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetFulfillmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetFulfillmentRequest} message GetFulfillmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetFulfillmentRequest.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 GetFulfillmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @instance + * @returns {Object.} JSON object + */ + GetFulfillmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetFulfillmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetFulfillmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetFulfillmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetFulfillmentRequest"; + }; + + return GetFulfillmentRequest; + })(); + + v2beta1.UpdateFulfillmentRequest = (function() { + + /** + * Properties of an UpdateFulfillmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateFulfillmentRequest + * @property {google.cloud.dialogflow.v2beta1.IFulfillment|null} [fulfillment] UpdateFulfillmentRequest fulfillment + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateFulfillmentRequest updateMask + */ + + /** + * Constructs a new UpdateFulfillmentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateFulfillmentRequest. + * @implements IUpdateFulfillmentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest=} [properties] Properties to set + */ + function UpdateFulfillmentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateFulfillmentRequest fulfillment. + * @member {google.cloud.dialogflow.v2beta1.IFulfillment|null|undefined} fulfillment + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @instance + */ + UpdateFulfillmentRequest.prototype.fulfillment = null; + + /** + * UpdateFulfillmentRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @instance + */ + UpdateFulfillmentRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateFulfillmentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest} UpdateFulfillmentRequest instance + */ + UpdateFulfillmentRequest.create = function create(properties) { + return new UpdateFulfillmentRequest(properties); + }; + + /** + * Encodes the specified UpdateFulfillmentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest} message UpdateFulfillmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFulfillmentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fulfillment != null && Object.hasOwnProperty.call(message, "fulfillment")) + $root.google.cloud.dialogflow.v2beta1.Fulfillment.encode(message.fulfillment, 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 UpdateFulfillmentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest} message UpdateFulfillmentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateFulfillmentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateFulfillmentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest} UpdateFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFulfillmentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.fulfillment = $root.google.cloud.dialogflow.v2beta1.Fulfillment.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 UpdateFulfillmentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest} UpdateFulfillmentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateFulfillmentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateFulfillmentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateFulfillmentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fulfillment != null && message.hasOwnProperty("fulfillment")) { + var error = $root.google.cloud.dialogflow.v2beta1.Fulfillment.verify(message.fulfillment); + if (error) + return "fulfillment." + 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 UpdateFulfillmentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest} UpdateFulfillmentRequest + */ + UpdateFulfillmentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest(); + if (object.fulfillment != null) { + if (typeof object.fulfillment !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest.fulfillment: object expected"); + message.fulfillment = $root.google.cloud.dialogflow.v2beta1.Fulfillment.fromObject(object.fulfillment); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateFulfillmentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest} message UpdateFulfillmentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateFulfillmentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fulfillment = null; + object.updateMask = null; + } + if (message.fulfillment != null && message.hasOwnProperty("fulfillment")) + object.fulfillment = $root.google.cloud.dialogflow.v2beta1.Fulfillment.toObject(message.fulfillment, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateFulfillmentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateFulfillmentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateFulfillmentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateFulfillmentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest"; + }; + + return UpdateFulfillmentRequest; + })(); + + v2beta1.HumanAgentAssistantEvent = (function() { + + /** + * Properties of a HumanAgentAssistantEvent. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IHumanAgentAssistantEvent + * @property {string|null} [conversation] HumanAgentAssistantEvent conversation + * @property {string|null} [participant] HumanAgentAssistantEvent participant + * @property {Array.|null} [suggestionResults] HumanAgentAssistantEvent suggestionResults + */ + + /** + * Constructs a new HumanAgentAssistantEvent. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a HumanAgentAssistantEvent. + * @implements IHumanAgentAssistantEvent + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantEvent=} [properties] Properties to set + */ + function HumanAgentAssistantEvent(properties) { + this.suggestionResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HumanAgentAssistantEvent conversation. + * @member {string} conversation + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @instance + */ + HumanAgentAssistantEvent.prototype.conversation = ""; + + /** + * HumanAgentAssistantEvent participant. + * @member {string} participant + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @instance + */ + HumanAgentAssistantEvent.prototype.participant = ""; + + /** + * HumanAgentAssistantEvent suggestionResults. + * @member {Array.} suggestionResults + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @instance + */ + HumanAgentAssistantEvent.prototype.suggestionResults = $util.emptyArray; + + /** + * Creates a new HumanAgentAssistantEvent instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @static + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantEvent=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent} HumanAgentAssistantEvent instance + */ + HumanAgentAssistantEvent.create = function create(properties) { + return new HumanAgentAssistantEvent(properties); + }; + + /** + * Encodes the specified HumanAgentAssistantEvent message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @static + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantEvent} message HumanAgentAssistantEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentAssistantEvent.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.conversation != null && Object.hasOwnProperty.call(message, "conversation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.conversation); + if (message.participant != null && Object.hasOwnProperty.call(message, "participant")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.participant); + if (message.suggestionResults != null && message.suggestionResults.length) + for (var i = 0; i < message.suggestionResults.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SuggestionResult.encode(message.suggestionResults[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified HumanAgentAssistantEvent message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @static + * @param {google.cloud.dialogflow.v2beta1.IHumanAgentAssistantEvent} message HumanAgentAssistantEvent message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HumanAgentAssistantEvent.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HumanAgentAssistantEvent message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent} HumanAgentAssistantEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentAssistantEvent.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.conversation = reader.string(); + break; + } + case 3: { + message.participant = reader.string(); + break; + } + case 5: { + if (!(message.suggestionResults && message.suggestionResults.length)) + message.suggestionResults = []; + message.suggestionResults.push($root.google.cloud.dialogflow.v2beta1.SuggestionResult.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HumanAgentAssistantEvent message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent} HumanAgentAssistantEvent + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HumanAgentAssistantEvent.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HumanAgentAssistantEvent message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HumanAgentAssistantEvent.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.conversation != null && message.hasOwnProperty("conversation")) + if (!$util.isString(message.conversation)) + return "conversation: string expected"; + if (message.participant != null && message.hasOwnProperty("participant")) + if (!$util.isString(message.participant)) + return "participant: string expected"; + if (message.suggestionResults != null && message.hasOwnProperty("suggestionResults")) { + if (!Array.isArray(message.suggestionResults)) + return "suggestionResults: array expected"; + for (var i = 0; i < message.suggestionResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.verify(message.suggestionResults[i]); + if (error) + return "suggestionResults." + error; + } + } + return null; + }; + + /** + * Creates a HumanAgentAssistantEvent message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent} HumanAgentAssistantEvent + */ + HumanAgentAssistantEvent.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent(); + if (object.conversation != null) + message.conversation = String(object.conversation); + if (object.participant != null) + message.participant = String(object.participant); + if (object.suggestionResults) { + if (!Array.isArray(object.suggestionResults)) + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent.suggestionResults: array expected"); + message.suggestionResults = []; + for (var i = 0; i < object.suggestionResults.length; ++i) { + if (typeof object.suggestionResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent.suggestionResults: object expected"); + message.suggestionResults[i] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.fromObject(object.suggestionResults[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HumanAgentAssistantEvent message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @static + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent} message HumanAgentAssistantEvent + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HumanAgentAssistantEvent.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.suggestionResults = []; + if (options.defaults) { + object.conversation = ""; + object.participant = ""; + } + if (message.conversation != null && message.hasOwnProperty("conversation")) + object.conversation = message.conversation; + if (message.participant != null && message.hasOwnProperty("participant")) + object.participant = message.participant; + if (message.suggestionResults && message.suggestionResults.length) { + object.suggestionResults = []; + for (var j = 0; j < message.suggestionResults.length; ++j) + object.suggestionResults[j] = $root.google.cloud.dialogflow.v2beta1.SuggestionResult.toObject(message.suggestionResults[j], options); + } + return object; + }; + + /** + * Converts this HumanAgentAssistantEvent to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @instance + * @returns {Object.} JSON object + */ + HumanAgentAssistantEvent.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HumanAgentAssistantEvent + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HumanAgentAssistantEvent.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.HumanAgentAssistantEvent"; + }; + + return HumanAgentAssistantEvent; + })(); + + v2beta1.KnowledgeBases = (function() { + + /** + * Constructs a new KnowledgeBases service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a KnowledgeBases + * @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 KnowledgeBases(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (KnowledgeBases.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = KnowledgeBases; + + /** + * Creates new KnowledgeBases service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @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 {KnowledgeBases} RPC service. Useful where requests and/or responses are streamed. + */ + KnowledgeBases.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|listKnowledgeBases}. + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @typedef ListKnowledgeBasesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse} [response] ListKnowledgeBasesResponse + */ + + /** + * Calls ListKnowledgeBases. + * @function listKnowledgeBases + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest} request ListKnowledgeBasesRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBasesCallback} callback Node-style callback called with the error, if any, and ListKnowledgeBasesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.listKnowledgeBases = function listKnowledgeBases(request, callback) { + return this.rpcCall(listKnowledgeBases, $root.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest, $root.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse, request, callback); + }, "name", { value: "ListKnowledgeBases" }); + + /** + * Calls ListKnowledgeBases. + * @function listKnowledgeBases + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest} request ListKnowledgeBasesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|getKnowledgeBase}. + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @typedef GetKnowledgeBaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} [response] KnowledgeBase + */ + + /** + * Calls GetKnowledgeBase. + * @function getKnowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest} request GetKnowledgeBaseRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBaseCallback} callback Node-style callback called with the error, if any, and KnowledgeBase + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.getKnowledgeBase = function getKnowledgeBase(request, callback) { + return this.rpcCall(getKnowledgeBase, $root.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest, $root.google.cloud.dialogflow.v2beta1.KnowledgeBase, request, callback); + }, "name", { value: "GetKnowledgeBase" }); + + /** + * Calls GetKnowledgeBase. + * @function getKnowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest} request GetKnowledgeBaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|createKnowledgeBase}. + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @typedef CreateKnowledgeBaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} [response] KnowledgeBase + */ + + /** + * Calls CreateKnowledgeBase. + * @function createKnowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest} request CreateKnowledgeBaseRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBaseCallback} callback Node-style callback called with the error, if any, and KnowledgeBase + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.createKnowledgeBase = function createKnowledgeBase(request, callback) { + return this.rpcCall(createKnowledgeBase, $root.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest, $root.google.cloud.dialogflow.v2beta1.KnowledgeBase, request, callback); + }, "name", { value: "CreateKnowledgeBase" }); + + /** + * Calls CreateKnowledgeBase. + * @function createKnowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest} request CreateKnowledgeBaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|deleteKnowledgeBase}. + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @typedef DeleteKnowledgeBaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteKnowledgeBase. + * @function deleteKnowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest} request DeleteKnowledgeBaseRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBaseCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.deleteKnowledgeBase = function deleteKnowledgeBase(request, callback) { + return this.rpcCall(deleteKnowledgeBase, $root.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteKnowledgeBase" }); + + /** + * Calls DeleteKnowledgeBase. + * @function deleteKnowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest} request DeleteKnowledgeBaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.KnowledgeBases|updateKnowledgeBase}. + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @typedef UpdateKnowledgeBaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} [response] KnowledgeBase + */ + + /** + * Calls UpdateKnowledgeBase. + * @function updateKnowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest} request UpdateKnowledgeBaseRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBaseCallback} callback Node-style callback called with the error, if any, and KnowledgeBase + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(KnowledgeBases.prototype.updateKnowledgeBase = function updateKnowledgeBase(request, callback) { + return this.rpcCall(updateKnowledgeBase, $root.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest, $root.google.cloud.dialogflow.v2beta1.KnowledgeBase, request, callback); + }, "name", { value: "UpdateKnowledgeBase" }); + + /** + * Calls UpdateKnowledgeBase. + * @function updateKnowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBases + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest} request UpdateKnowledgeBaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return KnowledgeBases; + })(); + + v2beta1.KnowledgeBase = (function() { + + /** + * Properties of a KnowledgeBase. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IKnowledgeBase + * @property {string|null} [name] KnowledgeBase name + * @property {string|null} [displayName] KnowledgeBase displayName + * @property {string|null} [languageCode] KnowledgeBase languageCode + */ + + /** + * Constructs a new KnowledgeBase. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a KnowledgeBase. + * @implements IKnowledgeBase + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeBase=} [properties] Properties to set + */ + function KnowledgeBase(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * KnowledgeBase name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @instance + */ + KnowledgeBase.prototype.name = ""; + + /** + * KnowledgeBase displayName. + * @member {string} displayName + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @instance + */ + KnowledgeBase.prototype.displayName = ""; + + /** + * KnowledgeBase languageCode. + * @member {string} languageCode + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @instance + */ + KnowledgeBase.prototype.languageCode = ""; + + /** + * Creates a new KnowledgeBase instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @static + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeBase=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeBase} KnowledgeBase instance + */ + KnowledgeBase.create = function create(properties) { + return new KnowledgeBase(properties); + }; + + /** + * Encodes the specified KnowledgeBase message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeBase.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @static + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeBase} message KnowledgeBase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeBase.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.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.languageCode); + return writer; + }; + + /** + * Encodes the specified KnowledgeBase message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.KnowledgeBase.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @static + * @param {google.cloud.dialogflow.v2beta1.IKnowledgeBase} message KnowledgeBase message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + KnowledgeBase.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a KnowledgeBase message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeBase} KnowledgeBase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeBase.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.KnowledgeBase(); + 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 4: { + message.languageCode = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a KnowledgeBase message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeBase} KnowledgeBase + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + KnowledgeBase.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a KnowledgeBase message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + KnowledgeBase.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.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + return null; + }; + + /** + * Creates a KnowledgeBase message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.KnowledgeBase} KnowledgeBase + */ + KnowledgeBase.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.KnowledgeBase) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.KnowledgeBase(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + return message; + }; + + /** + * Creates a plain object from a KnowledgeBase message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @static + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} message KnowledgeBase + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + KnowledgeBase.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.languageCode = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; + return object; + }; + + /** + * Converts this KnowledgeBase to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @instance + * @returns {Object.} JSON object + */ + KnowledgeBase.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for KnowledgeBase + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.KnowledgeBase + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + KnowledgeBase.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.KnowledgeBase"; + }; + + return KnowledgeBase; + })(); + + v2beta1.ListKnowledgeBasesRequest = (function() { + + /** + * Properties of a ListKnowledgeBasesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListKnowledgeBasesRequest + * @property {string|null} [parent] ListKnowledgeBasesRequest parent + * @property {number|null} [pageSize] ListKnowledgeBasesRequest pageSize + * @property {string|null} [pageToken] ListKnowledgeBasesRequest pageToken + * @property {string|null} [filter] ListKnowledgeBasesRequest filter + */ + + /** + * Constructs a new ListKnowledgeBasesRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListKnowledgeBasesRequest. + * @implements IListKnowledgeBasesRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest=} [properties] Properties to set + */ + function ListKnowledgeBasesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKnowledgeBasesRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @instance + */ + ListKnowledgeBasesRequest.prototype.parent = ""; + + /** + * ListKnowledgeBasesRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @instance + */ + ListKnowledgeBasesRequest.prototype.pageSize = 0; + + /** + * ListKnowledgeBasesRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @instance + */ + ListKnowledgeBasesRequest.prototype.pageToken = ""; + + /** + * ListKnowledgeBasesRequest filter. + * @member {string} filter + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @instance + */ + ListKnowledgeBasesRequest.prototype.filter = ""; + + /** + * Creates a new ListKnowledgeBasesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest} ListKnowledgeBasesRequest instance + */ + ListKnowledgeBasesRequest.create = function create(properties) { + return new ListKnowledgeBasesRequest(properties); + }; + + /** + * Encodes the specified ListKnowledgeBasesRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest} message ListKnowledgeBasesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKnowledgeBasesRequest.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); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListKnowledgeBasesRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest} message ListKnowledgeBasesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKnowledgeBasesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKnowledgeBasesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest} ListKnowledgeBasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKnowledgeBasesRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest(); + 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; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKnowledgeBasesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest} ListKnowledgeBasesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKnowledgeBasesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKnowledgeBasesRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKnowledgeBasesRequest.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"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListKnowledgeBasesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest} ListKnowledgeBasesRequest + */ + ListKnowledgeBasesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest(); + 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); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListKnowledgeBasesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest} message ListKnowledgeBasesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKnowledgeBasesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + 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; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListKnowledgeBasesRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @instance + * @returns {Object.} JSON object + */ + ListKnowledgeBasesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListKnowledgeBasesRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListKnowledgeBasesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest"; + }; + + return ListKnowledgeBasesRequest; + })(); + + v2beta1.ListKnowledgeBasesResponse = (function() { + + /** + * Properties of a ListKnowledgeBasesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListKnowledgeBasesResponse + * @property {Array.|null} [knowledgeBases] ListKnowledgeBasesResponse knowledgeBases + * @property {string|null} [nextPageToken] ListKnowledgeBasesResponse nextPageToken + */ + + /** + * Constructs a new ListKnowledgeBasesResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListKnowledgeBasesResponse. + * @implements IListKnowledgeBasesResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse=} [properties] Properties to set + */ + function ListKnowledgeBasesResponse(properties) { + this.knowledgeBases = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListKnowledgeBasesResponse knowledgeBases. + * @member {Array.} knowledgeBases + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @instance + */ + ListKnowledgeBasesResponse.prototype.knowledgeBases = $util.emptyArray; + + /** + * ListKnowledgeBasesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @instance + */ + ListKnowledgeBasesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListKnowledgeBasesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse} ListKnowledgeBasesResponse instance + */ + ListKnowledgeBasesResponse.create = function create(properties) { + return new ListKnowledgeBasesResponse(properties); + }; + + /** + * Encodes the specified ListKnowledgeBasesResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse} message ListKnowledgeBasesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKnowledgeBasesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.knowledgeBases != null && message.knowledgeBases.length) + for (var i = 0; i < message.knowledgeBases.length; ++i) + $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.encode(message.knowledgeBases[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 ListKnowledgeBasesResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse} message ListKnowledgeBasesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListKnowledgeBasesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListKnowledgeBasesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse} ListKnowledgeBasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKnowledgeBasesResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.knowledgeBases && message.knowledgeBases.length)) + message.knowledgeBases = []; + message.knowledgeBases.push($root.google.cloud.dialogflow.v2beta1.KnowledgeBase.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListKnowledgeBasesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse} ListKnowledgeBasesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListKnowledgeBasesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListKnowledgeBasesResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListKnowledgeBasesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.knowledgeBases != null && message.hasOwnProperty("knowledgeBases")) { + if (!Array.isArray(message.knowledgeBases)) + return "knowledgeBases: array expected"; + for (var i = 0; i < message.knowledgeBases.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.verify(message.knowledgeBases[i]); + if (error) + return "knowledgeBases." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListKnowledgeBasesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse} ListKnowledgeBasesResponse + */ + ListKnowledgeBasesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse(); + if (object.knowledgeBases) { + if (!Array.isArray(object.knowledgeBases)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse.knowledgeBases: array expected"); + message.knowledgeBases = []; + for (var i = 0; i < object.knowledgeBases.length; ++i) { + if (typeof object.knowledgeBases[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse.knowledgeBases: object expected"); + message.knowledgeBases[i] = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.fromObject(object.knowledgeBases[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListKnowledgeBasesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse} message ListKnowledgeBasesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListKnowledgeBasesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.knowledgeBases = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.knowledgeBases && message.knowledgeBases.length) { + object.knowledgeBases = []; + for (var j = 0; j < message.knowledgeBases.length; ++j) + object.knowledgeBases[j] = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.toObject(message.knowledgeBases[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListKnowledgeBasesResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @instance + * @returns {Object.} JSON object + */ + ListKnowledgeBasesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListKnowledgeBasesResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListKnowledgeBasesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse"; + }; + + return ListKnowledgeBasesResponse; + })(); + + v2beta1.GetKnowledgeBaseRequest = (function() { + + /** + * Properties of a GetKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetKnowledgeBaseRequest + * @property {string|null} [name] GetKnowledgeBaseRequest name + */ + + /** + * Constructs a new GetKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetKnowledgeBaseRequest. + * @implements IGetKnowledgeBaseRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest=} [properties] Properties to set + */ + function GetKnowledgeBaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetKnowledgeBaseRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @instance + */ + GetKnowledgeBaseRequest.prototype.name = ""; + + /** + * Creates a new GetKnowledgeBaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest} GetKnowledgeBaseRequest instance + */ + GetKnowledgeBaseRequest.create = function create(properties) { + return new GetKnowledgeBaseRequest(properties); + }; + + /** + * Encodes the specified GetKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest} message GetKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKnowledgeBaseRequest.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 GetKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest} message GetKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetKnowledgeBaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetKnowledgeBaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest} GetKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKnowledgeBaseRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest(); + 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 GetKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest} GetKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetKnowledgeBaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetKnowledgeBaseRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetKnowledgeBaseRequest.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 GetKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest} GetKnowledgeBaseRequest + */ + GetKnowledgeBaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetKnowledgeBaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest} message GetKnowledgeBaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetKnowledgeBaseRequest.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 GetKnowledgeBaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @instance + * @returns {Object.} JSON object + */ + GetKnowledgeBaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetKnowledgeBaseRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetKnowledgeBaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest"; + }; + + return GetKnowledgeBaseRequest; + })(); + + v2beta1.CreateKnowledgeBaseRequest = (function() { + + /** + * Properties of a CreateKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateKnowledgeBaseRequest + * @property {string|null} [parent] CreateKnowledgeBaseRequest parent + * @property {google.cloud.dialogflow.v2beta1.IKnowledgeBase|null} [knowledgeBase] CreateKnowledgeBaseRequest knowledgeBase + */ + + /** + * Constructs a new CreateKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateKnowledgeBaseRequest. + * @implements ICreateKnowledgeBaseRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest=} [properties] Properties to set + */ + function CreateKnowledgeBaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateKnowledgeBaseRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @instance + */ + CreateKnowledgeBaseRequest.prototype.parent = ""; + + /** + * CreateKnowledgeBaseRequest knowledgeBase. + * @member {google.cloud.dialogflow.v2beta1.IKnowledgeBase|null|undefined} knowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @instance + */ + CreateKnowledgeBaseRequest.prototype.knowledgeBase = null; + + /** + * Creates a new CreateKnowledgeBaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest} CreateKnowledgeBaseRequest instance + */ + CreateKnowledgeBaseRequest.create = function create(properties) { + return new CreateKnowledgeBaseRequest(properties); + }; + + /** + * Encodes the specified CreateKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest} message CreateKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKnowledgeBaseRequest.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.knowledgeBase != null && Object.hasOwnProperty.call(message, "knowledgeBase")) + $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.encode(message.knowledgeBase, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest} message CreateKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateKnowledgeBaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateKnowledgeBaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest} CreateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKnowledgeBaseRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.knowledgeBase = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest} CreateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateKnowledgeBaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateKnowledgeBaseRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateKnowledgeBaseRequest.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.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) { + var error = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.verify(message.knowledgeBase); + if (error) + return "knowledgeBase." + error; + } + return null; + }; + + /** + * Creates a CreateKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest} CreateKnowledgeBaseRequest + */ + CreateKnowledgeBaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.knowledgeBase != null) { + if (typeof object.knowledgeBase !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest.knowledgeBase: object expected"); + message.knowledgeBase = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.fromObject(object.knowledgeBase); + } + return message; + }; + + /** + * Creates a plain object from a CreateKnowledgeBaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest} message CreateKnowledgeBaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateKnowledgeBaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.knowledgeBase = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + object.knowledgeBase = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.toObject(message.knowledgeBase, options); + return object; + }; + + /** + * Converts this CreateKnowledgeBaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @instance + * @returns {Object.} JSON object + */ + CreateKnowledgeBaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateKnowledgeBaseRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateKnowledgeBaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest"; + }; + + return CreateKnowledgeBaseRequest; + })(); + + v2beta1.DeleteKnowledgeBaseRequest = (function() { + + /** + * Properties of a DeleteKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteKnowledgeBaseRequest + * @property {string|null} [name] DeleteKnowledgeBaseRequest name + * @property {boolean|null} [force] DeleteKnowledgeBaseRequest force + */ + + /** + * Constructs a new DeleteKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteKnowledgeBaseRequest. + * @implements IDeleteKnowledgeBaseRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest=} [properties] Properties to set + */ + function DeleteKnowledgeBaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteKnowledgeBaseRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @instance + */ + DeleteKnowledgeBaseRequest.prototype.name = ""; + + /** + * DeleteKnowledgeBaseRequest force. + * @member {boolean} force + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @instance + */ + DeleteKnowledgeBaseRequest.prototype.force = false; + + /** + * Creates a new DeleteKnowledgeBaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest} DeleteKnowledgeBaseRequest instance + */ + DeleteKnowledgeBaseRequest.create = function create(properties) { + return new DeleteKnowledgeBaseRequest(properties); + }; + + /** + * Encodes the specified DeleteKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest} message DeleteKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteKnowledgeBaseRequest.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.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.force); + return writer; + }; + + /** + * Encodes the specified DeleteKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest} message DeleteKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteKnowledgeBaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteKnowledgeBaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest} DeleteKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteKnowledgeBaseRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.force = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest} DeleteKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteKnowledgeBaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteKnowledgeBaseRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteKnowledgeBaseRequest.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.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a DeleteKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest} DeleteKnowledgeBaseRequest + */ + DeleteKnowledgeBaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a DeleteKnowledgeBaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest} message DeleteKnowledgeBaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteKnowledgeBaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.force = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this DeleteKnowledgeBaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteKnowledgeBaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteKnowledgeBaseRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteKnowledgeBaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest"; + }; + + return DeleteKnowledgeBaseRequest; + })(); + + v2beta1.UpdateKnowledgeBaseRequest = (function() { + + /** + * Properties of an UpdateKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateKnowledgeBaseRequest + * @property {google.cloud.dialogflow.v2beta1.IKnowledgeBase|null} [knowledgeBase] UpdateKnowledgeBaseRequest knowledgeBase + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateKnowledgeBaseRequest updateMask + */ + + /** + * Constructs a new UpdateKnowledgeBaseRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateKnowledgeBaseRequest. + * @implements IUpdateKnowledgeBaseRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest=} [properties] Properties to set + */ + function UpdateKnowledgeBaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateKnowledgeBaseRequest knowledgeBase. + * @member {google.cloud.dialogflow.v2beta1.IKnowledgeBase|null|undefined} knowledgeBase + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @instance + */ + UpdateKnowledgeBaseRequest.prototype.knowledgeBase = null; + + /** + * UpdateKnowledgeBaseRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @instance + */ + UpdateKnowledgeBaseRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateKnowledgeBaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest} UpdateKnowledgeBaseRequest instance + */ + UpdateKnowledgeBaseRequest.create = function create(properties) { + return new UpdateKnowledgeBaseRequest(properties); + }; + + /** + * Encodes the specified UpdateKnowledgeBaseRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest} message UpdateKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateKnowledgeBaseRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.knowledgeBase != null && Object.hasOwnProperty.call(message, "knowledgeBase")) + $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.encode(message.knowledgeBase, 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 UpdateKnowledgeBaseRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest} message UpdateKnowledgeBaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateKnowledgeBaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateKnowledgeBaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest} UpdateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateKnowledgeBaseRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.knowledgeBase = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.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 UpdateKnowledgeBaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest} UpdateKnowledgeBaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateKnowledgeBaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateKnowledgeBaseRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateKnowledgeBaseRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) { + var error = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.verify(message.knowledgeBase); + if (error) + return "knowledgeBase." + 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 UpdateKnowledgeBaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest} UpdateKnowledgeBaseRequest + */ + UpdateKnowledgeBaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest(); + if (object.knowledgeBase != null) { + if (typeof object.knowledgeBase !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest.knowledgeBase: object expected"); + message.knowledgeBase = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.fromObject(object.knowledgeBase); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateKnowledgeBaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest} message UpdateKnowledgeBaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateKnowledgeBaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.knowledgeBase = null; + object.updateMask = null; + } + if (message.knowledgeBase != null && message.hasOwnProperty("knowledgeBase")) + object.knowledgeBase = $root.google.cloud.dialogflow.v2beta1.KnowledgeBase.toObject(message.knowledgeBase, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateKnowledgeBaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateKnowledgeBaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateKnowledgeBaseRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateKnowledgeBaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest"; + }; + + return UpdateKnowledgeBaseRequest; + })(); + + v2beta1.Versions = (function() { + + /** + * Constructs a new Versions service. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Versions + * @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 Versions(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Versions.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Versions; + + /** + * Creates new Versions service using the specified rpc implementation. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @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 {Versions} RPC service. Useful where requests and/or responses are streamed. + */ + Versions.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|listVersions}. + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @typedef ListVersionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.ListVersionsResponse} [response] ListVersionsResponse + */ + + /** + * Calls ListVersions. + * @function listVersions + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListVersionsRequest} request ListVersionsRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Versions.ListVersionsCallback} callback Node-style callback called with the error, if any, and ListVersionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.listVersions = function listVersions(request, callback) { + return this.rpcCall(listVersions, $root.google.cloud.dialogflow.v2beta1.ListVersionsRequest, $root.google.cloud.dialogflow.v2beta1.ListVersionsResponse, request, callback); + }, "name", { value: "ListVersions" }); + + /** + * Calls ListVersions. + * @function listVersions + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IListVersionsRequest} request ListVersionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|getVersion}. + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @typedef GetVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Version} [response] Version + */ + + /** + * Calls GetVersion. + * @function getVersion + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetVersionRequest} request GetVersionRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Versions.GetVersionCallback} callback Node-style callback called with the error, if any, and Version + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.getVersion = function getVersion(request, callback) { + return this.rpcCall(getVersion, $root.google.cloud.dialogflow.v2beta1.GetVersionRequest, $root.google.cloud.dialogflow.v2beta1.Version, request, callback); + }, "name", { value: "GetVersion" }); + + /** + * Calls GetVersion. + * @function getVersion + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IGetVersionRequest} request GetVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|createVersion}. + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @typedef CreateVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Version} [response] Version + */ + + /** + * Calls CreateVersion. + * @function createVersion + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateVersionRequest} request CreateVersionRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Versions.CreateVersionCallback} callback Node-style callback called with the error, if any, and Version + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.createVersion = function createVersion(request, callback) { + return this.rpcCall(createVersion, $root.google.cloud.dialogflow.v2beta1.CreateVersionRequest, $root.google.cloud.dialogflow.v2beta1.Version, request, callback); + }, "name", { value: "CreateVersion" }); + + /** + * Calls CreateVersion. + * @function createVersion + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.ICreateVersionRequest} request CreateVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|updateVersion}. + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @typedef UpdateVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.dialogflow.v2beta1.Version} [response] Version + */ + + /** + * Calls UpdateVersion. + * @function updateVersion + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateVersionRequest} request UpdateVersionRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Versions.UpdateVersionCallback} callback Node-style callback called with the error, if any, and Version + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.updateVersion = function updateVersion(request, callback) { + return this.rpcCall(updateVersion, $root.google.cloud.dialogflow.v2beta1.UpdateVersionRequest, $root.google.cloud.dialogflow.v2beta1.Version, request, callback); + }, "name", { value: "UpdateVersion" }); + + /** + * Calls UpdateVersion. + * @function updateVersion + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IUpdateVersionRequest} request UpdateVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.dialogflow.v2beta1.Versions|deleteVersion}. + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @typedef DeleteVersionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteVersion. + * @function deleteVersion + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteVersionRequest} request DeleteVersionRequest message or plain object + * @param {google.cloud.dialogflow.v2beta1.Versions.DeleteVersionCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Versions.prototype.deleteVersion = function deleteVersion(request, callback) { + return this.rpcCall(deleteVersion, $root.google.cloud.dialogflow.v2beta1.DeleteVersionRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteVersion" }); + + /** + * Calls DeleteVersion. + * @function deleteVersion + * @memberof google.cloud.dialogflow.v2beta1.Versions + * @instance + * @param {google.cloud.dialogflow.v2beta1.IDeleteVersionRequest} request DeleteVersionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Versions; + })(); + + v2beta1.Version = (function() { + + /** + * Properties of a Version. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IVersion + * @property {string|null} [name] Version name + * @property {string|null} [description] Version description + * @property {number|null} [versionNumber] Version versionNumber + * @property {google.protobuf.ITimestamp|null} [createTime] Version createTime + * @property {google.cloud.dialogflow.v2beta1.Version.VersionStatus|null} [status] Version status + */ + + /** + * Constructs a new Version. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a Version. + * @implements IVersion + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IVersion=} [properties] Properties to set + */ + function Version(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Version name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.Version + * @instance + */ + Version.prototype.name = ""; + + /** + * Version description. + * @member {string} description + * @memberof google.cloud.dialogflow.v2beta1.Version + * @instance + */ + Version.prototype.description = ""; + + /** + * Version versionNumber. + * @member {number} versionNumber + * @memberof google.cloud.dialogflow.v2beta1.Version + * @instance + */ + Version.prototype.versionNumber = 0; + + /** + * Version createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.dialogflow.v2beta1.Version + * @instance + */ + Version.prototype.createTime = null; + + /** + * Version status. + * @member {google.cloud.dialogflow.v2beta1.Version.VersionStatus} status + * @memberof google.cloud.dialogflow.v2beta1.Version + * @instance + */ + Version.prototype.status = 0; + + /** + * Creates a new Version instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.Version + * @static + * @param {google.cloud.dialogflow.v2beta1.IVersion=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.Version} Version instance + */ + Version.create = function create(properties) { + return new Version(properties); + }; + + /** + * Encodes the specified Version message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Version.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.Version + * @static + * @param {google.cloud.dialogflow.v2beta1.IVersion} message Version message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Version.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.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.versionNumber != null && Object.hasOwnProperty.call(message, "versionNumber")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.versionNumber); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.status); + return writer; + }; + + /** + * Encodes the specified Version message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.Version.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Version + * @static + * @param {google.cloud.dialogflow.v2beta1.IVersion} message Version message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Version.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Version message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.Version + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.Version} Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Version.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.Version(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.versionNumber = reader.int32(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.status = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Version message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.Version + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.Version} Version + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Version.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Version message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.Version + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Version.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.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) + if (!$util.isInteger(message.versionNumber)) + return "versionNumber: integer expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a Version message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.Version + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.Version} Version + */ + Version.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.Version) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.Version(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.versionNumber != null) + message.versionNumber = object.versionNumber | 0; + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.Version.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + switch (object.status) { + default: + if (typeof object.status === "number") { + message.status = object.status; + break; + } + break; + case "VERSION_STATUS_UNSPECIFIED": + case 0: + message.status = 0; + break; + case "IN_PROGRESS": + case 1: + message.status = 1; + break; + case "READY": + case 2: + message.status = 2; + break; + case "FAILED": + case 3: + message.status = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a Version message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.Version + * @static + * @param {google.cloud.dialogflow.v2beta1.Version} message Version + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Version.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.versionNumber = 0; + object.createTime = null; + object.status = options.enums === String ? "VERSION_STATUS_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.versionNumber != null && message.hasOwnProperty("versionNumber")) + object.versionNumber = message.versionNumber; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.google.cloud.dialogflow.v2beta1.Version.VersionStatus[message.status] === undefined ? message.status : $root.google.cloud.dialogflow.v2beta1.Version.VersionStatus[message.status] : message.status; + return object; + }; + + /** + * Converts this Version to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.Version + * @instance + * @returns {Object.} JSON object + */ + Version.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Version + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.Version + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Version.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.Version"; + }; + + /** + * VersionStatus enum. + * @name google.cloud.dialogflow.v2beta1.Version.VersionStatus + * @enum {number} + * @property {number} VERSION_STATUS_UNSPECIFIED=0 VERSION_STATUS_UNSPECIFIED value + * @property {number} IN_PROGRESS=1 IN_PROGRESS value + * @property {number} READY=2 READY value + * @property {number} FAILED=3 FAILED value + */ + Version.VersionStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VERSION_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "IN_PROGRESS"] = 1; + values[valuesById[2] = "READY"] = 2; + values[valuesById[3] = "FAILED"] = 3; + return values; + })(); + + return Version; + })(); + + v2beta1.ListVersionsRequest = (function() { + + /** + * Properties of a ListVersionsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListVersionsRequest + * @property {string|null} [parent] ListVersionsRequest parent + * @property {number|null} [pageSize] ListVersionsRequest pageSize + * @property {string|null} [pageToken] ListVersionsRequest pageToken + */ + + /** + * Constructs a new ListVersionsRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListVersionsRequest. + * @implements IListVersionsRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListVersionsRequest=} [properties] Properties to set + */ + function ListVersionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListVersionsRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @instance + */ + ListVersionsRequest.prototype.parent = ""; + + /** + * ListVersionsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @instance + */ + ListVersionsRequest.prototype.pageSize = 0; + + /** + * ListVersionsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @instance + */ + ListVersionsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListVersionsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListVersionsRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListVersionsRequest} ListVersionsRequest instance + */ + ListVersionsRequest.create = function create(properties) { + return new ListVersionsRequest(properties); + }; + + /** + * Encodes the specified ListVersionsRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListVersionsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListVersionsRequest} message ListVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsRequest.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 ListVersionsRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListVersionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IListVersionsRequest} message ListVersionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListVersionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListVersionsRequest} ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListVersionsRequest(); + 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 ListVersionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListVersionsRequest} ListVersionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListVersionsRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListVersionsRequest.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 ListVersionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListVersionsRequest} ListVersionsRequest + */ + ListVersionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListVersionsRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListVersionsRequest(); + 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 ListVersionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ListVersionsRequest} message ListVersionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListVersionsRequest.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 ListVersionsRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListVersionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListVersionsRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListVersionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListVersionsRequest"; + }; + + return ListVersionsRequest; + })(); + + v2beta1.ListVersionsResponse = (function() { + + /** + * Properties of a ListVersionsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IListVersionsResponse + * @property {Array.|null} [versions] ListVersionsResponse versions + * @property {string|null} [nextPageToken] ListVersionsResponse nextPageToken + */ + + /** + * Constructs a new ListVersionsResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a ListVersionsResponse. + * @implements IListVersionsResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IListVersionsResponse=} [properties] Properties to set + */ + function ListVersionsResponse(properties) { + this.versions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListVersionsResponse versions. + * @member {Array.} versions + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @instance + */ + ListVersionsResponse.prototype.versions = $util.emptyArray; + + /** + * ListVersionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @instance + */ + ListVersionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListVersionsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListVersionsResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.ListVersionsResponse} ListVersionsResponse instance + */ + ListVersionsResponse.create = function create(properties) { + return new ListVersionsResponse(properties); + }; + + /** + * Encodes the specified ListVersionsResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListVersionsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListVersionsResponse} message ListVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.versions != null && message.versions.length) + for (var i = 0; i < message.versions.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Version.encode(message.versions[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 ListVersionsResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.ListVersionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IListVersionsResponse} message ListVersionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListVersionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.ListVersionsResponse} ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.ListVersionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.versions && message.versions.length)) + message.versions = []; + message.versions.push($root.google.cloud.dialogflow.v2beta1.Version.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListVersionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.ListVersionsResponse} ListVersionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListVersionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListVersionsResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListVersionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.versions != null && message.hasOwnProperty("versions")) { + if (!Array.isArray(message.versions)) + return "versions: array expected"; + for (var i = 0; i < message.versions.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Version.verify(message.versions[i]); + if (error) + return "versions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListVersionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.ListVersionsResponse} ListVersionsResponse + */ + ListVersionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.ListVersionsResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.ListVersionsResponse(); + if (object.versions) { + if (!Array.isArray(object.versions)) + throw TypeError(".google.cloud.dialogflow.v2beta1.ListVersionsResponse.versions: array expected"); + message.versions = []; + for (var i = 0; i < object.versions.length; ++i) { + if (typeof object.versions[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.ListVersionsResponse.versions: object expected"); + message.versions[i] = $root.google.cloud.dialogflow.v2beta1.Version.fromObject(object.versions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListVersionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.ListVersionsResponse} message ListVersionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListVersionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.versions = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.versions && message.versions.length) { + object.versions = []; + for (var j = 0; j < message.versions.length; ++j) + object.versions[j] = $root.google.cloud.dialogflow.v2beta1.Version.toObject(message.versions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListVersionsResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListVersionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListVersionsResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.ListVersionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListVersionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.ListVersionsResponse"; + }; + + return ListVersionsResponse; + })(); + + v2beta1.GetVersionRequest = (function() { + + /** + * Properties of a GetVersionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IGetVersionRequest + * @property {string|null} [name] GetVersionRequest name + */ + + /** + * Constructs a new GetVersionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a GetVersionRequest. + * @implements IGetVersionRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IGetVersionRequest=} [properties] Properties to set + */ + function GetVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetVersionRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @instance + */ + GetVersionRequest.prototype.name = ""; + + /** + * Creates a new GetVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.GetVersionRequest} GetVersionRequest instance + */ + GetVersionRequest.create = function create(properties) { + return new GetVersionRequest(properties); + }; + + /** + * Encodes the specified GetVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetVersionRequest} message GetVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionRequest.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 GetVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.GetVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IGetVersionRequest} message GetVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.GetVersionRequest} GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.GetVersionRequest(); + 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 GetVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.GetVersionRequest} GetVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetVersionRequest.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 GetVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.GetVersionRequest} GetVersionRequest + */ + GetVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.GetVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.GetVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.GetVersionRequest} message GetVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetVersionRequest.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 GetVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @instance + * @returns {Object.} JSON object + */ + GetVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetVersionRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.GetVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.GetVersionRequest"; + }; + + return GetVersionRequest; + })(); + + v2beta1.CreateVersionRequest = (function() { + + /** + * Properties of a CreateVersionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface ICreateVersionRequest + * @property {string|null} [parent] CreateVersionRequest parent + * @property {google.cloud.dialogflow.v2beta1.IVersion|null} [version] CreateVersionRequest version + */ + + /** + * Constructs a new CreateVersionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a CreateVersionRequest. + * @implements ICreateVersionRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.ICreateVersionRequest=} [properties] Properties to set + */ + function CreateVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateVersionRequest parent. + * @member {string} parent + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @instance + */ + CreateVersionRequest.prototype.parent = ""; + + /** + * CreateVersionRequest version. + * @member {google.cloud.dialogflow.v2beta1.IVersion|null|undefined} version + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @instance + */ + CreateVersionRequest.prototype.version = null; + + /** + * Creates a new CreateVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.CreateVersionRequest} CreateVersionRequest instance + */ + CreateVersionRequest.create = function create(properties) { + return new CreateVersionRequest(properties); + }; + + /** + * Encodes the specified CreateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateVersionRequest} message CreateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVersionRequest.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.version != null && Object.hasOwnProperty.call(message, "version")) + $root.google.cloud.dialogflow.v2beta1.Version.encode(message.version, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.CreateVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.ICreateVersionRequest} message CreateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.CreateVersionRequest} CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.CreateVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.version = $root.google.cloud.dialogflow.v2beta1.Version.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.CreateVersionRequest} CreateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateVersionRequest.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.version != null && message.hasOwnProperty("version")) { + var error = $root.google.cloud.dialogflow.v2beta1.Version.verify(message.version); + if (error) + return "version." + error; + } + return null; + }; + + /** + * Creates a CreateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.CreateVersionRequest} CreateVersionRequest + */ + CreateVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.CreateVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.CreateVersionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.CreateVersionRequest.version: object expected"); + message.version = $root.google.cloud.dialogflow.v2beta1.Version.fromObject(object.version); + } + return message; + }; + + /** + * Creates a plain object from a CreateVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.CreateVersionRequest} message CreateVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.version = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.google.cloud.dialogflow.v2beta1.Version.toObject(message.version, options); + return object; + }; + + /** + * Converts this CreateVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateVersionRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.CreateVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.CreateVersionRequest"; + }; + + return CreateVersionRequest; + })(); + + v2beta1.UpdateVersionRequest = (function() { + + /** + * Properties of an UpdateVersionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IUpdateVersionRequest + * @property {google.cloud.dialogflow.v2beta1.IVersion|null} [version] UpdateVersionRequest version + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateVersionRequest updateMask + */ + + /** + * Constructs a new UpdateVersionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an UpdateVersionRequest. + * @implements IUpdateVersionRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IUpdateVersionRequest=} [properties] Properties to set + */ + function UpdateVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateVersionRequest version. + * @member {google.cloud.dialogflow.v2beta1.IVersion|null|undefined} version + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @instance + */ + UpdateVersionRequest.prototype.version = null; + + /** + * UpdateVersionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @instance + */ + UpdateVersionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.UpdateVersionRequest} UpdateVersionRequest instance + */ + UpdateVersionRequest.create = function create(properties) { + return new UpdateVersionRequest(properties); + }; + + /** + * Encodes the specified UpdateVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateVersionRequest} message UpdateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateVersionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + $root.google.cloud.dialogflow.v2beta1.Version.encode(message.version, 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 UpdateVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.UpdateVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IUpdateVersionRequest} message UpdateVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.UpdateVersionRequest} UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.UpdateVersionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.version = $root.google.cloud.dialogflow.v2beta1.Version.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 UpdateVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.UpdateVersionRequest} UpdateVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateVersionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) { + var error = $root.google.cloud.dialogflow.v2beta1.Version.verify(message.version); + if (error) + return "version." + 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 UpdateVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.UpdateVersionRequest} UpdateVersionRequest + */ + UpdateVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.UpdateVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.UpdateVersionRequest(); + if (object.version != null) { + if (typeof object.version !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateVersionRequest.version: object expected"); + message.version = $root.google.cloud.dialogflow.v2beta1.Version.fromObject(object.version); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.UpdateVersionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.UpdateVersionRequest} message UpdateVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateVersionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = null; + object.updateMask = null; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = $root.google.cloud.dialogflow.v2beta1.Version.toObject(message.version, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateVersionRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.UpdateVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.UpdateVersionRequest"; + }; + + return UpdateVersionRequest; + })(); + + v2beta1.DeleteVersionRequest = (function() { + + /** + * Properties of a DeleteVersionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IDeleteVersionRequest + * @property {string|null} [name] DeleteVersionRequest name + */ + + /** + * Constructs a new DeleteVersionRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a DeleteVersionRequest. + * @implements IDeleteVersionRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IDeleteVersionRequest=} [properties] Properties to set + */ + function DeleteVersionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteVersionRequest name. + * @member {string} name + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @instance + */ + DeleteVersionRequest.prototype.name = ""; + + /** + * Creates a new DeleteVersionRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteVersionRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.DeleteVersionRequest} DeleteVersionRequest instance + */ + DeleteVersionRequest.create = function create(properties) { + return new DeleteVersionRequest(properties); + }; + + /** + * Encodes the specified DeleteVersionRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteVersionRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteVersionRequest} message DeleteVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteVersionRequest.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 DeleteVersionRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.DeleteVersionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IDeleteVersionRequest} message DeleteVersionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteVersionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteVersionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.DeleteVersionRequest} DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteVersionRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.DeleteVersionRequest(); + 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 DeleteVersionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.DeleteVersionRequest} DeleteVersionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteVersionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteVersionRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteVersionRequest.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 DeleteVersionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.DeleteVersionRequest} DeleteVersionRequest + */ + DeleteVersionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.DeleteVersionRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.DeleteVersionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteVersionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.DeleteVersionRequest} message DeleteVersionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteVersionRequest.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 DeleteVersionRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteVersionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteVersionRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.DeleteVersionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteVersionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.DeleteVersionRequest"; + }; + + return DeleteVersionRequest; + })(); + + v2beta1.WebhookRequest = (function() { + + /** + * Properties of a WebhookRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IWebhookRequest + * @property {string|null} [session] WebhookRequest session + * @property {string|null} [responseId] WebhookRequest responseId + * @property {google.cloud.dialogflow.v2beta1.IQueryResult|null} [queryResult] WebhookRequest queryResult + * @property {Array.|null} [alternativeQueryResults] WebhookRequest alternativeQueryResults + * @property {google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest|null} [originalDetectIntentRequest] WebhookRequest originalDetectIntentRequest + */ + + /** + * Constructs a new WebhookRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a WebhookRequest. + * @implements IWebhookRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IWebhookRequest=} [properties] Properties to set + */ + function WebhookRequest(properties) { + this.alternativeQueryResults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebhookRequest session. + * @member {string} session + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.session = ""; + + /** + * WebhookRequest responseId. + * @member {string} responseId + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.responseId = ""; + + /** + * WebhookRequest queryResult. + * @member {google.cloud.dialogflow.v2beta1.IQueryResult|null|undefined} queryResult + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.queryResult = null; + + /** + * WebhookRequest alternativeQueryResults. + * @member {Array.} alternativeQueryResults + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.alternativeQueryResults = $util.emptyArray; + + /** + * WebhookRequest originalDetectIntentRequest. + * @member {google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest|null|undefined} originalDetectIntentRequest + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @instance + */ + WebhookRequest.prototype.originalDetectIntentRequest = null; + + /** + * Creates a new WebhookRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IWebhookRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.WebhookRequest} WebhookRequest instance + */ + WebhookRequest.create = function create(properties) { + return new WebhookRequest(properties); + }; + + /** + * Encodes the specified WebhookRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.WebhookRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IWebhookRequest} message WebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseId != null && Object.hasOwnProperty.call(message, "responseId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseId); + if (message.queryResult != null && Object.hasOwnProperty.call(message, "queryResult")) + $root.google.cloud.dialogflow.v2beta1.QueryResult.encode(message.queryResult, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.originalDetectIntentRequest != null && Object.hasOwnProperty.call(message, "originalDetectIntentRequest")) + $root.google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.encode(message.originalDetectIntentRequest, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.session != null && Object.hasOwnProperty.call(message, "session")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.session); + if (message.alternativeQueryResults != null && message.alternativeQueryResults.length) + for (var i = 0; i < message.alternativeQueryResults.length; ++i) + $root.google.cloud.dialogflow.v2beta1.QueryResult.encode(message.alternativeQueryResults[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WebhookRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.WebhookRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IWebhookRequest} message WebhookRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.WebhookRequest} WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.WebhookRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 4: { + message.session = reader.string(); + break; + } + case 1: { + message.responseId = reader.string(); + break; + } + case 2: { + message.queryResult = $root.google.cloud.dialogflow.v2beta1.QueryResult.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.alternativeQueryResults && message.alternativeQueryResults.length)) + message.alternativeQueryResults = []; + message.alternativeQueryResults.push($root.google.cloud.dialogflow.v2beta1.QueryResult.decode(reader, reader.uint32())); + break; + } + case 3: { + message.originalDetectIntentRequest = $root.google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebhookRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.WebhookRequest} WebhookRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebhookRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebhookRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.session != null && message.hasOwnProperty("session")) + if (!$util.isString(message.session)) + return "session: string expected"; + if (message.responseId != null && message.hasOwnProperty("responseId")) + if (!$util.isString(message.responseId)) + return "responseId: string expected"; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryResult.verify(message.queryResult); + if (error) + return "queryResult." + error; + } + if (message.alternativeQueryResults != null && message.hasOwnProperty("alternativeQueryResults")) { + if (!Array.isArray(message.alternativeQueryResults)) + return "alternativeQueryResults: array expected"; + for (var i = 0; i < message.alternativeQueryResults.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.QueryResult.verify(message.alternativeQueryResults[i]); + if (error) + return "alternativeQueryResults." + error; + } + } + if (message.originalDetectIntentRequest != null && message.hasOwnProperty("originalDetectIntentRequest")) { + var error = $root.google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.verify(message.originalDetectIntentRequest); + if (error) + return "originalDetectIntentRequest." + error; + } + return null; + }; + + /** + * Creates a WebhookRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.WebhookRequest} WebhookRequest + */ + WebhookRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.WebhookRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.WebhookRequest(); + if (object.session != null) + message.session = String(object.session); + if (object.responseId != null) + message.responseId = String(object.responseId); + if (object.queryResult != null) { + if (typeof object.queryResult !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookRequest.queryResult: object expected"); + message.queryResult = $root.google.cloud.dialogflow.v2beta1.QueryResult.fromObject(object.queryResult); + } + if (object.alternativeQueryResults) { + if (!Array.isArray(object.alternativeQueryResults)) + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookRequest.alternativeQueryResults: array expected"); + message.alternativeQueryResults = []; + for (var i = 0; i < object.alternativeQueryResults.length; ++i) { + if (typeof object.alternativeQueryResults[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookRequest.alternativeQueryResults: object expected"); + message.alternativeQueryResults[i] = $root.google.cloud.dialogflow.v2beta1.QueryResult.fromObject(object.alternativeQueryResults[i]); + } + } + if (object.originalDetectIntentRequest != null) { + if (typeof object.originalDetectIntentRequest !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookRequest.originalDetectIntentRequest: object expected"); + message.originalDetectIntentRequest = $root.google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.fromObject(object.originalDetectIntentRequest); + } + return message; + }; + + /** + * Creates a plain object from a WebhookRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.WebhookRequest} message WebhookRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebhookRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.alternativeQueryResults = []; + if (options.defaults) { + object.responseId = ""; + object.queryResult = null; + object.originalDetectIntentRequest = null; + object.session = ""; + } + if (message.responseId != null && message.hasOwnProperty("responseId")) + object.responseId = message.responseId; + if (message.queryResult != null && message.hasOwnProperty("queryResult")) + object.queryResult = $root.google.cloud.dialogflow.v2beta1.QueryResult.toObject(message.queryResult, options); + if (message.originalDetectIntentRequest != null && message.hasOwnProperty("originalDetectIntentRequest")) + object.originalDetectIntentRequest = $root.google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.toObject(message.originalDetectIntentRequest, options); + if (message.session != null && message.hasOwnProperty("session")) + object.session = message.session; + if (message.alternativeQueryResults && message.alternativeQueryResults.length) { + object.alternativeQueryResults = []; + for (var j = 0; j < message.alternativeQueryResults.length; ++j) + object.alternativeQueryResults[j] = $root.google.cloud.dialogflow.v2beta1.QueryResult.toObject(message.alternativeQueryResults[j], options); + } + return object; + }; + + /** + * Converts this WebhookRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @instance + * @returns {Object.} JSON object + */ + WebhookRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WebhookRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.WebhookRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WebhookRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.WebhookRequest"; + }; + + return WebhookRequest; + })(); + + v2beta1.WebhookResponse = (function() { + + /** + * Properties of a WebhookResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IWebhookResponse + * @property {string|null} [fulfillmentText] WebhookResponse fulfillmentText + * @property {Array.|null} [fulfillmentMessages] WebhookResponse fulfillmentMessages + * @property {string|null} [source] WebhookResponse source + * @property {google.protobuf.IStruct|null} [payload] WebhookResponse payload + * @property {Array.|null} [outputContexts] WebhookResponse outputContexts + * @property {google.cloud.dialogflow.v2beta1.IEventInput|null} [followupEventInput] WebhookResponse followupEventInput + * @property {boolean|null} [liveAgentHandoff] WebhookResponse liveAgentHandoff + * @property {boolean|null} [endInteraction] WebhookResponse endInteraction + * @property {Array.|null} [sessionEntityTypes] WebhookResponse sessionEntityTypes + */ + + /** + * Constructs a new WebhookResponse. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents a WebhookResponse. + * @implements IWebhookResponse + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IWebhookResponse=} [properties] Properties to set + */ + function WebhookResponse(properties) { + this.fulfillmentMessages = []; + this.outputContexts = []; + this.sessionEntityTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WebhookResponse fulfillmentText. + * @member {string} fulfillmentText + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.fulfillmentText = ""; + + /** + * WebhookResponse fulfillmentMessages. + * @member {Array.} fulfillmentMessages + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.fulfillmentMessages = $util.emptyArray; + + /** + * WebhookResponse source. + * @member {string} source + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.source = ""; + + /** + * WebhookResponse payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.payload = null; + + /** + * WebhookResponse outputContexts. + * @member {Array.} outputContexts + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.outputContexts = $util.emptyArray; + + /** + * WebhookResponse followupEventInput. + * @member {google.cloud.dialogflow.v2beta1.IEventInput|null|undefined} followupEventInput + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.followupEventInput = null; + + /** + * WebhookResponse liveAgentHandoff. + * @member {boolean} liveAgentHandoff + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.liveAgentHandoff = false; + + /** + * WebhookResponse endInteraction. + * @member {boolean} endInteraction + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.endInteraction = false; + + /** + * WebhookResponse sessionEntityTypes. + * @member {Array.} sessionEntityTypes + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + */ + WebhookResponse.prototype.sessionEntityTypes = $util.emptyArray; + + /** + * Creates a new WebhookResponse instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IWebhookResponse=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.WebhookResponse} WebhookResponse instance + */ + WebhookResponse.create = function create(properties) { + return new WebhookResponse(properties); + }; + + /** + * Encodes the specified WebhookResponse message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.WebhookResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IWebhookResponse} message WebhookResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fulfillmentText != null && Object.hasOwnProperty.call(message, "fulfillmentText")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fulfillmentText); + if (message.fulfillmentMessages != null && message.fulfillmentMessages.length) + for (var i = 0; i < message.fulfillmentMessages.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Intent.Message.encode(message.fulfillmentMessages[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.source); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.outputContexts != null && message.outputContexts.length) + for (var i = 0; i < message.outputContexts.length; ++i) + $root.google.cloud.dialogflow.v2beta1.Context.encode(message.outputContexts[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.followupEventInput != null && Object.hasOwnProperty.call(message, "followupEventInput")) + $root.google.cloud.dialogflow.v2beta1.EventInput.encode(message.followupEventInput, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.liveAgentHandoff != null && Object.hasOwnProperty.call(message, "liveAgentHandoff")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.liveAgentHandoff); + if (message.endInteraction != null && Object.hasOwnProperty.call(message, "endInteraction")) + writer.uint32(/* id 8, wireType 0 =*/64).bool(message.endInteraction); + if (message.sessionEntityTypes != null && message.sessionEntityTypes.length) + for (var i = 0; i < message.sessionEntityTypes.length; ++i) + $root.google.cloud.dialogflow.v2beta1.SessionEntityType.encode(message.sessionEntityTypes[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WebhookResponse message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.WebhookResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.IWebhookResponse} message WebhookResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WebhookResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.WebhookResponse} WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.WebhookResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.fulfillmentText = reader.string(); + break; + } + case 2: { + if (!(message.fulfillmentMessages && message.fulfillmentMessages.length)) + message.fulfillmentMessages = []; + message.fulfillmentMessages.push($root.google.cloud.dialogflow.v2beta1.Intent.Message.decode(reader, reader.uint32())); + break; + } + case 3: { + message.source = reader.string(); + break; + } + case 4: { + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.outputContexts && message.outputContexts.length)) + message.outputContexts = []; + message.outputContexts.push($root.google.cloud.dialogflow.v2beta1.Context.decode(reader, reader.uint32())); + break; + } + case 6: { + message.followupEventInput = $root.google.cloud.dialogflow.v2beta1.EventInput.decode(reader, reader.uint32()); + break; + } + case 7: { + message.liveAgentHandoff = reader.bool(); + break; + } + case 8: { + message.endInteraction = reader.bool(); + break; + } + case 10: { + if (!(message.sessionEntityTypes && message.sessionEntityTypes.length)) + message.sessionEntityTypes = []; + message.sessionEntityTypes.push($root.google.cloud.dialogflow.v2beta1.SessionEntityType.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WebhookResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.WebhookResponse} WebhookResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WebhookResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WebhookResponse message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WebhookResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fulfillmentText != null && message.hasOwnProperty("fulfillmentText")) + if (!$util.isString(message.fulfillmentText)) + return "fulfillmentText: string expected"; + if (message.fulfillmentMessages != null && message.hasOwnProperty("fulfillmentMessages")) { + if (!Array.isArray(message.fulfillmentMessages)) + return "fulfillmentMessages: array expected"; + for (var i = 0; i < message.fulfillmentMessages.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Intent.Message.verify(message.fulfillmentMessages[i]); + if (error) + return "fulfillmentMessages." + error; + } + } + if (message.source != null && message.hasOwnProperty("source")) + if (!$util.isString(message.source)) + return "source: string expected"; + if (message.payload != null && message.hasOwnProperty("payload")) { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + if (message.outputContexts != null && message.hasOwnProperty("outputContexts")) { + if (!Array.isArray(message.outputContexts)) + return "outputContexts: array expected"; + for (var i = 0; i < message.outputContexts.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.Context.verify(message.outputContexts[i]); + if (error) + return "outputContexts." + error; + } + } + if (message.followupEventInput != null && message.hasOwnProperty("followupEventInput")) { + var error = $root.google.cloud.dialogflow.v2beta1.EventInput.verify(message.followupEventInput); + if (error) + return "followupEventInput." + error; + } + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) + if (typeof message.liveAgentHandoff !== "boolean") + return "liveAgentHandoff: boolean expected"; + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) + if (typeof message.endInteraction !== "boolean") + return "endInteraction: boolean expected"; + if (message.sessionEntityTypes != null && message.hasOwnProperty("sessionEntityTypes")) { + if (!Array.isArray(message.sessionEntityTypes)) + return "sessionEntityTypes: array expected"; + for (var i = 0; i < message.sessionEntityTypes.length; ++i) { + var error = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.verify(message.sessionEntityTypes[i]); + if (error) + return "sessionEntityTypes." + error; + } + } + return null; + }; + + /** + * Creates a WebhookResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.WebhookResponse} WebhookResponse + */ + WebhookResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.WebhookResponse) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.WebhookResponse(); + if (object.fulfillmentText != null) + message.fulfillmentText = String(object.fulfillmentText); + if (object.fulfillmentMessages) { + if (!Array.isArray(object.fulfillmentMessages)) + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookResponse.fulfillmentMessages: array expected"); + message.fulfillmentMessages = []; + for (var i = 0; i < object.fulfillmentMessages.length; ++i) { + if (typeof object.fulfillmentMessages[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookResponse.fulfillmentMessages: object expected"); + message.fulfillmentMessages[i] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.fromObject(object.fulfillmentMessages[i]); + } + } + if (object.source != null) + message.source = String(object.source); + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookResponse.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + if (object.outputContexts) { + if (!Array.isArray(object.outputContexts)) + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookResponse.outputContexts: array expected"); + message.outputContexts = []; + for (var i = 0; i < object.outputContexts.length; ++i) { + if (typeof object.outputContexts[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookResponse.outputContexts: object expected"); + message.outputContexts[i] = $root.google.cloud.dialogflow.v2beta1.Context.fromObject(object.outputContexts[i]); + } + } + if (object.followupEventInput != null) { + if (typeof object.followupEventInput !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookResponse.followupEventInput: object expected"); + message.followupEventInput = $root.google.cloud.dialogflow.v2beta1.EventInput.fromObject(object.followupEventInput); + } + if (object.liveAgentHandoff != null) + message.liveAgentHandoff = Boolean(object.liveAgentHandoff); + if (object.endInteraction != null) + message.endInteraction = Boolean(object.endInteraction); + if (object.sessionEntityTypes) { + if (!Array.isArray(object.sessionEntityTypes)) + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookResponse.sessionEntityTypes: array expected"); + message.sessionEntityTypes = []; + for (var i = 0; i < object.sessionEntityTypes.length; ++i) { + if (typeof object.sessionEntityTypes[i] !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.WebhookResponse.sessionEntityTypes: object expected"); + message.sessionEntityTypes[i] = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.fromObject(object.sessionEntityTypes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a WebhookResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @static + * @param {google.cloud.dialogflow.v2beta1.WebhookResponse} message WebhookResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WebhookResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.fulfillmentMessages = []; + object.outputContexts = []; + object.sessionEntityTypes = []; + } + if (options.defaults) { + object.fulfillmentText = ""; + object.source = ""; + object.payload = null; + object.followupEventInput = null; + object.liveAgentHandoff = false; + object.endInteraction = false; + } + if (message.fulfillmentText != null && message.hasOwnProperty("fulfillmentText")) + object.fulfillmentText = message.fulfillmentText; + if (message.fulfillmentMessages && message.fulfillmentMessages.length) { + object.fulfillmentMessages = []; + for (var j = 0; j < message.fulfillmentMessages.length; ++j) + object.fulfillmentMessages[j] = $root.google.cloud.dialogflow.v2beta1.Intent.Message.toObject(message.fulfillmentMessages[j], options); + } + if (message.source != null && message.hasOwnProperty("source")) + object.source = message.source; + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + if (message.outputContexts && message.outputContexts.length) { + object.outputContexts = []; + for (var j = 0; j < message.outputContexts.length; ++j) + object.outputContexts[j] = $root.google.cloud.dialogflow.v2beta1.Context.toObject(message.outputContexts[j], options); + } + if (message.followupEventInput != null && message.hasOwnProperty("followupEventInput")) + object.followupEventInput = $root.google.cloud.dialogflow.v2beta1.EventInput.toObject(message.followupEventInput, options); + if (message.liveAgentHandoff != null && message.hasOwnProperty("liveAgentHandoff")) + object.liveAgentHandoff = message.liveAgentHandoff; + if (message.endInteraction != null && message.hasOwnProperty("endInteraction")) + object.endInteraction = message.endInteraction; + if (message.sessionEntityTypes && message.sessionEntityTypes.length) { + object.sessionEntityTypes = []; + for (var j = 0; j < message.sessionEntityTypes.length; ++j) + object.sessionEntityTypes[j] = $root.google.cloud.dialogflow.v2beta1.SessionEntityType.toObject(message.sessionEntityTypes[j], options); + } + return object; + }; + + /** + * Converts this WebhookResponse to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @instance + * @returns {Object.} JSON object + */ + WebhookResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WebhookResponse + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.WebhookResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WebhookResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.WebhookResponse"; + }; + + return WebhookResponse; + })(); + + v2beta1.OriginalDetectIntentRequest = (function() { + + /** + * Properties of an OriginalDetectIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @interface IOriginalDetectIntentRequest + * @property {string|null} [source] OriginalDetectIntentRequest source + * @property {string|null} [version] OriginalDetectIntentRequest version + * @property {google.protobuf.IStruct|null} [payload] OriginalDetectIntentRequest payload + */ + + /** + * Constructs a new OriginalDetectIntentRequest. + * @memberof google.cloud.dialogflow.v2beta1 + * @classdesc Represents an OriginalDetectIntentRequest. + * @implements IOriginalDetectIntentRequest + * @constructor + * @param {google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest=} [properties] Properties to set + */ + function OriginalDetectIntentRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OriginalDetectIntentRequest source. + * @member {string} source + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @instance + */ + OriginalDetectIntentRequest.prototype.source = ""; + + /** + * OriginalDetectIntentRequest version. + * @member {string} version + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @instance + */ + OriginalDetectIntentRequest.prototype.version = ""; + + /** + * OriginalDetectIntentRequest payload. + * @member {google.protobuf.IStruct|null|undefined} payload + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @instance + */ + OriginalDetectIntentRequest.prototype.payload = null; + + /** + * Creates a new OriginalDetectIntentRequest instance using the specified properties. + * @function create + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest=} [properties] Properties to set + * @returns {google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest} OriginalDetectIntentRequest instance + */ + OriginalDetectIntentRequest.create = function create(properties) { + return new OriginalDetectIntentRequest(properties); + }; + + /** + * Encodes the specified OriginalDetectIntentRequest message. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest} message OriginalDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OriginalDetectIntentRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.source != null && Object.hasOwnProperty.call(message, "source")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.source); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.version); + if (message.payload != null && Object.hasOwnProperty.call(message, "payload")) + $root.google.protobuf.Struct.encode(message.payload, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OriginalDetectIntentRequest message, length delimited. Does not implicitly {@link google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.IOriginalDetectIntentRequest} message OriginalDetectIntentRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OriginalDetectIntentRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OriginalDetectIntentRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest} OriginalDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OriginalDetectIntentRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.source = reader.string(); + break; + } + case 2: { + message.version = reader.string(); + break; + } + case 3: { + message.payload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OriginalDetectIntentRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest} OriginalDetectIntentRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OriginalDetectIntentRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OriginalDetectIntentRequest message. + * @function verify + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OriginalDetectIntentRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.source != null && message.hasOwnProperty("source")) + if (!$util.isString(message.source)) + return "source: string expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.payload != null && message.hasOwnProperty("payload")) { + var error = $root.google.protobuf.Struct.verify(message.payload); + if (error) + return "payload." + error; + } + return null; + }; + + /** + * Creates an OriginalDetectIntentRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest} OriginalDetectIntentRequest + */ + OriginalDetectIntentRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest) + return object; + var message = new $root.google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest(); + if (object.source != null) + message.source = String(object.source); + if (object.version != null) + message.version = String(object.version); + if (object.payload != null) { + if (typeof object.payload !== "object") + throw TypeError(".google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest.payload: object expected"); + message.payload = $root.google.protobuf.Struct.fromObject(object.payload); + } + return message; + }; + + /** + * Creates a plain object from an OriginalDetectIntentRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @static + * @param {google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest} message OriginalDetectIntentRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OriginalDetectIntentRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.source = ""; + object.version = ""; + object.payload = null; + } + if (message.source != null && message.hasOwnProperty("source")) + object.source = message.source; + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.payload != null && message.hasOwnProperty("payload")) + object.payload = $root.google.protobuf.Struct.toObject(message.payload, options); + return object; + }; + + /** + * Converts this OriginalDetectIntentRequest to JSON. + * @function toJSON + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @instance + * @returns {Object.} JSON object + */ + OriginalDetectIntentRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OriginalDetectIntentRequest + * @function getTypeUrl + * @memberof google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OriginalDetectIntentRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest"; + }; + + return OriginalDetectIntentRequest; + })(); + + return v2beta1; + })(); + + return dialogflow; + })(); + + 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.Struct = (function() { + + /** + * Properties of a Struct. + * @memberof google.protobuf + * @interface IStruct + * @property {Object.|null} [fields] Struct fields + */ + + /** + * Constructs a new Struct. + * @memberof google.protobuf + * @classdesc Represents a Struct. + * @implements IStruct + * @constructor + * @param {google.protobuf.IStruct=} [properties] Properties to set + */ + function Struct(properties) { + this.fields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Struct fields. + * @member {Object.} fields + * @memberof google.protobuf.Struct + * @instance + */ + Struct.prototype.fields = $util.emptyObject; + + /** + * Creates a new Struct instance using the specified properties. + * @function create + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct=} [properties] Properties to set + * @returns {google.protobuf.Struct} Struct instance + */ + Struct.create = function create(properties) { + return new Struct(properties); + }; + + /** + * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) + for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Struct message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decode = function 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.Struct(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.fields[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Struct message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Struct message. + * @function verify + * @memberof google.protobuf.Struct + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Struct.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fields != null && message.hasOwnProperty("fields")) { + if (!$util.isObject(message.fields)) + return "fields: object expected"; + var key = Object.keys(message.fields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.fields[key[i]]); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a Struct message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Struct + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Struct} Struct + */ + Struct.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Struct) + return object; + var message = new $root.google.protobuf.Struct(); + if (object.fields) { + if (typeof object.fields !== "object") + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields = {}; + for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (typeof object.fields[keys[i]] !== "object") + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a Struct message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.Struct} message Struct + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Struct.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.fields = {}; + var keys2; + if (message.fields && (keys2 = Object.keys(message.fields)).length) { + object.fields = {}; + for (var j = 0; j < keys2.length; ++j) + object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options); + } + return object; + }; + + /** + * Converts this Struct to JSON. + * @function toJSON + * @memberof google.protobuf.Struct + * @instance + * @returns {Object.} JSON object + */ + Struct.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Struct + * @function getTypeUrl + * @memberof google.protobuf.Struct + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Struct.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Struct"; + }; + + return Struct; + })(); + + protobuf.Value = (function() { + + /** + * Properties of a Value. + * @memberof google.protobuf + * @interface IValue + * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue + * @property {number|null} [numberValue] Value numberValue + * @property {string|null} [stringValue] Value stringValue + * @property {boolean|null} [boolValue] Value boolValue + * @property {google.protobuf.IStruct|null} [structValue] Value structValue + * @property {google.protobuf.IListValue|null} [listValue] Value listValue + */ + + /** + * Constructs a new Value. + * @memberof google.protobuf + * @classdesc Represents a Value. + * @implements IValue + * @constructor + * @param {google.protobuf.IValue=} [properties] Properties to set + */ + function Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Value nullValue. + * @member {google.protobuf.NullValue|null|undefined} nullValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.nullValue = null; + + /** + * Value numberValue. + * @member {number|null|undefined} numberValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.numberValue = null; + + /** + * Value stringValue. + * @member {string|null|undefined} stringValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.stringValue = null; + + /** + * Value boolValue. + * @member {boolean|null|undefined} boolValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.boolValue = null; + + /** + * Value structValue. + * @member {google.protobuf.IStruct|null|undefined} structValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.structValue = null; + + /** + * Value listValue. + * @member {google.protobuf.IListValue|null|undefined} listValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.listValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Value kind. + * @member {"nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"|undefined} kind + * @memberof google.protobuf.Value + * @instance + */ + Object.defineProperty(Value.prototype, "kind", { + get: $util.oneOfGetter($oneOfFields = ["nullValue", "numberValue", "stringValue", "boolValue", "structValue", "listValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue=} [properties] Properties to set + * @returns {google.protobuf.Value} Value instance + */ + Value.create = function create(properties) { + return new Value(properties); + }; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nullValue); + if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.numberValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.stringValue); + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.boolValue); + if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) + $root.google.protobuf.Struct.encode(message.structValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) + $root.google.protobuf.ListValue.encode(message.listValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decode = function 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.Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.nullValue = reader.int32(); + break; + } + case 2: { + message.numberValue = reader.double(); + break; + } + case 3: { + message.stringValue = reader.string(); + break; + } + case 4: { + message.boolValue = reader.bool(); + break; + } + case 5: { + message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 6: { + message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Value message. + * @function verify + * @memberof google.protobuf.Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + properties.kind = 1; + switch (message.nullValue) { + default: + return "nullValue: enum value expected"; + case 0: + break; + } + } + if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.numberValue !== "number") + return "numberValue: number expected"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (!$util.isString(message.stringValue)) + return "stringValue: string expected"; + } + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.boolValue !== "boolean") + return "boolValue: boolean expected"; + } + if (message.structValue != null && message.hasOwnProperty("structValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.Struct.verify(message.structValue); + if (error) + return "structValue." + error; + } + } + if (message.listValue != null && message.hasOwnProperty("listValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.ListValue.verify(message.listValue); + if (error) + return "listValue." + error; + } + } + return null; + }; + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Value} Value + */ + Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Value) + return object; + var message = new $root.google.protobuf.Value(); + switch (object.nullValue) { + default: + if (typeof object.nullValue === "number") { + message.nullValue = object.nullValue; + break; + } + break; + case "NULL_VALUE": + case 0: + message.nullValue = 0; + break; + } + if (object.numberValue != null) + message.numberValue = Number(object.numberValue); + if (object.stringValue != null) + message.stringValue = String(object.stringValue); + if (object.boolValue != null) + message.boolValue = Boolean(object.boolValue); + if (object.structValue != null) { + if (typeof object.structValue !== "object") + throw TypeError(".google.protobuf.Value.structValue: object expected"); + message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue); + } + if (object.listValue != null) { + if (typeof object.listValue !== "object") + throw TypeError(".google.protobuf.Value.listValue: object expected"); + message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue); + } + return message; + }; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.Value} message Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; + if (options.oneofs) + object.kind = "nullValue"; + } + if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + object.numberValue = options.json && !isFinite(message.numberValue) ? String(message.numberValue) : message.numberValue; + if (options.oneofs) + object.kind = "numberValue"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + object.stringValue = message.stringValue; + if (options.oneofs) + object.kind = "stringValue"; + } + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + object.boolValue = message.boolValue; + if (options.oneofs) + object.kind = "boolValue"; + } + if (message.structValue != null && message.hasOwnProperty("structValue")) { + object.structValue = $root.google.protobuf.Struct.toObject(message.structValue, options); + if (options.oneofs) + object.kind = "structValue"; + } + if (message.listValue != null && message.hasOwnProperty("listValue")) { + object.listValue = $root.google.protobuf.ListValue.toObject(message.listValue, options); + if (options.oneofs) + object.kind = "listValue"; + } + return object; + }; + + /** + * Converts this Value to JSON. + * @function toJSON + * @memberof google.protobuf.Value + * @instance + * @returns {Object.} JSON object + */ + Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Value + * @function getTypeUrl + * @memberof google.protobuf.Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Value"; + }; + + return Value; + })(); + + /** + * NullValue enum. + * @name google.protobuf.NullValue + * @enum {number} + * @property {number} NULL_VALUE=0 NULL_VALUE value + */ + protobuf.NullValue = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NULL_VALUE"] = 0; + return values; + })(); + + protobuf.ListValue = (function() { + + /** + * Properties of a ListValue. + * @memberof google.protobuf + * @interface IListValue + * @property {Array.|null} [values] ListValue values + */ + + /** + * Constructs a new ListValue. + * @memberof google.protobuf + * @classdesc Represents a ListValue. + * @implements IListValue + * @constructor + * @param {google.protobuf.IListValue=} [properties] Properties to set + */ + function ListValue(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListValue values. + * @member {Array.} values + * @memberof google.protobuf.ListValue + * @instance + */ + ListValue.prototype.values = $util.emptyArray; + + /** + * Creates a new ListValue instance using the specified properties. + * @function create + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue=} [properties] Properties to set + * @returns {google.protobuf.ListValue} ListValue instance + */ + ListValue.create = function create(properties) { + return new ListValue(properties); + }; + + /** + * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.protobuf.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decode = function 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.ListValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListValue message. + * @function verify + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.values[i]); + if (error) + return "values." + error; + } + } + return null; + }; + + /** + * Creates a ListValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ListValue} ListValue + */ + ListValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ListValue) + return object; + var message = new $root.google.protobuf.ListValue(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.protobuf.ListValue.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.protobuf.ListValue.values: object expected"); + message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.ListValue} message ListValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.protobuf.Value.toObject(message.values[j], options); + } + return object; + }; + + /** + * Converts this ListValue to JSON. + * @function toJSON + * @memberof google.protobuf.ListValue + * @instance + * @returns {Object.} JSON object + */ + ListValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListValue + * @function getTypeUrl + * @memberof google.protobuf.ListValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ListValue"; + }; + + return ListValue; + })(); + + 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; + })(); + + 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.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/packages/google-cloud-dialogflow/protos/protos.json b/packages/google-cloud-dialogflow/protos/protos.json new file mode 100644 index 00000000000..fbdc8f8342a --- /dev/null +++ b/packages/google-cloud-dialogflow/protos/protos.json @@ -0,0 +1,20184 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "nested": { + "dialogflow": { + "nested": { + "v2": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.Cloud.Dialogflow.V2", + "go_package": "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow", + "java_multiple_files": true, + "java_outer_classname": "WebhookProto", + "java_package": "com.google.cloud.dialogflow.v2", + "objc_class_prefix": "DF", + "(google.api.resource_definition).type": "dialogflow.googleapis.com/CXSecuritySettings", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/securitySettings/{security_settings}" + }, + "nested": { + "Agents": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "GetAgent": { + "requestType": "GetAgentRequest", + "responseType": "Agent", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*}/agent", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*}/agent", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*}/agent", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*}/agent" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SetAgent": { + "requestType": "SetAgentRequest", + "responseType": "Agent", + "options": { + "(google.api.http).post": "/v2/{agent.parent=projects/*}/agent", + "(google.api.http).body": "agent", + "(google.api.http).additional_bindings.post": "/v2/{agent.parent=projects/*/locations/*}/agent", + "(google.api.http).additional_bindings.body": "agent", + "(google.api.method_signature)": "agent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{agent.parent=projects/*}/agent", + "body": "agent", + "additional_bindings": { + "post": "/v2/{agent.parent=projects/*/locations/*}/agent", + "body": "agent" + } + } + }, + { + "(google.api.method_signature)": "agent" + } + ] + }, + "DeleteAgent": { + "requestType": "DeleteAgentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{parent=projects/*}/agent", + "(google.api.http).additional_bindings.delete": "/v2/{parent=projects/*/locations/*}/agent", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{parent=projects/*}/agent", + "additional_bindings": { + "delete": "/v2/{parent=projects/*/locations/*}/agent" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SearchAgents": { + "requestType": "SearchAgentsRequest", + "responseType": "SearchAgentsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*}/agent:search", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*}/agent:search", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*}/agent:search", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*}/agent:search" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "TrainAgent": { + "requestType": "TrainAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*}/agent:train", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*}/agent:train", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*}/agent:train", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*}/agent:train", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "ExportAgent": { + "requestType": "ExportAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*}/agent:export", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*}/agent:export", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent", + "(google.longrunning.operation_info).response_type": "google.cloud.dialogflow.v2.ExportAgentResponse", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*}/agent:export", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*}/agent:export", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.dialogflow.v2.ExportAgentResponse", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "ImportAgent": { + "requestType": "ImportAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*}/agent:import", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*}/agent:import", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*}/agent:import", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*}/agent:import", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "RestoreAgent": { + "requestType": "RestoreAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*}/agent:restore", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*}/agent:restore", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*}/agent:restore", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*}/agent:restore", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "GetValidationResult": { + "requestType": "GetValidationResultRequest", + "responseType": "ValidationResult", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*}/agent/validationResult", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*}/agent/validationResult" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*}/agent/validationResult", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*}/agent/validationResult" + } + } + } + ] + } + } + }, + "Agent": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Agent", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent" + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "defaultLanguageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "supportedLanguageCodes": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "timeZone": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "avatarUri": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "enableLogging": { + "type": "bool", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "matchMode": { + "type": "MatchMode", + "id": 9, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "classificationThreshold": { + "type": "float", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "apiVersion": { + "type": "ApiVersion", + "id": 14, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "tier": { + "type": "Tier", + "id": 15, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "MatchMode": { + "values": { + "MATCH_MODE_UNSPECIFIED": 0, + "MATCH_MODE_HYBRID": 1, + "MATCH_MODE_ML_ONLY": 2 + } + }, + "ApiVersion": { + "values": { + "API_VERSION_UNSPECIFIED": 0, + "API_VERSION_V1": 1, + "API_VERSION_V2": 2, + "API_VERSION_V2_BETA_1": 3 + } + }, + "Tier": { + "valuesOptions": { + "TIER_ENTERPRISE_PLUS": { + "deprecated": true + } + }, + "values": { + "TIER_UNSPECIFIED": 0, + "TIER_STANDARD": 1, + "TIER_ENTERPRISE": 2, + "TIER_ENTERPRISE_PLUS": 3 + } + } + } + }, + "GetAgentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "SetAgentRequest": { + "fields": { + "agent": { + "type": "Agent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteAgentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "SearchAgentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "SearchAgentsResponse": { + "fields": { + "agents": { + "rule": "repeated", + "type": "Agent", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "TrainAgentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "ExportAgentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "agentUri": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ExportAgentResponse": { + "oneofs": { + "agent": { + "oneof": [ + "agentUri", + "agentContent" + ] + } + }, + "fields": { + "agentUri": { + "type": "string", + "id": 1 + }, + "agentContent": { + "type": "bytes", + "id": 2 + } + } + }, + "ImportAgentRequest": { + "oneofs": { + "agent": { + "oneof": [ + "agentUri", + "agentContent" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "agentUri": { + "type": "string", + "id": 2 + }, + "agentContent": { + "type": "bytes", + "id": 3 + } + } + }, + "RestoreAgentRequest": { + "oneofs": { + "agent": { + "oneof": [ + "agentUri", + "agentContent" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "agentUri": { + "type": "string", + "id": 2 + }, + "agentContent": { + "type": "bytes", + "id": 3 + } + } + }, + "GetValidationResultRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ValidationError": { + "fields": { + "severity": { + "type": "Severity", + "id": 1 + }, + "entries": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "errorMessage": { + "type": "string", + "id": 4 + } + }, + "nested": { + "Severity": { + "values": { + "SEVERITY_UNSPECIFIED": 0, + "INFO": 1, + "WARNING": 2, + "ERROR": 3, + "CRITICAL": 4 + } + } + } + }, + "ValidationResult": { + "fields": { + "validationErrors": { + "rule": "repeated", + "type": "ValidationError", + "id": 1 + } + } + }, + "AnswerRecords": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListAnswerRecords": { + "requestType": "ListAnswerRecordsRequest", + "responseType": "ListAnswerRecordsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*}/answerRecords", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*}/answerRecords", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*}/answerRecords", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*}/answerRecords" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateAnswerRecord": { + "requestType": "UpdateAnswerRecordRequest", + "responseType": "AnswerRecord", + "options": { + "(google.api.http).patch": "/v2/{answer_record.name=projects/*/answerRecords/*}", + "(google.api.http).body": "answer_record", + "(google.api.http).additional_bindings.patch": "/v2/{answer_record.name=projects/*/locations/*/answerRecords/*}", + "(google.api.http).additional_bindings.body": "answer_record", + "(google.api.method_signature)": "answer_record,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{answer_record.name=projects/*/answerRecords/*}", + "body": "answer_record", + "additional_bindings": { + "patch": "/v2/{answer_record.name=projects/*/locations/*/answerRecords/*}", + "body": "answer_record" + } + } + }, + { + "(google.api.method_signature)": "answer_record,update_mask" + } + ] + } + } + }, + "AnswerRecord": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/AnswerRecord", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/answerRecords/{answer_record}" + }, + "oneofs": { + "record": { + "oneof": [ + "agentAssistantRecord" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "answerFeedback": { + "type": "AnswerFeedback", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "agentAssistantRecord": { + "type": "AgentAssistantRecord", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "ListAnswerRecordsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/AnswerRecord" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListAnswerRecordsResponse": { + "fields": { + "answerRecords": { + "rule": "repeated", + "type": "AnswerRecord", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateAnswerRecordRequest": { + "fields": { + "answerRecord": { + "type": "AnswerRecord", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "AnswerFeedback": { + "oneofs": { + "detailFeedback": { + "oneof": [ + "agentAssistantDetailFeedback" + ] + } + }, + "fields": { + "correctnessLevel": { + "type": "CorrectnessLevel", + "id": 1 + }, + "agentAssistantDetailFeedback": { + "type": "AgentAssistantFeedback", + "id": 2 + }, + "clicked": { + "type": "bool", + "id": 3 + }, + "clickTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "displayed": { + "type": "bool", + "id": 4 + }, + "displayTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + } + }, + "nested": { + "CorrectnessLevel": { + "values": { + "CORRECTNESS_LEVEL_UNSPECIFIED": 0, + "NOT_CORRECT": 1, + "PARTIALLY_CORRECT": 2, + "FULLY_CORRECT": 3 + } + } + } + }, + "AgentAssistantFeedback": { + "fields": { + "answerRelevance": { + "type": "AnswerRelevance", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "documentCorrectness": { + "type": "DocumentCorrectness", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "documentEfficiency": { + "type": "DocumentEfficiency", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "AnswerRelevance": { + "values": { + "ANSWER_RELEVANCE_UNSPECIFIED": 0, + "IRRELEVANT": 1, + "RELEVANT": 2 + } + }, + "DocumentCorrectness": { + "values": { + "DOCUMENT_CORRECTNESS_UNSPECIFIED": 0, + "INCORRECT": 1, + "CORRECT": 2 + } + }, + "DocumentEfficiency": { + "values": { + "DOCUMENT_EFFICIENCY_UNSPECIFIED": 0, + "INEFFICIENT": 1, + "EFFICIENT": 2 + } + } + } + }, + "AgentAssistantRecord": { + "oneofs": { + "answer": { + "oneof": [ + "articleSuggestionAnswer", + "faqAnswer" + ] + } + }, + "fields": { + "articleSuggestionAnswer": { + "type": "ArticleAnswer", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "faqAnswer": { + "type": "FaqAnswer", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "Participants": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "CreateParticipant": { + "requestType": "CreateParticipantRequest", + "responseType": "Participant", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/conversations/*}/participants", + "(google.api.http).body": "participant", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/conversations/*}/participants", + "(google.api.http).additional_bindings.body": "participant", + "(google.api.method_signature)": "parent,participant" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/conversations/*}/participants", + "body": "participant", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/conversations/*}/participants", + "body": "participant" + } + } + }, + { + "(google.api.method_signature)": "parent,participant" + } + ] + }, + "GetParticipant": { + "requestType": "GetParticipantRequest", + "responseType": "Participant", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/conversations/*/participants/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/conversations/*/participants/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/conversations/*/participants/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/conversations/*/participants/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListParticipants": { + "requestType": "ListParticipantsRequest", + "responseType": "ListParticipantsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/conversations/*}/participants", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/conversations/*}/participants", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/conversations/*}/participants", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*/conversations/*}/participants" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateParticipant": { + "requestType": "UpdateParticipantRequest", + "responseType": "Participant", + "options": { + "(google.api.http).patch": "/v2/{participant.name=projects/*/conversations/*/participants/*}", + "(google.api.http).body": "participant", + "(google.api.http).additional_bindings.patch": "/v2/{participant.name=projects/*/locations/*/conversations/*/participants/*}", + "(google.api.http).additional_bindings.body": "participant", + "(google.api.method_signature)": "participant,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{participant.name=projects/*/conversations/*/participants/*}", + "body": "participant", + "additional_bindings": { + "patch": "/v2/{participant.name=projects/*/locations/*/conversations/*/participants/*}", + "body": "participant" + } + } + }, + { + "(google.api.method_signature)": "participant,update_mask" + } + ] + }, + "AnalyzeContent": { + "requestType": "AnalyzeContentRequest", + "responseType": "AnalyzeContentResponse", + "options": { + "(google.api.http).post": "/v2/{participant=projects/*/conversations/*/participants/*}:analyzeContent", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "participant,event_input" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{participant=projects/*/conversations/*/participants/*}:analyzeContent", + "body": "*", + "additional_bindings": { + "post": "/v2/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "participant,text_input" + }, + { + "(google.api.method_signature)": "participant,event_input" + } + ] + }, + "StreamingAnalyzeContent": { + "requestType": "StreamingAnalyzeContentRequest", + "requestStream": true, + "responseType": "StreamingAnalyzeContentResponse", + "responseStream": true + }, + "SuggestArticles": { + "requestType": "SuggestArticlesRequest", + "responseType": "SuggestArticlesResponse", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SuggestFaqAnswers": { + "requestType": "SuggestFaqAnswersRequest", + "responseType": "SuggestFaqAnswersResponse", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SuggestSmartReplies": { + "requestType": "SuggestSmartRepliesRequest", + "responseType": "SuggestSmartRepliesResponse", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "Participant": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Participant", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "role": { + "type": "Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "sipRecordingMediaLabel": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "obfuscatedExternalUserId": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "documentsMetadataFilters": { + "keyType": "string", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Role": { + "values": { + "ROLE_UNSPECIFIED": 0, + "HUMAN_AGENT": 1, + "AUTOMATED_AGENT": 2, + "END_USER": 3 + } + } + } + }, + "Message": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Message", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "content": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "participant": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "participantRole": { + "type": "Participant.Role", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "sendTime": { + "type": "google.protobuf.Timestamp", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "messageAnnotation": { + "type": "MessageAnnotation", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "sentimentAnalysis": { + "type": "SentimentAnalysisResult", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CreateParticipantRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Participant" + } + }, + "participant": { + "type": "Participant", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetParticipantRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + } + } + }, + "ListParticipantsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Participant" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListParticipantsResponse": { + "fields": { + "participants": { + "rule": "repeated", + "type": "Participant", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateParticipantRequest": { + "fields": { + "participant": { + "type": "Participant", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "AnalyzeContentRequest": { + "oneofs": { + "input": { + "oneof": [ + "textInput", + "eventInput" + ] + } + }, + "fields": { + "participant": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "textInput": { + "type": "TextInput", + "id": 6 + }, + "eventInput": { + "type": "EventInput", + "id": 8 + }, + "replyAudioConfig": { + "type": "OutputAudioConfig", + "id": 5 + }, + "queryParams": { + "type": "QueryParameters", + "id": 9 + }, + "assistQueryParams": { + "type": "AssistQueryParameters", + "id": 14 + }, + "cxParameters": { + "type": "google.protobuf.Struct", + "id": 18 + }, + "requestId": { + "type": "string", + "id": 11 + } + } + }, + "DtmfParameters": { + "fields": { + "acceptsDtmfInput": { + "type": "bool", + "id": 1 + } + } + }, + "AnalyzeContentResponse": { + "fields": { + "replyText": { + "type": "string", + "id": 1 + }, + "replyAudio": { + "type": "OutputAudio", + "id": 2 + }, + "automatedAgentReply": { + "type": "AutomatedAgentReply", + "id": 3 + }, + "message": { + "type": "Message", + "id": 5 + }, + "humanAgentSuggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 6 + }, + "endUserSuggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 7 + }, + "dtmfParameters": { + "type": "DtmfParameters", + "id": 9 + } + } + }, + "StreamingAnalyzeContentRequest": { + "oneofs": { + "config": { + "oneof": [ + "audioConfig", + "textConfig" + ] + }, + "input": { + "oneof": [ + "inputAudio", + "inputText", + "inputDtmf" + ] + } + }, + "fields": { + "participant": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "audioConfig": { + "type": "InputAudioConfig", + "id": 2 + }, + "textConfig": { + "type": "InputTextConfig", + "id": 3 + }, + "replyAudioConfig": { + "type": "OutputAudioConfig", + "id": 4 + }, + "inputAudio": { + "type": "bytes", + "id": 5 + }, + "inputText": { + "type": "string", + "id": 6 + }, + "inputDtmf": { + "type": "TelephonyDtmfEvents", + "id": 9 + }, + "queryParams": { + "type": "QueryParameters", + "id": 7 + }, + "assistQueryParams": { + "type": "AssistQueryParameters", + "id": 8 + }, + "cxParameters": { + "type": "google.protobuf.Struct", + "id": 13 + }, + "enablePartialAutomatedAgentReply": { + "type": "bool", + "id": 12 + } + } + }, + "StreamingAnalyzeContentResponse": { + "fields": { + "recognitionResult": { + "type": "StreamingRecognitionResult", + "id": 1 + }, + "replyText": { + "type": "string", + "id": 2 + }, + "replyAudio": { + "type": "OutputAudio", + "id": 3 + }, + "automatedAgentReply": { + "type": "AutomatedAgentReply", + "id": 4 + }, + "message": { + "type": "Message", + "id": 6 + }, + "humanAgentSuggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 7 + }, + "endUserSuggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 8 + }, + "dtmfParameters": { + "type": "DtmfParameters", + "id": 10 + } + } + }, + "SuggestArticlesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "latestMessage": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "assistQueryParams": { + "type": "AssistQueryParameters", + "id": 4 + } + } + }, + "SuggestArticlesResponse": { + "fields": { + "articleAnswers": { + "rule": "repeated", + "type": "ArticleAnswer", + "id": 1 + }, + "latestMessage": { + "type": "string", + "id": 2 + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "SuggestFaqAnswersRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "latestMessage": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "assistQueryParams": { + "type": "AssistQueryParameters", + "id": 4 + } + } + }, + "SuggestFaqAnswersResponse": { + "fields": { + "faqAnswers": { + "rule": "repeated", + "type": "FaqAnswer", + "id": 1 + }, + "latestMessage": { + "type": "string", + "id": 2 + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "SuggestSmartRepliesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "currentTextInput": { + "type": "TextInput", + "id": 4 + }, + "latestMessage": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "SuggestSmartRepliesResponse": { + "fields": { + "smartReplyAnswers": { + "rule": "repeated", + "type": "SmartReplyAnswer", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "latestMessage": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "OutputAudio": { + "fields": { + "config": { + "type": "OutputAudioConfig", + "id": 1 + }, + "audio": { + "type": "bytes", + "id": 2 + } + } + }, + "AutomatedAgentReply": { + "fields": { + "detectIntentResponse": { + "type": "DetectIntentResponse", + "id": 1 + }, + "automatedAgentReplyType": { + "type": "AutomatedAgentReplyType", + "id": 7 + }, + "allowCancellation": { + "type": "bool", + "id": 8 + } + }, + "nested": { + "AutomatedAgentReplyType": { + "values": { + "AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED": 0, + "PARTIAL": 1, + "FINAL": 2 + } + } + } + }, + "ArticleAnswer": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "uri": { + "type": "string", + "id": 2 + }, + "snippets": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "confidence": { + "type": "float", + "id": 4 + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 5 + }, + "answerRecord": { + "type": "string", + "id": 6 + } + } + }, + "FaqAnswer": { + "fields": { + "answer": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + }, + "question": { + "type": "string", + "id": 3 + }, + "source": { + "type": "string", + "id": 4 + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 5 + }, + "answerRecord": { + "type": "string", + "id": 6 + } + } + }, + "SmartReplyAnswer": { + "fields": { + "reply": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + }, + "answerRecord": { + "type": "string", + "id": 3, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/AnswerRecord" + } + } + } + }, + "SuggestionResult": { + "oneofs": { + "suggestionResponse": { + "oneof": [ + "error", + "suggestArticlesResponse", + "suggestFaqAnswersResponse", + "suggestSmartRepliesResponse" + ] + } + }, + "fields": { + "error": { + "type": "google.rpc.Status", + "id": 1 + }, + "suggestArticlesResponse": { + "type": "SuggestArticlesResponse", + "id": 2 + }, + "suggestFaqAnswersResponse": { + "type": "SuggestFaqAnswersResponse", + "id": 3 + }, + "suggestSmartRepliesResponse": { + "type": "SuggestSmartRepliesResponse", + "id": 4 + } + } + }, + "InputTextConfig": { + "fields": { + "languageCode": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "AnnotatedMessagePart": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "entityType": { + "type": "string", + "id": 2 + }, + "formattedValue": { + "type": "google.protobuf.Value", + "id": 3 + } + } + }, + "MessageAnnotation": { + "fields": { + "parts": { + "rule": "repeated", + "type": "AnnotatedMessagePart", + "id": 1 + }, + "containEntities": { + "type": "bool", + "id": 2 + } + } + }, + "AssistQueryParameters": { + "fields": { + "documentsMetadataFilters": { + "keyType": "string", + "type": "string", + "id": 1 + } + } + }, + "AudioEncoding": { + "values": { + "AUDIO_ENCODING_UNSPECIFIED": 0, + "AUDIO_ENCODING_LINEAR_16": 1, + "AUDIO_ENCODING_FLAC": 2, + "AUDIO_ENCODING_MULAW": 3, + "AUDIO_ENCODING_AMR": 4, + "AUDIO_ENCODING_AMR_WB": 5, + "AUDIO_ENCODING_OGG_OPUS": 6, + "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": 7 + } + }, + "SpeechContext": { + "fields": { + "phrases": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "boost": { + "type": "float", + "id": 2 + } + } + }, + "SpeechModelVariant": { + "values": { + "SPEECH_MODEL_VARIANT_UNSPECIFIED": 0, + "USE_BEST_AVAILABLE": 1, + "USE_STANDARD": 2, + "USE_ENHANCED": 3 + } + }, + "SpeechWordInfo": { + "fields": { + "word": { + "type": "string", + "id": 3 + }, + "startOffset": { + "type": "google.protobuf.Duration", + "id": 1 + }, + "endOffset": { + "type": "google.protobuf.Duration", + "id": 2 + }, + "confidence": { + "type": "float", + "id": 4 + } + } + }, + "InputAudioConfig": { + "fields": { + "audioEncoding": { + "type": "AudioEncoding", + "id": 1 + }, + "sampleRateHertz": { + "type": "int32", + "id": 2 + }, + "languageCode": { + "type": "string", + "id": 3 + }, + "enableWordInfo": { + "type": "bool", + "id": 13 + }, + "phraseHints": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "deprecated": true + } + }, + "speechContexts": { + "rule": "repeated", + "type": "SpeechContext", + "id": 11 + }, + "model": { + "type": "string", + "id": 7 + }, + "modelVariant": { + "type": "SpeechModelVariant", + "id": 10 + }, + "singleUtterance": { + "type": "bool", + "id": 8 + }, + "disableNoSpeechRecognizedEvent": { + "type": "bool", + "id": 14 + } + } + }, + "SsmlVoiceGender": { + "values": { + "SSML_VOICE_GENDER_UNSPECIFIED": 0, + "SSML_VOICE_GENDER_MALE": 1, + "SSML_VOICE_GENDER_FEMALE": 2, + "SSML_VOICE_GENDER_NEUTRAL": 3 + } + }, + "VoiceSelectionParams": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "ssmlGender": { + "type": "SsmlVoiceGender", + "id": 2 + } + } + }, + "SynthesizeSpeechConfig": { + "fields": { + "speakingRate": { + "type": "double", + "id": 1 + }, + "pitch": { + "type": "double", + "id": 2 + }, + "volumeGainDb": { + "type": "double", + "id": 3 + }, + "effectsProfileId": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "voice": { + "type": "VoiceSelectionParams", + "id": 4 + } + } + }, + "OutputAudioEncoding": { + "values": { + "OUTPUT_AUDIO_ENCODING_UNSPECIFIED": 0, + "OUTPUT_AUDIO_ENCODING_LINEAR_16": 1, + "OUTPUT_AUDIO_ENCODING_MP3": 2, + "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS": 4, + "OUTPUT_AUDIO_ENCODING_OGG_OPUS": 3, + "OUTPUT_AUDIO_ENCODING_MULAW": 5 + } + }, + "OutputAudioConfig": { + "fields": { + "audioEncoding": { + "type": "OutputAudioEncoding", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sampleRateHertz": { + "type": "int32", + "id": 2 + }, + "synthesizeSpeechConfig": { + "type": "SynthesizeSpeechConfig", + "id": 3 + } + } + }, + "TelephonyDtmf": { + "values": { + "TELEPHONY_DTMF_UNSPECIFIED": 0, + "DTMF_ONE": 1, + "DTMF_TWO": 2, + "DTMF_THREE": 3, + "DTMF_FOUR": 4, + "DTMF_FIVE": 5, + "DTMF_SIX": 6, + "DTMF_SEVEN": 7, + "DTMF_EIGHT": 8, + "DTMF_NINE": 9, + "DTMF_ZERO": 10, + "DTMF_A": 11, + "DTMF_B": 12, + "DTMF_C": 13, + "DTMF_D": 14, + "DTMF_STAR": 15, + "DTMF_POUND": 16 + } + }, + "TelephonyDtmfEvents": { + "fields": { + "dtmfEvents": { + "rule": "repeated", + "type": "TelephonyDtmf", + "id": 1 + } + } + }, + "SpeechToTextConfig": { + "fields": { + "speechModelVariant": { + "type": "SpeechModelVariant", + "id": 1 + }, + "model": { + "type": "string", + "id": 2 + } + } + }, + "Sessions": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "DetectIntent": { + "requestType": "DetectIntentRequest", + "responseType": "DetectIntentResponse", + "options": { + "(google.api.http).post": "/v2/{session=projects/*/agent/sessions/*}:detectIntent", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "session,query_input" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{session=projects/*/agent/sessions/*}:detectIntent", + "body": "*", + "additional_bindings": [ + { + "post": "/v2/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent", + "body": "*" + }, + { + "post": "/v2/{session=projects/*/locations/*/agent/sessions/*}:detectIntent", + "body": "*" + }, + { + "post": "/v2/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent", + "body": "*" + } + ] + } + }, + { + "(google.api.method_signature)": "session,query_input" + } + ] + }, + "StreamingDetectIntent": { + "requestType": "StreamingDetectIntentRequest", + "requestStream": true, + "responseType": "StreamingDetectIntentResponse", + "responseStream": true + } + } + }, + "DetectIntentRequest": { + "fields": { + "session": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Session" + } + }, + "queryParams": { + "type": "QueryParameters", + "id": 2 + }, + "queryInput": { + "type": "QueryInput", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 4 + }, + "outputAudioConfigMask": { + "type": "google.protobuf.FieldMask", + "id": 7 + }, + "inputAudio": { + "type": "bytes", + "id": 5 + } + } + }, + "DetectIntentResponse": { + "fields": { + "responseId": { + "type": "string", + "id": 1 + }, + "queryResult": { + "type": "QueryResult", + "id": 2 + }, + "webhookStatus": { + "type": "google.rpc.Status", + "id": 3 + }, + "outputAudio": { + "type": "bytes", + "id": 4 + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 6 + } + } + }, + "QueryParameters": { + "fields": { + "timeZone": { + "type": "string", + "id": 1 + }, + "geoLocation": { + "type": "google.type.LatLng", + "id": 2 + }, + "contexts": { + "rule": "repeated", + "type": "Context", + "id": 3 + }, + "resetContexts": { + "type": "bool", + "id": 4 + }, + "sessionEntityTypes": { + "rule": "repeated", + "type": "SessionEntityType", + "id": 5 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 6 + }, + "sentimentAnalysisRequestConfig": { + "type": "SentimentAnalysisRequestConfig", + "id": 10 + }, + "webhookHeaders": { + "keyType": "string", + "type": "string", + "id": 14 + } + } + }, + "QueryInput": { + "oneofs": { + "input": { + "oneof": [ + "audioConfig", + "text", + "event" + ] + } + }, + "fields": { + "audioConfig": { + "type": "InputAudioConfig", + "id": 1 + }, + "text": { + "type": "TextInput", + "id": 2 + }, + "event": { + "type": "EventInput", + "id": 3 + } + } + }, + "QueryResult": { + "fields": { + "queryText": { + "type": "string", + "id": 1 + }, + "languageCode": { + "type": "string", + "id": 15 + }, + "speechRecognitionConfidence": { + "type": "float", + "id": 2 + }, + "action": { + "type": "string", + "id": 3 + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 4 + }, + "allRequiredParamsPresent": { + "type": "bool", + "id": 5 + }, + "cancelsSlotFilling": { + "type": "bool", + "id": 21 + }, + "fulfillmentText": { + "type": "string", + "id": 6 + }, + "fulfillmentMessages": { + "rule": "repeated", + "type": "Intent.Message", + "id": 7 + }, + "webhookSource": { + "type": "string", + "id": 8 + }, + "webhookPayload": { + "type": "google.protobuf.Struct", + "id": 9 + }, + "outputContexts": { + "rule": "repeated", + "type": "Context", + "id": 10 + }, + "intent": { + "type": "Intent", + "id": 11 + }, + "intentDetectionConfidence": { + "type": "float", + "id": 12 + }, + "diagnosticInfo": { + "type": "google.protobuf.Struct", + "id": 14 + }, + "sentimentAnalysisResult": { + "type": "SentimentAnalysisResult", + "id": 17 + } + } + }, + "StreamingDetectIntentRequest": { + "fields": { + "session": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Session" + } + }, + "queryParams": { + "type": "QueryParameters", + "id": 2 + }, + "queryInput": { + "type": "QueryInput", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "singleUtterance": { + "type": "bool", + "id": 4, + "options": { + "deprecated": true + } + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 5 + }, + "outputAudioConfigMask": { + "type": "google.protobuf.FieldMask", + "id": 7 + }, + "inputAudio": { + "type": "bytes", + "id": 6 + } + } + }, + "StreamingDetectIntentResponse": { + "fields": { + "responseId": { + "type": "string", + "id": 1 + }, + "recognitionResult": { + "type": "StreamingRecognitionResult", + "id": 2 + }, + "queryResult": { + "type": "QueryResult", + "id": 3 + }, + "webhookStatus": { + "type": "google.rpc.Status", + "id": 4 + }, + "outputAudio": { + "type": "bytes", + "id": 5 + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 6 + } + } + }, + "StreamingRecognitionResult": { + "fields": { + "messageType": { + "type": "MessageType", + "id": 1 + }, + "transcript": { + "type": "string", + "id": 2 + }, + "isFinal": { + "type": "bool", + "id": 3 + }, + "confidence": { + "type": "float", + "id": 4 + }, + "speechWordInfo": { + "rule": "repeated", + "type": "SpeechWordInfo", + "id": 7 + }, + "speechEndOffset": { + "type": "google.protobuf.Duration", + "id": 8 + }, + "languageCode": { + "type": "string", + "id": 10 + } + }, + "nested": { + "MessageType": { + "values": { + "MESSAGE_TYPE_UNSPECIFIED": 0, + "TRANSCRIPT": 1, + "END_OF_SINGLE_UTTERANCE": 2 + } + } + } + }, + "TextInput": { + "fields": { + "text": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "EventInput": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 2 + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SentimentAnalysisRequestConfig": { + "fields": { + "analyzeQueryTextSentiment": { + "type": "bool", + "id": 1 + } + } + }, + "SentimentAnalysisResult": { + "fields": { + "queryTextSentiment": { + "type": "Sentiment", + "id": 1 + } + } + }, + "Sentiment": { + "fields": { + "score": { + "type": "float", + "id": 1 + }, + "magnitude": { + "type": "float", + "id": 2 + } + } + }, + "Contexts": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListContexts": { + "requestType": "ListContextsRequest", + "responseType": "ListContextsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/agent/sessions/*}/contexts", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/agent/sessions/*}/contexts", + "additional_bindings": [ + { + "get": "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + }, + { + "get": "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + }, + { + "get": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetContext": { + "requestType": "GetContextRequest", + "responseType": "Context", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/agent/sessions/*/contexts/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/agent/sessions/*/contexts/*}", + "additional_bindings": [ + { + "get": "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + }, + { + "get": "/v2/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + }, + { + "get": "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateContext": { + "requestType": "CreateContextRequest", + "responseType": "Context", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent/sessions/*}/contexts", + "(google.api.http).body": "context", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts", + "(google.api.http).additional_bindings.body": "context", + "(google.api.method_signature)": "parent,context" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent/sessions/*}/contexts", + "body": "context", + "additional_bindings": [ + { + "post": "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts", + "body": "context" + }, + { + "post": "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts", + "body": "context" + }, + { + "post": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts", + "body": "context" + } + ] + } + }, + { + "(google.api.method_signature)": "parent,context" + } + ] + }, + "UpdateContext": { + "requestType": "UpdateContextRequest", + "responseType": "Context", + "options": { + "(google.api.http).patch": "/v2/{context.name=projects/*/agent/sessions/*/contexts/*}", + "(google.api.http).body": "context", + "(google.api.http).additional_bindings.patch": "/v2/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "(google.api.http).additional_bindings.body": "context", + "(google.api.method_signature)": "context,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{context.name=projects/*/agent/sessions/*/contexts/*}", + "body": "context", + "additional_bindings": [ + { + "patch": "/v2/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "body": "context" + }, + { + "patch": "/v2/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}", + "body": "context" + }, + { + "patch": "/v2/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "body": "context" + } + ] + } + }, + { + "(google.api.method_signature)": "context,update_mask" + } + ] + }, + "DeleteContext": { + "requestType": "DeleteContextRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/agent/sessions/*/contexts/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/agent/sessions/*/contexts/*}", + "additional_bindings": [ + { + "delete": "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + }, + { + "delete": "/v2/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + }, + { + "delete": "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteAllContexts": { + "requestType": "DeleteAllContextsRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{parent=projects/*/agent/sessions/*}/contexts", + "(google.api.http).additional_bindings.delete": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{parent=projects/*/agent/sessions/*}/contexts", + "additional_bindings": [ + { + "delete": "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + }, + { + "delete": "/v2/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + }, + { + "delete": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "Context": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Context", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "lifespanCount": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListContextsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Context" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListContextsResponse": { + "fields": { + "contexts": { + "rule": "repeated", + "type": "Context", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetContextRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Context" + } + } + } + }, + "CreateContextRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Context" + } + }, + "context": { + "type": "Context", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateContextRequest": { + "fields": { + "context": { + "type": "Context", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteContextRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Context" + } + } + } + }, + "DeleteAllContextsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Context" + } + } + } + }, + "Intents": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListIntents": { + "requestType": "ListIntentsRequest", + "responseType": "ListIntentsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/agent}/intents", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/agent/environments/*}/intents", + "(google.api.method_signature)": "parent,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/agent}/intents", + "additional_bindings": [ + { + "get": "/v2/{parent=projects/*/locations/*/agent}/intents" + }, + { + "get": "/v2/{parent=projects/*/agent/environments/*}/intents" + }, + { + "get": "/v2/{parent=projects/*/locations/*/agent/environments/*}/intents" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + }, + { + "(google.api.method_signature)": "parent,language_code" + } + ] + }, + "GetIntent": { + "requestType": "GetIntentRequest", + "responseType": "Intent", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/agent/intents/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/agent/intents/*}", + "(google.api.method_signature)": "name,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/agent/intents/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/agent/intents/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.api.method_signature)": "name,language_code" + } + ] + }, + "CreateIntent": { + "requestType": "CreateIntentRequest", + "responseType": "Intent", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent}/intents", + "(google.api.http).body": "intent", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent}/intents", + "(google.api.http).additional_bindings.body": "intent", + "(google.api.method_signature)": "parent,intent,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent}/intents", + "body": "intent", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent}/intents", + "body": "intent" + } + } + }, + { + "(google.api.method_signature)": "parent,intent" + }, + { + "(google.api.method_signature)": "parent,intent,language_code" + } + ] + }, + "UpdateIntent": { + "requestType": "UpdateIntentRequest", + "responseType": "Intent", + "options": { + "(google.api.http).patch": "/v2/{intent.name=projects/*/agent/intents/*}", + "(google.api.http).body": "intent", + "(google.api.http).additional_bindings.patch": "/v2/{intent.name=projects/*/locations/*/agent/intents/*}", + "(google.api.http).additional_bindings.body": "intent", + "(google.api.method_signature)": "intent,language_code,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{intent.name=projects/*/agent/intents/*}", + "body": "intent", + "additional_bindings": { + "patch": "/v2/{intent.name=projects/*/locations/*/agent/intents/*}", + "body": "intent" + } + } + }, + { + "(google.api.method_signature)": "intent,language_code" + }, + { + "(google.api.method_signature)": "intent,language_code,update_mask" + } + ] + }, + "DeleteIntent": { + "requestType": "DeleteIntentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/agent/intents/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/locations/*/agent/intents/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/agent/intents/*}", + "additional_bindings": { + "delete": "/v2/{name=projects/*/locations/*/agent/intents/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "BatchUpdateIntents": { + "requestType": "BatchUpdateIntentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent}/intents:batchUpdate", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent}/intents:batchUpdate", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,intent_batch_inline", + "(google.longrunning.operation_info).response_type": "google.cloud.dialogflow.v2.BatchUpdateIntentsResponse", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent}/intents:batchUpdate", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent}/intents:batchUpdate", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,intent_batch_uri" + }, + { + "(google.api.method_signature)": "parent,intent_batch_inline" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.dialogflow.v2.BatchUpdateIntentsResponse", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchDeleteIntents": { + "requestType": "BatchDeleteIntentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent}/intents:batchDelete", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent}/intents:batchDelete", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,intents", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent}/intents:batchDelete", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent}/intents:batchDelete", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,intents" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + } + } + }, + "Intent": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Intent", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/intents/{intent}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "webhookState": { + "type": "WebhookState", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "priority": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "isFallback": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mlDisabled": { + "type": "bool", + "id": 19, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "liveAgentHandoff": { + "type": "bool", + "id": 20, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "endInteraction": { + "type": "bool", + "id": 21, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "inputContextNames": { + "rule": "repeated", + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "events": { + "rule": "repeated", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "trainingPhrases": { + "rule": "repeated", + "type": "TrainingPhrase", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "action": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "outputContexts": { + "rule": "repeated", + "type": "Context", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "resetContexts": { + "type": "bool", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "parameters": { + "rule": "repeated", + "type": "Parameter", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "messages": { + "rule": "repeated", + "type": "Message", + "id": 14, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "defaultResponsePlatforms": { + "rule": "repeated", + "type": "Message.Platform", + "id": 15, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "rootFollowupIntentName": { + "type": "string", + "id": 16, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "parentFollowupIntentName": { + "type": "string", + "id": 17 + }, + "followupIntentInfo": { + "rule": "repeated", + "type": "FollowupIntentInfo", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "WebhookState": { + "values": { + "WEBHOOK_STATE_UNSPECIFIED": 0, + "WEBHOOK_STATE_ENABLED": 1, + "WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING": 2 + } + }, + "TrainingPhrase": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "Type", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "parts": { + "rule": "repeated", + "type": "Part", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "timesAddedCount": { + "type": "int32", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Type": { + "valuesOptions": { + "TEMPLATE": { + "deprecated": true + } + }, + "values": { + "TYPE_UNSPECIFIED": 0, + "EXAMPLE": 1, + "TEMPLATE": 2 + } + }, + "Part": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "entityType": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "alias": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "userDefined": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "Parameter": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "value": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "defaultValue": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "entityTypeDisplayName": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mandatory": { + "type": "bool", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "prompts": { + "rule": "repeated", + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "isList": { + "type": "bool", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Message": { + "oneofs": { + "message": { + "oneof": [ + "text", + "image", + "quickReplies", + "card", + "payload", + "simpleResponses", + "basicCard", + "suggestions", + "linkOutSuggestion", + "listSelect", + "carouselSelect", + "browseCarouselCard", + "tableCard", + "mediaContent" + ] + } + }, + "fields": { + "text": { + "type": "Text", + "id": 1 + }, + "image": { + "type": "Image", + "id": 2 + }, + "quickReplies": { + "type": "QuickReplies", + "id": 3 + }, + "card": { + "type": "Card", + "id": 4 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 5 + }, + "simpleResponses": { + "type": "SimpleResponses", + "id": 7 + }, + "basicCard": { + "type": "BasicCard", + "id": 8 + }, + "suggestions": { + "type": "Suggestions", + "id": 9 + }, + "linkOutSuggestion": { + "type": "LinkOutSuggestion", + "id": 10 + }, + "listSelect": { + "type": "ListSelect", + "id": 11 + }, + "carouselSelect": { + "type": "CarouselSelect", + "id": 12 + }, + "browseCarouselCard": { + "type": "BrowseCarouselCard", + "id": 22 + }, + "tableCard": { + "type": "TableCard", + "id": 23 + }, + "mediaContent": { + "type": "MediaContent", + "id": 24 + }, + "platform": { + "type": "Platform", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Platform": { + "values": { + "PLATFORM_UNSPECIFIED": 0, + "FACEBOOK": 1, + "SLACK": 2, + "TELEGRAM": 3, + "KIK": 4, + "SKYPE": 5, + "LINE": 6, + "VIBER": 7, + "ACTIONS_ON_GOOGLE": 8, + "GOOGLE_HANGOUTS": 11 + } + }, + "Text": { + "fields": { + "text": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Image": { + "fields": { + "imageUri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "accessibilityText": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "QuickReplies": { + "fields": { + "title": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "quickReplies": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Card": { + "fields": { + "title": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "subtitle": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "imageUri": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "buttons": { + "rule": "repeated", + "type": "Button", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Button": { + "fields": { + "text": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "postback": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "SimpleResponse": { + "fields": { + "textToSpeech": { + "type": "string", + "id": 1 + }, + "ssml": { + "type": "string", + "id": 2 + }, + "displayText": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SimpleResponses": { + "fields": { + "simpleResponses": { + "rule": "repeated", + "type": "SimpleResponse", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "BasicCard": { + "fields": { + "title": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "subtitle": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "formattedText": { + "type": "string", + "id": 3 + }, + "image": { + "type": "Image", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "buttons": { + "rule": "repeated", + "type": "Button", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Button": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "openUriAction": { + "type": "OpenUriAction", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "OpenUriAction": { + "fields": { + "uri": { + "type": "string", + "id": 1 + } + } + } + } + } + } + }, + "Suggestion": { + "fields": { + "title": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "Suggestions": { + "fields": { + "suggestions": { + "rule": "repeated", + "type": "Suggestion", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "LinkOutSuggestion": { + "fields": { + "destinationName": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "uri": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListSelect": { + "fields": { + "title": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "items": { + "rule": "repeated", + "type": "Item", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "subtitle": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Item": { + "fields": { + "info": { + "type": "SelectItemInfo", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "title": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "image": { + "type": "Image", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "CarouselSelect": { + "fields": { + "items": { + "rule": "repeated", + "type": "Item", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "Item": { + "fields": { + "info": { + "type": "SelectItemInfo", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "title": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "image": { + "type": "Image", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "SelectItemInfo": { + "fields": { + "key": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "MediaContent": { + "fields": { + "mediaType": { + "type": "ResponseMediaType", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mediaObjects": { + "rule": "repeated", + "type": "ResponseMediaObject", + "id": 2 + } + }, + "nested": { + "ResponseMediaType": { + "values": { + "RESPONSE_MEDIA_TYPE_UNSPECIFIED": 0, + "AUDIO": 1 + } + }, + "ResponseMediaObject": { + "oneofs": { + "image": { + "oneof": [ + "largeImage", + "icon" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "largeImage": { + "type": "Image", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "icon": { + "type": "Image", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "contentUrl": { + "type": "string", + "id": 5 + } + } + } + } + }, + "BrowseCarouselCard": { + "fields": { + "items": { + "rule": "repeated", + "type": "BrowseCarouselCardItem", + "id": 1 + }, + "imageDisplayOptions": { + "type": "ImageDisplayOptions", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "BrowseCarouselCardItem": { + "fields": { + "openUriAction": { + "type": "OpenUrlAction", + "id": 1 + }, + "title": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "image": { + "type": "Image", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "footer": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "OpenUrlAction": { + "fields": { + "url": { + "type": "string", + "id": 1 + }, + "urlTypeHint": { + "type": "UrlTypeHint", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "UrlTypeHint": { + "values": { + "URL_TYPE_HINT_UNSPECIFIED": 0, + "AMP_ACTION": 1, + "AMP_CONTENT": 2 + } + } + } + } + } + }, + "ImageDisplayOptions": { + "values": { + "IMAGE_DISPLAY_OPTIONS_UNSPECIFIED": 0, + "GRAY": 1, + "WHITE": 2, + "CROPPED": 3, + "BLURRED_BACKGROUND": 4 + } + } + } + }, + "TableCard": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "subtitle": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "image": { + "type": "Image", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "columnProperties": { + "rule": "repeated", + "type": "ColumnProperties", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "rows": { + "rule": "repeated", + "type": "TableCardRow", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "buttons": { + "rule": "repeated", + "type": "BasicCard.Button", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ColumnProperties": { + "fields": { + "header": { + "type": "string", + "id": 1 + }, + "horizontalAlignment": { + "type": "HorizontalAlignment", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "HorizontalAlignment": { + "values": { + "HORIZONTAL_ALIGNMENT_UNSPECIFIED": 0, + "LEADING": 1, + "CENTER": 2, + "TRAILING": 3 + } + } + } + }, + "TableCardRow": { + "fields": { + "cells": { + "rule": "repeated", + "type": "TableCardCell", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "dividerAfter": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TableCardCell": { + "fields": { + "text": { + "type": "string", + "id": 1 + } + } + } + } + }, + "FollowupIntentInfo": { + "fields": { + "followupIntentName": { + "type": "string", + "id": 1 + }, + "parentFollowupIntentName": { + "type": "string", + "id": 2 + } + } + } + } + }, + "ListIntentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "intentView": { + "type": "IntentView", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListIntentsResponse": { + "fields": { + "intents": { + "rule": "repeated", + "type": "Intent", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetIntentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "intentView": { + "type": "IntentView", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "CreateIntentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "intent": { + "type": "Intent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "intentView": { + "type": "IntentView", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "UpdateIntentRequest": { + "fields": { + "intent": { + "type": "Intent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "intentView": { + "type": "IntentView", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteIntentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + } + } + }, + "BatchUpdateIntentsRequest": { + "oneofs": { + "intentBatch": { + "oneof": [ + "intentBatchUri", + "intentBatchInline" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "intentBatchUri": { + "type": "string", + "id": 2 + }, + "intentBatchInline": { + "type": "IntentBatch", + "id": 3 + }, + "languageCode": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "intentView": { + "type": "IntentView", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchUpdateIntentsResponse": { + "fields": { + "intents": { + "rule": "repeated", + "type": "Intent", + "id": 1 + } + } + }, + "BatchDeleteIntentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "intents": { + "rule": "repeated", + "type": "Intent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "IntentView": { + "values": { + "INTENT_VIEW_UNSPECIFIED": 0, + "INTENT_VIEW_FULL": 1 + } + }, + "IntentBatch": { + "fields": { + "intents": { + "rule": "repeated", + "type": "Intent", + "id": 1 + } + } + }, + "SessionEntityTypes": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListSessionEntityTypes": { + "requestType": "ListSessionEntityTypesRequest", + "responseType": "ListSessionEntityTypesResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/agent/sessions/*}/entityTypes", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/agent/sessions/*}/entityTypes", + "additional_bindings": [ + { + "get": "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + }, + { + "get": "/v2/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + }, + { + "get": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetSessionEntityType": { + "requestType": "GetSessionEntityTypeRequest", + "responseType": "SessionEntityType", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}", + "additional_bindings": [ + { + "get": "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + }, + { + "get": "/v2/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + }, + { + "get": "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateSessionEntityType": { + "requestType": "CreateSessionEntityTypeRequest", + "responseType": "SessionEntityType", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent/sessions/*}/entityTypes", + "(google.api.http).body": "session_entity_type", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes", + "(google.api.http).additional_bindings.body": "session_entity_type", + "(google.api.method_signature)": "parent,session_entity_type" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent/sessions/*}/entityTypes", + "body": "session_entity_type", + "additional_bindings": [ + { + "post": "/v2/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes", + "body": "session_entity_type" + }, + { + "post": "/v2/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes", + "body": "session_entity_type" + }, + { + "post": "/v2/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes", + "body": "session_entity_type" + } + ] + } + }, + { + "(google.api.method_signature)": "parent,session_entity_type" + } + ] + }, + "UpdateSessionEntityType": { + "requestType": "UpdateSessionEntityTypeRequest", + "responseType": "SessionEntityType", + "options": { + "(google.api.http).patch": "/v2/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}", + "(google.api.http).body": "session_entity_type", + "(google.api.http).additional_bindings.patch": "/v2/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "(google.api.http).additional_bindings.body": "session_entity_type", + "(google.api.method_signature)": "session_entity_type,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}", + "body": "session_entity_type", + "additional_bindings": [ + { + "patch": "/v2/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "body": "session_entity_type" + }, + { + "patch": "/v2/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}", + "body": "session_entity_type" + }, + { + "patch": "/v2/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "body": "session_entity_type" + } + ] + } + }, + { + "(google.api.method_signature)": "session_entity_type" + }, + { + "(google.api.method_signature)": "session_entity_type,update_mask" + } + ] + }, + "DeleteSessionEntityType": { + "requestType": "DeleteSessionEntityTypeRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/agent/sessions/*/entityTypes/*}", + "additional_bindings": [ + { + "delete": "/v2/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + }, + { + "delete": "/v2/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + }, + { + "delete": "/v2/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "SessionEntityType": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/SessionEntityType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "entityOverrideMode": { + "type": "EntityOverrideMode", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "entities": { + "rule": "repeated", + "type": "EntityType.Entity", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "EntityOverrideMode": { + "values": { + "ENTITY_OVERRIDE_MODE_UNSPECIFIED": 0, + "ENTITY_OVERRIDE_MODE_OVERRIDE": 1, + "ENTITY_OVERRIDE_MODE_SUPPLEMENT": 2 + } + } + } + }, + "ListSessionEntityTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/SessionEntityType" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListSessionEntityTypesResponse": { + "fields": { + "sessionEntityTypes": { + "rule": "repeated", + "type": "SessionEntityType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetSessionEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/SessionEntityType" + } + } + } + }, + "CreateSessionEntityTypeRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/SessionEntityType" + } + }, + "sessionEntityType": { + "type": "SessionEntityType", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateSessionEntityTypeRequest": { + "fields": { + "sessionEntityType": { + "type": "SessionEntityType", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteSessionEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/SessionEntityType" + } + } + } + }, + "EntityTypes": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListEntityTypes": { + "requestType": "ListEntityTypesRequest", + "responseType": "ListEntityTypesResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/agent}/entityTypes", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/agent}/entityTypes", + "(google.api.method_signature)": "parent,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/agent}/entityTypes", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*/agent}/entityTypes" + } + } + }, + { + "(google.api.method_signature)": "parent" + }, + { + "(google.api.method_signature)": "parent,language_code" + } + ] + }, + "GetEntityType": { + "requestType": "GetEntityTypeRequest", + "responseType": "EntityType", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/agent/entityTypes/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/agent/entityTypes/*}", + "(google.api.method_signature)": "name,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/agent/entityTypes/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/agent/entityTypes/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.api.method_signature)": "name,language_code" + } + ] + }, + "CreateEntityType": { + "requestType": "CreateEntityTypeRequest", + "responseType": "EntityType", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent}/entityTypes", + "(google.api.http).body": "entity_type", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent}/entityTypes", + "(google.api.http).additional_bindings.body": "entity_type", + "(google.api.method_signature)": "parent,entity_type,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent}/entityTypes", + "body": "entity_type", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent}/entityTypes", + "body": "entity_type" + } + } + }, + { + "(google.api.method_signature)": "parent,entity_type" + }, + { + "(google.api.method_signature)": "parent,entity_type,language_code" + } + ] + }, + "UpdateEntityType": { + "requestType": "UpdateEntityTypeRequest", + "responseType": "EntityType", + "options": { + "(google.api.http).patch": "/v2/{entity_type.name=projects/*/agent/entityTypes/*}", + "(google.api.http).body": "entity_type", + "(google.api.http).additional_bindings.patch": "/v2/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}", + "(google.api.http).additional_bindings.body": "entity_type", + "(google.api.method_signature)": "entity_type,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{entity_type.name=projects/*/agent/entityTypes/*}", + "body": "entity_type", + "additional_bindings": { + "patch": "/v2/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}", + "body": "entity_type" + } + } + }, + { + "(google.api.method_signature)": "entity_type" + }, + { + "(google.api.method_signature)": "entity_type,language_code" + } + ] + }, + "DeleteEntityType": { + "requestType": "DeleteEntityTypeRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/agent/entityTypes/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/locations/*/agent/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/agent/entityTypes/*}", + "additional_bindings": { + "delete": "/v2/{name=projects/*/locations/*/agent/entityTypes/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "BatchUpdateEntityTypes": { + "requestType": "BatchUpdateEntityTypesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent}/entityTypes:batchUpdate", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent}/entityTypes:batchUpdate", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchDeleteEntityTypes": { + "requestType": "BatchDeleteEntityTypesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent}/entityTypes:batchDelete", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,entity_type_names", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent}/entityTypes:batchDelete", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,entity_type_names" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchCreateEntities": { + "requestType": "BatchCreateEntitiesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,entities,language_code", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,entities" + }, + { + "(google.api.method_signature)": "parent,entities,language_code" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchUpdateEntities": { + "requestType": "BatchUpdateEntitiesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,entities,language_code", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,entities" + }, + { + "(google.api.method_signature)": "parent,entities,language_code" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchDeleteEntities": { + "requestType": "BatchDeleteEntitiesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,entity_values,language_code", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,entity_values" + }, + { + "(google.api.method_signature)": "parent,entity_values,language_code" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + } + } + }, + "EntityType": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/EntityType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/entityTypes/{entity_type}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "kind": { + "type": "Kind", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "autoExpansionMode": { + "type": "AutoExpansionMode", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "entities": { + "rule": "repeated", + "type": "Entity", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "enableFuzzyExtraction": { + "type": "bool", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Kind": { + "values": { + "KIND_UNSPECIFIED": 0, + "KIND_MAP": 1, + "KIND_LIST": 2, + "KIND_REGEXP": 3 + } + }, + "AutoExpansionMode": { + "values": { + "AUTO_EXPANSION_MODE_UNSPECIFIED": 0, + "AUTO_EXPANSION_MODE_DEFAULT": 1 + } + }, + "Entity": { + "fields": { + "value": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "ListEntityTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListEntityTypesResponse": { + "fields": { + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "CreateEntityTypeRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "entityType": { + "type": "EntityType", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "UpdateEntityTypeRequest": { + "fields": { + "entityType": { + "type": "EntityType", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + } + } + }, + "BatchUpdateEntityTypesRequest": { + "oneofs": { + "entityTypeBatch": { + "oneof": [ + "entityTypeBatchUri", + "entityTypeBatchInline" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "entityTypeBatchUri": { + "type": "string", + "id": 2 + }, + "entityTypeBatchInline": { + "type": "EntityTypeBatch", + "id": 3 + }, + "languageCode": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchUpdateEntityTypesResponse": { + "fields": { + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 1 + } + } + }, + "BatchDeleteEntityTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "entityTypeNames": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "BatchCreateEntitiesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "entities": { + "rule": "repeated", + "type": "EntityType.Entity", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchUpdateEntitiesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "entities": { + "rule": "repeated", + "type": "EntityType.Entity", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchDeleteEntitiesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "entityValues": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "EntityTypeBatch": { + "fields": { + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 1 + } + } + }, + "Conversations": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "CreateConversation": { + "requestType": "CreateConversationRequest", + "responseType": "Conversation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*}/conversations", + "(google.api.http).body": "conversation", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*}/conversations", + "(google.api.http).additional_bindings.body": "conversation", + "(google.api.method_signature)": "parent,conversation" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*}/conversations", + "body": "conversation", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*}/conversations", + "body": "conversation" + } + } + }, + { + "(google.api.method_signature)": "parent,conversation" + } + ] + }, + "ListConversations": { + "requestType": "ListConversationsRequest", + "responseType": "ListConversationsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*}/conversations", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*}/conversations", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*}/conversations", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*}/conversations" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetConversation": { + "requestType": "GetConversationRequest", + "responseType": "Conversation", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/conversations/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/conversations/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/conversations/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/conversations/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CompleteConversation": { + "requestType": "CompleteConversationRequest", + "responseType": "Conversation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/conversations/*}:complete", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{name=projects/*/locations/*/conversations/*}:complete", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/conversations/*}:complete", + "body": "*", + "additional_bindings": { + "post": "/v2/{name=projects/*/locations/*/conversations/*}:complete", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListMessages": { + "requestType": "ListMessagesRequest", + "responseType": "ListMessagesResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/conversations/*}/messages", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/conversations/*}/messages", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/conversations/*}/messages", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*/conversations/*}/messages" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "Conversation": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Conversation", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversations/{conversation}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lifecycleState": { + "type": "LifecycleState", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "conversationProfile": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationProfile" + } + }, + "phoneNumber": { + "type": "ConversationPhoneNumber", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "conversationStage": { + "type": "ConversationStage", + "id": 7 + } + }, + "nested": { + "LifecycleState": { + "values": { + "LIFECYCLE_STATE_UNSPECIFIED": 0, + "IN_PROGRESS": 1, + "COMPLETED": 2 + } + }, + "ConversationStage": { + "values": { + "CONVERSATION_STAGE_UNSPECIFIED": 0, + "VIRTUAL_AGENT_STAGE": 1, + "HUMAN_ASSIST_STAGE": 2 + } + } + } + }, + "CreateConversationRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Conversation" + } + }, + "conversation": { + "type": "Conversation", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "conversationId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListConversationsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Conversation" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4 + } + } + }, + "ListConversationsResponse": { + "fields": { + "conversations": { + "rule": "repeated", + "type": "Conversation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetConversationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Conversation" + } + } + } + }, + "CompleteConversationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Conversation" + } + } + } + }, + "ListMessagesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Message" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListMessagesResponse": { + "fields": { + "messages": { + "rule": "repeated", + "type": "Message", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "ConversationPhoneNumber": { + "fields": { + "phoneNumber": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "ConversationDatasets": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "CreateConversationDataset": { + "requestType": "CreateConversationDatasetRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*}/conversationDatasets", + "(google.api.http).body": "conversation_dataset", + "(google.api.method_signature)": "parent,conversation_dataset", + "(google.longrunning.operation_info).response_type": "ConversationDataset", + "(google.longrunning.operation_info).metadata_type": "CreateConversationDatasetOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*}/conversationDatasets", + "body": "conversation_dataset" + } + }, + { + "(google.api.method_signature)": "parent,conversation_dataset" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ConversationDataset", + "metadata_type": "CreateConversationDatasetOperationMetadata" + } + } + ] + }, + "GetConversationDataset": { + "requestType": "GetConversationDatasetRequest", + "responseType": "ConversationDataset", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/conversationDatasets/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/conversationDatasets/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/conversationDatasets/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/conversationDatasets/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListConversationDatasets": { + "requestType": "ListConversationDatasetsRequest", + "responseType": "ListConversationDatasetsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*}/conversationDatasets", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*}/conversationDatasets", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*}/conversationDatasets", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*}/conversationDatasets" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "DeleteConversationDataset": { + "requestType": "DeleteConversationDatasetRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/locations/*/conversationDatasets/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteConversationDatasetOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/locations/*/conversationDatasets/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteConversationDatasetOperationMetadata" + } + } + ] + }, + "ImportConversationData": { + "requestType": "ImportConversationDataRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/conversationDatasets/*}:importConversationData", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{name=projects/*/locations/*/conversationDatasets/*}:importConversationData", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "ImportConversationDataOperationResponse", + "(google.longrunning.operation_info).metadata_type": "ImportConversationDataOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/conversationDatasets/*}:importConversationData", + "body": "*", + "additional_bindings": { + "post": "/v2/{name=projects/*/locations/*/conversationDatasets/*}:importConversationData", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ImportConversationDataOperationResponse", + "metadata_type": "ImportConversationDataOperationMetadata" + } + } + ] + } + } + }, + "ConversationInfo": { + "fields": { + "languageCode": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "InputConfig": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "gcsSource": { + "type": "GcsSources", + "id": 1 + } + } + }, + "ConversationDataset": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/ConversationDataset", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "description": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "inputConfig": { + "type": "InputConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "conversationInfo": { + "type": "ConversationInfo", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "conversationCount": { + "type": "int64", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CreateConversationDatasetRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "conversationDataset": { + "type": "ConversationDataset", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetConversationDatasetRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationDataset" + } + } + } + }, + "ListConversationDatasetsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/ConversationDataset" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListConversationDatasetsResponse": { + "fields": { + "conversationDatasets": { + "rule": "repeated", + "type": "ConversationDataset", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "DeleteConversationDatasetRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationDataset" + } + } + } + }, + "ImportConversationDataRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationDataset" + } + }, + "inputConfig": { + "type": "InputConfig", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportConversationDataOperationMetadata": { + "fields": { + "conversationDataset": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationDataset" + } + }, + "partialFailures": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "ImportConversationDataOperationResponse": { + "fields": { + "conversationDataset": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationDataset" + } + }, + "importCount": { + "type": "int32", + "id": 3 + } + } + }, + "CreateConversationDatasetOperationMetadata": { + "fields": { + "conversationDataset": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationDataset" + } + } + } + }, + "DeleteConversationDatasetOperationMetadata": { + "fields": {} + }, + "GcsSources": { + "fields": { + "uris": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GcsDestination": { + "fields": { + "uri": { + "type": "string", + "id": 1 + } + } + }, + "ConversationEvent": { + "oneofs": { + "payload": { + "oneof": [ + "newMessagePayload" + ] + } + }, + "fields": { + "conversation": { + "type": "string", + "id": 1 + }, + "type": { + "type": "Type", + "id": 2 + }, + "errorStatus": { + "type": "google.rpc.Status", + "id": 3 + }, + "newMessagePayload": { + "type": "Message", + "id": 4 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "CONVERSATION_STARTED": 1, + "CONVERSATION_FINISHED": 2, + "HUMAN_INTERVENTION_NEEDED": 3, + "NEW_MESSAGE": 5, + "UNRECOVERABLE_ERROR": 4 + } + } + } + }, + "ConversationModels": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "CreateConversationModel": { + "requestType": "CreateConversationModelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*}/conversationModels", + "(google.api.http).body": "conversation_model", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*}/conversationModels", + "(google.api.http).additional_bindings.body": "conversation_model", + "(google.api.method_signature)": "parent,conversation_model", + "(google.longrunning.operation_info).response_type": "ConversationModel", + "(google.longrunning.operation_info).metadata_type": "CreateConversationModelOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*}/conversationModels", + "body": "conversation_model", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*}/conversationModels", + "body": "conversation_model" + } + } + }, + { + "(google.api.method_signature)": "parent,conversation_model" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ConversationModel", + "metadata_type": "CreateConversationModelOperationMetadata" + } + } + ] + }, + "GetConversationModel": { + "requestType": "GetConversationModelRequest", + "responseType": "ConversationModel", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/conversationModels/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/conversationModels/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/conversationModels/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/conversationModels/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListConversationModels": { + "requestType": "ListConversationModelsRequest", + "responseType": "ListConversationModelsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*}/conversationModels", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*}/conversationModels", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*}/conversationModels", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*}/conversationModels" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "DeleteConversationModel": { + "requestType": "DeleteConversationModelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/conversationModels/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/locations/*/conversationModels/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteConversationModelOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/conversationModels/*}", + "additional_bindings": { + "delete": "/v2/{name=projects/*/locations/*/conversationModels/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteConversationModelOperationMetadata" + } + } + ] + }, + "DeployConversationModel": { + "requestType": "DeployConversationModelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/conversationModels/*}:deploy", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{name=projects/*/locations/*/conversationModels/*}:deploy", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeployConversationModelOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/conversationModels/*}:deploy", + "body": "*", + "additional_bindings": { + "post": "/v2/{name=projects/*/locations/*/conversationModels/*}:deploy", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeployConversationModelOperationMetadata" + } + } + ] + }, + "UndeployConversationModel": { + "requestType": "UndeployConversationModelRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/conversationModels/*}:undeploy", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{name=projects/*/locations/*/conversationModels/*}:undeploy", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "UndeployConversationModelOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/conversationModels/*}:undeploy", + "body": "*", + "additional_bindings": { + "post": "/v2/{name=projects/*/locations/*/conversationModels/*}:undeploy", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "UndeployConversationModelOperationMetadata" + } + } + ] + }, + "GetConversationModelEvaluation": { + "requestType": "GetConversationModelEvaluationRequest", + "responseType": "ConversationModelEvaluation", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/conversationModels/*/evaluations/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/conversationModels/*/evaluations/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/conversationModels/*/evaluations/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/conversationModels/*/evaluations/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListConversationModelEvaluations": { + "requestType": "ListConversationModelEvaluationsRequest", + "responseType": "ListConversationModelEvaluationsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/conversationModels/*}/evaluations", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/conversationModels/*}/evaluations", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "CreateConversationModelEvaluation": { + "requestType": "CreateConversationModelEvaluationRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations", + "(google.api.http).body": "*", + "(google.api.method_signature)": "parent,conversation_model_evaluation", + "(google.longrunning.operation_info).response_type": "ConversationModelEvaluation", + "(google.longrunning.operation_info).metadata_type": "CreateConversationModelEvaluationOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/locations/*/conversationModels/*}/evaluations", + "body": "*" + } + }, + { + "(google.api.method_signature)": "parent,conversation_model_evaluation" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ConversationModelEvaluation", + "metadata_type": "CreateConversationModelEvaluationOperationMetadata" + } + } + ] + } + } + }, + "ConversationModel": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/ConversationModel", + "(google.api.resource).pattern": "projects/{project}/conversationModels/{conversation_model}" + }, + "oneofs": { + "modelMetadata": { + "oneof": [ + "articleSuggestionModelMetadata", + "smartReplyModelMetadata" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "datasets": { + "rule": "repeated", + "type": "InputDataset", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "state": { + "type": "State", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "languageCode": { + "type": "string", + "id": 19 + }, + "articleSuggestionModelMetadata": { + "type": "ArticleSuggestionModelMetadata", + "id": 8 + }, + "smartReplyModelMetadata": { + "type": "SmartReplyModelMetadata", + "id": 9 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "UNDEPLOYED": 2, + "DEPLOYING": 3, + "DEPLOYED": 4, + "UNDEPLOYING": 5, + "DELETING": 6, + "FAILED": 7, + "PENDING": 8 + } + }, + "ModelType": { + "values": { + "MODEL_TYPE_UNSPECIFIED": 0, + "SMART_REPLY_DUAL_ENCODER_MODEL": 2, + "SMART_REPLY_BERT_MODEL": 6 + } + } + } + }, + "ConversationModelEvaluation": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/ConversationModelEvaluation", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}" + }, + "oneofs": { + "metrics": { + "oneof": [ + "smartReplyMetrics" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "evaluationConfig": { + "type": "EvaluationConfig", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "smartReplyMetrics": { + "type": "SmartReplyMetrics", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "EvaluationConfig": { + "oneofs": { + "modelSpecificConfig": { + "oneof": [ + "smartReplyConfig", + "smartComposeConfig" + ] + } + }, + "fields": { + "datasets": { + "rule": "repeated", + "type": "InputDataset", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "smartReplyConfig": { + "type": "SmartReplyConfig", + "id": 2 + }, + "smartComposeConfig": { + "type": "SmartComposeConfig", + "id": 4 + } + }, + "nested": { + "SmartReplyConfig": { + "fields": { + "allowlistDocument": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + }, + "maxResultCount": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SmartComposeConfig": { + "fields": { + "allowlistDocument": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + }, + "maxResultCount": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "InputDataset": { + "fields": { + "dataset": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationDataset" + } + } + } + }, + "ArticleSuggestionModelMetadata": { + "fields": { + "trainingModelType": { + "type": "ConversationModel.ModelType", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SmartReplyModelMetadata": { + "fields": { + "trainingModelType": { + "type": "ConversationModel.ModelType", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SmartReplyMetrics": { + "fields": { + "allowlistCoverage": { + "type": "float", + "id": 1 + }, + "topNMetrics": { + "rule": "repeated", + "type": "TopNMetrics", + "id": 2 + }, + "conversationCount": { + "type": "int64", + "id": 3 + } + }, + "nested": { + "TopNMetrics": { + "fields": { + "n": { + "type": "int32", + "id": 1 + }, + "recall": { + "type": "float", + "id": 2 + } + } + } + } + }, + "CreateConversationModelRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "conversationModel": { + "type": "ConversationModel", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetConversationModelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListConversationModelsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListConversationModelsResponse": { + "fields": { + "conversationModels": { + "rule": "repeated", + "type": "ConversationModel", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "DeleteConversationModelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeployConversationModelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UndeployConversationModelRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetConversationModelEvaluationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ListConversationModelEvaluationsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListConversationModelEvaluationsResponse": { + "fields": { + "conversationModelEvaluations": { + "rule": "repeated", + "type": "ConversationModelEvaluation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CreateConversationModelEvaluationRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/ConversationModelEvaluation" + } + }, + "conversationModelEvaluation": { + "type": "ConversationModelEvaluation", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "CreateConversationModelOperationMetadata": { + "fields": { + "conversationModel": { + "type": "string", + "id": 1 + }, + "state": { + "type": "State", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "PENDING": 1, + "SUCCEEDED": 2, + "FAILED": 3, + "CANCELLED": 4, + "CANCELLING": 5, + "TRAINING": 6 + } + } + } + }, + "DeployConversationModelOperationMetadata": { + "fields": { + "conversationModel": { + "type": "string", + "id": 1 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "UndeployConversationModelOperationMetadata": { + "fields": { + "conversationModel": { + "type": "string", + "id": 1 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "DeleteConversationModelOperationMetadata": { + "fields": { + "conversationModel": { + "type": "string", + "id": 1 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "CreateConversationModelEvaluationOperationMetadata": { + "fields": { + "conversationModelEvaluation": { + "type": "string", + "id": 1 + }, + "conversationModel": { + "type": "string", + "id": 4 + }, + "state": { + "type": "State", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "INITIALIZING": 1, + "RUNNING": 2, + "CANCELLED": 3, + "SUCCEEDED": 4, + "FAILED": 5 + } + } + } + }, + "ConversationProfiles": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListConversationProfiles": { + "requestType": "ListConversationProfilesRequest", + "responseType": "ListConversationProfilesResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*}/conversationProfiles", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*}/conversationProfiles", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*}/conversationProfiles", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*}/conversationProfiles" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetConversationProfile": { + "requestType": "GetConversationProfileRequest", + "responseType": "ConversationProfile", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/conversationProfiles/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/conversationProfiles/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/conversationProfiles/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/conversationProfiles/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateConversationProfile": { + "requestType": "CreateConversationProfileRequest", + "responseType": "ConversationProfile", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*}/conversationProfiles", + "(google.api.http).body": "conversation_profile", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*}/conversationProfiles", + "(google.api.http).additional_bindings.body": "conversation_profile", + "(google.api.method_signature)": "parent,conversation_profile" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*}/conversationProfiles", + "body": "conversation_profile", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*}/conversationProfiles", + "body": "conversation_profile" + } + } + }, + { + "(google.api.method_signature)": "parent,conversation_profile" + } + ] + }, + "UpdateConversationProfile": { + "requestType": "UpdateConversationProfileRequest", + "responseType": "ConversationProfile", + "options": { + "(google.api.http).patch": "/v2/{conversation_profile.name=projects/*/conversationProfiles/*}", + "(google.api.http).body": "conversation_profile", + "(google.api.http).additional_bindings.patch": "/v2/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}", + "(google.api.http).additional_bindings.body": "conversation_profile", + "(google.api.method_signature)": "conversation_profile,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{conversation_profile.name=projects/*/conversationProfiles/*}", + "body": "conversation_profile", + "additional_bindings": { + "patch": "/v2/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}", + "body": "conversation_profile" + } + } + }, + { + "(google.api.method_signature)": "conversation_profile,update_mask" + } + ] + }, + "DeleteConversationProfile": { + "requestType": "DeleteConversationProfileRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/conversationProfiles/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/locations/*/conversationProfiles/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/conversationProfiles/*}", + "additional_bindings": { + "delete": "/v2/{name=projects/*/locations/*/conversationProfiles/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "SetSuggestionFeatureConfig": { + "requestType": "SetSuggestionFeatureConfigRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "conversation_profile", + "(google.longrunning.operation_info).response_type": "ConversationProfile", + "(google.longrunning.operation_info).metadata_type": "SetSuggestionFeatureConfigOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig", + "body": "*", + "additional_bindings": { + "post": "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "conversation_profile" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ConversationProfile", + "metadata_type": "SetSuggestionFeatureConfigOperationMetadata" + } + } + ] + }, + "ClearSuggestionFeatureConfig": { + "requestType": "ClearSuggestionFeatureConfigRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "conversation_profile", + "(google.longrunning.operation_info).response_type": "ConversationProfile", + "(google.longrunning.operation_info).metadata_type": "ClearSuggestionFeatureConfigOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig", + "body": "*", + "additional_bindings": { + "post": "/v2/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "conversation_profile" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ConversationProfile", + "metadata_type": "ClearSuggestionFeatureConfigOperationMetadata" + } + } + ] + } + } + }, + "ConversationProfile": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/ConversationProfile", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "automatedAgentConfig": { + "type": "AutomatedAgentConfig", + "id": 3 + }, + "humanAgentAssistantConfig": { + "type": "HumanAgentAssistantConfig", + "id": 4 + }, + "humanAgentHandoffConfig": { + "type": "HumanAgentHandoffConfig", + "id": 5 + }, + "notificationConfig": { + "type": "NotificationConfig", + "id": 6 + }, + "loggingConfig": { + "type": "LoggingConfig", + "id": 7 + }, + "newMessageEventNotificationConfig": { + "type": "NotificationConfig", + "id": 8 + }, + "sttConfig": { + "type": "SpeechToTextConfig", + "id": 9 + }, + "languageCode": { + "type": "string", + "id": 10 + }, + "timeZone": { + "type": "string", + "id": 14 + }, + "securitySettings": { + "type": "string", + "id": 13, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/CXSecuritySettings" + } + } + } + }, + "ListConversationProfilesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/ConversationProfile" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListConversationProfilesResponse": { + "fields": { + "conversationProfiles": { + "rule": "repeated", + "type": "ConversationProfile", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetConversationProfileRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationProfile" + } + } + } + }, + "CreateConversationProfileRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/ConversationProfile" + } + }, + "conversationProfile": { + "type": "ConversationProfile", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateConversationProfileRequest": { + "fields": { + "conversationProfile": { + "type": "ConversationProfile", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteConversationProfileRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationProfile" + } + } + } + }, + "AutomatedAgentConfig": { + "fields": { + "agent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "HumanAgentAssistantConfig": { + "fields": { + "notificationConfig": { + "type": "NotificationConfig", + "id": 2 + }, + "humanAgentSuggestionConfig": { + "type": "SuggestionConfig", + "id": 3 + }, + "endUserSuggestionConfig": { + "type": "SuggestionConfig", + "id": 4 + }, + "messageAnalysisConfig": { + "type": "MessageAnalysisConfig", + "id": 5 + } + }, + "nested": { + "SuggestionTriggerSettings": { + "fields": { + "noSmalltalk": { + "type": "bool", + "id": 1 + }, + "onlyEndUser": { + "type": "bool", + "id": 2 + } + } + }, + "SuggestionFeatureConfig": { + "fields": { + "suggestionFeature": { + "type": "SuggestionFeature", + "id": 5 + }, + "enableEventBasedSuggestion": { + "type": "bool", + "id": 3 + }, + "suggestionTriggerSettings": { + "type": "SuggestionTriggerSettings", + "id": 10 + }, + "queryConfig": { + "type": "SuggestionQueryConfig", + "id": 6 + }, + "conversationModelConfig": { + "type": "ConversationModelConfig", + "id": 7 + }, + "conversationProcessConfig": { + "type": "ConversationProcessConfig", + "id": 8 + } + } + }, + "SuggestionConfig": { + "fields": { + "featureConfigs": { + "rule": "repeated", + "type": "SuggestionFeatureConfig", + "id": 2 + }, + "groupSuggestionResponses": { + "type": "bool", + "id": 3 + } + } + }, + "SuggestionQueryConfig": { + "oneofs": { + "querySource": { + "oneof": [ + "knowledgeBaseQuerySource", + "documentQuerySource", + "dialogflowQuerySource" + ] + } + }, + "fields": { + "knowledgeBaseQuerySource": { + "type": "KnowledgeBaseQuerySource", + "id": 1 + }, + "documentQuerySource": { + "type": "DocumentQuerySource", + "id": 2 + }, + "dialogflowQuerySource": { + "type": "DialogflowQuerySource", + "id": 3 + }, + "maxResults": { + "type": "int32", + "id": 4 + }, + "confidenceThreshold": { + "type": "float", + "id": 5 + }, + "contextFilterSettings": { + "type": "ContextFilterSettings", + "id": 7 + } + }, + "nested": { + "KnowledgeBaseQuerySource": { + "fields": { + "knowledgeBases": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/KnowledgeBase" + } + } + } + }, + "DocumentQuerySource": { + "fields": { + "documents": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + } + } + }, + "DialogflowQuerySource": { + "fields": { + "agent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "ContextFilterSettings": { + "fields": { + "dropHandoffMessages": { + "type": "bool", + "id": 1 + }, + "dropVirtualAgentMessages": { + "type": "bool", + "id": 2 + }, + "dropIvrMessages": { + "type": "bool", + "id": 3 + } + } + } + } + }, + "ConversationModelConfig": { + "fields": { + "model": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationModel" + } + } + } + }, + "ConversationProcessConfig": { + "fields": { + "recentSentencesCount": { + "type": "int32", + "id": 2 + } + } + }, + "MessageAnalysisConfig": { + "fields": { + "enableEntityExtraction": { + "type": "bool", + "id": 2 + }, + "enableSentimentAnalysis": { + "type": "bool", + "id": 3 + } + } + } + } + }, + "HumanAgentHandoffConfig": { + "oneofs": { + "agentService": { + "oneof": [ + "livePersonConfig", + "salesforceLiveAgentConfig" + ] + } + }, + "fields": { + "livePersonConfig": { + "type": "LivePersonConfig", + "id": 1 + }, + "salesforceLiveAgentConfig": { + "type": "SalesforceLiveAgentConfig", + "id": 2 + } + }, + "nested": { + "LivePersonConfig": { + "fields": { + "accountNumber": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SalesforceLiveAgentConfig": { + "fields": { + "organizationId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "deploymentId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "buttonId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "endpointDomain": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "NotificationConfig": { + "fields": { + "topic": { + "type": "string", + "id": 1 + }, + "messageFormat": { + "type": "MessageFormat", + "id": 2 + } + }, + "nested": { + "MessageFormat": { + "values": { + "MESSAGE_FORMAT_UNSPECIFIED": 0, + "PROTO": 1, + "JSON": 2 + } + } + } + }, + "LoggingConfig": { + "fields": { + "enableStackdriverLogging": { + "type": "bool", + "id": 3 + } + } + }, + "SuggestionFeature": { + "fields": { + "type": { + "type": "Type", + "id": 1 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "ARTICLE_SUGGESTION": 1, + "FAQ": 2, + "SMART_REPLY": 3 + } + } + } + }, + "SetSuggestionFeatureConfigRequest": { + "fields": { + "conversationProfile": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "participantRole": { + "type": "Participant.Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "suggestionFeatureConfig": { + "type": "HumanAgentAssistantConfig.SuggestionFeatureConfig", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ClearSuggestionFeatureConfigRequest": { + "fields": { + "conversationProfile": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "participantRole": { + "type": "Participant.Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "suggestionFeatureType": { + "type": "SuggestionFeature.Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SetSuggestionFeatureConfigOperationMetadata": { + "fields": { + "conversationProfile": { + "type": "string", + "id": 1 + }, + "participantRole": { + "type": "Participant.Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "suggestionFeatureType": { + "type": "SuggestionFeature.Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "ClearSuggestionFeatureConfigOperationMetadata": { + "fields": { + "conversationProfile": { + "type": "string", + "id": 1 + }, + "participantRole": { + "type": "Participant.Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "suggestionFeatureType": { + "type": "SuggestionFeature.Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "Documents": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListDocuments": { + "requestType": "ListDocumentsRequest", + "responseType": "ListDocumentsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/knowledgeBases/*}/documents", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/knowledgeBases/*}/documents", + "additional_bindings": [ + { + "get": "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + }, + { + "get": "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetDocument": { + "requestType": "GetDocumentRequest", + "responseType": "Document", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/knowledgeBases/*/documents/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/knowledgeBases/*/documents/*}", + "additional_bindings": [ + { + "get": "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + }, + { + "get": "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateDocument": { + "requestType": "CreateDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/knowledgeBases/*}/documents", + "(google.api.http).body": "document", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents", + "(google.api.http).additional_bindings.body": "document", + "(google.api.method_signature)": "parent,document", + "(google.longrunning.operation_info).response_type": "Document", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/knowledgeBases/*}/documents", + "body": "document", + "additional_bindings": [ + { + "post": "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents", + "body": "document" + }, + { + "post": "/v2/{parent=projects/*/agent/knowledgeBases/*}/documents", + "body": "document" + } + ] + } + }, + { + "(google.api.method_signature)": "parent,document" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Document", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + }, + "ImportDocuments": { + "requestType": "ImportDocumentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/knowledgeBases/*}/documents:import", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "ImportDocumentsResponse", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/knowledgeBases/*}/documents:import", + "body": "*", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ImportDocumentsResponse", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + }, + "DeleteDocument": { + "requestType": "DeleteDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/knowledgeBases/*/documents/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/knowledgeBases/*/documents/*}", + "additional_bindings": [ + { + "delete": "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + }, + { + "delete": "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + }, + "UpdateDocument": { + "requestType": "UpdateDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v2/{document.name=projects/*/knowledgeBases/*/documents/*}", + "(google.api.http).body": "document", + "(google.api.http).additional_bindings.patch": "/v2/{document.name=projects/*/agent/knowledgeBases/*/documents/*}", + "(google.api.http).additional_bindings.body": "document", + "(google.api.method_signature)": "document,update_mask", + "(google.longrunning.operation_info).response_type": "Document", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{document.name=projects/*/knowledgeBases/*/documents/*}", + "body": "document", + "additional_bindings": [ + { + "patch": "/v2/{document.name=projects/*/locations/*/knowledgeBases/*/documents/*}", + "body": "document" + }, + { + "patch": "/v2/{document.name=projects/*/agent/knowledgeBases/*/documents/*}", + "body": "document" + } + ] + } + }, + { + "(google.api.method_signature)": "document,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Document", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + }, + "ReloadDocument": { + "requestType": "ReloadDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/knowledgeBases/*/documents/*}:reload", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "name,content_uri", + "(google.longrunning.operation_info).response_type": "Document", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/knowledgeBases/*/documents/*}:reload", + "body": "*", + "additional_bindings": [ + { + "post": "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:reload", + "body": "*" + }, + { + "post": "/v2/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload", + "body": "*" + } + ] + } + }, + { + "(google.api.method_signature)": "name,content_uri" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Document", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + }, + "ExportDocument": { + "requestType": "ExportDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2/{name=projects/*/knowledgeBases/*/documents/*}:export", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:export", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "Document", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{name=projects/*/knowledgeBases/*/documents/*}:export", + "body": "*", + "additional_bindings": { + "post": "/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:export", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Document", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + } + } + }, + "Document": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Document", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}" + }, + "oneofs": { + "source": { + "oneof": [ + "contentUri", + "rawContent" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "mimeType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "knowledgeTypes": { + "rule": "repeated", + "type": "KnowledgeType", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "contentUri": { + "type": "string", + "id": 5 + }, + "rawContent": { + "type": "bytes", + "id": 9 + }, + "enableAutoReload": { + "type": "bool", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "latestReloadStatus": { + "type": "ReloadStatus", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "state": { + "type": "State", + "id": 13, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "KnowledgeType": { + "values": { + "KNOWLEDGE_TYPE_UNSPECIFIED": 0, + "FAQ": 1, + "EXTRACTIVE_QA": 2, + "ARTICLE_SUGGESTION": 3, + "AGENT_FACING_SMART_REPLY": 4 + } + }, + "ReloadStatus": { + "fields": { + "time": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "status": { + "type": "google.rpc.Status", + "id": 2 + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "ACTIVE": 2, + "UPDATING": 3, + "RELOADING": 4, + "DELETING": 5 + } + } + } + }, + "GetDocumentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + } + } + }, + "ListDocumentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Document" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + } + } + }, + "ListDocumentsResponse": { + "fields": { + "documents": { + "rule": "repeated", + "type": "Document", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CreateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Document" + } + }, + "document": { + "type": "Document", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ImportDocumentsRequest": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Document" + } + }, + "gcsSource": { + "type": "GcsSources", + "id": 2 + }, + "documentTemplate": { + "type": "ImportDocumentTemplate", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "importGcsCustomMetadata": { + "type": "bool", + "id": 4 + } + } + }, + "ImportDocumentTemplate": { + "fields": { + "mimeType": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "knowledgeTypes": { + "rule": "repeated", + "type": "Document.KnowledgeType", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 3 + } + } + }, + "ImportDocumentsResponse": { + "fields": { + "warnings": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + } + } + }, + "DeleteDocumentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + } + } + }, + "UpdateDocumentRequest": { + "fields": { + "document": { + "type": "Document", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ReloadDocumentRequest": { + "oneofs": { + "source": { + "oneof": [ + "contentUri" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + }, + "contentUri": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "importGcsCustomMetadata": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "smartMessagingPartialUpdate": { + "type": "bool", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ExportDocumentRequest": { + "oneofs": { + "destination": { + "oneof": [ + "gcsDestination" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + }, + "gcsDestination": { + "type": "GcsDestination", + "id": 2 + }, + "exportFullContent": { + "type": "bool", + "id": 3 + }, + "smartMessagingPartialUpdate": { + "type": "bool", + "id": 5 + } + } + }, + "ExportOperationMetadata": { + "fields": { + "exportedGcsDestination": { + "type": "GcsDestination", + "id": 1 + } + } + }, + "KnowledgeOperationMetadata": { + "oneofs": { + "operationMetadata": { + "oneof": [ + "exportOperationMetadata" + ] + } + }, + "fields": { + "state": { + "type": "State", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "knowledgeBase": { + "type": "string", + "id": 3 + }, + "exportOperationMetadata": { + "type": "ExportOperationMetadata", + "id": 4 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "PENDING": 1, + "RUNNING": 2, + "DONE": 3 + } + } + } + }, + "Environments": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListEnvironments": { + "requestType": "ListEnvironmentsRequest", + "responseType": "ListEnvironmentsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/agent}/environments", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/agent}/environments", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/agent}/environments", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*/agent}/environments" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetEnvironment": { + "requestType": "GetEnvironmentRequest", + "responseType": "Environment", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/agent/environments/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/agent/environments/*}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/agent/environments/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/agent/environments/*}" + } + } + } + ] + }, + "CreateEnvironment": { + "requestType": "CreateEnvironmentRequest", + "responseType": "Environment", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent}/environments", + "(google.api.http).body": "environment", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent}/environments", + "(google.api.http).additional_bindings.body": "environment" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent}/environments", + "body": "environment", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent}/environments", + "body": "environment" + } + } + } + ] + }, + "UpdateEnvironment": { + "requestType": "UpdateEnvironmentRequest", + "responseType": "Environment", + "options": { + "(google.api.http).patch": "/v2/{environment.name=projects/*/agent/environments/*}", + "(google.api.http).body": "environment", + "(google.api.http).additional_bindings.patch": "/v2/{environment.name=projects/*/locations/*/agent/environments/*}", + "(google.api.http).additional_bindings.body": "environment" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{environment.name=projects/*/agent/environments/*}", + "body": "environment", + "additional_bindings": { + "patch": "/v2/{environment.name=projects/*/locations/*/agent/environments/*}", + "body": "environment" + } + } + } + ] + }, + "DeleteEnvironment": { + "requestType": "DeleteEnvironmentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/agent/environments/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/locations/*/agent/environments/*}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/agent/environments/*}", + "additional_bindings": { + "delete": "/v2/{name=projects/*/locations/*/agent/environments/*}" + } + } + } + ] + }, + "GetEnvironmentHistory": { + "requestType": "GetEnvironmentHistoryRequest", + "responseType": "EnvironmentHistory", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/agent/environments/*}/history", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/agent/environments/*}/history" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/agent/environments/*}/history", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*/agent/environments/*}/history" + } + } + } + ] + } + } + }, + "Environment": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Environment", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/environments/{environment}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "description": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "agentVersion": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + }, + "state": { + "type": "State", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "textToSpeechSettings": { + "type": "TextToSpeechSettings", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "fulfillment": { + "type": "Fulfillment", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "STOPPED": 1, + "LOADING": 2, + "RUNNING": 3 + } + } + } + }, + "TextToSpeechSettings": { + "fields": { + "enableTextToSpeech": { + "type": "bool", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "outputAudioEncoding": { + "type": "OutputAudioEncoding", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sampleRateHertz": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "synthesizeSpeechConfigs": { + "keyType": "string", + "type": "SynthesizeSpeechConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListEnvironmentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Environment" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListEnvironmentsResponse": { + "fields": { + "environments": { + "rule": "repeated", + "type": "Environment", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetEnvironmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } + } + } + }, + "CreateEnvironmentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Environment" + } + }, + "environment": { + "type": "Environment", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "environmentId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateEnvironmentRequest": { + "fields": { + "environment": { + "type": "Environment", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "allowLoadToDraftAndDiscardChanges": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteEnvironmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } + } + } + }, + "GetEnvironmentHistoryRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "EnvironmentHistory": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "entries": { + "rule": "repeated", + "type": "Entry", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "nextPageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Entry": { + "fields": { + "agentVersion": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + } + } + }, + "Fulfillments": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "GetFulfillment": { + "requestType": "GetFulfillmentRequest", + "responseType": "Fulfillment", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/agent/fulfillment}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/agent/fulfillment}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/agent/fulfillment}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/agent/fulfillment}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateFulfillment": { + "requestType": "UpdateFulfillmentRequest", + "responseType": "Fulfillment", + "options": { + "(google.api.http).patch": "/v2/{fulfillment.name=projects/*/agent/fulfillment}", + "(google.api.http).body": "fulfillment", + "(google.api.http).additional_bindings.patch": "/v2/{fulfillment.name=projects/*/locations/*/agent/fulfillment}", + "(google.api.http).additional_bindings.body": "fulfillment", + "(google.api.method_signature)": "fulfillment,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{fulfillment.name=projects/*/agent/fulfillment}", + "body": "fulfillment", + "additional_bindings": { + "patch": "/v2/{fulfillment.name=projects/*/locations/*/agent/fulfillment}", + "body": "fulfillment" + } + } + }, + { + "(google.api.method_signature)": "fulfillment,update_mask" + } + ] + } + } + }, + "Fulfillment": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Fulfillment", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/fulfillment" + }, + "oneofs": { + "fulfillment": { + "oneof": [ + "genericWebService" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "genericWebService": { + "type": "GenericWebService", + "id": 3 + }, + "enabled": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "features": { + "rule": "repeated", + "type": "Feature", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "GenericWebService": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "username": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "password": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "requestHeaders": { + "keyType": "string", + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "isCloudFunction": { + "type": "bool", + "id": 5, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Feature": { + "fields": { + "type": { + "type": "Type", + "id": 1 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "SMALLTALK": 1 + } + } + } + } + } + }, + "GetFulfillmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Fulfillment" + } + } + } + }, + "UpdateFulfillmentRequest": { + "fields": { + "fulfillment": { + "type": "Fulfillment", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "HumanAgentAssistantEvent": { + "fields": { + "conversation": { + "type": "string", + "id": 1 + }, + "participant": { + "type": "string", + "id": 3 + }, + "suggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 5 + } + } + }, + "KnowledgeBases": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListKnowledgeBases": { + "requestType": "ListKnowledgeBasesRequest", + "responseType": "ListKnowledgeBasesResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*}/knowledgeBases", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/agent}/knowledgeBases", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*}/knowledgeBases", + "additional_bindings": [ + { + "get": "/v2/{parent=projects/*/locations/*}/knowledgeBases" + }, + { + "get": "/v2/{parent=projects/*/agent}/knowledgeBases" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetKnowledgeBase": { + "requestType": "GetKnowledgeBaseRequest", + "responseType": "KnowledgeBase", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/knowledgeBases/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/agent/knowledgeBases/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/knowledgeBases/*}", + "additional_bindings": [ + { + "get": "/v2/{name=projects/*/locations/*/knowledgeBases/*}" + }, + { + "get": "/v2/{name=projects/*/agent/knowledgeBases/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateKnowledgeBase": { + "requestType": "CreateKnowledgeBaseRequest", + "responseType": "KnowledgeBase", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*}/knowledgeBases", + "(google.api.http).body": "knowledge_base", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/agent}/knowledgeBases", + "(google.api.http).additional_bindings.body": "knowledge_base", + "(google.api.method_signature)": "parent,knowledge_base" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*}/knowledgeBases", + "body": "knowledge_base", + "additional_bindings": [ + { + "post": "/v2/{parent=projects/*/locations/*}/knowledgeBases", + "body": "knowledge_base" + }, + { + "post": "/v2/{parent=projects/*/agent}/knowledgeBases", + "body": "knowledge_base" + } + ] + } + }, + { + "(google.api.method_signature)": "parent,knowledge_base" + } + ] + }, + "DeleteKnowledgeBase": { + "requestType": "DeleteKnowledgeBaseRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/knowledgeBases/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/agent/knowledgeBases/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/knowledgeBases/*}", + "additional_bindings": [ + { + "delete": "/v2/{name=projects/*/locations/*/knowledgeBases/*}" + }, + { + "delete": "/v2/{name=projects/*/agent/knowledgeBases/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateKnowledgeBase": { + "requestType": "UpdateKnowledgeBaseRequest", + "responseType": "KnowledgeBase", + "options": { + "(google.api.http).patch": "/v2/{knowledge_base.name=projects/*/knowledgeBases/*}", + "(google.api.http).body": "knowledge_base", + "(google.api.http).additional_bindings.patch": "/v2/{knowledge_base.name=projects/*/agent/knowledgeBases/*}", + "(google.api.http).additional_bindings.body": "knowledge_base", + "(google.api.method_signature)": "knowledge_base,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{knowledge_base.name=projects/*/knowledgeBases/*}", + "body": "knowledge_base", + "additional_bindings": [ + { + "patch": "/v2/{knowledge_base.name=projects/*/locations/*/knowledgeBases/*}", + "body": "knowledge_base" + }, + { + "patch": "/v2/{knowledge_base.name=projects/*/agent/knowledgeBases/*}", + "body": "knowledge_base" + } + ] + } + }, + { + "(google.api.method_signature)": "knowledge_base,update_mask" + } + ] + } + } + }, + "KnowledgeBase": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/KnowledgeBase", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 4 + } + } + }, + "ListKnowledgeBasesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/KnowledgeBase" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + } + } + }, + "ListKnowledgeBasesResponse": { + "fields": { + "knowledgeBases": { + "rule": "repeated", + "type": "KnowledgeBase", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetKnowledgeBaseRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/KnowledgeBase" + } + } + } + }, + "CreateKnowledgeBaseRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/KnowledgeBase" + } + }, + "knowledgeBase": { + "type": "KnowledgeBase", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteKnowledgeBaseRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/KnowledgeBase" + } + }, + "force": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "UpdateKnowledgeBaseRequest": { + "fields": { + "knowledgeBase": { + "type": "KnowledgeBase", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Versions": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListVersions": { + "requestType": "ListVersionsRequest", + "responseType": "ListVersionsResponse", + "options": { + "(google.api.http).get": "/v2/{parent=projects/*/agent}/versions", + "(google.api.http).additional_bindings.get": "/v2/{parent=projects/*/locations/*/agent}/versions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{parent=projects/*/agent}/versions", + "additional_bindings": { + "get": "/v2/{parent=projects/*/locations/*/agent}/versions" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetVersion": { + "requestType": "GetVersionRequest", + "responseType": "Version", + "options": { + "(google.api.http).get": "/v2/{name=projects/*/agent/versions/*}", + "(google.api.http).additional_bindings.get": "/v2/{name=projects/*/locations/*/agent/versions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2/{name=projects/*/agent/versions/*}", + "additional_bindings": { + "get": "/v2/{name=projects/*/locations/*/agent/versions/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateVersion": { + "requestType": "CreateVersionRequest", + "responseType": "Version", + "options": { + "(google.api.http).post": "/v2/{parent=projects/*/agent}/versions", + "(google.api.http).body": "version", + "(google.api.http).additional_bindings.post": "/v2/{parent=projects/*/locations/*/agent}/versions", + "(google.api.http).additional_bindings.body": "version", + "(google.api.method_signature)": "parent,version" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2/{parent=projects/*/agent}/versions", + "body": "version", + "additional_bindings": { + "post": "/v2/{parent=projects/*/locations/*/agent}/versions", + "body": "version" + } + } + }, + { + "(google.api.method_signature)": "parent,version" + } + ] + }, + "UpdateVersion": { + "requestType": "UpdateVersionRequest", + "responseType": "Version", + "options": { + "(google.api.http).patch": "/v2/{version.name=projects/*/agent/versions/*}", + "(google.api.http).body": "version", + "(google.api.http).additional_bindings.patch": "/v2/{version.name=projects/*/locations/*/agent/versions/*}", + "(google.api.http).additional_bindings.body": "version", + "(google.api.method_signature)": "version,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2/{version.name=projects/*/agent/versions/*}", + "body": "version", + "additional_bindings": { + "patch": "/v2/{version.name=projects/*/locations/*/agent/versions/*}", + "body": "version" + } + } + }, + { + "(google.api.method_signature)": "version,update_mask" + } + ] + }, + "DeleteVersion": { + "requestType": "DeleteVersionRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2/{name=projects/*/agent/versions/*}", + "(google.api.http).additional_bindings.delete": "/v2/{name=projects/*/locations/*/agent/versions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2/{name=projects/*/agent/versions/*}", + "additional_bindings": { + "delete": "/v2/{name=projects/*/locations/*/agent/versions/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "Version": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Version", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/versions/{version}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "description": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "versionNumber": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "status": { + "type": "VersionStatus", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "VersionStatus": { + "values": { + "VERSION_STATUS_UNSPECIFIED": 0, + "IN_PROGRESS": 1, + "READY": 2, + "FAILED": 3 + } + } + } + }, + "ListVersionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Version" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListVersionsResponse": { + "fields": { + "versions": { + "rule": "repeated", + "type": "Version", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + } + } + }, + "CreateVersionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Version" + } + }, + "version": { + "type": "Version", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateVersionRequest": { + "fields": { + "version": { + "type": "Version", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + } + } + }, + "WebhookRequest": { + "fields": { + "session": { + "type": "string", + "id": 4 + }, + "responseId": { + "type": "string", + "id": 1 + }, + "queryResult": { + "type": "QueryResult", + "id": 2 + }, + "originalDetectIntentRequest": { + "type": "OriginalDetectIntentRequest", + "id": 3 + } + } + }, + "WebhookResponse": { + "fields": { + "fulfillmentText": { + "type": "string", + "id": 1 + }, + "fulfillmentMessages": { + "rule": "repeated", + "type": "Intent.Message", + "id": 2 + }, + "source": { + "type": "string", + "id": 3 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 4 + }, + "outputContexts": { + "rule": "repeated", + "type": "Context", + "id": 5 + }, + "followupEventInput": { + "type": "EventInput", + "id": 6 + }, + "sessionEntityTypes": { + "rule": "repeated", + "type": "SessionEntityType", + "id": 10 + } + } + }, + "OriginalDetectIntentRequest": { + "fields": { + "source": { + "type": "string", + "id": 1 + }, + "version": { + "type": "string", + "id": 2 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 3 + } + } + } + } + }, + "v2beta1": { + "options": { + "cc_enable_arenas": true, + "csharp_namespace": "Google.Cloud.Dialogflow.V2beta1", + "go_package": "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow", + "java_multiple_files": true, + "java_outer_classname": "WebhookProto", + "java_package": "com.google.cloud.dialogflow.v2beta1", + "objc_class_prefix": "DF", + "(google.api.resource_definition).type": "dialogflow.googleapis.com/ConversationModel", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/conversationModels/{conversation_model}" + }, + "nested": { + "Agents": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "GetAgent": { + "requestType": "GetAgentRequest", + "responseType": "Agent", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*}/agent", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*}/agent", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*}/agent", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*}/agent" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SetAgent": { + "requestType": "SetAgentRequest", + "responseType": "Agent", + "options": { + "(google.api.http).post": "/v2beta1/{agent.parent=projects/*}/agent", + "(google.api.http).body": "agent", + "(google.api.http).additional_bindings.post": "/v2beta1/{agent.parent=projects/*/locations/*}/agent", + "(google.api.http).additional_bindings.body": "agent", + "(google.api.method_signature)": "agent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{agent.parent=projects/*}/agent", + "body": "agent", + "additional_bindings": { + "post": "/v2beta1/{agent.parent=projects/*/locations/*}/agent", + "body": "agent" + } + } + }, + { + "(google.api.method_signature)": "agent" + } + ] + }, + "DeleteAgent": { + "requestType": "DeleteAgentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{parent=projects/*}/agent", + "(google.api.http).additional_bindings.delete": "/v2beta1/{parent=projects/*/locations/*}/agent", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{parent=projects/*}/agent", + "additional_bindings": { + "delete": "/v2beta1/{parent=projects/*/locations/*}/agent" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SearchAgents": { + "requestType": "SearchAgentsRequest", + "responseType": "SearchAgentsResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*}/agent:search", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*}/agent:search", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*}/agent:search", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*}/agent:search" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "TrainAgent": { + "requestType": "TrainAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*}/agent:train", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*}/agent:train", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*}/agent:train", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*}/agent:train", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "ExportAgent": { + "requestType": "ExportAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*}/agent:export", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*}/agent:export", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent", + "(google.longrunning.operation_info).response_type": "google.cloud.dialogflow.v2beta1.ExportAgentResponse", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*}/agent:export", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*}/agent:export", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.dialogflow.v2beta1.ExportAgentResponse", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "ImportAgent": { + "requestType": "ImportAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*}/agent:import", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*}/agent:import", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*}/agent:import", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*}/agent:import", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "RestoreAgent": { + "requestType": "RestoreAgentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*}/agent:restore", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*}/agent:restore", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*}/agent:restore", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*}/agent:restore", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "GetValidationResult": { + "requestType": "GetValidationResultRequest", + "responseType": "ValidationResult", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*}/agent/validationResult", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*}/agent/validationResult" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*}/agent/validationResult", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*}/agent/validationResult" + } + } + } + ] + } + } + }, + "Agent": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Agent", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent" + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudresourcemanager.googleapis.com/Project" + } + }, + "displayName": { + "type": "string", + "id": 2 + }, + "defaultLanguageCode": { + "type": "string", + "id": 3 + }, + "supportedLanguageCodes": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "timeZone": { + "type": "string", + "id": 5 + }, + "description": { + "type": "string", + "id": 6 + }, + "avatarUri": { + "type": "string", + "id": 7 + }, + "enableLogging": { + "type": "bool", + "id": 8 + }, + "matchMode": { + "type": "MatchMode", + "id": 9, + "options": { + "deprecated": true + } + }, + "classificationThreshold": { + "type": "float", + "id": 10 + }, + "apiVersion": { + "type": "ApiVersion", + "id": 14 + }, + "tier": { + "type": "Tier", + "id": 15 + } + }, + "nested": { + "MatchMode": { + "values": { + "MATCH_MODE_UNSPECIFIED": 0, + "MATCH_MODE_HYBRID": 1, + "MATCH_MODE_ML_ONLY": 2 + } + }, + "ApiVersion": { + "values": { + "API_VERSION_UNSPECIFIED": 0, + "API_VERSION_V1": 1, + "API_VERSION_V2": 2, + "API_VERSION_V2_BETA_1": 3 + } + }, + "Tier": { + "valuesOptions": { + "TIER_ENTERPRISE_PLUS": { + "deprecated": true + } + }, + "values": { + "TIER_UNSPECIFIED": 0, + "TIER_STANDARD": 1, + "TIER_ENTERPRISE": 2, + "TIER_ENTERPRISE_PLUS": 3 + } + } + } + }, + "GetAgentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "SetAgentRequest": { + "fields": { + "agent": { + "type": "Agent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteAgentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "SubAgent": { + "fields": { + "project": { + "type": "string", + "id": 1 + }, + "environment": { + "type": "string", + "id": 2 + } + } + }, + "SearchAgentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "SearchAgentsResponse": { + "fields": { + "agents": { + "rule": "repeated", + "type": "Agent", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "TrainAgentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "ExportAgentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "agentUri": { + "type": "string", + "id": 2 + } + } + }, + "ExportAgentResponse": { + "oneofs": { + "agent": { + "oneof": [ + "agentUri", + "agentContent" + ] + } + }, + "fields": { + "agentUri": { + "type": "string", + "id": 1 + }, + "agentContent": { + "type": "bytes", + "id": 2 + } + } + }, + "ImportAgentRequest": { + "oneofs": { + "agent": { + "oneof": [ + "agentUri", + "agentContent" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "agentUri": { + "type": "string", + "id": 2 + }, + "agentContent": { + "type": "bytes", + "id": 3 + } + } + }, + "RestoreAgentRequest": { + "oneofs": { + "agent": { + "oneof": [ + "agentUri", + "agentContent" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "agentUri": { + "type": "string", + "id": 2 + }, + "agentContent": { + "type": "bytes", + "id": 3 + } + } + }, + "GetValidationResultRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Agent" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ValidationError": { + "fields": { + "severity": { + "type": "Severity", + "id": 1 + }, + "entries": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "errorMessage": { + "type": "string", + "id": 4 + } + }, + "nested": { + "Severity": { + "values": { + "SEVERITY_UNSPECIFIED": 0, + "INFO": 1, + "WARNING": 2, + "ERROR": 3, + "CRITICAL": 4 + } + } + } + }, + "ValidationResult": { + "fields": { + "validationErrors": { + "rule": "repeated", + "type": "ValidationError", + "id": 1 + } + } + }, + "AnswerRecords": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "GetAnswerRecord": { + "requestType": "GetAnswerRecordRequest", + "responseType": "AnswerRecord", + "options": { + "deprecated": true, + "(google.api.http).get": "/v2beta1/{name=projects/*/answerRecords/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/answerRecords/*}" + }, + "parsedOptions": [ + { + "deprecated": true + }, + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/answerRecords/*}", + "additional_bindings": { + "get": "/v2beta1/{name=projects/*/locations/*/answerRecords/*}" + } + } + } + ] + }, + "ListAnswerRecords": { + "requestType": "ListAnswerRecordsRequest", + "responseType": "ListAnswerRecordsResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*}/answerRecords", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*}/answerRecords", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*}/answerRecords", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*}/answerRecords" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateAnswerRecord": { + "requestType": "UpdateAnswerRecordRequest", + "responseType": "AnswerRecord", + "options": { + "(google.api.http).patch": "/v2beta1/{answer_record.name=projects/*/answerRecords/*}", + "(google.api.http).body": "answer_record", + "(google.api.http).additional_bindings.patch": "/v2beta1/{answer_record.name=projects/*/locations/*/answerRecords/*}", + "(google.api.http).additional_bindings.body": "answer_record", + "(google.api.method_signature)": "answer_record,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{answer_record.name=projects/*/answerRecords/*}", + "body": "answer_record", + "additional_bindings": { + "patch": "/v2beta1/{answer_record.name=projects/*/locations/*/answerRecords/*}", + "body": "answer_record" + } + } + }, + { + "(google.api.method_signature)": "answer_record,update_mask" + } + ] + } + } + }, + "AnswerRecord": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/AnswerRecord", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/answerRecords/{answer_record}" + }, + "oneofs": { + "record": { + "oneof": [ + "agentAssistantRecord" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "answerFeedback": { + "type": "AnswerFeedback", + "id": 3 + }, + "agentAssistantRecord": { + "type": "AgentAssistantRecord", + "id": 4 + } + } + }, + "AgentAssistantRecord": { + "oneofs": { + "answer": { + "oneof": [ + "articleSuggestionAnswer", + "faqAnswer" + ] + } + }, + "fields": { + "articleSuggestionAnswer": { + "type": "ArticleAnswer", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "faqAnswer": { + "type": "FaqAnswer", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "AnswerFeedback": { + "oneofs": { + "detailFeedback": { + "oneof": [ + "agentAssistantDetailFeedback" + ] + } + }, + "fields": { + "correctnessLevel": { + "type": "CorrectnessLevel", + "id": 1 + }, + "agentAssistantDetailFeedback": { + "type": "AgentAssistantFeedback", + "id": 2 + }, + "clicked": { + "type": "bool", + "id": 3 + }, + "clickTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "displayed": { + "type": "bool", + "id": 4 + }, + "displayTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + } + }, + "nested": { + "CorrectnessLevel": { + "values": { + "CORRECTNESS_LEVEL_UNSPECIFIED": 0, + "NOT_CORRECT": 1, + "PARTIALLY_CORRECT": 2, + "FULLY_CORRECT": 3 + } + } + } + }, + "AgentAssistantFeedback": { + "fields": { + "answerRelevance": { + "type": "AnswerRelevance", + "id": 1 + }, + "documentCorrectness": { + "type": "DocumentCorrectness", + "id": 2 + }, + "documentEfficiency": { + "type": "DocumentEfficiency", + "id": 3 + }, + "summarizationFeedback": { + "type": "SummarizationFeedback", + "id": 4 + } + }, + "nested": { + "AnswerRelevance": { + "values": { + "ANSWER_RELEVANCE_UNSPECIFIED": 0, + "IRRELEVANT": 1, + "RELEVANT": 2 + } + }, + "DocumentCorrectness": { + "values": { + "DOCUMENT_CORRECTNESS_UNSPECIFIED": 0, + "INCORRECT": 1, + "CORRECT": 2 + } + }, + "DocumentEfficiency": { + "values": { + "DOCUMENT_EFFICIENCY_UNSPECIFIED": 0, + "INEFFICIENT": 1, + "EFFICIENT": 2 + } + }, + "SummarizationFeedback": { + "fields": { + "startTimestamp": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "submitTimestamp": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "summaryText": { + "type": "string", + "id": 3 + } + } + } + } + }, + "GetAnswerRecordRequest": { + "fields": { + "name": { + "type": "string", + "id": 1 + } + } + }, + "ListAnswerRecordsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/AnswerRecord" + } + }, + "filter": { + "type": "string", + "id": 2, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 3 + }, + "pageToken": { + "type": "string", + "id": 4 + } + } + }, + "ListAnswerRecordsResponse": { + "fields": { + "answerRecords": { + "rule": "repeated", + "type": "AnswerRecord", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateAnswerRecordRequest": { + "fields": { + "answerRecord": { + "type": "AnswerRecord", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "Participants": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "CreateParticipant": { + "requestType": "CreateParticipantRequest", + "responseType": "Participant", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/conversations/*}/participants", + "(google.api.http).body": "participant", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants", + "(google.api.http).additional_bindings.body": "participant", + "(google.api.method_signature)": "parent,participant" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/conversations/*}/participants", + "body": "participant", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants", + "body": "participant" + } + } + }, + { + "(google.api.method_signature)": "parent,participant" + } + ] + }, + "GetParticipant": { + "requestType": "GetParticipantRequest", + "responseType": "Participant", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/conversations/*/participants/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/conversations/*/participants/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/conversations/*/participants/*}", + "additional_bindings": { + "get": "/v2beta1/{name=projects/*/locations/*/conversations/*/participants/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListParticipants": { + "requestType": "ListParticipantsRequest", + "responseType": "ListParticipantsResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/conversations/*}/participants", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/conversations/*}/participants", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*/conversations/*}/participants" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateParticipant": { + "requestType": "UpdateParticipantRequest", + "responseType": "Participant", + "options": { + "(google.api.http).patch": "/v2beta1/{participant.name=projects/*/conversations/*/participants/*}", + "(google.api.http).body": "participant", + "(google.api.http).additional_bindings.patch": "/v2beta1/{participant.name=projects/*/locations/*/conversations/*/participants/*}", + "(google.api.http).additional_bindings.body": "participant", + "(google.api.method_signature)": "participant,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{participant.name=projects/*/conversations/*/participants/*}", + "body": "participant", + "additional_bindings": { + "patch": "/v2beta1/{participant.name=projects/*/locations/*/conversations/*/participants/*}", + "body": "participant" + } + } + }, + { + "(google.api.method_signature)": "participant,update_mask" + } + ] + }, + "AnalyzeContent": { + "requestType": "AnalyzeContentRequest", + "responseType": "AnalyzeContentResponse", + "options": { + "(google.api.http).post": "/v2beta1/{participant=projects/*/conversations/*/participants/*}:analyzeContent", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "participant,event_input" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{participant=projects/*/conversations/*/participants/*}:analyzeContent", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{participant=projects/*/locations/*/conversations/*/participants/*}:analyzeContent", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "participant,text_input" + }, + { + "(google.api.method_signature)": "participant,audio_input" + }, + { + "(google.api.method_signature)": "participant,event_input" + } + ] + }, + "StreamingAnalyzeContent": { + "requestType": "StreamingAnalyzeContentRequest", + "requestStream": true, + "responseType": "StreamingAnalyzeContentResponse", + "responseStream": true + }, + "SuggestArticles": { + "requestType": "SuggestArticlesRequest", + "responseType": "SuggestArticlesResponse", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestArticles", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestArticles", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SuggestFaqAnswers": { + "requestType": "SuggestFaqAnswersRequest", + "responseType": "SuggestFaqAnswersResponse", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestFaqAnswers", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SuggestSmartReplies": { + "requestType": "SuggestSmartRepliesRequest", + "responseType": "SuggestSmartRepliesResponse", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:suggestSmartReplies", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/conversations/*/participants/*}/suggestions:suggestSmartReplies", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListSuggestions": { + "requestType": "ListSuggestionsRequest", + "responseType": "ListSuggestionsResponse", + "options": { + "deprecated": true, + "(google.api.http).get": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions" + }, + "parsedOptions": [ + { + "deprecated": true + }, + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions" + } + } + ] + }, + "CompileSuggestion": { + "requestType": "CompileSuggestionRequest", + "responseType": "CompileSuggestionResponse", + "options": { + "deprecated": true, + "(google.api.http).post": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:compile", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "deprecated": true + }, + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/conversations/*/participants/*}/suggestions:compile", + "body": "*" + } + } + ] + } + } + }, + "Participant": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Participant", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "role": { + "type": "Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, + "obfuscatedExternalUserId": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "documentsMetadataFilters": { + "keyType": "string", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Role": { + "values": { + "ROLE_UNSPECIFIED": 0, + "HUMAN_AGENT": 1, + "AUTOMATED_AGENT": 2, + "END_USER": 3 + } + } + } + }, + "Message": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Message", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "content": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "participant": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "participantRole": { + "type": "Participant.Role", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "sendTime": { + "type": "google.protobuf.Timestamp", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "messageAnnotation": { + "type": "MessageAnnotation", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "sentimentAnalysis": { + "type": "SentimentAnalysisResult", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CreateParticipantRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Participant" + } + }, + "participant": { + "type": "Participant", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetParticipantRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + } + } + }, + "ListParticipantsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Participant" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListParticipantsResponse": { + "fields": { + "participants": { + "rule": "repeated", + "type": "Participant", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "UpdateParticipantRequest": { + "fields": { + "participant": { + "type": "Participant", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "AudioInput": { + "fields": { + "config": { + "type": "InputAudioConfig", + "id": 1 + }, + "audio": { + "type": "bytes", + "id": 2 + } + } + }, + "OutputAudio": { + "fields": { + "config": { + "type": "OutputAudioConfig", + "id": 1 + }, + "audio": { + "type": "bytes", + "id": 2 + } + } + }, + "AutomatedAgentReply": { + "oneofs": { + "response": { + "oneof": [ + "detectIntentResponse" + ] + }, + "match": { + "oneof": [ + "intent", + "event" + ] + } + }, + "fields": { + "detectIntentResponse": { + "type": "DetectIntentResponse", + "id": 1 + }, + "responseMessages": { + "rule": "repeated", + "type": "ResponseMessage", + "id": 3 + }, + "intent": { + "type": "string", + "id": 4, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + }, + "event": { + "type": "string", + "id": 5 + }, + "matchConfidence": { + "type": "float", + "id": 9 + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 10 + }, + "cxSessionParameters": { + "type": "google.protobuf.Struct", + "id": 6, + "options": { + "deprecated": true + } + }, + "automatedAgentReplyType": { + "type": "AutomatedAgentReplyType", + "id": 7 + }, + "allowCancellation": { + "type": "bool", + "id": 8 + } + }, + "nested": { + "AutomatedAgentReplyType": { + "values": { + "AUTOMATED_AGENT_REPLY_TYPE_UNSPECIFIED": 0, + "PARTIAL": 1, + "FINAL": 2 + } + } + } + }, + "SuggestionFeature": { + "fields": { + "type": { + "type": "Type", + "id": 1 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "ARTICLE_SUGGESTION": 1, + "FAQ": 2, + "SMART_REPLY": 3, + "CONVERSATION_SUMMARIZATION": 8 + } + } + } + }, + "AssistQueryParameters": { + "fields": { + "documentsMetadataFilters": { + "keyType": "string", + "type": "string", + "id": 1 + } + } + }, + "AnalyzeContentRequest": { + "oneofs": { + "input": { + "oneof": [ + "textInput", + "audioInput", + "eventInput" + ] + } + }, + "fields": { + "participant": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "textInput": { + "type": "TextInput", + "id": 6 + }, + "audioInput": { + "type": "AudioInput", + "id": 7 + }, + "eventInput": { + "type": "EventInput", + "id": 8 + }, + "replyAudioConfig": { + "type": "OutputAudioConfig", + "id": 5 + }, + "queryParams": { + "type": "QueryParameters", + "id": 9 + }, + "assistQueryParams": { + "type": "AssistQueryParameters", + "id": 14 + }, + "cxParameters": { + "type": "google.protobuf.Struct", + "id": 18 + }, + "cxCurrentPage": { + "type": "string", + "id": 20 + }, + "messageSendTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + }, + "requestId": { + "type": "string", + "id": 11 + } + } + }, + "DtmfParameters": { + "fields": { + "acceptsDtmfInput": { + "type": "bool", + "id": 1 + } + } + }, + "AnalyzeContentResponse": { + "fields": { + "replyText": { + "type": "string", + "id": 1 + }, + "replyAudio": { + "type": "OutputAudio", + "id": 2 + }, + "automatedAgentReply": { + "type": "AutomatedAgentReply", + "id": 3 + }, + "message": { + "type": "Message", + "id": 5 + }, + "humanAgentSuggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 6 + }, + "endUserSuggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 7 + }, + "dtmfParameters": { + "type": "DtmfParameters", + "id": 9 + } + } + }, + "InputTextConfig": { + "fields": { + "languageCode": { + "type": "string", + "id": 1 + } + } + }, + "StreamingAnalyzeContentRequest": { + "oneofs": { + "config": { + "oneof": [ + "audioConfig", + "textConfig" + ] + }, + "input": { + "oneof": [ + "inputAudio", + "inputText", + "inputDtmf" + ] + } + }, + "fields": { + "participant": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "audioConfig": { + "type": "InputAudioConfig", + "id": 2 + }, + "textConfig": { + "type": "InputTextConfig", + "id": 3 + }, + "replyAudioConfig": { + "type": "OutputAudioConfig", + "id": 4 + }, + "inputAudio": { + "type": "bytes", + "id": 5 + }, + "inputText": { + "type": "string", + "id": 6 + }, + "inputDtmf": { + "type": "TelephonyDtmfEvents", + "id": 9 + }, + "queryParams": { + "type": "QueryParameters", + "id": 7 + }, + "assistQueryParams": { + "type": "AssistQueryParameters", + "id": 8 + }, + "cxParameters": { + "type": "google.protobuf.Struct", + "id": 13 + }, + "cxCurrentPage": { + "type": "string", + "id": 15 + }, + "enablePartialAutomatedAgentReply": { + "type": "bool", + "id": 12 + } + } + }, + "StreamingAnalyzeContentResponse": { + "fields": { + "recognitionResult": { + "type": "StreamingRecognitionResult", + "id": 1 + }, + "replyText": { + "type": "string", + "id": 2 + }, + "replyAudio": { + "type": "OutputAudio", + "id": 3 + }, + "automatedAgentReply": { + "type": "AutomatedAgentReply", + "id": 4 + }, + "message": { + "type": "Message", + "id": 6 + }, + "humanAgentSuggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 7 + }, + "endUserSuggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 8 + }, + "dtmfParameters": { + "type": "DtmfParameters", + "id": 10 + } + } + }, + "AnnotatedMessagePart": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "entityType": { + "type": "string", + "id": 2 + }, + "formattedValue": { + "type": "google.protobuf.Value", + "id": 3 + } + } + }, + "MessageAnnotation": { + "fields": { + "parts": { + "rule": "repeated", + "type": "AnnotatedMessagePart", + "id": 1 + }, + "containEntities": { + "type": "bool", + "id": 2 + } + } + }, + "ArticleAnswer": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "uri": { + "type": "string", + "id": 2 + }, + "snippets": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 5 + }, + "answerRecord": { + "type": "string", + "id": 6 + } + } + }, + "FaqAnswer": { + "fields": { + "answer": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + }, + "question": { + "type": "string", + "id": 3 + }, + "source": { + "type": "string", + "id": 4 + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 5 + }, + "answerRecord": { + "type": "string", + "id": 6 + } + } + }, + "SmartReplyAnswer": { + "fields": { + "reply": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + }, + "answerRecord": { + "type": "string", + "id": 3, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/AnswerRecord" + } + } + } + }, + "SuggestionResult": { + "oneofs": { + "suggestionResponse": { + "oneof": [ + "error", + "suggestArticlesResponse", + "suggestFaqAnswersResponse", + "suggestSmartRepliesResponse" + ] + } + }, + "fields": { + "error": { + "type": "google.rpc.Status", + "id": 1 + }, + "suggestArticlesResponse": { + "type": "SuggestArticlesResponse", + "id": 2 + }, + "suggestFaqAnswersResponse": { + "type": "SuggestFaqAnswersResponse", + "id": 3 + }, + "suggestSmartRepliesResponse": { + "type": "SuggestSmartRepliesResponse", + "id": 4 + } + } + }, + "SuggestArticlesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "latestMessage": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "assistQueryParams": { + "type": "AssistQueryParameters", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SuggestArticlesResponse": { + "fields": { + "articleAnswers": { + "rule": "repeated", + "type": "ArticleAnswer", + "id": 1 + }, + "latestMessage": { + "type": "string", + "id": 2 + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "SuggestFaqAnswersRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "latestMessage": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "assistQueryParams": { + "type": "AssistQueryParameters", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SuggestFaqAnswersResponse": { + "fields": { + "faqAnswers": { + "rule": "repeated", + "type": "FaqAnswer", + "id": 1 + }, + "latestMessage": { + "type": "string", + "id": 2 + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "SuggestSmartRepliesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Participant" + } + }, + "currentTextInput": { + "type": "TextInput", + "id": 4 + }, + "latestMessage": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "SuggestSmartRepliesResponse": { + "fields": { + "smartReplyAnswers": { + "rule": "repeated", + "type": "SmartReplyAnswer", + "id": 1 + }, + "latestMessage": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "Suggestion": { + "options": { + "deprecated": true + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "articles": { + "rule": "repeated", + "type": "Article", + "id": 2 + }, + "faqAnswers": { + "rule": "repeated", + "type": "FaqAnswer", + "id": 4 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "latestMessage": { + "type": "string", + "id": 7 + } + }, + "nested": { + "Article": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "uri": { + "type": "string", + "id": 2 + }, + "snippets": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 5 + }, + "answerRecord": { + "type": "string", + "id": 6 + } + } + }, + "FaqAnswer": { + "fields": { + "answer": { + "type": "string", + "id": 1 + }, + "confidence": { + "type": "float", + "id": 2 + }, + "question": { + "type": "string", + "id": 3 + }, + "source": { + "type": "string", + "id": 4 + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 5 + }, + "answerRecord": { + "type": "string", + "id": 6 + } + } + } + } + }, + "ListSuggestionsRequest": { + "options": { + "deprecated": true + }, + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + } + } + }, + "ListSuggestionsResponse": { + "options": { + "deprecated": true + }, + "fields": { + "suggestions": { + "rule": "repeated", + "type": "Suggestion", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CompileSuggestionRequest": { + "options": { + "deprecated": true + }, + "fields": { + "parent": { + "type": "string", + "id": 1 + }, + "latestMessage": { + "type": "string", + "id": 2 + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "CompileSuggestionResponse": { + "options": { + "deprecated": true + }, + "fields": { + "suggestion": { + "type": "Suggestion", + "id": 1 + }, + "latestMessage": { + "type": "string", + "id": 2 + }, + "contextSize": { + "type": "int32", + "id": 3 + } + } + }, + "ResponseMessage": { + "oneofs": { + "message": { + "oneof": [ + "text", + "payload", + "liveAgentHandoff", + "endInteraction", + "mixedAudio", + "telephonyTransferCall" + ] + } + }, + "fields": { + "text": { + "type": "Text", + "id": 1 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 2 + }, + "liveAgentHandoff": { + "type": "LiveAgentHandoff", + "id": 3 + }, + "endInteraction": { + "type": "EndInteraction", + "id": 4 + }, + "mixedAudio": { + "type": "MixedAudio", + "id": 5 + }, + "telephonyTransferCall": { + "type": "TelephonyTransferCall", + "id": 6 + } + }, + "nested": { + "Text": { + "fields": { + "text": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "LiveAgentHandoff": { + "fields": { + "metadata": { + "type": "google.protobuf.Struct", + "id": 1 + } + } + }, + "EndInteraction": { + "fields": {} + }, + "MixedAudio": { + "fields": { + "segments": { + "rule": "repeated", + "type": "Segment", + "id": 1 + } + }, + "nested": { + "Segment": { + "oneofs": { + "content": { + "oneof": [ + "audio", + "uri" + ] + } + }, + "fields": { + "audio": { + "type": "bytes", + "id": 1 + }, + "uri": { + "type": "string", + "id": 2 + }, + "allowPlaybackInterruption": { + "type": "bool", + "id": 3 + } + } + } + } + }, + "TelephonyTransferCall": { + "oneofs": { + "endpoint": { + "oneof": [ + "phoneNumber", + "sipUri" + ] + } + }, + "fields": { + "phoneNumber": { + "type": "string", + "id": 1 + }, + "sipUri": { + "type": "string", + "id": 2 + } + } + } + } + }, + "AudioEncoding": { + "values": { + "AUDIO_ENCODING_UNSPECIFIED": 0, + "AUDIO_ENCODING_LINEAR_16": 1, + "AUDIO_ENCODING_FLAC": 2, + "AUDIO_ENCODING_MULAW": 3, + "AUDIO_ENCODING_AMR": 4, + "AUDIO_ENCODING_AMR_WB": 5, + "AUDIO_ENCODING_OGG_OPUS": 6, + "AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE": 7 + } + }, + "SpeechContext": { + "fields": { + "phrases": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "boost": { + "type": "float", + "id": 2 + } + } + }, + "SpeechModelVariant": { + "values": { + "SPEECH_MODEL_VARIANT_UNSPECIFIED": 0, + "USE_BEST_AVAILABLE": 1, + "USE_STANDARD": 2, + "USE_ENHANCED": 3 + } + }, + "SpeechWordInfo": { + "fields": { + "word": { + "type": "string", + "id": 3 + }, + "startOffset": { + "type": "google.protobuf.Duration", + "id": 1 + }, + "endOffset": { + "type": "google.protobuf.Duration", + "id": 2 + }, + "confidence": { + "type": "float", + "id": 4 + } + } + }, + "InputAudioConfig": { + "fields": { + "audioEncoding": { + "type": "AudioEncoding", + "id": 1 + }, + "sampleRateHertz": { + "type": "int32", + "id": 2 + }, + "languageCode": { + "type": "string", + "id": 3 + }, + "enableWordInfo": { + "type": "bool", + "id": 13 + }, + "phraseHints": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "deprecated": true + } + }, + "speechContexts": { + "rule": "repeated", + "type": "SpeechContext", + "id": 11 + }, + "model": { + "type": "string", + "id": 7 + }, + "modelVariant": { + "type": "SpeechModelVariant", + "id": 10 + }, + "singleUtterance": { + "type": "bool", + "id": 8 + }, + "disableNoSpeechRecognizedEvent": { + "type": "bool", + "id": 14 + } + } + }, + "SsmlVoiceGender": { + "values": { + "SSML_VOICE_GENDER_UNSPECIFIED": 0, + "SSML_VOICE_GENDER_MALE": 1, + "SSML_VOICE_GENDER_FEMALE": 2, + "SSML_VOICE_GENDER_NEUTRAL": 3 + } + }, + "VoiceSelectionParams": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "ssmlGender": { + "type": "SsmlVoiceGender", + "id": 2 + } + } + }, + "SynthesizeSpeechConfig": { + "fields": { + "speakingRate": { + "type": "double", + "id": 1 + }, + "pitch": { + "type": "double", + "id": 2 + }, + "volumeGainDb": { + "type": "double", + "id": 3 + }, + "effectsProfileId": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "voice": { + "type": "VoiceSelectionParams", + "id": 4 + } + } + }, + "OutputAudioEncoding": { + "values": { + "OUTPUT_AUDIO_ENCODING_UNSPECIFIED": 0, + "OUTPUT_AUDIO_ENCODING_LINEAR_16": 1, + "OUTPUT_AUDIO_ENCODING_MP3": 2, + "OUTPUT_AUDIO_ENCODING_MP3_64_KBPS": 4, + "OUTPUT_AUDIO_ENCODING_OGG_OPUS": 3, + "OUTPUT_AUDIO_ENCODING_MULAW": 5 + } + }, + "OutputAudioConfig": { + "fields": { + "audioEncoding": { + "type": "OutputAudioEncoding", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sampleRateHertz": { + "type": "int32", + "id": 2 + }, + "synthesizeSpeechConfig": { + "type": "SynthesizeSpeechConfig", + "id": 3 + } + } + }, + "TelephonyDtmf": { + "values": { + "TELEPHONY_DTMF_UNSPECIFIED": 0, + "DTMF_ONE": 1, + "DTMF_TWO": 2, + "DTMF_THREE": 3, + "DTMF_FOUR": 4, + "DTMF_FIVE": 5, + "DTMF_SIX": 6, + "DTMF_SEVEN": 7, + "DTMF_EIGHT": 8, + "DTMF_NINE": 9, + "DTMF_ZERO": 10, + "DTMF_A": 11, + "DTMF_B": 12, + "DTMF_C": 13, + "DTMF_D": 14, + "DTMF_STAR": 15, + "DTMF_POUND": 16 + } + }, + "TelephonyDtmfEvents": { + "fields": { + "dtmfEvents": { + "rule": "repeated", + "type": "TelephonyDtmf", + "id": 1 + } + } + }, + "SpeechToTextConfig": { + "fields": { + "speechModelVariant": { + "type": "SpeechModelVariant", + "id": 1 + }, + "model": { + "type": "string", + "id": 2 + } + } + }, + "Sessions": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "DetectIntent": { + "requestType": "DetectIntentRequest", + "responseType": "DetectIntentResponse", + "options": { + "(google.api.http).post": "/v2beta1/{session=projects/*/agent/sessions/*}:detectIntent", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "session,query_input" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{session=projects/*/agent/sessions/*}:detectIntent", + "body": "*", + "additional_bindings": [ + { + "post": "/v2beta1/{session=projects/*/agent/environments/*/users/*/sessions/*}:detectIntent", + "body": "*" + }, + { + "post": "/v2beta1/{session=projects/*/locations/*/agent/sessions/*}:detectIntent", + "body": "*" + }, + { + "post": "/v2beta1/{session=projects/*/locations/*/agent/environments/*/users/*/sessions/*}:detectIntent", + "body": "*" + } + ] + } + }, + { + "(google.api.method_signature)": "session,query_input" + } + ] + }, + "StreamingDetectIntent": { + "requestType": "StreamingDetectIntentRequest", + "requestStream": true, + "responseType": "StreamingDetectIntentResponse", + "responseStream": true + } + } + }, + "DetectIntentRequest": { + "fields": { + "session": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Session" + } + }, + "queryParams": { + "type": "QueryParameters", + "id": 2 + }, + "queryInput": { + "type": "QueryInput", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 4 + }, + "outputAudioConfigMask": { + "type": "google.protobuf.FieldMask", + "id": 7 + }, + "inputAudio": { + "type": "bytes", + "id": 5 + } + } + }, + "DetectIntentResponse": { + "fields": { + "responseId": { + "type": "string", + "id": 1 + }, + "queryResult": { + "type": "QueryResult", + "id": 2 + }, + "alternativeQueryResults": { + "rule": "repeated", + "type": "QueryResult", + "id": 5 + }, + "webhookStatus": { + "type": "google.rpc.Status", + "id": 3 + }, + "outputAudio": { + "type": "bytes", + "id": 4 + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 6 + } + } + }, + "QueryParameters": { + "fields": { + "timeZone": { + "type": "string", + "id": 1 + }, + "geoLocation": { + "type": "google.type.LatLng", + "id": 2 + }, + "contexts": { + "rule": "repeated", + "type": "Context", + "id": 3 + }, + "resetContexts": { + "type": "bool", + "id": 4 + }, + "sessionEntityTypes": { + "rule": "repeated", + "type": "SessionEntityType", + "id": 5 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 6 + }, + "knowledgeBaseNames": { + "rule": "repeated", + "type": "string", + "id": 12 + }, + "sentimentAnalysisRequestConfig": { + "type": "SentimentAnalysisRequestConfig", + "id": 10 + }, + "subAgents": { + "rule": "repeated", + "type": "SubAgent", + "id": 13 + }, + "webhookHeaders": { + "keyType": "string", + "type": "string", + "id": 14 + } + } + }, + "QueryInput": { + "oneofs": { + "input": { + "oneof": [ + "audioConfig", + "text", + "event", + "dtmf" + ] + } + }, + "fields": { + "audioConfig": { + "type": "InputAudioConfig", + "id": 1 + }, + "text": { + "type": "TextInput", + "id": 2 + }, + "event": { + "type": "EventInput", + "id": 3 + }, + "dtmf": { + "type": "TelephonyDtmfEvents", + "id": 4 + } + } + }, + "QueryResult": { + "fields": { + "queryText": { + "type": "string", + "id": 1 + }, + "languageCode": { + "type": "string", + "id": 15 + }, + "speechRecognitionConfidence": { + "type": "float", + "id": 2 + }, + "action": { + "type": "string", + "id": 3 + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 4 + }, + "allRequiredParamsPresent": { + "type": "bool", + "id": 5 + }, + "cancelsSlotFilling": { + "type": "bool", + "id": 21 + }, + "fulfillmentText": { + "type": "string", + "id": 6 + }, + "fulfillmentMessages": { + "rule": "repeated", + "type": "Intent.Message", + "id": 7 + }, + "webhookSource": { + "type": "string", + "id": 8 + }, + "webhookPayload": { + "type": "google.protobuf.Struct", + "id": 9 + }, + "outputContexts": { + "rule": "repeated", + "type": "Context", + "id": 10 + }, + "intent": { + "type": "Intent", + "id": 11 + }, + "intentDetectionConfidence": { + "type": "float", + "id": 12 + }, + "diagnosticInfo": { + "type": "google.protobuf.Struct", + "id": 14 + }, + "sentimentAnalysisResult": { + "type": "SentimentAnalysisResult", + "id": 17 + }, + "knowledgeAnswers": { + "type": "KnowledgeAnswers", + "id": 18 + } + } + }, + "KnowledgeAnswers": { + "fields": { + "answers": { + "rule": "repeated", + "type": "Answer", + "id": 1 + } + }, + "nested": { + "Answer": { + "fields": { + "source": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + }, + "faqQuestion": { + "type": "string", + "id": 2 + }, + "answer": { + "type": "string", + "id": 3 + }, + "matchConfidenceLevel": { + "type": "MatchConfidenceLevel", + "id": 4 + }, + "matchConfidence": { + "type": "float", + "id": 5 + } + }, + "nested": { + "MatchConfidenceLevel": { + "values": { + "MATCH_CONFIDENCE_LEVEL_UNSPECIFIED": 0, + "LOW": 1, + "MEDIUM": 2, + "HIGH": 3 + } + } + } + } + } + }, + "StreamingDetectIntentRequest": { + "fields": { + "session": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Session" + } + }, + "queryParams": { + "type": "QueryParameters", + "id": 2 + }, + "queryInput": { + "type": "QueryInput", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "singleUtterance": { + "type": "bool", + "id": 4, + "options": { + "deprecated": true + } + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 5 + }, + "outputAudioConfigMask": { + "type": "google.protobuf.FieldMask", + "id": 7 + }, + "inputAudio": { + "type": "bytes", + "id": 6 + } + } + }, + "StreamingDetectIntentResponse": { + "fields": { + "responseId": { + "type": "string", + "id": 1 + }, + "recognitionResult": { + "type": "StreamingRecognitionResult", + "id": 2 + }, + "queryResult": { + "type": "QueryResult", + "id": 3 + }, + "alternativeQueryResults": { + "rule": "repeated", + "type": "QueryResult", + "id": 7 + }, + "webhookStatus": { + "type": "google.rpc.Status", + "id": 4 + }, + "outputAudio": { + "type": "bytes", + "id": 5 + }, + "outputAudioConfig": { + "type": "OutputAudioConfig", + "id": 6 + } + } + }, + "StreamingRecognitionResult": { + "fields": { + "messageType": { + "type": "MessageType", + "id": 1 + }, + "transcript": { + "type": "string", + "id": 2 + }, + "isFinal": { + "type": "bool", + "id": 3 + }, + "confidence": { + "type": "float", + "id": 4 + }, + "stability": { + "type": "float", + "id": 6 + }, + "speechWordInfo": { + "rule": "repeated", + "type": "SpeechWordInfo", + "id": 7 + }, + "speechEndOffset": { + "type": "google.protobuf.Duration", + "id": 8 + }, + "languageCode": { + "type": "string", + "id": 10 + }, + "dtmfDigits": { + "type": "TelephonyDtmfEvents", + "id": 5 + } + }, + "nested": { + "MessageType": { + "values": { + "MESSAGE_TYPE_UNSPECIFIED": 0, + "TRANSCRIPT": 1, + "DTMF_DIGITS": 3, + "END_OF_SINGLE_UTTERANCE": 2, + "PARTIAL_DTMF_DIGITS": 4 + } + } + } + }, + "TextInput": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "languageCode": { + "type": "string", + "id": 2 + } + } + }, + "EventInput": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 2 + }, + "languageCode": { + "type": "string", + "id": 3 + } + } + }, + "SentimentAnalysisRequestConfig": { + "fields": { + "analyzeQueryTextSentiment": { + "type": "bool", + "id": 1 + } + } + }, + "SentimentAnalysisResult": { + "fields": { + "queryTextSentiment": { + "type": "Sentiment", + "id": 1 + } + } + }, + "Sentiment": { + "fields": { + "score": { + "type": "float", + "id": 1 + }, + "magnitude": { + "type": "float", + "id": 2 + } + } + }, + "Contexts": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListContexts": { + "requestType": "ListContextsRequest", + "responseType": "ListContextsResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts", + "additional_bindings": [ + { + "get": "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + }, + { + "get": "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + }, + { + "get": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetContext": { + "requestType": "GetContextRequest", + "responseType": "Context", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}", + "additional_bindings": [ + { + "get": "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + }, + { + "get": "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + }, + { + "get": "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateContext": { + "requestType": "CreateContextRequest", + "responseType": "Context", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts", + "(google.api.http).body": "context", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts", + "(google.api.http).additional_bindings.body": "context", + "(google.api.method_signature)": "parent,context" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts", + "body": "context", + "additional_bindings": [ + { + "post": "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts", + "body": "context" + }, + { + "post": "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts", + "body": "context" + }, + { + "post": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts", + "body": "context" + } + ] + } + }, + { + "(google.api.method_signature)": "parent,context" + } + ] + }, + "UpdateContext": { + "requestType": "UpdateContextRequest", + "responseType": "Context", + "options": { + "(google.api.http).patch": "/v2beta1/{context.name=projects/*/agent/sessions/*/contexts/*}", + "(google.api.http).body": "context", + "(google.api.http).additional_bindings.patch": "/v2beta1/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "(google.api.http).additional_bindings.body": "context", + "(google.api.method_signature)": "context" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{context.name=projects/*/agent/sessions/*/contexts/*}", + "body": "context", + "additional_bindings": [ + { + "patch": "/v2beta1/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "body": "context" + }, + { + "patch": "/v2beta1/{context.name=projects/*/locations/*/agent/sessions/*/contexts/*}", + "body": "context" + }, + { + "patch": "/v2beta1/{context.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "body": "context" + } + ] + } + }, + { + "(google.api.method_signature)": "context,update_mask" + }, + { + "(google.api.method_signature)": "context" + } + ] + }, + "DeleteContext": { + "requestType": "DeleteContextRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}", + "(google.api.http).additional_bindings.delete": "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}", + "additional_bindings": [ + { + "delete": "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}" + }, + { + "delete": "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/contexts/*}" + }, + { + "delete": "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/contexts/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "DeleteAllContexts": { + "requestType": "DeleteAllContextsRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts", + "(google.api.http).additional_bindings.delete": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts", + "additional_bindings": [ + { + "delete": "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts" + }, + { + "delete": "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/contexts" + }, + { + "delete": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/contexts" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "Context": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Context", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "lifespanCount": { + "type": "int32", + "id": 2 + }, + "parameters": { + "type": "google.protobuf.Struct", + "id": 3 + } + } + }, + "ListContextsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Context" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListContextsResponse": { + "fields": { + "contexts": { + "rule": "repeated", + "type": "Context", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetContextRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Context" + } + } + } + }, + "CreateContextRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Context" + } + }, + "context": { + "type": "Context", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateContextRequest": { + "fields": { + "context": { + "type": "Context", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteContextRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Context" + } + } + } + }, + "DeleteAllContextsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Context" + } + } + } + }, + "Intents": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListIntents": { + "requestType": "ListIntentsRequest", + "responseType": "ListIntentsResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/agent}/intents", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/intents", + "(google.api.method_signature)": "parent,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/agent}/intents", + "additional_bindings": [ + { + "get": "/v2beta1/{parent=projects/*/locations/*/agent}/intents" + }, + { + "get": "/v2beta1/{parent=projects/*/agent/environments/*}/intents" + }, + { + "get": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/intents" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + }, + { + "(google.api.method_signature)": "parent,language_code" + } + ] + }, + "GetIntent": { + "requestType": "GetIntentRequest", + "responseType": "Intent", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/agent/intents/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/agent/intents/*}", + "(google.api.method_signature)": "name,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/agent/intents/*}", + "additional_bindings": { + "get": "/v2beta1/{name=projects/*/locations/*/agent/intents/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.api.method_signature)": "name,language_code" + } + ] + }, + "CreateIntent": { + "requestType": "CreateIntentRequest", + "responseType": "Intent", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent}/intents", + "(google.api.http).body": "intent", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent}/intents", + "(google.api.http).additional_bindings.body": "intent", + "(google.api.method_signature)": "parent,intent,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent}/intents", + "body": "intent", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent}/intents", + "body": "intent" + } + } + }, + { + "(google.api.method_signature)": "parent,intent" + }, + { + "(google.api.method_signature)": "parent,intent,language_code" + } + ] + }, + "UpdateIntent": { + "requestType": "UpdateIntentRequest", + "responseType": "Intent", + "options": { + "(google.api.http).patch": "/v2beta1/{intent.name=projects/*/agent/intents/*}", + "(google.api.http).body": "intent", + "(google.api.http).additional_bindings.patch": "/v2beta1/{intent.name=projects/*/locations/*/agent/intents/*}", + "(google.api.http).additional_bindings.body": "intent", + "(google.api.method_signature)": "intent,language_code,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{intent.name=projects/*/agent/intents/*}", + "body": "intent", + "additional_bindings": { + "patch": "/v2beta1/{intent.name=projects/*/locations/*/agent/intents/*}", + "body": "intent" + } + } + }, + { + "(google.api.method_signature)": "intent,update_mask" + }, + { + "(google.api.method_signature)": "intent" + }, + { + "(google.api.method_signature)": "intent,language_code" + }, + { + "(google.api.method_signature)": "intent,language_code,update_mask" + } + ] + }, + "DeleteIntent": { + "requestType": "DeleteIntentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{name=projects/*/agent/intents/*}", + "(google.api.http).additional_bindings.delete": "/v2beta1/{name=projects/*/locations/*/agent/intents/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{name=projects/*/agent/intents/*}", + "additional_bindings": { + "delete": "/v2beta1/{name=projects/*/locations/*/agent/intents/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "BatchUpdateIntents": { + "requestType": "BatchUpdateIntentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent}/intents:batchUpdate", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchUpdate", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,intent_batch_inline", + "(google.longrunning.operation_info).response_type": "google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent}/intents:batchUpdate", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchUpdate", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,intent_batch_uri" + }, + { + "(google.api.method_signature)": "parent,intent_batch_inline" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchDeleteIntents": { + "requestType": "BatchDeleteIntentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent}/intents:batchDelete", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchDelete", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,intents", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent}/intents:batchDelete", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent}/intents:batchDelete", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,intents" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + } + } + }, + "Intent": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Intent", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/intents/{intent}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "webhookState": { + "type": "WebhookState", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "priority": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "isFallback": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mlEnabled": { + "type": "bool", + "id": 5, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mlDisabled": { + "type": "bool", + "id": 19, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "liveAgentHandoff": { + "type": "bool", + "id": 20, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "endInteraction": { + "type": "bool", + "id": 21, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "inputContextNames": { + "rule": "repeated", + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "events": { + "rule": "repeated", + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "trainingPhrases": { + "rule": "repeated", + "type": "TrainingPhrase", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "action": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "outputContexts": { + "rule": "repeated", + "type": "Context", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "resetContexts": { + "type": "bool", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "parameters": { + "rule": "repeated", + "type": "Parameter", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "messages": { + "rule": "repeated", + "type": "Message", + "id": 14 + }, + "defaultResponsePlatforms": { + "rule": "repeated", + "type": "Message.Platform", + "id": 15, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "rootFollowupIntentName": { + "type": "string", + "id": 16, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "parentFollowupIntentName": { + "type": "string", + "id": 17, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "followupIntentInfo": { + "rule": "repeated", + "type": "FollowupIntentInfo", + "id": 18, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "WebhookState": { + "values": { + "WEBHOOK_STATE_UNSPECIFIED": 0, + "WEBHOOK_STATE_ENABLED": 1, + "WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING": 2 + } + }, + "TrainingPhrase": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "Type", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "parts": { + "rule": "repeated", + "type": "Part", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "timesAddedCount": { + "type": "int32", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Type": { + "valuesOptions": { + "TEMPLATE": { + "deprecated": true + } + }, + "values": { + "TYPE_UNSPECIFIED": 0, + "EXAMPLE": 1, + "TEMPLATE": 2 + } + }, + "Part": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "entityType": { + "type": "string", + "id": 2 + }, + "alias": { + "type": "string", + "id": 3 + }, + "userDefined": { + "type": "bool", + "id": 4 + } + } + } + } + }, + "Parameter": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2 + }, + "value": { + "type": "string", + "id": 3 + }, + "defaultValue": { + "type": "string", + "id": 4 + }, + "entityTypeDisplayName": { + "type": "string", + "id": 5 + }, + "mandatory": { + "type": "bool", + "id": 6 + }, + "prompts": { + "rule": "repeated", + "type": "string", + "id": 7 + }, + "isList": { + "type": "bool", + "id": 8 + } + } + }, + "Message": { + "oneofs": { + "message": { + "oneof": [ + "text", + "image", + "quickReplies", + "card", + "payload", + "simpleResponses", + "basicCard", + "suggestions", + "linkOutSuggestion", + "listSelect", + "carouselSelect", + "telephonyPlayAudio", + "telephonySynthesizeSpeech", + "telephonyTransferCall", + "rbmText", + "rbmStandaloneRichCard", + "rbmCarouselRichCard", + "browseCarouselCard", + "tableCard", + "mediaContent" + ] + } + }, + "fields": { + "text": { + "type": "Text", + "id": 1 + }, + "image": { + "type": "Image", + "id": 2 + }, + "quickReplies": { + "type": "QuickReplies", + "id": 3 + }, + "card": { + "type": "Card", + "id": 4 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 5 + }, + "simpleResponses": { + "type": "SimpleResponses", + "id": 7 + }, + "basicCard": { + "type": "BasicCard", + "id": 8 + }, + "suggestions": { + "type": "Suggestions", + "id": 9 + }, + "linkOutSuggestion": { + "type": "LinkOutSuggestion", + "id": 10 + }, + "listSelect": { + "type": "ListSelect", + "id": 11 + }, + "carouselSelect": { + "type": "CarouselSelect", + "id": 12 + }, + "telephonyPlayAudio": { + "type": "TelephonyPlayAudio", + "id": 13 + }, + "telephonySynthesizeSpeech": { + "type": "TelephonySynthesizeSpeech", + "id": 14 + }, + "telephonyTransferCall": { + "type": "TelephonyTransferCall", + "id": 15 + }, + "rbmText": { + "type": "RbmText", + "id": 18 + }, + "rbmStandaloneRichCard": { + "type": "RbmStandaloneCard", + "id": 19 + }, + "rbmCarouselRichCard": { + "type": "RbmCarouselCard", + "id": 20 + }, + "browseCarouselCard": { + "type": "BrowseCarouselCard", + "id": 22 + }, + "tableCard": { + "type": "TableCard", + "id": 23 + }, + "mediaContent": { + "type": "MediaContent", + "id": 24 + }, + "platform": { + "type": "Platform", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Platform": { + "values": { + "PLATFORM_UNSPECIFIED": 0, + "FACEBOOK": 1, + "SLACK": 2, + "TELEGRAM": 3, + "KIK": 4, + "SKYPE": 5, + "LINE": 6, + "VIBER": 7, + "ACTIONS_ON_GOOGLE": 8, + "TELEPHONY": 10, + "GOOGLE_HANGOUTS": 11 + } + }, + "Text": { + "fields": { + "text": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Image": { + "fields": { + "imageUri": { + "type": "string", + "id": 1 + }, + "accessibilityText": { + "type": "string", + "id": 2 + } + } + }, + "QuickReplies": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "quickReplies": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "Card": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "subtitle": { + "type": "string", + "id": 2 + }, + "imageUri": { + "type": "string", + "id": 3 + }, + "buttons": { + "rule": "repeated", + "type": "Button", + "id": 4 + } + }, + "nested": { + "Button": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "postback": { + "type": "string", + "id": 2 + } + } + } + } + }, + "SimpleResponse": { + "fields": { + "textToSpeech": { + "type": "string", + "id": 1 + }, + "ssml": { + "type": "string", + "id": 2 + }, + "displayText": { + "type": "string", + "id": 3 + } + } + }, + "SimpleResponses": { + "fields": { + "simpleResponses": { + "rule": "repeated", + "type": "SimpleResponse", + "id": 1 + } + } + }, + "BasicCard": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "subtitle": { + "type": "string", + "id": 2 + }, + "formattedText": { + "type": "string", + "id": 3 + }, + "image": { + "type": "Image", + "id": 4 + }, + "buttons": { + "rule": "repeated", + "type": "Button", + "id": 5 + } + }, + "nested": { + "Button": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "openUriAction": { + "type": "OpenUriAction", + "id": 2 + } + }, + "nested": { + "OpenUriAction": { + "fields": { + "uri": { + "type": "string", + "id": 1 + } + } + } + } + } + } + }, + "Suggestion": { + "fields": { + "title": { + "type": "string", + "id": 1 + } + } + }, + "Suggestions": { + "fields": { + "suggestions": { + "rule": "repeated", + "type": "Suggestion", + "id": 1 + } + } + }, + "LinkOutSuggestion": { + "fields": { + "destinationName": { + "type": "string", + "id": 1 + }, + "uri": { + "type": "string", + "id": 2 + } + } + }, + "ListSelect": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "Item", + "id": 2 + }, + "subtitle": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Item": { + "fields": { + "info": { + "type": "SelectItemInfo", + "id": 1 + }, + "title": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + }, + "image": { + "type": "Image", + "id": 4 + } + } + } + } + }, + "CarouselSelect": { + "fields": { + "items": { + "rule": "repeated", + "type": "Item", + "id": 1 + } + }, + "nested": { + "Item": { + "fields": { + "info": { + "type": "SelectItemInfo", + "id": 1 + }, + "title": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + }, + "image": { + "type": "Image", + "id": 4 + } + } + } + } + }, + "SelectItemInfo": { + "fields": { + "key": { + "type": "string", + "id": 1 + }, + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "TelephonyPlayAudio": { + "fields": { + "audioUri": { + "type": "string", + "id": 1 + } + } + }, + "TelephonySynthesizeSpeech": { + "oneofs": { + "source": { + "oneof": [ + "text", + "ssml" + ] + } + }, + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "ssml": { + "type": "string", + "id": 2 + } + } + }, + "TelephonyTransferCall": { + "fields": { + "phoneNumber": { + "type": "string", + "id": 1 + } + } + }, + "RbmText": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "rbmSuggestion": { + "rule": "repeated", + "type": "RbmSuggestion", + "id": 2 + } + } + }, + "RbmCarouselCard": { + "fields": { + "cardWidth": { + "type": "CardWidth", + "id": 1 + }, + "cardContents": { + "rule": "repeated", + "type": "RbmCardContent", + "id": 2 + } + }, + "nested": { + "CardWidth": { + "values": { + "CARD_WIDTH_UNSPECIFIED": 0, + "SMALL": 1, + "MEDIUM": 2 + } + } + } + }, + "RbmStandaloneCard": { + "fields": { + "cardOrientation": { + "type": "CardOrientation", + "id": 1 + }, + "thumbnailImageAlignment": { + "type": "ThumbnailImageAlignment", + "id": 2 + }, + "cardContent": { + "type": "RbmCardContent", + "id": 3 + } + }, + "nested": { + "CardOrientation": { + "values": { + "CARD_ORIENTATION_UNSPECIFIED": 0, + "HORIZONTAL": 1, + "VERTICAL": 2 + } + }, + "ThumbnailImageAlignment": { + "values": { + "THUMBNAIL_IMAGE_ALIGNMENT_UNSPECIFIED": 0, + "LEFT": 1, + "RIGHT": 2 + } + } + } + }, + "RbmCardContent": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "media": { + "type": "RbmMedia", + "id": 3 + }, + "suggestions": { + "rule": "repeated", + "type": "RbmSuggestion", + "id": 4 + } + }, + "nested": { + "RbmMedia": { + "fields": { + "fileUri": { + "type": "string", + "id": 1 + }, + "thumbnailUri": { + "type": "string", + "id": 2 + }, + "height": { + "type": "Height", + "id": 3 + } + }, + "nested": { + "Height": { + "values": { + "HEIGHT_UNSPECIFIED": 0, + "SHORT": 1, + "MEDIUM": 2, + "TALL": 3 + } + } + } + } + } + }, + "RbmSuggestion": { + "oneofs": { + "suggestion": { + "oneof": [ + "reply", + "action" + ] + } + }, + "fields": { + "reply": { + "type": "RbmSuggestedReply", + "id": 1 + }, + "action": { + "type": "RbmSuggestedAction", + "id": 2 + } + } + }, + "RbmSuggestedReply": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "postbackData": { + "type": "string", + "id": 2 + } + } + }, + "RbmSuggestedAction": { + "oneofs": { + "action": { + "oneof": [ + "dial", + "openUrl", + "shareLocation" + ] + } + }, + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "postbackData": { + "type": "string", + "id": 2 + }, + "dial": { + "type": "RbmSuggestedActionDial", + "id": 3 + }, + "openUrl": { + "type": "RbmSuggestedActionOpenUri", + "id": 4 + }, + "shareLocation": { + "type": "RbmSuggestedActionShareLocation", + "id": 5 + } + }, + "nested": { + "RbmSuggestedActionDial": { + "fields": { + "phoneNumber": { + "type": "string", + "id": 1 + } + } + }, + "RbmSuggestedActionOpenUri": { + "fields": { + "uri": { + "type": "string", + "id": 1 + } + } + }, + "RbmSuggestedActionShareLocation": { + "fields": {} + } + } + }, + "MediaContent": { + "fields": { + "mediaType": { + "type": "ResponseMediaType", + "id": 1 + }, + "mediaObjects": { + "rule": "repeated", + "type": "ResponseMediaObject", + "id": 2 + } + }, + "nested": { + "ResponseMediaType": { + "values": { + "RESPONSE_MEDIA_TYPE_UNSPECIFIED": 0, + "AUDIO": 1 + } + }, + "ResponseMediaObject": { + "oneofs": { + "image": { + "oneof": [ + "largeImage", + "icon" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "largeImage": { + "type": "Image", + "id": 3 + }, + "icon": { + "type": "Image", + "id": 4 + }, + "contentUrl": { + "type": "string", + "id": 5 + } + } + } + } + }, + "BrowseCarouselCard": { + "fields": { + "items": { + "rule": "repeated", + "type": "BrowseCarouselCardItem", + "id": 1 + }, + "imageDisplayOptions": { + "type": "ImageDisplayOptions", + "id": 2 + } + }, + "nested": { + "BrowseCarouselCardItem": { + "fields": { + "openUriAction": { + "type": "OpenUrlAction", + "id": 1 + }, + "title": { + "type": "string", + "id": 2 + }, + "description": { + "type": "string", + "id": 3 + }, + "image": { + "type": "Image", + "id": 4 + }, + "footer": { + "type": "string", + "id": 5 + } + }, + "nested": { + "OpenUrlAction": { + "fields": { + "url": { + "type": "string", + "id": 1 + }, + "urlTypeHint": { + "type": "UrlTypeHint", + "id": 3 + } + }, + "nested": { + "UrlTypeHint": { + "values": { + "URL_TYPE_HINT_UNSPECIFIED": 0, + "AMP_ACTION": 1, + "AMP_CONTENT": 2 + } + } + } + } + } + }, + "ImageDisplayOptions": { + "values": { + "IMAGE_DISPLAY_OPTIONS_UNSPECIFIED": 0, + "GRAY": 1, + "WHITE": 2, + "CROPPED": 3, + "BLURRED_BACKGROUND": 4 + } + } + } + }, + "TableCard": { + "fields": { + "title": { + "type": "string", + "id": 1 + }, + "subtitle": { + "type": "string", + "id": 2 + }, + "image": { + "type": "Image", + "id": 3 + }, + "columnProperties": { + "rule": "repeated", + "type": "ColumnProperties", + "id": 4 + }, + "rows": { + "rule": "repeated", + "type": "TableCardRow", + "id": 5 + }, + "buttons": { + "rule": "repeated", + "type": "BasicCard.Button", + "id": 6 + } + } + }, + "ColumnProperties": { + "fields": { + "header": { + "type": "string", + "id": 1 + }, + "horizontalAlignment": { + "type": "HorizontalAlignment", + "id": 2 + } + }, + "nested": { + "HorizontalAlignment": { + "values": { + "HORIZONTAL_ALIGNMENT_UNSPECIFIED": 0, + "LEADING": 1, + "CENTER": 2, + "TRAILING": 3 + } + } + } + }, + "TableCardRow": { + "fields": { + "cells": { + "rule": "repeated", + "type": "TableCardCell", + "id": 1 + }, + "dividerAfter": { + "type": "bool", + "id": 2 + } + } + }, + "TableCardCell": { + "fields": { + "text": { + "type": "string", + "id": 1 + } + } + } + } + }, + "FollowupIntentInfo": { + "fields": { + "followupIntentName": { + "type": "string", + "id": 1 + }, + "parentFollowupIntentName": { + "type": "string", + "id": 2 + } + } + } + } + }, + "ListIntentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "intentView": { + "type": "IntentView", + "id": 3 + }, + "pageSize": { + "type": "int32", + "id": 4 + }, + "pageToken": { + "type": "string", + "id": 5 + } + } + }, + "ListIntentsResponse": { + "fields": { + "intents": { + "rule": "repeated", + "type": "Intent", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetIntentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "intentView": { + "type": "IntentView", + "id": 3 + } + } + }, + "CreateIntentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "intent": { + "type": "Intent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "intentView": { + "type": "IntentView", + "id": 4 + } + } + }, + "UpdateIntentRequest": { + "fields": { + "intent": { + "type": "Intent", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3 + }, + "intentView": { + "type": "IntentView", + "id": 4 + } + } + }, + "DeleteIntentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Intent" + } + } + } + }, + "BatchUpdateIntentsRequest": { + "oneofs": { + "intentBatch": { + "oneof": [ + "intentBatchUri", + "intentBatchInline" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "intentBatchUri": { + "type": "string", + "id": 2 + }, + "intentBatchInline": { + "type": "IntentBatch", + "id": 3 + }, + "languageCode": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 5 + }, + "intentView": { + "type": "IntentView", + "id": 6 + } + } + }, + "BatchUpdateIntentsResponse": { + "fields": { + "intents": { + "rule": "repeated", + "type": "Intent", + "id": 1 + } + } + }, + "BatchDeleteIntentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Intent" + } + }, + "intents": { + "rule": "repeated", + "type": "Intent", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "IntentView": { + "values": { + "INTENT_VIEW_UNSPECIFIED": 0, + "INTENT_VIEW_FULL": 1 + } + }, + "IntentBatch": { + "fields": { + "intents": { + "rule": "repeated", + "type": "Intent", + "id": 1 + } + } + }, + "SessionEntityTypes": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListSessionEntityTypes": { + "requestType": "ListSessionEntityTypesRequest", + "responseType": "ListSessionEntityTypesResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes", + "additional_bindings": [ + { + "get": "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes" + }, + { + "get": "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes" + }, + { + "get": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetSessionEntityType": { + "requestType": "GetSessionEntityTypeRequest", + "responseType": "SessionEntityType", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}", + "additional_bindings": [ + { + "get": "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + }, + { + "get": "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + }, + { + "get": "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateSessionEntityType": { + "requestType": "CreateSessionEntityTypeRequest", + "responseType": "SessionEntityType", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes", + "(google.api.http).body": "session_entity_type", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes", + "(google.api.http).additional_bindings.body": "session_entity_type", + "(google.api.method_signature)": "parent,session_entity_type" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent/sessions/*}/entityTypes", + "body": "session_entity_type", + "additional_bindings": [ + { + "post": "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/entityTypes", + "body": "session_entity_type" + }, + { + "post": "/v2beta1/{parent=projects/*/locations/*/agent/sessions/*}/entityTypes", + "body": "session_entity_type" + }, + { + "post": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*/users/*/sessions/*}/entityTypes", + "body": "session_entity_type" + } + ] + } + }, + { + "(google.api.method_signature)": "parent,session_entity_type" + } + ] + }, + "UpdateSessionEntityType": { + "requestType": "UpdateSessionEntityTypeRequest", + "responseType": "SessionEntityType", + "options": { + "(google.api.http).patch": "/v2beta1/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}", + "(google.api.http).body": "session_entity_type", + "(google.api.http).additional_bindings.patch": "/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "(google.api.http).additional_bindings.body": "session_entity_type", + "(google.api.method_signature)": "session_entity_type,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{session_entity_type.name=projects/*/agent/sessions/*/entityTypes/*}", + "body": "session_entity_type", + "additional_bindings": [ + { + "patch": "/v2beta1/{session_entity_type.name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "body": "session_entity_type" + }, + { + "patch": "/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/sessions/*/entityTypes/*}", + "body": "session_entity_type" + }, + { + "patch": "/v2beta1/{session_entity_type.name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "body": "session_entity_type" + } + ] + } + }, + { + "(google.api.method_signature)": "session_entity_type" + }, + { + "(google.api.method_signature)": "session_entity_type,update_mask" + } + ] + }, + "DeleteSessionEntityType": { + "requestType": "DeleteSessionEntityTypeRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}", + "(google.api.http).additional_bindings.delete": "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{name=projects/*/agent/sessions/*/entityTypes/*}", + "additional_bindings": [ + { + "delete": "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + }, + { + "delete": "/v2beta1/{name=projects/*/locations/*/agent/sessions/*/entityTypes/*}" + }, + { + "delete": "/v2beta1/{name=projects/*/locations/*/agent/environments/*/users/*/sessions/*/entityTypes/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "SessionEntityType": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/SessionEntityType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "entityOverrideMode": { + "type": "EntityOverrideMode", + "id": 2 + }, + "entities": { + "rule": "repeated", + "type": "EntityType.Entity", + "id": 3 + } + }, + "nested": { + "EntityOverrideMode": { + "values": { + "ENTITY_OVERRIDE_MODE_UNSPECIFIED": 0, + "ENTITY_OVERRIDE_MODE_OVERRIDE": 1, + "ENTITY_OVERRIDE_MODE_SUPPLEMENT": 2 + } + } + } + }, + "ListSessionEntityTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/SessionEntityType" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListSessionEntityTypesResponse": { + "fields": { + "sessionEntityTypes": { + "rule": "repeated", + "type": "SessionEntityType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetSessionEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/SessionEntityType" + } + } + } + }, + "CreateSessionEntityTypeRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/SessionEntityType" + } + }, + "sessionEntityType": { + "type": "SessionEntityType", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateSessionEntityTypeRequest": { + "fields": { + "sessionEntityType": { + "type": "SessionEntityType", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteSessionEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/SessionEntityType" + } + } + } + }, + "EntityTypes": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListEntityTypes": { + "requestType": "ListEntityTypesRequest", + "responseType": "ListEntityTypesResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/agent}/entityTypes", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes", + "(google.api.method_signature)": "parent,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/agent}/entityTypes", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes" + } + } + }, + { + "(google.api.method_signature)": "parent" + }, + { + "(google.api.method_signature)": "parent,language_code" + } + ] + }, + "GetEntityType": { + "requestType": "GetEntityTypeRequest", + "responseType": "EntityType", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/agent/entityTypes/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}", + "(google.api.method_signature)": "name,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/agent/entityTypes/*}", + "additional_bindings": { + "get": "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.api.method_signature)": "name,language_code" + } + ] + }, + "CreateEntityType": { + "requestType": "CreateEntityTypeRequest", + "responseType": "EntityType", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent}/entityTypes", + "(google.api.http).body": "entity_type", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes", + "(google.api.http).additional_bindings.body": "entity_type", + "(google.api.method_signature)": "parent,entity_type,language_code" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent}/entityTypes", + "body": "entity_type", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes", + "body": "entity_type" + } + } + }, + { + "(google.api.method_signature)": "parent,entity_type" + }, + { + "(google.api.method_signature)": "parent,entity_type,language_code" + } + ] + }, + "UpdateEntityType": { + "requestType": "UpdateEntityTypeRequest", + "responseType": "EntityType", + "options": { + "(google.api.http).patch": "/v2beta1/{entity_type.name=projects/*/agent/entityTypes/*}", + "(google.api.http).body": "entity_type", + "(google.api.http).additional_bindings.patch": "/v2beta1/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}", + "(google.api.http).additional_bindings.body": "entity_type", + "(google.api.method_signature)": "entity_type,language_code,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{entity_type.name=projects/*/agent/entityTypes/*}", + "body": "entity_type", + "additional_bindings": { + "patch": "/v2beta1/{entity_type.name=projects/*/locations/*/agent/entityTypes/*}", + "body": "entity_type" + } + } + }, + { + "(google.api.method_signature)": "entity_type" + }, + { + "(google.api.method_signature)": "entity_type,language_code" + }, + { + "(google.api.method_signature)": "entity_type,language_code,update_mask" + } + ] + }, + "DeleteEntityType": { + "requestType": "DeleteEntityTypeRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{name=projects/*/agent/entityTypes/*}", + "(google.api.http).additional_bindings.delete": "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{name=projects/*/agent/entityTypes/*}", + "additional_bindings": { + "delete": "/v2beta1/{name=projects/*/locations/*/agent/entityTypes/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "BatchUpdateEntityTypes": { + "requestType": "BatchUpdateEntityTypesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent}/entityTypes:batchUpdate", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent}/entityTypes:batchUpdate", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchUpdate", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchDeleteEntityTypes": { + "requestType": "BatchDeleteEntityTypesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent}/entityTypes:batchDelete", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,entity_type_names", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent}/entityTypes:batchDelete", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent}/entityTypes:batchDelete", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,entity_type_names" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchCreateEntities": { + "requestType": "BatchCreateEntitiesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,entities,language_code", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchCreate", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchCreate", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,entities" + }, + { + "(google.api.method_signature)": "parent,entities,language_code" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchUpdateEntities": { + "requestType": "BatchUpdateEntitiesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,entities,language_code", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchUpdate", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchUpdate", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,entities" + }, + { + "(google.api.method_signature)": "parent,entities,language_code" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + }, + "BatchDeleteEntities": { + "requestType": "BatchDeleteEntitiesRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent,entity_values,language_code", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "google.protobuf.Struct" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent/entityTypes/*}/entities:batchDelete", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent/entityTypes/*}/entities:batchDelete", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent,entity_values" + }, + { + "(google.api.method_signature)": "parent,entity_values,language_code" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "google.protobuf.Struct" + } + } + ] + } + } + }, + "EntityType": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/EntityType", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/entityTypes/{entity_type}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "kind": { + "type": "Kind", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "autoExpansionMode": { + "type": "AutoExpansionMode", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "entities": { + "rule": "repeated", + "type": "Entity", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "enableFuzzyExtraction": { + "type": "bool", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "Kind": { + "values": { + "KIND_UNSPECIFIED": 0, + "KIND_MAP": 1, + "KIND_LIST": 2, + "KIND_REGEXP": 3 + } + }, + "AutoExpansionMode": { + "values": { + "AUTO_EXPANSION_MODE_UNSPECIFIED": 0, + "AUTO_EXPANSION_MODE_DEFAULT": 1 + } + }, + "Entity": { + "fields": { + "value": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "synonyms": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + } + } + }, + "ListEntityTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageSize": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListEntityTypesResponse": { + "fields": { + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "CreateEntityTypeRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "entityType": { + "type": "EntityType", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "UpdateEntityTypeRequest": { + "fields": { + "entityType": { + "type": "EntityType", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteEntityTypeRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + } + } + }, + "BatchUpdateEntityTypesRequest": { + "oneofs": { + "entityTypeBatch": { + "oneof": [ + "entityTypeBatchUri", + "entityTypeBatchInline" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "entityTypeBatchUri": { + "type": "string", + "id": 2 + }, + "entityTypeBatchInline": { + "type": "EntityTypeBatch", + "id": 3 + }, + "languageCode": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchUpdateEntityTypesResponse": { + "fields": { + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 1 + } + } + }, + "BatchDeleteEntityTypesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/EntityType" + } + }, + "entityTypeNames": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "BatchCreateEntitiesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "entities": { + "rule": "repeated", + "type": "EntityType.Entity", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BatchUpdateEntitiesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "entities": { + "rule": "repeated", + "type": "EntityType.Entity", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 4 + } + } + }, + "BatchDeleteEntitiesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/EntityType" + } + }, + "entityValues": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "EntityTypeBatch": { + "fields": { + "entityTypes": { + "rule": "repeated", + "type": "EntityType", + "id": 1 + } + } + }, + "Conversations": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "CreateConversation": { + "requestType": "CreateConversationRequest", + "responseType": "Conversation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*}/conversations", + "(google.api.http).body": "conversation", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*}/conversations", + "(google.api.http).additional_bindings.body": "conversation", + "(google.api.method_signature)": "parent,conversation" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*}/conversations", + "body": "conversation", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*}/conversations", + "body": "conversation" + } + } + }, + { + "(google.api.method_signature)": "parent,conversation" + } + ] + }, + "ListConversations": { + "requestType": "ListConversationsRequest", + "responseType": "ListConversationsResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*}/conversations", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*}/conversations", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*}/conversations", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*}/conversations" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetConversation": { + "requestType": "GetConversationRequest", + "responseType": "Conversation", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/conversations/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/conversations/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/conversations/*}", + "additional_bindings": { + "get": "/v2beta1/{name=projects/*/locations/*/conversations/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CompleteConversation": { + "requestType": "CompleteConversationRequest", + "responseType": "Conversation", + "options": { + "(google.api.http).post": "/v2beta1/{name=projects/*/conversations/*}:complete", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{name=projects/*/locations/*/conversations/*}:complete", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{name=projects/*/conversations/*}:complete", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{name=projects/*/locations/*/conversations/*}:complete", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "BatchCreateMessages": { + "requestType": "BatchCreateMessagesRequest", + "responseType": "BatchCreateMessagesResponse", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/conversations/*}/messages:batchCreate", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages:batchCreate", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/conversations/*}/messages:batchCreate", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages:batchCreate", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "ListMessages": { + "requestType": "ListMessagesRequest", + "responseType": "ListMessagesResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/conversations/*}/messages", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/conversations/*}/messages", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "SuggestConversationSummary": { + "requestType": "SuggestConversationSummaryRequest", + "responseType": "SuggestConversationSummaryResponse", + "options": { + "(google.api.http).post": "/v2beta1/{conversation=projects/*/conversations/*}/suggestions:suggestConversationSummary", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{conversation=projects/*/locations/*/conversations/*}/suggestions:suggestConversationSummary", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "conversation" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{conversation=projects/*/conversations/*}/suggestions:suggestConversationSummary", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{conversation=projects/*/locations/*/conversations/*}/suggestions:suggestConversationSummary", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "conversation" + } + ] + } + } + }, + "Conversation": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Conversation", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversations/{conversation}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "lifecycleState": { + "type": "LifecycleState", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "conversationProfile": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationProfile" + } + }, + "phoneNumber": { + "type": "ConversationPhoneNumber", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "conversationStage": { + "type": "ConversationStage", + "id": 7 + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "LifecycleState": { + "values": { + "LIFECYCLE_STATE_UNSPECIFIED": 0, + "IN_PROGRESS": 1, + "COMPLETED": 2 + } + }, + "ConversationStage": { + "values": { + "CONVERSATION_STAGE_UNSPECIFIED": 0, + "VIRTUAL_AGENT_STAGE": 1, + "HUMAN_ASSIST_STAGE": 2 + } + } + } + }, + "ConversationPhoneNumber": { + "fields": { + "phoneNumber": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "CreateConversationRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Conversation" + } + }, + "conversation": { + "type": "Conversation", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "conversationId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListConversationsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Conversation" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + } + } + }, + "ListConversationsResponse": { + "fields": { + "conversations": { + "rule": "repeated", + "type": "Conversation", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetConversationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Conversation" + } + } + } + }, + "CompleteConversationRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Conversation" + } + } + } + }, + "CreateMessageRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Conversation" + } + }, + "message": { + "type": "Message", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "BatchCreateMessagesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Conversation" + } + }, + "requests": { + "rule": "repeated", + "type": "CreateMessageRequest", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "BatchCreateMessagesResponse": { + "fields": { + "messages": { + "rule": "repeated", + "type": "Message", + "id": 1 + } + } + }, + "ListMessagesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Message" + } + }, + "filter": { + "type": "string", + "id": 4 + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListMessagesResponse": { + "fields": { + "messages": { + "rule": "repeated", + "type": "Message", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "SuggestConversationSummaryRequest": { + "fields": { + "conversation": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Conversation" + } + }, + "latestMessage": { + "type": "string", + "id": 3, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 4 + } + } + }, + "SuggestConversationSummaryResponse": { + "fields": { + "summary": { + "type": "Summary", + "id": 1 + }, + "latestMessage": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Message" + } + }, + "contextSize": { + "type": "int32", + "id": 3 + } + }, + "nested": { + "Summary": { + "fields": { + "text": { + "type": "string", + "id": 1 + }, + "textSections": { + "keyType": "string", + "type": "string", + "id": 4 + }, + "answerRecord": { + "type": "string", + "id": 3, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/AnswerRecord" + } + } + } + } + } + }, + "ConversationEvent": { + "oneofs": { + "payload": { + "oneof": [ + "newMessagePayload" + ] + } + }, + "fields": { + "conversation": { + "type": "string", + "id": 1 + }, + "type": { + "type": "Type", + "id": 2 + }, + "errorStatus": { + "type": "google.rpc.Status", + "id": 3 + }, + "newMessagePayload": { + "type": "Message", + "id": 4 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "CONVERSATION_STARTED": 1, + "CONVERSATION_FINISHED": 2, + "HUMAN_INTERVENTION_NEEDED": 3, + "NEW_MESSAGE": 5, + "UNRECOVERABLE_ERROR": 4 + } + } + } + }, + "ConversationProfiles": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListConversationProfiles": { + "requestType": "ListConversationProfilesRequest", + "responseType": "ListConversationProfilesResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*}/conversationProfiles", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*}/conversationProfiles", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetConversationProfile": { + "requestType": "GetConversationProfileRequest", + "responseType": "ConversationProfile", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/conversationProfiles/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/conversationProfiles/*}", + "additional_bindings": { + "get": "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateConversationProfile": { + "requestType": "CreateConversationProfileRequest", + "responseType": "ConversationProfile", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*}/conversationProfiles", + "(google.api.http).body": "conversation_profile", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles", + "(google.api.http).additional_bindings.body": "conversation_profile", + "(google.api.method_signature)": "parent,conversation_profile" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*}/conversationProfiles", + "body": "conversation_profile", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*}/conversationProfiles", + "body": "conversation_profile" + } + } + }, + { + "(google.api.method_signature)": "parent,conversation_profile" + } + ] + }, + "UpdateConversationProfile": { + "requestType": "UpdateConversationProfileRequest", + "responseType": "ConversationProfile", + "options": { + "(google.api.http).patch": "/v2beta1/{conversation_profile.name=projects/*/conversationProfiles/*}", + "(google.api.http).body": "conversation_profile", + "(google.api.http).additional_bindings.patch": "/v2beta1/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}", + "(google.api.http).additional_bindings.body": "conversation_profile", + "(google.api.method_signature)": "conversation_profile,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{conversation_profile.name=projects/*/conversationProfiles/*}", + "body": "conversation_profile", + "additional_bindings": { + "patch": "/v2beta1/{conversation_profile.name=projects/*/locations/*/conversationProfiles/*}", + "body": "conversation_profile" + } + } + }, + { + "(google.api.method_signature)": "conversation_profile,update_mask" + } + ] + }, + "DeleteConversationProfile": { + "requestType": "DeleteConversationProfileRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{name=projects/*/conversationProfiles/*}", + "(google.api.http).additional_bindings.delete": "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{name=projects/*/conversationProfiles/*}", + "additional_bindings": { + "delete": "/v2beta1/{name=projects/*/locations/*/conversationProfiles/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "SetSuggestionFeatureConfig": { + "requestType": "SetSuggestionFeatureConfigRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "conversation_profile", + "(google.longrunning.operation_info).response_type": "ConversationProfile", + "(google.longrunning.operation_info).metadata_type": "SetSuggestionFeatureConfigOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:setSuggestionFeatureConfig", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:setSuggestionFeatureConfig", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "conversation_profile" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ConversationProfile", + "metadata_type": "SetSuggestionFeatureConfigOperationMetadata" + } + } + ] + }, + "ClearSuggestionFeatureConfig": { + "requestType": "ClearSuggestionFeatureConfigRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "conversation_profile", + "(google.longrunning.operation_info).response_type": "ConversationProfile", + "(google.longrunning.operation_info).metadata_type": "ClearSuggestionFeatureConfigOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{conversation_profile=projects/*/conversationProfiles/*}:clearSuggestionFeatureConfig", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{conversation_profile=projects/*/locations/*/conversationProfiles/*}:clearSuggestionFeatureConfig", + "body": "*" + } + } + }, + { + "(google.api.method_signature)": "conversation_profile" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ConversationProfile", + "metadata_type": "ClearSuggestionFeatureConfigOperationMetadata" + } + } + ] + } + } + }, + "ConversationProfile": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/ConversationProfile", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "automatedAgentConfig": { + "type": "AutomatedAgentConfig", + "id": 3 + }, + "humanAgentAssistantConfig": { + "type": "HumanAgentAssistantConfig", + "id": 4 + }, + "humanAgentHandoffConfig": { + "type": "HumanAgentHandoffConfig", + "id": 5 + }, + "notificationConfig": { + "type": "NotificationConfig", + "id": 6 + }, + "loggingConfig": { + "type": "LoggingConfig", + "id": 7 + }, + "newMessageEventNotificationConfig": { + "type": "NotificationConfig", + "id": 8 + }, + "sttConfig": { + "type": "SpeechToTextConfig", + "id": 9 + }, + "languageCode": { + "type": "string", + "id": 10 + }, + "timeZone": { + "type": "string", + "id": 14 + }, + "securitySettings": { + "type": "string", + "id": 13, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/CXSecuritySettings" + } + } + } + }, + "AutomatedAgentConfig": { + "fields": { + "agent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "HumanAgentAssistantConfig": { + "fields": { + "notificationConfig": { + "type": "NotificationConfig", + "id": 2 + }, + "humanAgentSuggestionConfig": { + "type": "SuggestionConfig", + "id": 3 + }, + "endUserSuggestionConfig": { + "type": "SuggestionConfig", + "id": 4 + }, + "messageAnalysisConfig": { + "type": "MessageAnalysisConfig", + "id": 5 + } + }, + "nested": { + "SuggestionTriggerSettings": { + "fields": { + "noSmallTalk": { + "type": "bool", + "id": 1 + }, + "onlyEndUser": { + "type": "bool", + "id": 2 + } + } + }, + "SuggestionFeatureConfig": { + "fields": { + "suggestionFeature": { + "type": "SuggestionFeature", + "id": 5 + }, + "enableEventBasedSuggestion": { + "type": "bool", + "id": 3 + }, + "suggestionTriggerSettings": { + "type": "SuggestionTriggerSettings", + "id": 10 + }, + "queryConfig": { + "type": "SuggestionQueryConfig", + "id": 6 + }, + "conversationModelConfig": { + "type": "ConversationModelConfig", + "id": 7 + }, + "conversationProcessConfig": { + "type": "ConversationProcessConfig", + "id": 8 + } + } + }, + "SuggestionConfig": { + "fields": { + "featureConfigs": { + "rule": "repeated", + "type": "SuggestionFeatureConfig", + "id": 2 + }, + "groupSuggestionResponses": { + "type": "bool", + "id": 3 + } + } + }, + "SuggestionQueryConfig": { + "oneofs": { + "querySource": { + "oneof": [ + "knowledgeBaseQuerySource", + "documentQuerySource", + "dialogflowQuerySource" + ] + } + }, + "fields": { + "knowledgeBaseQuerySource": { + "type": "KnowledgeBaseQuerySource", + "id": 1 + }, + "documentQuerySource": { + "type": "DocumentQuerySource", + "id": 2 + }, + "dialogflowQuerySource": { + "type": "DialogflowQuerySource", + "id": 3 + }, + "maxResults": { + "type": "int32", + "id": 4 + }, + "confidenceThreshold": { + "type": "float", + "id": 5 + }, + "contextFilterSettings": { + "type": "ContextFilterSettings", + "id": 7 + } + }, + "nested": { + "KnowledgeBaseQuerySource": { + "fields": { + "knowledgeBases": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/KnowledgeBase" + } + } + } + }, + "DocumentQuerySource": { + "fields": { + "documents": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + } + } + }, + "DialogflowQuerySource": { + "fields": { + "agent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Agent" + } + } + } + }, + "ContextFilterSettings": { + "fields": { + "dropHandoffMessages": { + "type": "bool", + "id": 1 + }, + "dropVirtualAgentMessages": { + "type": "bool", + "id": 2 + }, + "dropIvrMessages": { + "type": "bool", + "id": 3 + } + } + } + } + }, + "ConversationModelConfig": { + "fields": { + "model": { + "type": "string", + "id": 1, + "options": { + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationModel" + } + } + } + }, + "ConversationProcessConfig": { + "fields": { + "recentSentencesCount": { + "type": "int32", + "id": 2 + } + } + }, + "MessageAnalysisConfig": { + "fields": { + "enableEntityExtraction": { + "type": "bool", + "id": 2 + }, + "enableSentimentAnalysis": { + "type": "bool", + "id": 3 + } + } + } + } + }, + "HumanAgentHandoffConfig": { + "oneofs": { + "agentService": { + "oneof": [ + "livePersonConfig", + "salesforceLiveAgentConfig" + ] + } + }, + "fields": { + "livePersonConfig": { + "type": "LivePersonConfig", + "id": 1 + }, + "salesforceLiveAgentConfig": { + "type": "SalesforceLiveAgentConfig", + "id": 2 + } + }, + "nested": { + "LivePersonConfig": { + "fields": { + "accountNumber": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SalesforceLiveAgentConfig": { + "fields": { + "organizationId": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "deploymentId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "buttonId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "endpointDomain": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "NotificationConfig": { + "fields": { + "topic": { + "type": "string", + "id": 1 + }, + "messageFormat": { + "type": "MessageFormat", + "id": 2 + } + }, + "nested": { + "MessageFormat": { + "values": { + "MESSAGE_FORMAT_UNSPECIFIED": 0, + "PROTO": 1, + "JSON": 2 + } + } + } + }, + "LoggingConfig": { + "fields": { + "enableStackdriverLogging": { + "type": "bool", + "id": 3 + } + } + }, + "ListConversationProfilesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/ConversationProfile" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + } + } + }, + "ListConversationProfilesResponse": { + "fields": { + "conversationProfiles": { + "rule": "repeated", + "type": "ConversationProfile", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetConversationProfileRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationProfile" + } + } + } + }, + "CreateConversationProfileRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/ConversationProfile" + } + }, + "conversationProfile": { + "type": "ConversationProfile", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateConversationProfileRequest": { + "fields": { + "conversationProfile": { + "type": "ConversationProfile", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteConversationProfileRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/ConversationProfile" + } + } + } + }, + "SetSuggestionFeatureConfigRequest": { + "fields": { + "conversationProfile": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "participantRole": { + "type": "Participant.Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "suggestionFeatureConfig": { + "type": "HumanAgentAssistantConfig.SuggestionFeatureConfig", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ClearSuggestionFeatureConfigRequest": { + "fields": { + "conversationProfile": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "participantRole": { + "type": "Participant.Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "suggestionFeatureType": { + "type": "SuggestionFeature.Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SetSuggestionFeatureConfigOperationMetadata": { + "fields": { + "conversationProfile": { + "type": "string", + "id": 1 + }, + "participantRole": { + "type": "Participant.Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "suggestionFeatureType": { + "type": "SuggestionFeature.Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "ClearSuggestionFeatureConfigOperationMetadata": { + "fields": { + "conversationProfile": { + "type": "string", + "id": 1 + }, + "participantRole": { + "type": "Participant.Role", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "suggestionFeatureType": { + "type": "SuggestionFeature.Type", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + } + } + }, + "Documents": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListDocuments": { + "requestType": "ListDocumentsRequest", + "responseType": "ListDocumentsResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents", + "additional_bindings": [ + { + "get": "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents" + }, + { + "get": "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetDocument": { + "requestType": "GetDocumentRequest", + "responseType": "Document", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}", + "additional_bindings": [ + { + "get": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + }, + { + "get": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateDocument": { + "requestType": "CreateDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents", + "(google.api.http).body": "document", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents", + "(google.api.http).additional_bindings.body": "document", + "(google.api.method_signature)": "parent,document", + "(google.longrunning.operation_info).response_type": "Document", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents", + "body": "document", + "additional_bindings": [ + { + "post": "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents", + "body": "document" + }, + { + "post": "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents", + "body": "document" + } + ] + } + }, + { + "(google.api.method_signature)": "parent,document" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Document", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + }, + "ImportDocuments": { + "requestType": "ImportDocumentsRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents:import", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import", + "(google.api.http).additional_bindings.body": "*", + "(google.longrunning.operation_info).response_type": "ImportDocumentsResponse", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents:import", + "body": "*", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/knowledgeBases/*}/documents:import", + "body": "*" + } + } + }, + { + "(google.longrunning.operation_info)": { + "response_type": "ImportDocumentsResponse", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + }, + "DeleteDocument": { + "requestType": "DeleteDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}", + "(google.api.http).additional_bindings.delete": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}", + "additional_bindings": [ + { + "delete": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}" + }, + { + "delete": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + }, + "UpdateDocument": { + "requestType": "UpdateDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v2beta1/{document.name=projects/*/knowledgeBases/*/documents/*}", + "(google.api.http).body": "document", + "(google.api.http).additional_bindings.patch": "/v2beta1/{document.name=projects/*/agent/knowledgeBases/*/documents/*}", + "(google.api.http).additional_bindings.body": "document", + "(google.api.method_signature)": "document", + "(google.longrunning.operation_info).response_type": "Document", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{document.name=projects/*/knowledgeBases/*/documents/*}", + "body": "document", + "additional_bindings": [ + { + "patch": "/v2beta1/{document.name=projects/*/locations/*/knowledgeBases/*/documents/*}", + "body": "document" + }, + { + "patch": "/v2beta1/{document.name=projects/*/agent/knowledgeBases/*/documents/*}", + "body": "document" + } + ] + } + }, + { + "(google.api.method_signature)": "document,update_mask" + }, + { + "(google.api.method_signature)": "document" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Document", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + }, + "ReloadDocument": { + "requestType": "ReloadDocumentRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}:reload", + "(google.api.http).body": "*", + "(google.api.http).additional_bindings.post": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload", + "(google.api.http).additional_bindings.body": "*", + "(google.api.method_signature)": "name,gcs_source", + "(google.longrunning.operation_info).response_type": "Document", + "(google.longrunning.operation_info).metadata_type": "KnowledgeOperationMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}:reload", + "body": "*", + "additional_bindings": [ + { + "post": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:reload", + "body": "*" + }, + { + "post": "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}:reload", + "body": "*" + } + ] + } + }, + { + "(google.api.method_signature)": "name,gcs_source" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Document", + "metadata_type": "KnowledgeOperationMetadata" + } + } + ] + } + } + }, + "Document": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Document", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}" + }, + "oneofs": { + "source": { + "oneof": [ + "contentUri", + "content", + "rawContent" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "mimeType": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "knowledgeTypes": { + "rule": "repeated", + "type": "KnowledgeType", + "id": 4, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "contentUri": { + "type": "string", + "id": 5 + }, + "content": { + "type": "string", + "id": 6, + "options": { + "deprecated": true + } + }, + "rawContent": { + "type": "bytes", + "id": 9 + }, + "enableAutoReload": { + "type": "bool", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "latestReloadStatus": { + "type": "ReloadStatus", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "state": { + "type": "State", + "id": 13, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "KnowledgeType": { + "options": { + "allow_alias": true + }, + "values": { + "KNOWLEDGE_TYPE_UNSPECIFIED": 0, + "FAQ": 1, + "EXTRACTIVE_QA": 2, + "ARTICLE_SUGGESTION": 3, + "AGENT_FACING_SMART_REPLY": 4, + "SMART_REPLY": 4 + } + }, + "ReloadStatus": { + "fields": { + "time": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "status": { + "type": "google.rpc.Status", + "id": 2 + } + } + }, + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "CREATING": 1, + "ACTIVE": 2, + "UPDATING": 3, + "RELOADING": 4, + "DELETING": 5 + } + } + } + }, + "GetDocumentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + } + } + }, + "ListDocumentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Document" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + } + } + }, + "ListDocumentsResponse": { + "fields": { + "documents": { + "rule": "repeated", + "type": "Document", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "CreateDocumentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Document" + } + }, + "document": { + "type": "Document", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "importGcsCustomMetadata": { + "type": "bool", + "id": 3 + } + } + }, + "ImportDocumentsRequest": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Document" + } + }, + "gcsSource": { + "type": "GcsSources", + "id": 2 + }, + "documentTemplate": { + "type": "ImportDocumentTemplate", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "importGcsCustomMetadata": { + "type": "bool", + "id": 4 + } + } + }, + "ImportDocumentTemplate": { + "fields": { + "mimeType": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "knowledgeTypes": { + "rule": "repeated", + "type": "Document.KnowledgeType", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "metadata": { + "keyType": "string", + "type": "string", + "id": 3 + } + } + }, + "ImportDocumentsResponse": { + "fields": { + "warnings": { + "rule": "repeated", + "type": "google.rpc.Status", + "id": 1 + } + } + }, + "DeleteDocumentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + } + } + }, + "UpdateDocumentRequest": { + "fields": { + "document": { + "type": "Document", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ExportOperationMetadata": { + "fields": { + "exportedGcsDestination": { + "type": "GcsDestination", + "id": 1 + } + } + }, + "KnowledgeOperationMetadata": { + "oneofs": { + "operationMetadata": { + "oneof": [ + "exportOperationMetadata" + ] + } + }, + "fields": { + "state": { + "type": "State", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "knowledgeBase": { + "type": "string", + "id": 3 + }, + "exportOperationMetadata": { + "type": "ExportOperationMetadata", + "id": 4 + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "PENDING": 1, + "RUNNING": 2, + "DONE": 3 + } + } + } + }, + "ReloadDocumentRequest": { + "oneofs": { + "source": { + "oneof": [ + "gcsSource" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Document" + } + }, + "gcsSource": { + "type": "GcsSource", + "id": 3 + }, + "importGcsCustomMetadata": { + "type": "bool", + "id": 4 + } + } + }, + "GcsSources": { + "fields": { + "uris": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GcsSource": { + "fields": { + "uri": { + "type": "string", + "id": 1 + } + } + }, + "GcsDestination": { + "fields": { + "uri": { + "type": "string", + "id": 1 + } + } + }, + "Environments": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListEnvironments": { + "requestType": "ListEnvironmentsRequest", + "responseType": "ListEnvironmentsResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/agent}/environments", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*/agent}/environments", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/agent}/environments", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*/agent}/environments" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetEnvironment": { + "requestType": "GetEnvironmentRequest", + "responseType": "Environment", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/agent/environments/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/agent/environments/*}", + "additional_bindings": { + "get": "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" + } + } + } + ] + }, + "CreateEnvironment": { + "requestType": "CreateEnvironmentRequest", + "responseType": "Environment", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent}/environments", + "(google.api.http).body": "environment", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent}/environments", + "(google.api.http).additional_bindings.body": "environment" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent}/environments", + "body": "environment", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent}/environments", + "body": "environment" + } + } + } + ] + }, + "UpdateEnvironment": { + "requestType": "UpdateEnvironmentRequest", + "responseType": "Environment", + "options": { + "(google.api.http).patch": "/v2beta1/{environment.name=projects/*/agent/environments/*}", + "(google.api.http).body": "environment", + "(google.api.http).additional_bindings.patch": "/v2beta1/{environment.name=projects/*/locations/*/agent/environments/*}", + "(google.api.http).additional_bindings.body": "environment" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{environment.name=projects/*/agent/environments/*}", + "body": "environment", + "additional_bindings": { + "patch": "/v2beta1/{environment.name=projects/*/locations/*/agent/environments/*}", + "body": "environment" + } + } + } + ] + }, + "DeleteEnvironment": { + "requestType": "DeleteEnvironmentRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{name=projects/*/agent/environments/*}", + "(google.api.http).additional_bindings.delete": "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{name=projects/*/agent/environments/*}", + "additional_bindings": { + "delete": "/v2beta1/{name=projects/*/locations/*/agent/environments/*}" + } + } + } + ] + }, + "GetEnvironmentHistory": { + "requestType": "GetEnvironmentHistoryRequest", + "responseType": "EnvironmentHistory", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/agent/environments/*}/history", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/history" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/agent/environments/*}/history", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*/agent/environments/*}/history" + } + } + } + ] + } + } + }, + "Environment": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Environment", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/environments/{environment}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "description": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "agentVersion": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + }, + "state": { + "type": "State", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "textToSpeechSettings": { + "type": "TextToSpeechSettings", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "fulfillment": { + "type": "Fulfillment", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "STOPPED": 1, + "LOADING": 2, + "RUNNING": 3 + } + } + } + }, + "TextToSpeechSettings": { + "fields": { + "enableTextToSpeech": { + "type": "bool", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "outputAudioEncoding": { + "type": "OutputAudioEncoding", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "sampleRateHertz": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "synthesizeSpeechConfigs": { + "keyType": "string", + "type": "SynthesizeSpeechConfig", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListEnvironmentsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Environment" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListEnvironmentsResponse": { + "fields": { + "environments": { + "rule": "repeated", + "type": "Environment", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetEnvironmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } + } + } + }, + "CreateEnvironmentRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Environment" + } + }, + "environment": { + "type": "Environment", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "environmentId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateEnvironmentRequest": { + "fields": { + "environment": { + "type": "Environment", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "allowLoadToDraftAndDiscardChanges": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteEnvironmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } + } + } + }, + "GetEnvironmentHistoryRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Environment" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "EnvironmentHistory": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "entries": { + "rule": "repeated", + "type": "Entry", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "nextPageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Entry": { + "fields": { + "agentVersion": { + "type": "string", + "id": 1 + }, + "description": { + "type": "string", + "id": 2 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + } + } + }, + "Fulfillments": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "GetFulfillment": { + "requestType": "GetFulfillmentRequest", + "responseType": "Fulfillment", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/agent/fulfillment}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/agent/fulfillment}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/agent/fulfillment}", + "additional_bindings": { + "get": "/v2beta1/{name=projects/*/locations/*/agent/fulfillment}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateFulfillment": { + "requestType": "UpdateFulfillmentRequest", + "responseType": "Fulfillment", + "options": { + "(google.api.http).patch": "/v2beta1/{fulfillment.name=projects/*/agent/fulfillment}", + "(google.api.http).body": "fulfillment", + "(google.api.http).additional_bindings.patch": "/v2beta1/{fulfillment.name=projects/*/locations/*/agent/fulfillment}", + "(google.api.http).additional_bindings.body": "fulfillment", + "(google.api.method_signature)": "fulfillment,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{fulfillment.name=projects/*/agent/fulfillment}", + "body": "fulfillment", + "additional_bindings": { + "patch": "/v2beta1/{fulfillment.name=projects/*/locations/*/agent/fulfillment}", + "body": "fulfillment" + } + } + }, + { + "(google.api.method_signature)": "fulfillment,update_mask" + } + ] + } + } + }, + "Fulfillment": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Fulfillment", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/fulfillment" + }, + "oneofs": { + "fulfillment": { + "oneof": [ + "genericWebService" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "displayName": { + "type": "string", + "id": 2 + }, + "genericWebService": { + "type": "GenericWebService", + "id": 3 + }, + "enabled": { + "type": "bool", + "id": 4 + }, + "features": { + "rule": "repeated", + "type": "Feature", + "id": 5 + } + }, + "nested": { + "GenericWebService": { + "fields": { + "uri": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "username": { + "type": "string", + "id": 2 + }, + "password": { + "type": "string", + "id": 3 + }, + "requestHeaders": { + "keyType": "string", + "type": "string", + "id": 4 + }, + "isCloudFunction": { + "type": "bool", + "id": 5, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Feature": { + "fields": { + "type": { + "type": "Type", + "id": 1 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_UNSPECIFIED": 0, + "SMALLTALK": 1 + } + } + } + } + } + }, + "GetFulfillmentRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Fulfillment" + } + } + } + }, + "UpdateFulfillmentRequest": { + "fields": { + "fulfillment": { + "type": "Fulfillment", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "HumanAgentAssistantEvent": { + "fields": { + "conversation": { + "type": "string", + "id": 1 + }, + "participant": { + "type": "string", + "id": 3 + }, + "suggestionResults": { + "rule": "repeated", + "type": "SuggestionResult", + "id": 5 + } + } + }, + "KnowledgeBases": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListKnowledgeBases": { + "requestType": "ListKnowledgeBasesRequest", + "responseType": "ListKnowledgeBasesResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*}/knowledgeBases", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/agent}/knowledgeBases", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*}/knowledgeBases", + "additional_bindings": [ + { + "get": "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases" + }, + { + "get": "/v2beta1/{parent=projects/*/agent}/knowledgeBases" + } + ] + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetKnowledgeBase": { + "requestType": "GetKnowledgeBaseRequest", + "responseType": "KnowledgeBase", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/knowledgeBases/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/agent/knowledgeBases/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/knowledgeBases/*}", + "additional_bindings": [ + { + "get": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + }, + { + "get": "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateKnowledgeBase": { + "requestType": "CreateKnowledgeBaseRequest", + "responseType": "KnowledgeBase", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*}/knowledgeBases", + "(google.api.http).body": "knowledge_base", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/agent}/knowledgeBases", + "(google.api.http).additional_bindings.body": "knowledge_base", + "(google.api.method_signature)": "parent,knowledge_base" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*}/knowledgeBases", + "body": "knowledge_base", + "additional_bindings": [ + { + "post": "/v2beta1/{parent=projects/*/locations/*}/knowledgeBases", + "body": "knowledge_base" + }, + { + "post": "/v2beta1/{parent=projects/*/agent}/knowledgeBases", + "body": "knowledge_base" + } + ] + } + }, + { + "(google.api.method_signature)": "parent,knowledge_base" + } + ] + }, + "DeleteKnowledgeBase": { + "requestType": "DeleteKnowledgeBaseRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{name=projects/*/knowledgeBases/*}", + "(google.api.http).additional_bindings.delete": "/v2beta1/{name=projects/*/agent/knowledgeBases/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{name=projects/*/knowledgeBases/*}", + "additional_bindings": [ + { + "delete": "/v2beta1/{name=projects/*/locations/*/knowledgeBases/*}" + }, + { + "delete": "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" + } + ] + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "UpdateKnowledgeBase": { + "requestType": "UpdateKnowledgeBaseRequest", + "responseType": "KnowledgeBase", + "options": { + "(google.api.http).patch": "/v2beta1/{knowledge_base.name=projects/*/knowledgeBases/*}", + "(google.api.http).body": "knowledge_base", + "(google.api.http).additional_bindings.patch": "/v2beta1/{knowledge_base.name=projects/*/agent/knowledgeBases/*}", + "(google.api.http).additional_bindings.body": "knowledge_base", + "(google.api.method_signature)": "knowledge_base" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{knowledge_base.name=projects/*/knowledgeBases/*}", + "body": "knowledge_base", + "additional_bindings": [ + { + "patch": "/v2beta1/{knowledge_base.name=projects/*/locations/*/knowledgeBases/*}", + "body": "knowledge_base" + }, + { + "patch": "/v2beta1/{knowledge_base.name=projects/*/agent/knowledgeBases/*}", + "body": "knowledge_base" + } + ] + } + }, + { + "(google.api.method_signature)": "knowledge_base,update_mask" + }, + { + "(google.api.method_signature)": "knowledge_base" + } + ] + } + } + }, + "KnowledgeBase": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/KnowledgeBase", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}" + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "languageCode": { + "type": "string", + "id": 4 + } + } + }, + "ListKnowledgeBasesRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/KnowledgeBase" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + } + } + }, + "ListKnowledgeBasesResponse": { + "fields": { + "knowledgeBases": { + "rule": "repeated", + "type": "KnowledgeBase", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetKnowledgeBaseRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/KnowledgeBase" + } + } + } + }, + "CreateKnowledgeBaseRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/KnowledgeBase" + } + }, + "knowledgeBase": { + "type": "KnowledgeBase", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteKnowledgeBaseRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/KnowledgeBase" + } + }, + "force": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "UpdateKnowledgeBaseRequest": { + "fields": { + "knowledgeBase": { + "type": "KnowledgeBase", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Versions": { + "options": { + "(google.api.default_host)": "dialogflow.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflow" + }, + "methods": { + "ListVersions": { + "requestType": "ListVersionsRequest", + "responseType": "ListVersionsResponse", + "options": { + "(google.api.http).get": "/v2beta1/{parent=projects/*/agent}/versions", + "(google.api.http).additional_bindings.get": "/v2beta1/{parent=projects/*/locations/*/agent}/versions", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{parent=projects/*/agent}/versions", + "additional_bindings": { + "get": "/v2beta1/{parent=projects/*/locations/*/agent}/versions" + } + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetVersion": { + "requestType": "GetVersionRequest", + "responseType": "Version", + "options": { + "(google.api.http).get": "/v2beta1/{name=projects/*/agent/versions/*}", + "(google.api.http).additional_bindings.get": "/v2beta1/{name=projects/*/locations/*/agent/versions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v2beta1/{name=projects/*/agent/versions/*}", + "additional_bindings": { + "get": "/v2beta1/{name=projects/*/locations/*/agent/versions/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "CreateVersion": { + "requestType": "CreateVersionRequest", + "responseType": "Version", + "options": { + "(google.api.http).post": "/v2beta1/{parent=projects/*/agent}/versions", + "(google.api.http).body": "version", + "(google.api.http).additional_bindings.post": "/v2beta1/{parent=projects/*/locations/*/agent}/versions", + "(google.api.http).additional_bindings.body": "version", + "(google.api.method_signature)": "parent,version" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v2beta1/{parent=projects/*/agent}/versions", + "body": "version", + "additional_bindings": { + "post": "/v2beta1/{parent=projects/*/locations/*/agent}/versions", + "body": "version" + } + } + }, + { + "(google.api.method_signature)": "parent,version" + } + ] + }, + "UpdateVersion": { + "requestType": "UpdateVersionRequest", + "responseType": "Version", + "options": { + "(google.api.http).patch": "/v2beta1/{version.name=projects/*/agent/versions/*}", + "(google.api.http).body": "version", + "(google.api.http).additional_bindings.patch": "/v2beta1/{version.name=projects/*/locations/*/agent/versions/*}", + "(google.api.http).additional_bindings.body": "version", + "(google.api.method_signature)": "version,update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v2beta1/{version.name=projects/*/agent/versions/*}", + "body": "version", + "additional_bindings": { + "patch": "/v2beta1/{version.name=projects/*/locations/*/agent/versions/*}", + "body": "version" + } + } + }, + { + "(google.api.method_signature)": "version,update_mask" + } + ] + }, + "DeleteVersion": { + "requestType": "DeleteVersionRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).delete": "/v2beta1/{name=projects/*/agent/versions/*}", + "(google.api.http).additional_bindings.delete": "/v2beta1/{name=projects/*/locations/*/agent/versions/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v2beta1/{name=projects/*/agent/versions/*}", + "additional_bindings": { + "delete": "/v2beta1/{name=projects/*/locations/*/agent/versions/*}" + } + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "Version": { + "options": { + "(google.api.resource).type": "dialogflow.googleapis.com/Version", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/agent/versions/{version}" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "description": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "versionNumber": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "status": { + "type": "VersionStatus", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "VersionStatus": { + "values": { + "VERSION_STATUS_UNSPECIFIED": 0, + "IN_PROGRESS": 1, + "READY": 2, + "FAILED": 3 + } + } + } + }, + "ListVersionsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Version" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListVersionsResponse": { + "fields": { + "versions": { + "rule": "repeated", + "type": "Version", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + } + } + }, + "GetVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + } + } + }, + "CreateVersionRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "dialogflow.googleapis.com/Version" + } + }, + "version": { + "type": "Version", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "UpdateVersionRequest": { + "fields": { + "version": { + "type": "Version", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "DeleteVersionRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "dialogflow.googleapis.com/Version" + } + } + } + }, + "WebhookRequest": { + "fields": { + "session": { + "type": "string", + "id": 4 + }, + "responseId": { + "type": "string", + "id": 1 + }, + "queryResult": { + "type": "QueryResult", + "id": 2 + }, + "alternativeQueryResults": { + "rule": "repeated", + "type": "QueryResult", + "id": 5 + }, + "originalDetectIntentRequest": { + "type": "OriginalDetectIntentRequest", + "id": 3 + } + } + }, + "WebhookResponse": { + "fields": { + "fulfillmentText": { + "type": "string", + "id": 1 + }, + "fulfillmentMessages": { + "rule": "repeated", + "type": "Intent.Message", + "id": 2 + }, + "source": { + "type": "string", + "id": 3 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 4 + }, + "outputContexts": { + "rule": "repeated", + "type": "Context", + "id": 5 + }, + "followupEventInput": { + "type": "EventInput", + "id": 6 + }, + "liveAgentHandoff": { + "type": "bool", + "id": 7 + }, + "endInteraction": { + "type": "bool", + "id": 8 + }, + "sessionEntityTypes": { + "rule": "repeated", + "type": "SessionEntityType", + "id": 10 + } + } + }, + "OriginalDetectIntentRequest": { + "fields": { + "source": { + "type": "string", + "id": 1 + }, + "version": { + "type": "string", + "id": 2 + }, + "payload": { + "type": "google.protobuf.Struct", + "id": 3 + } + } + } + } + } + } + } + } + }, + "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 + } + } + }, + "Struct": { + "fields": { + "fields": { + "keyType": "string", + "type": "Value", + "id": 1 + } + } + }, + "Value": { + "oneofs": { + "kind": { + "oneof": [ + "nullValue", + "numberValue", + "stringValue", + "boolValue", + "structValue", + "listValue" + ] + } + }, + "fields": { + "nullValue": { + "type": "NullValue", + "id": 1 + }, + "numberValue": { + "type": "double", + "id": 2 + }, + "stringValue": { + "type": "string", + "id": 3 + }, + "boolValue": { + "type": "bool", + "id": 4 + }, + "structValue": { + "type": "Struct", + "id": 5 + }, + "listValue": { + "type": "ListValue", + "id": 6 + } + } + }, + "NullValue": { + "values": { + "NULL_VALUE": 0 + } + }, + "ListValue": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + } + } + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "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": { + "LatLng": { + "fields": { + "latitude": { + "type": "double", + "id": 1 + }, + "longitude": { + "type": "double", + "id": 2 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/packages/google-cloud-dialogflow/samples/.eslintrc.yml b/packages/google-cloud-dialogflow/samples/.eslintrc.yml new file mode 100644 index 00000000000..4a23a6da8ed --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/.eslintrc.yml @@ -0,0 +1,4 @@ +--- +rules: + no-console: off + no-process-exit: off diff --git a/packages/google-cloud-dialogflow/samples/README.md b/packages/google-cloud-dialogflow/samples/README.md new file mode 100644 index 00000000000..24597cb2add --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/README.md @@ -0,0 +1,3560 @@ +[//]: # "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 + +# [Dialogflow API: Node.js Samples](https://github.com/googleapis/google-cloud-node) + +[![Open in Cloud Shell][shell_img]][shell_link] + + + +## Table of Contents + +* [Before you begin](#before-you-begin) +* [Samples](#samples) + * [Agents.delete_agent](#agents.delete_agent) + * [Agents.export_agent](#agents.export_agent) + * [Agents.get_agent](#agents.get_agent) + * [Agents.get_validation_result](#agents.get_validation_result) + * [Agents.import_agent](#agents.import_agent) + * [Agents.restore_agent](#agents.restore_agent) + * [Agents.search_agents](#agents.search_agents) + * [Agents.set_agent](#agents.set_agent) + * [Agents.train_agent](#agents.train_agent) + * [Answer_records.list_answer_records](#answer_records.list_answer_records) + * [Answer_records.update_answer_record](#answer_records.update_answer_record) + * [Contexts.create_context](#contexts.create_context) + * [Contexts.delete_all_contexts](#contexts.delete_all_contexts) + * [Contexts.delete_context](#contexts.delete_context) + * [Contexts.get_context](#contexts.get_context) + * [Contexts.list_contexts](#contexts.list_contexts) + * [Contexts.update_context](#contexts.update_context) + * [Conversation_datasets.create_conversation_dataset](#conversation_datasets.create_conversation_dataset) + * [Conversation_datasets.delete_conversation_dataset](#conversation_datasets.delete_conversation_dataset) + * [Conversation_datasets.get_conversation_dataset](#conversation_datasets.get_conversation_dataset) + * [Conversation_datasets.import_conversation_data](#conversation_datasets.import_conversation_data) + * [Conversation_datasets.list_conversation_datasets](#conversation_datasets.list_conversation_datasets) + * [Conversation_models.create_conversation_model](#conversation_models.create_conversation_model) + * [Conversation_models.create_conversation_model_evaluation](#conversation_models.create_conversation_model_evaluation) + * [Conversation_models.delete_conversation_model](#conversation_models.delete_conversation_model) + * [Conversation_models.deploy_conversation_model](#conversation_models.deploy_conversation_model) + * [Conversation_models.get_conversation_model](#conversation_models.get_conversation_model) + * [Conversation_models.get_conversation_model_evaluation](#conversation_models.get_conversation_model_evaluation) + * [Conversation_models.list_conversation_model_evaluations](#conversation_models.list_conversation_model_evaluations) + * [Conversation_models.list_conversation_models](#conversation_models.list_conversation_models) + * [Conversation_models.undeploy_conversation_model](#conversation_models.undeploy_conversation_model) + * [Conversation_profiles.clear_suggestion_feature_config](#conversation_profiles.clear_suggestion_feature_config) + * [Conversation_profiles.create_conversation_profile](#conversation_profiles.create_conversation_profile) + * [Conversation_profiles.delete_conversation_profile](#conversation_profiles.delete_conversation_profile) + * [Conversation_profiles.get_conversation_profile](#conversation_profiles.get_conversation_profile) + * [Conversation_profiles.list_conversation_profiles](#conversation_profiles.list_conversation_profiles) + * [Conversation_profiles.set_suggestion_feature_config](#conversation_profiles.set_suggestion_feature_config) + * [Conversation_profiles.update_conversation_profile](#conversation_profiles.update_conversation_profile) + * [Conversations.complete_conversation](#conversations.complete_conversation) + * [Conversations.create_conversation](#conversations.create_conversation) + * [Conversations.get_conversation](#conversations.get_conversation) + * [Conversations.list_conversations](#conversations.list_conversations) + * [Conversations.list_messages](#conversations.list_messages) + * [Documents.create_document](#documents.create_document) + * [Documents.delete_document](#documents.delete_document) + * [Documents.export_document](#documents.export_document) + * [Documents.get_document](#documents.get_document) + * [Documents.import_documents](#documents.import_documents) + * [Documents.list_documents](#documents.list_documents) + * [Documents.reload_document](#documents.reload_document) + * [Documents.update_document](#documents.update_document) + * [Entity_types.batch_create_entities](#entity_types.batch_create_entities) + * [Entity_types.batch_delete_entities](#entity_types.batch_delete_entities) + * [Entity_types.batch_delete_entity_types](#entity_types.batch_delete_entity_types) + * [Entity_types.batch_update_entities](#entity_types.batch_update_entities) + * [Entity_types.batch_update_entity_types](#entity_types.batch_update_entity_types) + * [Entity_types.create_entity_type](#entity_types.create_entity_type) + * [Entity_types.delete_entity_type](#entity_types.delete_entity_type) + * [Entity_types.get_entity_type](#entity_types.get_entity_type) + * [Entity_types.list_entity_types](#entity_types.list_entity_types) + * [Entity_types.update_entity_type](#entity_types.update_entity_type) + * [Environments.create_environment](#environments.create_environment) + * [Environments.delete_environment](#environments.delete_environment) + * [Environments.get_environment](#environments.get_environment) + * [Environments.get_environment_history](#environments.get_environment_history) + * [Environments.list_environments](#environments.list_environments) + * [Environments.update_environment](#environments.update_environment) + * [Fulfillments.get_fulfillment](#fulfillments.get_fulfillment) + * [Fulfillments.update_fulfillment](#fulfillments.update_fulfillment) + * [Intents.batch_delete_intents](#intents.batch_delete_intents) + * [Intents.batch_update_intents](#intents.batch_update_intents) + * [Intents.create_intent](#intents.create_intent) + * [Intents.delete_intent](#intents.delete_intent) + * [Intents.get_intent](#intents.get_intent) + * [Intents.list_intents](#intents.list_intents) + * [Intents.update_intent](#intents.update_intent) + * [Knowledge_bases.create_knowledge_base](#knowledge_bases.create_knowledge_base) + * [Knowledge_bases.delete_knowledge_base](#knowledge_bases.delete_knowledge_base) + * [Knowledge_bases.get_knowledge_base](#knowledge_bases.get_knowledge_base) + * [Knowledge_bases.list_knowledge_bases](#knowledge_bases.list_knowledge_bases) + * [Knowledge_bases.update_knowledge_base](#knowledge_bases.update_knowledge_base) + * [Participants.analyze_content](#participants.analyze_content) + * [Participants.create_participant](#participants.create_participant) + * [Participants.get_participant](#participants.get_participant) + * [Participants.list_participants](#participants.list_participants) + * [Participants.streaming_analyze_content](#participants.streaming_analyze_content) + * [Participants.suggest_articles](#participants.suggest_articles) + * [Participants.suggest_faq_answers](#participants.suggest_faq_answers) + * [Participants.suggest_smart_replies](#participants.suggest_smart_replies) + * [Participants.update_participant](#participants.update_participant) + * [Session_entity_types.create_session_entity_type](#session_entity_types.create_session_entity_type) + * [Session_entity_types.delete_session_entity_type](#session_entity_types.delete_session_entity_type) + * [Session_entity_types.get_session_entity_type](#session_entity_types.get_session_entity_type) + * [Session_entity_types.list_session_entity_types](#session_entity_types.list_session_entity_types) + * [Session_entity_types.update_session_entity_type](#session_entity_types.update_session_entity_type) + * [Sessions.detect_intent](#sessions.detect_intent) + * [Sessions.streaming_detect_intent](#sessions.streaming_detect_intent) + * [Versions.create_version](#versions.create_version) + * [Versions.delete_version](#versions.delete_version) + * [Versions.get_version](#versions.get_version) + * [Versions.list_versions](#versions.list_versions) + * [Versions.update_version](#versions.update_version) + * [Agents.delete_agent](#agents.delete_agent) + * [Agents.export_agent](#agents.export_agent) + * [Agents.get_agent](#agents.get_agent) + * [Agents.get_validation_result](#agents.get_validation_result) + * [Agents.import_agent](#agents.import_agent) + * [Agents.restore_agent](#agents.restore_agent) + * [Agents.search_agents](#agents.search_agents) + * [Agents.set_agent](#agents.set_agent) + * [Agents.train_agent](#agents.train_agent) + * [Answer_records.get_answer_record](#answer_records.get_answer_record) + * [Answer_records.list_answer_records](#answer_records.list_answer_records) + * [Answer_records.update_answer_record](#answer_records.update_answer_record) + * [Contexts.create_context](#contexts.create_context) + * [Contexts.delete_all_contexts](#contexts.delete_all_contexts) + * [Contexts.delete_context](#contexts.delete_context) + * [Contexts.get_context](#contexts.get_context) + * [Contexts.list_contexts](#contexts.list_contexts) + * [Contexts.update_context](#contexts.update_context) + * [Conversation_profiles.clear_suggestion_feature_config](#conversation_profiles.clear_suggestion_feature_config) + * [Conversation_profiles.create_conversation_profile](#conversation_profiles.create_conversation_profile) + * [Conversation_profiles.delete_conversation_profile](#conversation_profiles.delete_conversation_profile) + * [Conversation_profiles.get_conversation_profile](#conversation_profiles.get_conversation_profile) + * [Conversation_profiles.list_conversation_profiles](#conversation_profiles.list_conversation_profiles) + * [Conversation_profiles.set_suggestion_feature_config](#conversation_profiles.set_suggestion_feature_config) + * [Conversation_profiles.update_conversation_profile](#conversation_profiles.update_conversation_profile) + * [Conversations.batch_create_messages](#conversations.batch_create_messages) + * [Conversations.complete_conversation](#conversations.complete_conversation) + * [Conversations.create_conversation](#conversations.create_conversation) + * [Conversations.get_conversation](#conversations.get_conversation) + * [Conversations.list_conversations](#conversations.list_conversations) + * [Conversations.list_messages](#conversations.list_messages) + * [Conversations.suggest_conversation_summary](#conversations.suggest_conversation_summary) + * [Documents.create_document](#documents.create_document) + * [Documents.delete_document](#documents.delete_document) + * [Documents.get_document](#documents.get_document) + * [Documents.import_documents](#documents.import_documents) + * [Documents.list_documents](#documents.list_documents) + * [Documents.reload_document](#documents.reload_document) + * [Documents.update_document](#documents.update_document) + * [Entity_types.batch_create_entities](#entity_types.batch_create_entities) + * [Entity_types.batch_delete_entities](#entity_types.batch_delete_entities) + * [Entity_types.batch_delete_entity_types](#entity_types.batch_delete_entity_types) + * [Entity_types.batch_update_entities](#entity_types.batch_update_entities) + * [Entity_types.batch_update_entity_types](#entity_types.batch_update_entity_types) + * [Entity_types.create_entity_type](#entity_types.create_entity_type) + * [Entity_types.delete_entity_type](#entity_types.delete_entity_type) + * [Entity_types.get_entity_type](#entity_types.get_entity_type) + * [Entity_types.list_entity_types](#entity_types.list_entity_types) + * [Entity_types.update_entity_type](#entity_types.update_entity_type) + * [Environments.create_environment](#environments.create_environment) + * [Environments.delete_environment](#environments.delete_environment) + * [Environments.get_environment](#environments.get_environment) + * [Environments.get_environment_history](#environments.get_environment_history) + * [Environments.list_environments](#environments.list_environments) + * [Environments.update_environment](#environments.update_environment) + * [Fulfillments.get_fulfillment](#fulfillments.get_fulfillment) + * [Fulfillments.update_fulfillment](#fulfillments.update_fulfillment) + * [Intents.batch_delete_intents](#intents.batch_delete_intents) + * [Intents.batch_update_intents](#intents.batch_update_intents) + * [Intents.create_intent](#intents.create_intent) + * [Intents.delete_intent](#intents.delete_intent) + * [Intents.get_intent](#intents.get_intent) + * [Intents.list_intents](#intents.list_intents) + * [Intents.update_intent](#intents.update_intent) + * [Knowledge_bases.create_knowledge_base](#knowledge_bases.create_knowledge_base) + * [Knowledge_bases.delete_knowledge_base](#knowledge_bases.delete_knowledge_base) + * [Knowledge_bases.get_knowledge_base](#knowledge_bases.get_knowledge_base) + * [Knowledge_bases.list_knowledge_bases](#knowledge_bases.list_knowledge_bases) + * [Knowledge_bases.update_knowledge_base](#knowledge_bases.update_knowledge_base) + * [Participants.analyze_content](#participants.analyze_content) + * [Participants.compile_suggestion](#participants.compile_suggestion) + * [Participants.create_participant](#participants.create_participant) + * [Participants.get_participant](#participants.get_participant) + * [Participants.list_participants](#participants.list_participants) + * [Participants.list_suggestions](#participants.list_suggestions) + * [Participants.streaming_analyze_content](#participants.streaming_analyze_content) + * [Participants.suggest_articles](#participants.suggest_articles) + * [Participants.suggest_faq_answers](#participants.suggest_faq_answers) + * [Participants.suggest_smart_replies](#participants.suggest_smart_replies) + * [Participants.update_participant](#participants.update_participant) + * [Session_entity_types.create_session_entity_type](#session_entity_types.create_session_entity_type) + * [Session_entity_types.delete_session_entity_type](#session_entity_types.delete_session_entity_type) + * [Session_entity_types.get_session_entity_type](#session_entity_types.get_session_entity_type) + * [Session_entity_types.list_session_entity_types](#session_entity_types.list_session_entity_types) + * [Session_entity_types.update_session_entity_type](#session_entity_types.update_session_entity_type) + * [Sessions.detect_intent](#sessions.detect_intent) + * [Sessions.streaming_detect_intent](#sessions.streaming_detect_intent) + * [Versions.create_version](#versions.create_version) + * [Versions.delete_version](#versions.delete_version) + * [Versions.get_version](#versions.get_version) + * [Versions.list_versions](#versions.list_versions) + * [Versions.update_version](#versions.update_version) + * [Quickstart](#quickstart) + * [Quickstart.test](#quickstart.test) + +## Before you begin + +Before running the samples, make sure you've followed the steps outlined in +[Using the client library](https://github.com/googleapis/google-cloud-node#using-the-client-library). + +`cd samples` + +`npm install` + +`cd ..` + +## Samples + + + +### Agents.delete_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js` + + +----- + + + + +### Agents.export_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js` + + +----- + + + + +### Agents.get_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js` + + +----- + + + + +### Agents.get_validation_result + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js` + + +----- + + + + +### Agents.import_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js` + + +----- + + + + +### Agents.restore_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js` + + +----- + + + + +### Agents.search_agents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js` + + +----- + + + + +### Agents.set_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js` + + +----- + + + + +### Agents.train_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js` + + +----- + + + + +### Answer_records.list_answer_records + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js` + + +----- + + + + +### Answer_records.update_answer_record + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js` + + +----- + + + + +### Contexts.create_context + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js` + + +----- + + + + +### Contexts.delete_all_contexts + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js` + + +----- + + + + +### Contexts.delete_context + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js` + + +----- + + + + +### Contexts.get_context + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js` + + +----- + + + + +### Contexts.list_contexts + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js` + + +----- + + + + +### Contexts.update_context + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js` + + +----- + + + + +### Conversation_datasets.create_conversation_dataset + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.create_conversation_dataset.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.create_conversation_dataset.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.create_conversation_dataset.js` + + +----- + + + + +### Conversation_datasets.delete_conversation_dataset + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js` + + +----- + + + + +### Conversation_datasets.get_conversation_dataset + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.get_conversation_dataset.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.get_conversation_dataset.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.get_conversation_dataset.js` + + +----- + + + + +### Conversation_datasets.import_conversation_data + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.import_conversation_data.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.import_conversation_data.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.import_conversation_data.js` + + +----- + + + + +### Conversation_datasets.list_conversation_datasets + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.list_conversation_datasets.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.list_conversation_datasets.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.list_conversation_datasets.js` + + +----- + + + + +### Conversation_models.create_conversation_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model.js` + + +----- + + + + +### Conversation_models.create_conversation_model_evaluation + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js` + + +----- + + + + +### Conversation_models.delete_conversation_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.delete_conversation_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.delete_conversation_model.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.delete_conversation_model.js` + + +----- + + + + +### Conversation_models.deploy_conversation_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.deploy_conversation_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.deploy_conversation_model.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.deploy_conversation_model.js` + + +----- + + + + +### Conversation_models.get_conversation_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model.js` + + +----- + + + + +### Conversation_models.get_conversation_model_evaluation + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js` + + +----- + + + + +### Conversation_models.list_conversation_model_evaluations + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js` + + +----- + + + + +### Conversation_models.list_conversation_models + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_models.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_models.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_models.js` + + +----- + + + + +### Conversation_models.undeploy_conversation_model + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.undeploy_conversation_model.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.undeploy_conversation_model.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.undeploy_conversation_model.js` + + +----- + + + + +### Conversation_profiles.clear_suggestion_feature_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js` + + +----- + + + + +### Conversation_profiles.create_conversation_profile + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js` + + +----- + + + + +### Conversation_profiles.delete_conversation_profile + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js` + + +----- + + + + +### Conversation_profiles.get_conversation_profile + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js` + + +----- + + + + +### Conversation_profiles.list_conversation_profiles + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js` + + +----- + + + + +### Conversation_profiles.set_suggestion_feature_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js` + + +----- + + + + +### Conversation_profiles.update_conversation_profile + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js` + + +----- + + + + +### Conversations.complete_conversation + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js` + + +----- + + + + +### Conversations.create_conversation + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js` + + +----- + + + + +### Conversations.get_conversation + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js` + + +----- + + + + +### Conversations.list_conversations + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js` + + +----- + + + + +### Conversations.list_messages + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js` + + +----- + + + + +### Documents.create_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js` + + +----- + + + + +### Documents.delete_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js` + + +----- + + + + +### Documents.export_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.export_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.export_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/documents.export_document.js` + + +----- + + + + +### Documents.get_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js` + + +----- + + + + +### Documents.import_documents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.import_documents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.import_documents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/documents.import_documents.js` + + +----- + + + + +### Documents.list_documents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js` + + +----- + + + + +### Documents.reload_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js` + + +----- + + + + +### Documents.update_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js` + + +----- + + + + +### Entity_types.batch_create_entities + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js` + + +----- + + + + +### Entity_types.batch_delete_entities + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js` + + +----- + + + + +### Entity_types.batch_delete_entity_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js` + + +----- + + + + +### Entity_types.batch_update_entities + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js` + + +----- + + + + +### Entity_types.batch_update_entity_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js` + + +----- + + + + +### Entity_types.create_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js` + + +----- + + + + +### Entity_types.delete_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js` + + +----- + + + + +### Entity_types.get_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js` + + +----- + + + + +### Entity_types.list_entity_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js` + + +----- + + + + +### Entity_types.update_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js` + + +----- + + + + +### Environments.create_environment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js` + + +----- + + + + +### Environments.delete_environment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js` + + +----- + + + + +### Environments.get_environment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js` + + +----- + + + + +### Environments.get_environment_history + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js` + + +----- + + + + +### Environments.list_environments + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js` + + +----- + + + + +### Environments.update_environment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js` + + +----- + + + + +### Fulfillments.get_fulfillment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js` + + +----- + + + + +### Fulfillments.update_fulfillment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js` + + +----- + + + + +### Intents.batch_delete_intents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js` + + +----- + + + + +### Intents.batch_update_intents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js` + + +----- + + + + +### Intents.create_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js` + + +----- + + + + +### Intents.delete_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js` + + +----- + + + + +### Intents.get_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js` + + +----- + + + + +### Intents.list_intents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js` + + +----- + + + + +### Intents.update_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js` + + +----- + + + + +### Knowledge_bases.create_knowledge_base + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js` + + +----- + + + + +### Knowledge_bases.delete_knowledge_base + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js` + + +----- + + + + +### Knowledge_bases.get_knowledge_base + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js` + + +----- + + + + +### Knowledge_bases.list_knowledge_bases + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js` + + +----- + + + + +### Knowledge_bases.update_knowledge_base + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js` + + +----- + + + + +### Participants.analyze_content + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js` + + +----- + + + + +### Participants.create_participant + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js` + + +----- + + + + +### Participants.get_participant + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js` + + +----- + + + + +### Participants.list_participants + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js` + + +----- + + + + +### Participants.streaming_analyze_content + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.streaming_analyze_content.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.streaming_analyze_content.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/participants.streaming_analyze_content.js` + + +----- + + + + +### Participants.suggest_articles + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js` + + +----- + + + + +### Participants.suggest_faq_answers + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js` + + +----- + + + + +### Participants.suggest_smart_replies + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_smart_replies.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_smart_replies.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_smart_replies.js` + + +----- + + + + +### Participants.update_participant + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js` + + +----- + + + + +### Session_entity_types.create_session_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js` + + +----- + + + + +### Session_entity_types.delete_session_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js` + + +----- + + + + +### Session_entity_types.get_session_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js` + + +----- + + + + +### Session_entity_types.list_session_entity_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js` + + +----- + + + + +### Session_entity_types.update_session_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js` + + +----- + + + + +### Sessions.detect_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js` + + +----- + + + + +### Sessions.streaming_detect_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js` + + +----- + + + + +### Versions.create_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js` + + +----- + + + + +### Versions.delete_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js` + + +----- + + + + +### Versions.get_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js` + + +----- + + + + +### Versions.list_versions + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js` + + +----- + + + + +### Versions.update_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js` + + +----- + + + + +### Agents.delete_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js` + + +----- + + + + +### Agents.export_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js` + + +----- + + + + +### Agents.get_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js` + + +----- + + + + +### Agents.get_validation_result + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js` + + +----- + + + + +### Agents.import_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js` + + +----- + + + + +### Agents.restore_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js` + + +----- + + + + +### Agents.search_agents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js` + + +----- + + + + +### Agents.set_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js` + + +----- + + + + +### Agents.train_agent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js` + + +----- + + + + +### Answer_records.get_answer_record + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js` + + +----- + + + + +### Answer_records.list_answer_records + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js` + + +----- + + + + +### Answer_records.update_answer_record + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js` + + +----- + + + + +### Contexts.create_context + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js` + + +----- + + + + +### Contexts.delete_all_contexts + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js` + + +----- + + + + +### Contexts.delete_context + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js` + + +----- + + + + +### Contexts.get_context + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js` + + +----- + + + + +### Contexts.list_contexts + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js` + + +----- + + + + +### Contexts.update_context + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js` + + +----- + + + + +### Conversation_profiles.clear_suggestion_feature_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js` + + +----- + + + + +### Conversation_profiles.create_conversation_profile + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js` + + +----- + + + + +### Conversation_profiles.delete_conversation_profile + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js` + + +----- + + + + +### Conversation_profiles.get_conversation_profile + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js` + + +----- + + + + +### Conversation_profiles.list_conversation_profiles + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js` + + +----- + + + + +### Conversation_profiles.set_suggestion_feature_config + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js` + + +----- + + + + +### Conversation_profiles.update_conversation_profile + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js` + + +----- + + + + +### Conversations.batch_create_messages + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js` + + +----- + + + + +### Conversations.complete_conversation + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js` + + +----- + + + + +### Conversations.create_conversation + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js` + + +----- + + + + +### Conversations.get_conversation + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js` + + +----- + + + + +### Conversations.list_conversations + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js` + + +----- + + + + +### Conversations.list_messages + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js` + + +----- + + + + +### Conversations.suggest_conversation_summary + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.suggest_conversation_summary.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.suggest_conversation_summary.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.suggest_conversation_summary.js` + + +----- + + + + +### Documents.create_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js` + + +----- + + + + +### Documents.delete_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js` + + +----- + + + + +### Documents.get_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js` + + +----- + + + + +### Documents.import_documents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js` + + +----- + + + + +### Documents.list_documents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js` + + +----- + + + + +### Documents.reload_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js` + + +----- + + + + +### Documents.update_document + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js` + + +----- + + + + +### Entity_types.batch_create_entities + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js` + + +----- + + + + +### Entity_types.batch_delete_entities + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js` + + +----- + + + + +### Entity_types.batch_delete_entity_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js` + + +----- + + + + +### Entity_types.batch_update_entities + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js` + + +----- + + + + +### Entity_types.batch_update_entity_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js` + + +----- + + + + +### Entity_types.create_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js` + + +----- + + + + +### Entity_types.delete_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js` + + +----- + + + + +### Entity_types.get_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js` + + +----- + + + + +### Entity_types.list_entity_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js` + + +----- + + + + +### Entity_types.update_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js` + + +----- + + + + +### Environments.create_environment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js` + + +----- + + + + +### Environments.delete_environment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js` + + +----- + + + + +### Environments.get_environment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js` + + +----- + + + + +### Environments.get_environment_history + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js` + + +----- + + + + +### Environments.list_environments + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js` + + +----- + + + + +### Environments.update_environment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js` + + +----- + + + + +### Fulfillments.get_fulfillment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js` + + +----- + + + + +### Fulfillments.update_fulfillment + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js` + + +----- + + + + +### Intents.batch_delete_intents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js` + + +----- + + + + +### Intents.batch_update_intents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js` + + +----- + + + + +### Intents.create_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js` + + +----- + + + + +### Intents.delete_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js` + + +----- + + + + +### Intents.get_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js` + + +----- + + + + +### Intents.list_intents + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js` + + +----- + + + + +### Intents.update_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js` + + +----- + + + + +### Knowledge_bases.create_knowledge_base + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js` + + +----- + + + + +### Knowledge_bases.delete_knowledge_base + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js` + + +----- + + + + +### Knowledge_bases.get_knowledge_base + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js` + + +----- + + + + +### Knowledge_bases.list_knowledge_bases + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js` + + +----- + + + + +### Knowledge_bases.update_knowledge_base + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js` + + +----- + + + + +### Participants.analyze_content + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js` + + +----- + + + + +### Participants.compile_suggestion + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js` + + +----- + + + + +### Participants.create_participant + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js` + + +----- + + + + +### Participants.get_participant + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js` + + +----- + + + + +### Participants.list_participants + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js` + + +----- + + + + +### Participants.list_suggestions + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js` + + +----- + + + + +### Participants.streaming_analyze_content + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.streaming_analyze_content.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.streaming_analyze_content.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.streaming_analyze_content.js` + + +----- + + + + +### Participants.suggest_articles + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js` + + +----- + + + + +### Participants.suggest_faq_answers + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js` + + +----- + + + + +### Participants.suggest_smart_replies + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js` + + +----- + + + + +### Participants.update_participant + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js` + + +----- + + + + +### Session_entity_types.create_session_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js` + + +----- + + + + +### Session_entity_types.delete_session_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js` + + +----- + + + + +### Session_entity_types.get_session_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js` + + +----- + + + + +### Session_entity_types.list_session_entity_types + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js` + + +----- + + + + +### Session_entity_types.update_session_entity_type + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js` + + +----- + + + + +### Sessions.detect_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js` + + +----- + + + + +### Sessions.streaming_detect_intent + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js` + + +----- + + + + +### Versions.create_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js` + + +----- + + + + +### Versions.delete_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js` + + +----- + + + + +### Versions.get_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js` + + +----- + + + + +### Versions.list_versions + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js` + + +----- + + + + +### Versions.update_version + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js` + + +----- + + + + +### Quickstart + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/quickstart.js` + + +----- + + + + +### Quickstart.test + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-dialogflow/samples/test/quickstart.test.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-dialogflow/samples/test/quickstart.test.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-dialogflow/samples/test/quickstart.test.js` + + + + + + +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/dialogflow-enterprise/ diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js new file mode 100644 index 00000000000..35a1a41ca4b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.delete_agent.js @@ -0,0 +1,62 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Agents_DeleteAgent_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 that the agent to delete is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callDeleteAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAgent(request); + console.log(response); + } + + callDeleteAgent(); + // [END dialogflow_v2_generated_Agents_DeleteAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js new file mode 100644 index 00000000000..576b77437fe --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.export_agent.js @@ -0,0 +1,76 @@ +// 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. +// +// ** 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, agentUri) { + // [START dialogflow_v2_generated_Agents_ExportAgent_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 that the agent to export is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * Required. The Google Cloud Storage (https://cloud.google.com/storage/docs/) + * URI to export the agent to. + * The format of this URI must be `gs:///`. + * If left unspecified, the serialized agent is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callExportAgent() { + // Construct request + const request = { + parent, + agentUri, + }; + + // Run request + const [operation] = await dialogflowClient.exportAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportAgent(); + // [END dialogflow_v2_generated_Agents_ExportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js new file mode 100644 index 00000000000..273222deed8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_agent.js @@ -0,0 +1,62 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Agents_GetAgent_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 that the agent to fetch is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callGetAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getAgent(request); + console.log(response); + } + + callGetAgent(); + // [END dialogflow_v2_generated_Agents_GetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js new file mode 100644 index 00000000000..c5ac6dbc83a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.get_validation_result.js @@ -0,0 +1,70 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Agents_GetValidationResult_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 that the agent is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * Optional. The language for which you want a validation result. If not + * specified, the agent's default language is used. Many + * languages (https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. Note: languages must be enabled in the agent before they can + * be used. + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callGetValidationResult() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getValidationResult(request); + console.log(response); + } + + callGetValidationResult(); + // [END dialogflow_v2_generated_Agents_GetValidationResult_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js new file mode 100644 index 00000000000..336d133cfd2 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.import_agent.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Agents_ImportAgent_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 that the agent to import is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callImportAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.importAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportAgent(); + // [END dialogflow_v2_generated_Agents_ImportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js new file mode 100644 index 00000000000..02954f41349 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.restore_agent.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Agents_RestoreAgent_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 that the agent to restore is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callRestoreAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.restoreAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreAgent(); + // [END dialogflow_v2_generated_Agents_RestoreAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js new file mode 100644 index 00000000000..1daeb2188f6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.search_agents.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Agents_SearchAgents_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 to list agents from. + * Format: `projects/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callSearchAgents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.searchAgentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAgents(); + // [END dialogflow_v2_generated_Agents_SearchAgents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js new file mode 100644 index 00000000000..369c74e522d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.set_agent.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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(agent) { + // [START dialogflow_v2_generated_Agents_SetAgent_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 agent to update. + */ + // const agent = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callSetAgent() { + // Construct request + const request = { + agent, + }; + + // Run request + const response = await dialogflowClient.setAgent(request); + console.log(response); + } + + callSetAgent(); + // [END dialogflow_v2_generated_Agents_SetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js new file mode 100644 index 00000000000..ebf5cd5d62d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/agents.train_agent.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Agents_TrainAgent_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 that the agent to train is associated with. + * Format: `projects/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callTrainAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.trainAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callTrainAgent(); + // [END dialogflow_v2_generated_Agents_TrainAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js b/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js new file mode 100644 index 00000000000..fa4bab0a98a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.list_answer_records.js @@ -0,0 +1,85 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_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 to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. Filters to restrict results to specific answer records. + * Marked deprecated as it hasn't been, and isn't currently, supported. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + */ + // const pageSize = 1234 + /** + * Optional. The + * ListAnswerRecordsResponse.next_page_token google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token + * value returned from a previous list request used to continue listing on + * the next page. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callListAnswerRecords() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listAnswerRecordsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAnswerRecords(); + // [END dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js b/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js new file mode 100644 index 00000000000..4108c84266d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/answer_records.update_answer_record.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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(answerRecord, updateMask) { + // [START dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_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. Answer record to update. + */ + // const answerRecord = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callUpdateAnswerRecord() { + // Construct request + const request = { + answerRecord, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateAnswerRecord(request); + console.log(response); + } + + callUpdateAnswerRecord(); + // [END dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js new file mode 100644 index 00000000000..13cdb444a00 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.create_context.js @@ -0,0 +1,71 @@ +// 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. +// +// ** 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, context) { + // [START dialogflow_v2_generated_Contexts_CreateContext_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 session to create a context for. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Required. The context to create. + */ + // const context = {} + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callCreateContext() { + // Construct request + const request = { + parent, + context, + }; + + // Run request + const response = await dialogflowClient.createContext(request); + console.log(response); + } + + callCreateContext(); + // [END dialogflow_v2_generated_Contexts_CreateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js new file mode 100644 index 00000000000..4bbb7d03111 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_all_contexts.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Contexts_DeleteAllContexts_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 name of the session to delete all contexts from. Format: + * `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callDeleteAllContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAllContexts(request); + console.log(response); + } + + callDeleteAllContexts(); + // [END dialogflow_v2_generated_Contexts_DeleteAllContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js new file mode 100644 index 00000000000..24aca4681ba --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.delete_context.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Contexts_DeleteContext_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 name of the context to delete. Format: + * `projects//agent/sessions//contexts/` + * or `projects//agent/environments//users//sessions//contexts/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callDeleteContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteContext(request); + console.log(response); + } + + callDeleteContext(); + // [END dialogflow_v2_generated_Contexts_DeleteContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js new file mode 100644 index 00000000000..717f9ec1aee --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.get_context.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Contexts_GetContext_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 name of the context. Format: + * `projects//agent/sessions//contexts/` + * or `projects//agent/environments//users//sessions//contexts/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callGetContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getContext(request); + console.log(response); + } + + callGetContext(); + // [END dialogflow_v2_generated_Contexts_GetContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js new file mode 100644 index 00000000000..cc5b18618ef --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.list_contexts.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Contexts_ListContexts_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 session to list all contexts from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callListContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listContextsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListContexts(); + // [END dialogflow_v2_generated_Contexts_ListContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js new file mode 100644 index 00000000000..2cfc4668522 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/contexts.update_context.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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(context) { + // [START dialogflow_v2_generated_Contexts_UpdateContext_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 context to update. + */ + // const context = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callUpdateContext() { + // Construct request + const request = { + context, + }; + + // Run request + const response = await dialogflowClient.updateContext(request); + console.log(response); + } + + callUpdateContext(); + // [END dialogflow_v2_generated_Contexts_UpdateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.create_conversation_dataset.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.create_conversation_dataset.js new file mode 100644 index 00000000000..eb2c98d3877 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.create_conversation_dataset.js @@ -0,0 +1,68 @@ +// 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. +// +// ** 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, conversationDataset) { + // [START dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_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 to create conversation dataset for. Format: + * `projects//locations/` + */ + // const parent = 'abc123' + /** + * Required. The conversation dataset to create. + */ + // const conversationDataset = {} + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callCreateConversationDataset() { + // Construct request + const request = { + parent, + conversationDataset, + }; + + // Run request + const [operation] = await dialogflowClient.createConversationDataset(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConversationDataset(); + // [END dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js new file mode 100644 index 00000000000..3c20de247e8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.delete_conversation_dataset.js @@ -0,0 +1,64 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_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 conversation dataset to delete. Format: + * `projects//locations//conversationDatasets/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callDeleteConversationDataset() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteConversationDataset(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConversationDataset(); + // [END dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.get_conversation_dataset.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.get_conversation_dataset.js new file mode 100644 index 00000000000..44c6c78537c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.get_conversation_dataset.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_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 conversation dataset to retrieve. Format: + * `projects//locations//conversationDatasets/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callGetConversationDataset() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationDataset(request); + console.log(response); + } + + callGetConversationDataset(); + // [END dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.import_conversation_data.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.import_conversation_data.js new file mode 100644 index 00000000000..6f75c4fa269 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.import_conversation_data.js @@ -0,0 +1,69 @@ +// 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. +// +// ** 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, inputConfig) { + // [START dialogflow_v2_generated_ConversationDatasets_ImportConversationData_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. Dataset resource name. Format: + * `projects//locations//conversationDatasets/` + */ + // const name = 'abc123' + /** + * Required. Configuration describing where to import data from. + */ + // const inputConfig = {} + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callImportConversationData() { + // Construct request + const request = { + name, + inputConfig, + }; + + // Run request + const [operation] = await dialogflowClient.importConversationData(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportConversationData(); + // [END dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.list_conversation_datasets.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.list_conversation_datasets.js new file mode 100644 index 00000000000..aad091cdac7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_datasets.list_conversation_datasets.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_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 and location name to list all conversation datasets for. + * Format: `projects//locations/` + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of conversation datasets to return in a single + * page. By default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationDatasetsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationDatasetsClient(); + + async function callListConversationDatasets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationDatasetsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationDatasets(); + // [END dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model.js new file mode 100644 index 00000000000..d4b354f244b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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(conversationModel) { + // [START dialogflow_v2_generated_ConversationModels_CreateConversationModel_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. + */ + /** + * The project to create conversation model for. Format: + * `projects/` + */ + // const parent = 'abc123' + /** + * Required. The conversation model to create. + */ + // const conversationModel = {} + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callCreateConversationModel() { + // Construct request + const request = { + conversationModel, + }; + + // Run request + const [operation] = await dialogflowClient.createConversationModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_CreateConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js new file mode 100644 index 00000000000..b535f38f5d1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.create_conversation_model_evaluation.js @@ -0,0 +1,69 @@ +// 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. +// +// ** 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, conversationModelEvaluation) { + // [START dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_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 conversation model resource name. Format: + * `projects//locations//conversationModels/` + */ + // const parent = 'abc123' + /** + * Required. The conversation model evaluation to be created. + */ + // const conversationModelEvaluation = {} + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callCreateConversationModelEvaluation() { + // Construct request + const request = { + parent, + conversationModelEvaluation, + }; + + // Run request + const [operation] = await dialogflowClient.createConversationModelEvaluation(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConversationModelEvaluation(); + // [END dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.delete_conversation_model.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.delete_conversation_model.js new file mode 100644 index 00000000000..c444a87c1d3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.delete_conversation_model.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationModels_DeleteConversationModel_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 conversation model to delete. Format: + * `projects//conversationModels/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callDeleteConversationModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteConversationModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.deploy_conversation_model.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.deploy_conversation_model.js new file mode 100644 index 00000000000..8e9de89b3e6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.deploy_conversation_model.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationModels_DeployConversationModel_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 conversation model to deploy. Format: + * `projects//conversationModels/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callDeployConversationModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deployConversationModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeployConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_DeployConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model.js new file mode 100644 index 00000000000..ad2f4924465 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model.js @@ -0,0 +1,62 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationModels_GetConversationModel_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 conversation model to retrieve. Format: + * `projects//conversationModels/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callGetConversationModel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationModel(request); + console.log(response); + } + + callGetConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_GetConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js new file mode 100644 index 00000000000..c8181e4053d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.get_conversation_model_evaluation.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_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 conversation model evaluation resource name. Format: + * `projects//conversationModels//evaluations/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callGetConversationModelEvaluation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationModelEvaluation(request); + console.log(response); + } + + callGetConversationModelEvaluation(); + // [END dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js new file mode 100644 index 00000000000..6d550c7ef1b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_model_evaluations.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_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 conversation model resource name. Format: + * `projects//conversationModels/` + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of evaluations to return in a + * single page. By default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callListConversationModelEvaluations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationModelEvaluationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationModelEvaluations(); + // [END dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_models.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_models.js new file mode 100644 index 00000000000..b930d994328 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.list_conversation_models.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationModels_ListConversationModels_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 to list all conversation models for. + * Format: `projects/` + */ + // const parent = 'abc123' + /** + * Optional. Maximum number of conversation models to return in a single + * page. By default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callListConversationModels() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationModelsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationModels(); + // [END dialogflow_v2_generated_ConversationModels_ListConversationModels_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.undeploy_conversation_model.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.undeploy_conversation_model.js new file mode 100644 index 00000000000..4b604037364 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_models.undeploy_conversation_model.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationModels_UndeployConversationModel_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 conversation model to undeploy. Format: + * `projects//conversationModels/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationModelsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationModelsClient(); + + async function callUndeployConversationModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.undeployConversationModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUndeployConversationModel(); + // [END dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js new file mode 100644 index 00000000000..1f96e6101ce --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.clear_suggestion_feature_config.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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(conversationProfile, participantRole, suggestionFeatureType) { + // [START dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_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 Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + */ + // const conversationProfile = 'abc123' + /** + * Required. The participant role to remove the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + */ + // const participantRole = {} + /** + * Required. The type of the suggestion feature to remove. + */ + // const suggestionFeatureType = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callClearSuggestionFeatureConfig() { + // Construct request + const request = { + conversationProfile, + participantRole, + suggestionFeatureType, + }; + + // Run request + const [operation] = await dialogflowClient.clearSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callClearSuggestionFeatureConfig(); + // [END dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js new file mode 100644 index 00000000000..06c37b6fd9e --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.create_conversation_profile.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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, conversationProfile) { + // [START dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_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 to create a conversation profile for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation profile to create. + */ + // const conversationProfile = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callCreateConversationProfile() { + // Construct request + const request = { + parent, + conversationProfile, + }; + + // Run request + const response = await dialogflowClient.createConversationProfile(request); + console.log(response); + } + + callCreateConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js new file mode 100644 index 00000000000..4dca2d27888 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.delete_conversation_profile.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_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 name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callDeleteConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteConversationProfile(request); + console.log(response); + } + + callDeleteConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js new file mode 100644 index 00000000000..e4cd2c91e96 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.get_conversation_profile.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_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 conversation profile. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callGetConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationProfile(request); + console.log(response); + } + + callGetConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js new file mode 100644 index 00000000000..a25e61e3fc8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.list_conversation_profiles.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_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 to list all conversation profiles from. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callListConversationProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationProfilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationProfiles(); + // [END dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js new file mode 100644 index 00000000000..767750ae2ff --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.set_suggestion_feature_config.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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(conversationProfile, participantRole, suggestionFeatureConfig) { + // [START dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_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 Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + */ + // const conversationProfile = 'abc123' + /** + * Required. The participant role to add or update the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + */ + // const participantRole = {} + /** + * Required. The suggestion feature config to add or update. + */ + // const suggestionFeatureConfig = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callSetSuggestionFeatureConfig() { + // Construct request + const request = { + conversationProfile, + participantRole, + suggestionFeatureConfig, + }; + + // Run request + const [operation] = await dialogflowClient.setSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSetSuggestionFeatureConfig(); + // [END dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js new file mode 100644 index 00000000000..1a6a41ab264 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversation_profiles.update_conversation_profile.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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(conversationProfile, updateMask) { + // [START dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_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 conversation profile to update. + */ + // const conversationProfile = {} + /** + * Required. The mask to control which fields to update. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callUpdateConversationProfile() { + // Construct request + const request = { + conversationProfile, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateConversationProfile(request); + console.log(response); + } + + callUpdateConversationProfile(); + // [END dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js new file mode 100644 index 00000000000..a1f2f129c46 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.complete_conversation.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Conversations_CompleteConversation_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 identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callCompleteConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.completeConversation(request); + console.log(response); + } + + callCompleteConversation(); + // [END dialogflow_v2_generated_Conversations_CompleteConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js new file mode 100644 index 00000000000..390d99d9131 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.create_conversation.js @@ -0,0 +1,79 @@ +// 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. +// +// ** 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, conversation) { + // [START dialogflow_v2_generated_Conversations_CreateConversation_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 identifier of the project creating the conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation to create. + */ + // const conversation = {} + /** + * Optional. Identifier of the conversation. Generally it's auto generated by Google. + * Only set it if you cannot wait for the response to return a + * auto-generated one to you. + * The conversation ID must be compliant with the regression fomula + * "a-zA-Z a-zA-Z0-9_-*" with the characters length in range of 3,64. + * If the field is provided, the caller is resposible for + * 1. the uniqueness of the ID, otherwise the request will be rejected. + * 2. the consistency for whether to use custom ID or not under a project to + * better ensure uniqueness. + */ + // const conversationId = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callCreateConversation() { + // Construct request + const request = { + parent, + conversation, + }; + + // Run request + const response = await dialogflowClient.createConversation(request); + console.log(response); + } + + callCreateConversation(); + // [END dialogflow_v2_generated_Conversations_CreateConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js new file mode 100644 index 00000000000..a75dbd80632 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.get_conversation.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Conversations_GetConversation_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 name of the conversation. Format: + * `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callGetConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversation(request); + console.log(response); + } + + callGetConversation(); + // [END dialogflow_v2_generated_Conversations_GetConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js new file mode 100644 index 00000000000..23328a9beb7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_conversations.js @@ -0,0 +1,91 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Conversations_ListConversations_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 to list all conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * `lifecycle_state = "COMPLETED"` + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callListConversations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversations(); + // [END dialogflow_v2_generated_Conversations_ListConversations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js new file mode 100644 index 00000000000..dc87405de1f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/conversations.list_messages.js @@ -0,0 +1,84 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Conversations_ListMessages_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 name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + */ + // const parent = 'abc123' + /** + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > 2017-01-15T01:30:15.01Z`. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callListMessages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listMessagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMessages(); + // [END dialogflow_v2_generated_Conversations_ListMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js new file mode 100644 index 00000000000..7a59f4c0126 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.create_document.js @@ -0,0 +1,69 @@ +// 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. +// +// ** 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, document) { + // [START dialogflow_v2_generated_Documents_CreateDocument_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 knowledge base to create a document for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * Required. The document to create. + */ + // const document = {} + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callCreateDocument() { + // Construct request + const request = { + parent, + document, + }; + + // Run request + const [operation] = await dialogflowClient.createDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateDocument(); + // [END dialogflow_v2_generated_Documents_CreateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js new file mode 100644 index 00000000000..962a21c8e37 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.delete_document.js @@ -0,0 +1,64 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Documents_DeleteDocument_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 name of the document to delete. + * Format: `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callDeleteDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteDocument(); + // [END dialogflow_v2_generated_Documents_DeleteDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.export_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.export_document.js new file mode 100644 index 00000000000..cae64ba4f17 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.export_document.js @@ -0,0 +1,78 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Documents_ExportDocument_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 name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + /** + * Cloud Storage file path to export the document. + */ + // const gcsDestination = {} + /** + * When enabled, export the full content of the document including empirical + * probability. + */ + // const exportFullContent = true + /** + * When enabled, export the smart messaging allowlist document for partial + * update. + */ + // const smartMessagingPartialUpdate = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callExportDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.exportDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportDocument(); + // [END dialogflow_v2_generated_Documents_ExportDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js new file mode 100644 index 00000000000..9fce9ffc540 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.get_document.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Documents_GetDocument_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 name of the document to retrieve. + * Format `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callGetDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getDocument(request); + console.log(response); + } + + callGetDocument(); + // [END dialogflow_v2_generated_Documents_GetDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.import_documents.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.import_documents.js new file mode 100644 index 00000000000..7861311d1ec --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.import_documents.js @@ -0,0 +1,82 @@ +// 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. +// +// ** 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, documentTemplate) { + // [START dialogflow_v2_generated_Documents_ImportDocuments_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 knowledge base to import documents into. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The Google Cloud Storage location for the documents. + * The path can include a wildcard. + * These URIs may have the forms + * `gs:///`. + * `gs:////*.`. + */ + // const gcsSource = {} + /** + * Required. Document template used for importing all the documents. + */ + // const documentTemplate = {} + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callImportDocuments() { + // Construct request + const request = { + parent, + documentTemplate, + }; + + // Run request + const [operation] = await dialogflowClient.importDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportDocuments(); + // [END dialogflow_v2_generated_Documents_ImportDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js new file mode 100644 index 00000000000..795b3ea3439 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.list_documents.js @@ -0,0 +1,92 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Documents_ListDocuments_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 knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * AND ... + * The following fields and operators are supported: + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * Examples: + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callListDocuments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listDocumentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDocuments(); + // [END dialogflow_v2_generated_Documents_ListDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js new file mode 100644 index 00000000000..c5b6c1b9745 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.reload_document.js @@ -0,0 +1,81 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Documents_ReloadDocument_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 name of the document to reload. + * Format: `projects//locations//knowledgeBases//documents/` + */ + // const name = 'abc123' + /** + * Optional. The path of gcs source file for reloading document content. For now, + * only gcs uri is supported. + * For documents stored in Google Cloud Storage, these URIs must have + * the form `gs:///`. + */ + // const contentUri = 'abc123' + /** + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + /** + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. + */ + // const smartMessagingPartialUpdate = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callReloadDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.reloadDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReloadDocument(); + // [END dialogflow_v2_generated_Documents_ReloadDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js b/packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js new file mode 100644 index 00000000000..56f44cd204f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/documents.update_document.js @@ -0,0 +1,68 @@ +// 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. +// +// ** 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(document) { + // [START dialogflow_v2_generated_Documents_UpdateDocument_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 document to update. + */ + // const document = {} + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callUpdateDocument() { + // Construct request + const request = { + document, + }; + + // Run request + const [operation] = await dialogflowClient.updateDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateDocument(); + // [END dialogflow_v2_generated_Documents_UpdateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js new file mode 100644 index 00000000000..0af48b2d653 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_create_entities.js @@ -0,0 +1,76 @@ +// 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. +// +// ** 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, entities) { + // [START dialogflow_v2_generated_EntityTypes_BatchCreateEntities_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 name of the entity type to create entities in. Format: + * `projects//agent/entityTypes/`. + */ + // const parent = 'abc123' + /** + * Required. The entities to create. + */ + // const entities = 1234 + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchCreateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchCreateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchCreateEntities(); + // [END dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js new file mode 100644 index 00000000000..f84f2922bfa --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entities.js @@ -0,0 +1,78 @@ +// 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. +// +// ** 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, entityValues) { + // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_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 name of the entity type to delete entries for. Format: + * `projects//agent/entityTypes/`. + */ + // const parent = 'abc123' + /** + * Required. The reference `values` of the entities to delete. Note that + * these are not fully-qualified names, i.e. they don't start with + * `projects/`. + */ + // const entityValues = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchDeleteEntities() { + // Construct request + const request = { + parent, + entityValues, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteEntities(); + // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js new file mode 100644 index 00000000000..1b1e6839e6b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_delete_entity_types.js @@ -0,0 +1,69 @@ +// 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. +// +// ** 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, entityTypeNames) { + // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_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 name of the agent to delete all entities types for. Format: + * `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + */ + // const entityTypeNames = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchDeleteEntityTypes() { + // Construct request + const request = { + parent, + entityTypeNames, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteEntityTypes(); + // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js new file mode 100644 index 00000000000..6b914ec3043 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entities.js @@ -0,0 +1,80 @@ +// 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. +// +// ** 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, entities) { + // [START dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_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 name of the entity type to update or create entities in. + * Format: `projects//agent/entityTypes/`. + */ + // const parent = 'abc123' + /** + * Required. The entities to update or create. + */ + // const entities = 1234 + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchUpdateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateEntities(); + // [END dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js new file mode 100644 index 00000000000..c2a1ed41d4b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.batch_update_entity_types.js @@ -0,0 +1,86 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_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 name of the agent to update or create entity types in. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing entity types to update + * or create. The file format can either be a serialized proto (of + * EntityBatch type) or a JSON object. Note: The URI must start with + * "gs://". + */ + // const entityTypeBatchUri = 'abc123' + /** + * The collection of entity types to update or create. + */ + // const entityTypeBatchInline = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchUpdateEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateEntityTypes(); + // [END dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js new file mode 100644 index 00000000000..45bca5bf77f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.create_entity_type.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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, entityType) { + // [START dialogflow_v2_generated_EntityTypes_CreateEntityType_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 agent to create a entity type for. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The entity type to create. + */ + // const entityType = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callCreateEntityType() { + // Construct request + const request = { + parent, + entityType, + }; + + // Run request + const response = await dialogflowClient.createEntityType(request); + console.log(response); + } + + callCreateEntityType(); + // [END dialogflow_v2_generated_EntityTypes_CreateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js new file mode 100644 index 00000000000..03c20e526bb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.delete_entity_type.js @@ -0,0 +1,62 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_EntityTypes_DeleteEntityType_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 name of the entity type to delete. + * Format: `projects//agent/entityTypes/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callDeleteEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEntityType(request); + console.log(response); + } + + callDeleteEntityType(); + // [END dialogflow_v2_generated_EntityTypes_DeleteEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js new file mode 100644 index 00000000000..9ce87aff18a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.get_entity_type.js @@ -0,0 +1,70 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_EntityTypes_GetEntityType_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 name of the entity type. + * Format: `projects//agent/entityTypes/`. + */ + // const name = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callGetEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEntityType(request); + console.log(response); + } + + callGetEntityType(); + // [END dialogflow_v2_generated_EntityTypes_GetEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js new file mode 100644 index 00000000000..e5d3abb8854 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.list_entity_types.js @@ -0,0 +1,81 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_EntityTypes_ListEntityTypes_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 agent to list all entity types from. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callListEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEntityTypes(); + // [END dialogflow_v2_generated_EntityTypes_ListEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js new file mode 100644 index 00000000000..9522c7521f6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/entity_types.update_entity_type.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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(entityType) { + // [START dialogflow_v2_generated_EntityTypes_UpdateEntityType_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 entity type to update. + */ + // const entityType = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callUpdateEntityType() { + // Construct request + const request = { + entityType, + }; + + // Run request + const response = await dialogflowClient.updateEntityType(request); + console.log(response); + } + + callUpdateEntityType(); + // [END dialogflow_v2_generated_EntityTypes_UpdateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js new file mode 100644 index 00000000000..0139e135542 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.create_environment.js @@ -0,0 +1,74 @@ +// 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. +// +// ** 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, environment, environmentId) { + // [START dialogflow_v2_generated_Environments_CreateEnvironment_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 agent to create an environment for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The environment to create. + */ + // const environment = {} + /** + * Required. The unique id of the new environment. + */ + // const environmentId = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callCreateEnvironment() { + // Construct request + const request = { + parent, + environment, + environmentId, + }; + + // Run request + const response = await dialogflowClient.createEnvironment(request); + console.log(response); + } + + callCreateEnvironment(); + // [END dialogflow_v2_generated_Environments_CreateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js new file mode 100644 index 00000000000..a13c799a0a5 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.delete_environment.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Environments_DeleteEnvironment_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 name of the environment to delete. + * / Format: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * The environment ID for the default environment is `-`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callDeleteEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEnvironment(request); + console.log(response); + } + + callDeleteEnvironment(); + // [END dialogflow_v2_generated_Environments_DeleteEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js new file mode 100644 index 00000000000..f1dd9fbe7c1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Environments_GetEnvironment_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 name of the environment. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * The environment ID for the default environment is `-`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callGetEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEnvironment(request); + console.log(response); + } + + callGetEnvironment(); + // [END dialogflow_v2_generated_Environments_GetEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js new file mode 100644 index 00000000000..7efbf8c312c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.get_environment_history.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Environments_GetEnvironmentHistory_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 name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * The environment ID for the default environment is `-`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callGetEnvironmentHistory() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.getEnvironmentHistoryAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGetEnvironmentHistory(); + // [END dialogflow_v2_generated_Environments_GetEnvironmentHistory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js new file mode 100644 index 00000000000..232d265b7c5 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.list_environments.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Environments_ListEnvironments_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 agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callListEnvironments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEnvironmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEnvironments(); + // [END dialogflow_v2_generated_Environments_ListEnvironments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js new file mode 100644 index 00000000000..5a3a190371f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/environments.update_environment.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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(environment, updateMask) { + // [START dialogflow_v2_generated_Environments_UpdateEnvironment_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 environment to update. + */ + // const environment = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. This field is used to prevent accidental overwrite of the default + * environment, which is an operation that cannot be undone. To confirm that + * the caller desires this overwrite, this field must be explicitly set to + * true when updating the default environment (environment ID = `-`). + */ + // const allowLoadToDraftAndDiscardChanges = true + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callUpdateEnvironment() { + // Construct request + const request = { + environment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateEnvironment(request); + console.log(response); + } + + callUpdateEnvironment(); + // [END dialogflow_v2_generated_Environments_UpdateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js b/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js new file mode 100644 index 00000000000..97b59e7c0df --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.get_fulfillment.js @@ -0,0 +1,62 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Fulfillments_GetFulfillment_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 name of the fulfillment. + * Format: `projects//agent/fulfillment`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function callGetFulfillment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getFulfillment(request); + console.log(response); + } + + callGetFulfillment(); + // [END dialogflow_v2_generated_Fulfillments_GetFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js b/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js new file mode 100644 index 00000000000..2eaa4eaf921 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/fulfillments.update_fulfillment.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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(fulfillment, updateMask) { + // [START dialogflow_v2_generated_Fulfillments_UpdateFulfillment_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 fulfillment to update. + */ + // const fulfillment = {} + /** + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function callUpdateFulfillment() { + // Construct request + const request = { + fulfillment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateFulfillment(request); + console.log(response); + } + + callUpdateFulfillment(); + // [END dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js new file mode 100644 index 00000000000..d383fb9171c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_delete_intents.js @@ -0,0 +1,69 @@ +// 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. +// +// ** 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, intents) { + // [START dialogflow_v2_generated_Intents_BatchDeleteIntents_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 name of the agent to delete all entities types for. Format: + * `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + */ + // const intents = 1234 + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callBatchDeleteIntents() { + // Construct request + const request = { + parent, + intents, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteIntents(); + // [END dialogflow_v2_generated_Intents_BatchDeleteIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js new file mode 100644 index 00000000000..95c585f6d99 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.batch_update_intents.js @@ -0,0 +1,89 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Intents_BatchUpdateIntents_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 name of the agent to update or create intents in. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing intents to update or + * create. The file format can either be a serialized proto (of IntentBatch + * type) or JSON object. Note: The URI must start with "gs://". + */ + // const intentBatchUri = 'abc123' + /** + * The collection of intents to update or create. + */ + // const intentBatchInline = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callBatchUpdateIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateIntents(); + // [END dialogflow_v2_generated_Intents_BatchUpdateIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js new file mode 100644 index 00000000000..67f3789c77b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.create_intent.js @@ -0,0 +1,79 @@ +// 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. +// +// ** 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, intent) { + // [START dialogflow_v2_generated_Intents_CreateIntent_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 agent to create a intent for. + * Format: `projects//agent`. + */ + // const parent = 'abc123' + /** + * Required. The intent to create. + */ + // const intent = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callCreateIntent() { + // Construct request + const request = { + parent, + intent, + }; + + // Run request + const response = await dialogflowClient.createIntent(request); + console.log(response); + } + + callCreateIntent(); + // [END dialogflow_v2_generated_Intents_CreateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js new file mode 100644 index 00000000000..f38f93dd1fc --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.delete_intent.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Intents_DeleteIntent_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 name of the intent to delete. If this intent has direct or + * indirect followup intents, we also delete them. + * Format: `projects//agent/intents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callDeleteIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteIntent(request); + console.log(response); + } + + callDeleteIntent(); + // [END dialogflow_v2_generated_Intents_DeleteIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js new file mode 100644 index 00000000000..9031c7a23fe --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.get_intent.js @@ -0,0 +1,74 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Intents_GetIntent_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 name of the intent. + * Format: `projects//agent/intents/`. + */ + // const name = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callGetIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getIntent(request); + console.log(response); + } + + callGetIntent(); + // [END dialogflow_v2_generated_Intents_GetIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js new file mode 100644 index 00000000000..0868e386d58 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.list_intents.js @@ -0,0 +1,92 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Intents_ListIntents_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 agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + */ + // const parent = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callListIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listIntentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListIntents(); + // [END dialogflow_v2_generated_Intents_ListIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js new file mode 100644 index 00000000000..0cd8227a6a8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/intents.update_intent.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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(intent) { + // [START dialogflow_v2_generated_Intents_UpdateIntent_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 intent to update. + */ + // const intent = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callUpdateIntent() { + // Construct request + const request = { + intent, + }; + + // Run request + const response = await dialogflowClient.updateIntent(request); + console.log(response); + } + + callUpdateIntent(); + // [END dialogflow_v2_generated_Intents_UpdateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js new file mode 100644 index 00000000000..0f699b2799d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.create_knowledge_base.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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, knowledgeBase) { + // [START dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_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 to create a knowledge base for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The knowledge base to create. + */ + // const knowledgeBase = {} + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callCreateKnowledgeBase() { + // Construct request + const request = { + parent, + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.createKnowledgeBase(request); + console.log(response); + } + + callCreateKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js new file mode 100644 index 00000000000..35e6176174b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.delete_knowledge_base.js @@ -0,0 +1,68 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_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 name of the knowledge base to delete. + * Format: `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + /** + * Optional. Force deletes the knowledge base. When set to true, any documents + * in the knowledge base are also deleted. + */ + // const force = true + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callDeleteKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteKnowledgeBase(request); + console.log(response); + } + + callDeleteKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js new file mode 100644 index 00000000000..613f3621c71 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.get_knowledge_base.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_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 name of the knowledge base to retrieve. + * Format `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callGetKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getKnowledgeBase(request); + console.log(response); + } + + callGetKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js new file mode 100644 index 00000000000..e27e649ab8b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.list_knowledge_bases.js @@ -0,0 +1,95 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_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 to list of knowledge bases for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * AND ... + * The following fields and operators are supported: + * * display_name with has(:) operator + * * language_code with equals(=) operator + * Examples: + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callListKnowledgeBases() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listKnowledgeBasesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListKnowledgeBases(); + // [END dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js new file mode 100644 index 00000000000..cd5a5c60058 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/knowledge_bases.update_knowledge_base.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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(knowledgeBase) { + // [START dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_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 knowledge base to update. + */ + // const knowledgeBase = {} + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callUpdateKnowledgeBase() { + // Construct request + const request = { + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.updateKnowledgeBase(request); + console.log(response); + } + + callUpdateKnowledgeBase(); + // [END dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js new file mode 100644 index 00000000000..a8740f5355f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.analyze_content.js @@ -0,0 +1,101 @@ +// 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. +// +// ** 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(participant) { + // [START dialogflow_v2_generated_Participants_AnalyzeContent_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 name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * The natural language text to be processed. + */ + // const textInput = {} + /** + * An input event to send to Dialogflow. + */ + // const eventInput = {} + /** + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * AnalyzeContent. If this configuration is not supplied, speech synthesis + * is disabled. + */ + // const replyAudioConfig = {} + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = {} + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + /** + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxParameters = {} + /** + * A unique identifier for this request. Restricted to 36 ASCII characters. + * A random UUID is recommended. + * This request is only idempotent if a `request_id` is provided. + */ + // const requestId = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callAnalyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const response = await dialogflowClient.analyzeContent(request); + console.log(response); + } + + callAnalyzeContent(); + // [END dialogflow_v2_generated_Participants_AnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js new file mode 100644 index 00000000000..13451c6bf04 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.create_participant.js @@ -0,0 +1,68 @@ +// 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. +// +// ** 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, participant) { + // [START dialogflow_v2_generated_Participants_CreateParticipant_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 identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Required. The participant to create. + */ + // const participant = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callCreateParticipant() { + // Construct request + const request = { + parent, + participant, + }; + + // Run request + const response = await dialogflowClient.createParticipant(request); + console.log(response); + } + + callCreateParticipant(); + // [END dialogflow_v2_generated_Participants_CreateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js new file mode 100644 index 00000000000..a40d3c106cf --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.get_participant.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Participants_GetParticipant_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 name of the participant. Format: + * `projects//locations//conversations//participants/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callGetParticipant() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getParticipant(request); + console.log(response); + } + + callGetParticipant(); + // [END dialogflow_v2_generated_Participants_GetParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js new file mode 100644 index 00000000000..8b95d039a33 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.list_participants.js @@ -0,0 +1,74 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Participants_ListParticipants_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 conversation to list all participants from. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callListParticipants() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listParticipantsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListParticipants(); + // [END dialogflow_v2_generated_Participants_ListParticipants_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.streaming_analyze_content.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.streaming_analyze_content.js new file mode 100644 index 00000000000..5077043f390 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.streaming_analyze_content.js @@ -0,0 +1,125 @@ +// 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. +// +// ** 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(participant) { + // [START dialogflow_v2_generated_Participants_StreamingAnalyzeContent_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 name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * Instructs the speech recognizer how to process the speech audio. + */ + // const audioConfig = {} + /** + * The natural language text to be processed. + */ + // const textConfig = {} + /** + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * StreamingAnalyzeContent. If this configuration is not supplied, speech + * synthesis is disabled. + */ + // const replyAudioConfig = {} + /** + * The input audio content to be recognized. Must be sent if `audio_config` + * is set in the first message. The complete audio over all streaming + * messages must not exceed 1 minute. + */ + // const inputAudio = 'Buffer.from('string')' + /** + * The UTF-8 encoded natural language text to be processed. Must be sent if + * `text_config` is set in the first message. Text length must not exceed + * 256 bytes for virtual agent interactions. The `input_text` field can be + * only sent once. + */ + // const inputText = 'abc123' + /** + * The DTMF digits used to invoke intent and fill in parameter value. + * This input is ignored if the previous response indicated that DTMF input + * is not accepted. + */ + // const inputDtmf = {} + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = {} + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + /** + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxParameters = {} + /** + * Enable partial virtual agent responses. If this flag is not enabled, + * response stream still contains only one final response even if some + * `Fulfillment`s in Dialogflow virtual agent have been configured to return + * partial responses. + */ + // const enablePartialAutomatedAgentReply = true + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callStreamingAnalyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const stream = await dialogflowClient.streamingAnalyzeContent(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingAnalyzeContent(); + // [END dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js new file mode 100644 index 00000000000..794835e5bd4 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_articles.js @@ -0,0 +1,80 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Participants_SuggestArticles_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 name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * latest_message google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message to use as context + * when compiling the suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestArticles() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestArticles(request); + console.log(response); + } + + callSuggestArticles(); + // [END dialogflow_v2_generated_Participants_SuggestArticles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js new file mode 100644 index 00000000000..ea6953e2593 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_faq_answers.js @@ -0,0 +1,80 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Participants_SuggestFaqAnswers_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 name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * latest_message to use as context when compiling the + * suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestFaqAnswers() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestFaqAnswers(request); + console.log(response); + } + + callSuggestFaqAnswers(); + // [END dialogflow_v2_generated_Participants_SuggestFaqAnswers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_smart_replies.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_smart_replies.js new file mode 100644 index 00000000000..6e15c4d4a83 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.suggest_smart_replies.js @@ -0,0 +1,82 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Participants_SuggestSmartReplies_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 name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * The current natural language text segment to compile suggestion + * for. This provides a way for user to get follow up smart reply suggestion + * after a smart reply selection, without sending a text message. + */ + // const currentTextInput = {} + /** + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Max number of messages prior to and including + * latest_message to use as context when compiling the + * suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestSmartReplies() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestSmartReplies(request); + console.log(response); + } + + callSuggestSmartReplies(); + // [END dialogflow_v2_generated_Participants_SuggestSmartReplies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js new file mode 100644 index 00000000000..1f54b8d8bb8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/participants.update_participant.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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(participant, updateMask) { + // [START dialogflow_v2_generated_Participants_UpdateParticipant_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 participant to update. + */ + // const participant = {} + /** + * Required. The mask to specify which fields to update. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callUpdateParticipant() { + // Construct request + const request = { + participant, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateParticipant(request); + console.log(response); + } + + callUpdateParticipant(); + // [END dialogflow_v2_generated_Participants_UpdateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js new file mode 100644 index 00000000000..6326d522ce5 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.create_session_entity_type.js @@ -0,0 +1,71 @@ +// 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. +// +// ** 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, sessionEntityType) { + // [START dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_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 session to create a session entity type for. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Required. The session entity type to create. + */ + // const sessionEntityType = {} + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callCreateSessionEntityType() { + // Construct request + const request = { + parent, + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.createSessionEntityType(request); + console.log(response); + } + + callCreateSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js new file mode 100644 index 00000000000..ba0bc98c285 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.delete_session_entity_type.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_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 name of the entity type to delete. Format: + * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callDeleteSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteSessionEntityType(request); + console.log(response); + } + + callDeleteSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js new file mode 100644 index 00000000000..7a60b72fce0 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.get_session_entity_type.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_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 name of the session entity type. Format: + * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callGetSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getSessionEntityType(request); + console.log(response); + } + + callGetSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js new file mode 100644 index 00000000000..87ccdabb650 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.list_session_entity_types.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_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 session to list all session entity types from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callListSessionEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listSessionEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSessionEntityTypes(); + // [END dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js new file mode 100644 index 00000000000..1976e6fd8ee --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/session_entity_types.update_session_entity_type.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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(sessionEntityType) { + // [START dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_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 session entity type to update. + */ + // const sessionEntityType = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callUpdateSessionEntityType() { + // Construct request + const request = { + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.updateSessionEntityType(request); + console.log(response); + } + + callUpdateSessionEntityType(); + // [END dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js new file mode 100644 index 00000000000..5c9419e8c4a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/sessions.detect_intent.js @@ -0,0 +1,108 @@ +// 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. +// +// ** 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(session, queryInput) { + // [START dialogflow_v2_generated_Sessions_DetectIntent_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 name of the session this query is sent to. Format: + * `projects//agent/sessions/`, or + * `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + * default 'draft' environment (`Environment ID` might be referred to as + * environment name at some places). If `User ID` is not specified, we are + * using "-". It's up to the API caller to choose an appropriate `Session ID` + * and `User Id`. They can be a random number or some type of user and session + * identifiers (preferably hashed). The length of the `Session ID` and + * `User ID` must not exceed 36 characters. + * For more information, see the API interactions + * guide (https://cloud.google.com/dialogflow/docs/api-overview). + * Note: Always use agent versions for production traffic. + * See Versions and + * environments (https://cloud.google.com/dialogflow/es/docs/agents-versions). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = {} + /** + * Required. The input specification. It can be set to: + * 1. an audio config + * which instructs the speech recognizer how to process the speech audio, + * 2. a conversational query in the form of text, or + * 3. an event that specifies which intent to trigger. + */ + // const queryInput = {} + /** + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + */ + // const outputAudioConfig = {} + /** + * Mask for output_audio_config google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * If unspecified or empty, output_audio_config google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config replaces the agent-level + * config in its entirety. + */ + // const outputAudioConfigMask = {} + /** + * The natural language speech audio to be processed. This field + * should be populated iff `query_input` is set to an input audio config. + * A single request can contain up to 1 minute of speech audio data. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function callDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const response = await dialogflowClient.detectIntent(request); + console.log(response); + } + + callDetectIntent(); + // [END dialogflow_v2_generated_Sessions_DetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js new file mode 100644 index 00000000000..50370fc7c94 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/sessions.streaming_detect_intent.js @@ -0,0 +1,123 @@ +// 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. +// +// ** 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(session, queryInput) { + // [START dialogflow_v2_generated_Sessions_StreamingDetectIntent_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 name of the session the query is sent to. + * Format of the session name: + * `projects//agent/sessions/`, or + * `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + * default 'draft' environment. If `User ID` is not specified, we are using + * "-". It's up to the API caller to choose an appropriate `Session ID` and + * `User Id`. They can be a random number or some type of user and session + * identifiers (preferably hashed). The length of the `Session ID` and + * `User ID` must not exceed 36 characters. + * For more information, see the API interactions + * guide (https://cloud.google.com/dialogflow/docs/api-overview). + * Note: Always use agent versions for production traffic. + * See Versions and + * environments (https://cloud.google.com/dialogflow/es/docs/agents-versions). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = {} + /** + * Required. The input specification. It can be set to: + * 1. an audio config which instructs the speech recognizer how to process + * the speech audio, + * 2. a conversational query in the form of text, or + * 3. an event that specifies which intent to trigger. + */ + // const queryInput = {} + /** + * Please use InputAudioConfig.single_utterance google.cloud.dialogflow.v2.InputAudioConfig.single_utterance instead. + * If `false` (default), recognition does not cease until + * the client closes the stream. If `true`, the recognizer will detect a + * single spoken utterance in input audio. Recognition ceases when it detects + * the audio's voice has stopped or paused. In this case, once a detected + * intent is received, the client should close the stream and start a new + * request with a new stream as needed. + * This setting is ignored when `query_input` is a piece of text or an event. + */ + // const singleUtterance = true + /** + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + */ + // const outputAudioConfig = {} + /** + * Mask for output_audio_config google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * If unspecified or empty, output_audio_config google.cloud.dialogflow.v2.StreamingDetectIntentRequest.output_audio_config replaces the agent-level + * config in its entirety. + */ + // const outputAudioConfigMask = {} + /** + * The input audio content to be recognized. Must be sent if + * `query_input` was set to a streaming input audio config. The complete audio + * over all streaming messages must not exceed 1 minute. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function callStreamingDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const stream = await dialogflowClient.streamingDetectIntent(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingDetectIntent(); + // [END dialogflow_v2_generated_Sessions_StreamingDetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json b/packages/google-cloud-dialogflow/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json new file mode 100644 index 00000000000..0a54f12429d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/snippet_metadata.google.cloud.dialogflow.v2.json @@ -0,0 +1,4731 @@ +{ + "clientLibrary": { + "name": "nodejs-dialogflow", + "version": "5.3.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.dialogflow.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "regionTag": "dialogflow_v2_generated_Agents_GetAgent_async", + "title": "dialogflow getAgent Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent.", + "canonical": true, + "file": "agents.get_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.GetAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Agent", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "GetAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.GetAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_SetAgent_async", + "title": "dialogflow setAgent Sample", + "origin": "API_DEFINITION", + "description": " Creates/updates the specified agent. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.set_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.SetAgent", + "async": true, + "parameters": [ + { + "name": "agent", + "type": ".google.cloud.dialogflow.v2.Agent" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Agent", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "SetAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.SetAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_DeleteAgent_async", + "title": "dialogflow deleteAgent Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified agent.", + "canonical": true, + "file": "agents.delete_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.DeleteAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "DeleteAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.DeleteAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_SearchAgents_async", + "title": "dialogflow searchAgents Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of agents. Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id \"-\". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).", + "canonical": true, + "file": "agents.search_agents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAgents", + "fullName": "google.cloud.dialogflow.v2.Agents.SearchAgents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SearchAgentsResponse", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "SearchAgents", + "fullName": "google.cloud.dialogflow.v2.Agents.SearchAgents", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_TrainAgent_async", + "title": "dialogflow trainAgent Sample", + "origin": "API_DEFINITION", + "description": " Trains the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.train_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TrainAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.TrainAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "TrainAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.TrainAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_ExportAgent_async", + "title": "dialogflow exportAgent Sample", + "origin": "API_DEFINITION", + "description": " Exports the specified agent to a ZIP file. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]", + "canonical": true, + "file": "agents.export_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.ExportAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "ExportAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.ExportAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_ImportAgent_async", + "title": "dialogflow importAgent Sample", + "origin": "API_DEFINITION", + "description": " Imports the specified agent from a ZIP file. Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when importing is complete, not when it is done training. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.import_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.ImportAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + }, + { + "name": "agent_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "ImportAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.ImportAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_RestoreAgent_async", + "title": "dialogflow restoreAgent Sample", + "origin": "API_DEFINITION", + "description": " Restores the specified agent from a ZIP file. Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when restoring is complete, not when it is done training. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.restore_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.RestoreAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + }, + { + "name": "agent_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "RestoreAgent", + "fullName": "google.cloud.dialogflow.v2.Agents.RestoreAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Agents_GetValidationResult_async", + "title": "dialogflow getValidationResult Sample", + "origin": "API_DEFINITION", + "description": " Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.", + "canonical": true, + "file": "agents.get_validation_result.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetValidationResult", + "fullName": "google.cloud.dialogflow.v2.Agents.GetValidationResult", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ValidationResult", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2.AgentsClient" + }, + "method": { + "shortName": "GetValidationResult", + "fullName": "google.cloud.dialogflow.v2.Agents.GetValidationResult", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async", + "title": "dialogflow listAnswerRecords Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all answer records in the specified project in reverse chronological order.", + "canonical": true, + "file": "answer_records.list_answer_records.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAnswerRecords", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListAnswerRecordsResponse", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2.AnswerRecordsClient" + }, + "method": { + "shortName": "ListAnswerRecords", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async", + "title": "dialogflow updateAnswerRecord Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified answer record.", + "canonical": true, + "file": "answer_records.update_answer_record.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAnswerRecord", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord", + "async": true, + "parameters": [ + { + "name": "answer_record", + "type": ".google.cloud.dialogflow.v2.AnswerRecord" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.AnswerRecord", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2.AnswerRecordsClient" + }, + "method": { + "shortName": "UpdateAnswerRecord", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords.UpdateAnswerRecord", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_ListContexts_async", + "title": "dialogflow listContexts Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all contexts in the specified session.", + "canonical": true, + "file": "contexts.list_contexts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListContexts", + "fullName": "google.cloud.dialogflow.v2.Contexts.ListContexts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListContextsResponse", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "ListContexts", + "fullName": "google.cloud.dialogflow.v2.Contexts.ListContexts", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_GetContext_async", + "title": "dialogflow getContext Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified context.", + "canonical": true, + "file": "contexts.get_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.GetContext", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "GetContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.GetContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_CreateContext_async", + "title": "dialogflow createContext Sample", + "origin": "API_DEFINITION", + "description": " Creates a context. If the specified context already exists, overrides the context.", + "canonical": true, + "file": "contexts.create_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.CreateContext", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "context", + "type": ".google.cloud.dialogflow.v2.Context" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "CreateContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.CreateContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_UpdateContext_async", + "title": "dialogflow updateContext Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified context.", + "canonical": true, + "file": "contexts.update_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.UpdateContext", + "async": true, + "parameters": [ + { + "name": "context", + "type": ".google.cloud.dialogflow.v2.Context" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "UpdateContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.UpdateContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_DeleteContext_async", + "title": "dialogflow deleteContext Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified context.", + "canonical": true, + "file": "contexts.delete_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteContext", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "DeleteContext", + "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Contexts_DeleteAllContexts_async", + "title": "dialogflow deleteAllContexts Sample", + "origin": "API_DEFINITION", + "description": " Deletes all active contexts in the specified session.", + "canonical": true, + "file": "contexts.delete_all_contexts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAllContexts", + "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteAllContexts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2.ContextsClient" + }, + "method": { + "shortName": "DeleteAllContexts", + "fullName": "google.cloud.dialogflow.v2.Contexts.DeleteAllContexts", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async", + "title": "dialogflow createConversationDataset Sample", + "origin": "API_DEFINITION", + "description": " Creates a new conversation dataset. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [CreateConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata] - `response`: [ConversationDataset][google.cloud.dialogflow.v2.ConversationDataset]", + "canonical": true, + "file": "conversation_datasets.create_conversation_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_dataset", + "type": ".google.cloud.dialogflow.v2.ConversationDataset" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "CreateConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.CreateConversationDataset", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async", + "title": "dialogflow getConversationDataset Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified conversation dataset.", + "canonical": true, + "file": "conversation_datasets.get_conversation_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationDataset", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "GetConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.GetConversationDataset", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async", + "title": "dialogflow listConversationDatasets Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversation datasets in the specified project and location.", + "canonical": true, + "file": "conversation_datasets.list_conversation_datasets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationDatasetsResponse", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "ListConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ListConversationDatasets", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async", + "title": "dialogflow deleteConversationDataset Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified conversation dataset. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [DeleteConversationDatasetOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "conversation_datasets.delete_conversation_dataset.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "DeleteConversationDataset", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.DeleteConversationDataset", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async", + "title": "dialogflow importConversationData Sample", + "origin": "API_DEFINITION", + "description": " Import data into the specified conversation dataset. Note that it is not allowed to import data to a conversation dataset that already has data in it. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [ImportConversationDataOperationMetadata][google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata] - `response`: [ImportConversationDataOperationResponse][google.cloud.dialogflow.v2.ImportConversationDataOperationResponse]", + "canonical": true, + "file": "conversation_datasets.import_conversation_data.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportConversationData", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "input_config", + "type": ".google.cloud.dialogflow.v2.InputConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationDatasetsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasetsClient" + }, + "method": { + "shortName": "ImportConversationData", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData", + "service": { + "shortName": "ConversationDatasets", + "fullName": "google.cloud.dialogflow.v2.ConversationDatasets" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_CreateConversationModel_async", + "title": "dialogflow createConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Creates a model. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [CreateConversationModelOperationMetadata][google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata] - `response`: [ConversationModel][google.cloud.dialogflow.v2.ConversationModel]", + "canonical": true, + "file": "conversation_models.create_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_model", + "type": ".google.cloud.dialogflow.v2.ConversationModel" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "CreateConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_GetConversationModel_async", + "title": "dialogflow getConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Gets conversation model.", + "canonical": true, + "file": "conversation_models.get_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationModel", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "GetConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_ListConversationModels_async", + "title": "dialogflow listConversationModels Sample", + "origin": "API_DEFINITION", + "description": " Lists conversation models.", + "canonical": true, + "file": "conversation_models.list_conversation_models.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModels", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationModelsResponse", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "ListConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModels", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async", + "title": "dialogflow deleteConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Deletes a model. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [DeleteConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "conversation_models.delete_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "DeleteConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeleteConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_DeployConversationModel_async", + "title": "dialogflow deployConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Deploys a model. If a model is already deployed, deploying it has no effect. A model can only serve prediction requests after it gets deployed. For article suggestion, custom model will not be used unless it is deployed. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [DeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "conversation_models.deploy_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeployConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "DeployConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.DeployConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async", + "title": "dialogflow undeployConversationModel Sample", + "origin": "API_DEFINITION", + "description": " Undeploys a model. If the model is not deployed this method has no effect. If the model is currently being used: - For article suggestion, article suggestion will fallback to the default model if model is undeployed. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [UndeployConversationModelOperationMetadata][google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "conversation_models.undeploy_conversation_model.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UndeployConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "UndeployConversationModel", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.UndeployConversationModel", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async", + "title": "dialogflow getConversationModelEvaluation Sample", + "origin": "API_DEFINITION", + "description": " Gets an evaluation of conversation model.", + "canonical": true, + "file": "conversation_models.get_conversation_model_evaluation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationModelEvaluation", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationModelEvaluation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "GetConversationModelEvaluation", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.GetConversationModelEvaluation", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async", + "title": "dialogflow listConversationModelEvaluations Sample", + "origin": "API_DEFINITION", + "description": " Lists evaluations of a conversation model.", + "canonical": true, + "file": "conversation_models.list_conversation_model_evaluations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationModelEvaluations", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationModelEvaluationsResponse", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "ListConversationModelEvaluations", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.ListConversationModelEvaluations", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async", + "title": "dialogflow createConversationModelEvaluation Sample", + "origin": "API_DEFINITION", + "description": " Creates evaluation of a conversation model.", + "canonical": true, + "file": "conversation_models.create_conversation_model_evaluation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationModelEvaluation", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_model_evaluation", + "type": ".google.cloud.dialogflow.v2.ConversationModelEvaluation" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationModelsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationModelsClient" + }, + "method": { + "shortName": "CreateConversationModelEvaluation", + "fullName": "google.cloud.dialogflow.v2.ConversationModels.CreateConversationModelEvaluation", + "service": { + "shortName": "ConversationModels", + "fullName": "google.cloud.dialogflow.v2.ConversationModels" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async", + "title": "dialogflow listConversationProfiles Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversation profiles in the specified project.", + "canonical": true, + "file": "conversation_profiles.list_conversation_profiles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationProfilesResponse", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "ListConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async", + "title": "dialogflow getConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified conversation profile.", + "canonical": true, + "file": "conversation_profiles.get_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "GetConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async", + "title": "dialogflow createConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Creates a conversation profile in the specified project. [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] aren't populated in the response. You can retrieve them via [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile] API.", + "canonical": true, + "file": "conversation_profiles.create_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_profile", + "type": ".google.cloud.dialogflow.v2.ConversationProfile" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "CreateConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.CreateConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async", + "title": "dialogflow updateConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified conversation profile. [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] aren't populated in the response. You can retrieve them via [GetConversationProfile][google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile] API.", + "canonical": true, + "file": "conversation_profiles.update_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": ".google.cloud.dialogflow.v2.ConversationProfile" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "UpdateConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.UpdateConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async", + "title": "dialogflow deleteConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified conversation profile.", + "canonical": true, + "file": "conversation_profiles.delete_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "DeleteConversationProfile", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.DeleteConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async", + "title": "dialogflow setSuggestionFeatureConfig Sample", + "origin": "API_DEFINITION", + "description": " Adds or updates a suggestion feature in a conversation profile. If the conversation profile contains the type of suggestion feature for the participant role, it will update it. Otherwise it will insert the suggestion feature. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile] If a long running operation to add or update suggestion feature config for the same conversation profile, participant role and suggestion feature type exists, please cancel the existing long running operation before sending such request, otherwise the request will be rejected.", + "canonical": true, + "file": "conversation_profiles.set_suggestion_feature_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": "TYPE_STRING" + }, + { + "name": "participant_role", + "type": ".google.cloud.dialogflow.v2.Participant.Role" + }, + { + "name": "suggestion_feature_config", + "type": ".google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "SetSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.SetSuggestionFeatureConfig", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async", + "title": "dialogflow clearSuggestionFeatureConfig Sample", + "origin": "API_DEFINITION", + "description": " Clears a suggestion feature from a conversation profile for the given participant role. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2.ConversationProfile]", + "canonical": true, + "file": "conversation_profiles.clear_suggestion_feature_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ClearSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": "TYPE_STRING" + }, + { + "name": "participant_role", + "type": ".google.cloud.dialogflow.v2.Participant.Role" + }, + { + "name": "suggestion_feature_type", + "type": ".google.cloud.dialogflow.v2.SuggestionFeature.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2.ConversationProfilesClient" + }, + "method": { + "shortName": "ClearSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles.ClearSuggestionFeatureConfig", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_CreateConversation_async", + "title": "dialogflow createConversation Sample", + "origin": "API_DEFINITION", + "description": " Creates a new conversation. Conversations are auto-completed after 24 hours. Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage. For Automated Agent Stage, there will be a dialogflow agent responding to user queries. For Assist Stage, there's no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation. If [Conversation.conversation_profile][google.cloud.dialogflow.v2.Conversation.conversation_profile] is configured for a dialogflow agent, conversation will start from `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And during `Automated Agent Stage`, once an [Intent][google.cloud.dialogflow.v2.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2.Intent.live_agent_handoff] is triggered, conversation will transfer to Assist Stage.", + "canonical": true, + "file": "conversations.create_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.CreateConversation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation", + "type": ".google.cloud.dialogflow.v2.Conversation" + }, + { + "name": "conversation_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "CreateConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.CreateConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_ListConversations_async", + "title": "dialogflow listConversations Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversations in the specified project.", + "canonical": true, + "file": "conversations.list_conversations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversations", + "fullName": "google.cloud.dialogflow.v2.Conversations.ListConversations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListConversationsResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "ListConversations", + "fullName": "google.cloud.dialogflow.v2.Conversations.ListConversations", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_GetConversation_async", + "title": "dialogflow getConversation Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specific conversation.", + "canonical": true, + "file": "conversations.get_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.GetConversation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "GetConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.GetConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_CompleteConversation_async", + "title": "dialogflow completeConversation Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified conversation. Finished conversations are purged from the database after 30 days.", + "canonical": true, + "file": "conversations.complete_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.CompleteConversation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "CompleteConversation", + "fullName": "google.cloud.dialogflow.v2.Conversations.CompleteConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Conversations_ListMessages_async", + "title": "dialogflow listMessages Sample", + "origin": "API_DEFINITION", + "description": " Lists messages that belong to a given conversation. `messages` are ordered by `create_time` in descending order. To fetch updates without duplication, send request with filter `create_time_epoch_microseconds > [first item's create_time of previous request]` and empty page_token.", + "canonical": true, + "file": "conversations.list_messages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMessages", + "fullName": "google.cloud.dialogflow.v2.Conversations.ListMessages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListMessagesResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2.ConversationsClient" + }, + "method": { + "shortName": "ListMessages", + "fullName": "google.cloud.dialogflow.v2.Conversations.ListMessages", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_ListDocuments_async", + "title": "dialogflow listDocuments Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all documents of the knowledge base.", + "canonical": true, + "file": "documents.list_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDocuments", + "fullName": "google.cloud.dialogflow.v2.Documents.ListDocuments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListDocumentsResponse", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "ListDocuments", + "fullName": "google.cloud.dialogflow.v2.Documents.ListDocuments", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_GetDocument_async", + "title": "dialogflow getDocument Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified document.", + "canonical": true, + "file": "documents.get_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.GetDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Document", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "GetDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.GetDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_CreateDocument_async", + "title": "dialogflow createDocument Sample", + "origin": "API_DEFINITION", + "description": " Creates a new document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document]", + "canonical": true, + "file": "documents.create_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.CreateDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.dialogflow.v2.Document" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "CreateDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.CreateDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_ImportDocuments_async", + "title": "dialogflow importDocuments Sample", + "origin": "API_DEFINITION", + "description": " Creates documents by importing data from external sources. Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2.ImportDocumentsResponse]", + "canonical": true, + "file": "documents.import_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportDocuments", + "fullName": "google.cloud.dialogflow.v2.Documents.ImportDocuments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "gcs_source", + "type": ".google.cloud.dialogflow.v2.GcsSources" + }, + { + "name": "document_template", + "type": ".google.cloud.dialogflow.v2.ImportDocumentTemplate" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "ImportDocuments", + "fullName": "google.cloud.dialogflow.v2.Documents.ImportDocuments", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_DeleteDocument_async", + "title": "dialogflow deleteDocument Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "documents.delete_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.DeleteDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "DeleteDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.DeleteDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_UpdateDocument_async", + "title": "dialogflow updateDocument Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document]", + "canonical": true, + "file": "documents.update_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.UpdateDocument", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.dialogflow.v2.Document" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "UpdateDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.UpdateDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_ReloadDocument_async", + "title": "dialogflow reloadDocument Sample", + "origin": "API_DEFINITION", + "description": " Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.reload_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReloadDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.ReloadDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "content_uri", + "type": "TYPE_STRING" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + }, + { + "name": "smart_messaging_partial_update", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "ReloadDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.ReloadDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Documents_ExportDocument_async", + "title": "dialogflow exportDocument Sample", + "origin": "API_DEFINITION", + "description": " Exports a smart messaging candidate document into the specified destination. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2.Document]", + "canonical": true, + "file": "documents.export_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.ExportDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "gcs_destination", + "type": ".google.cloud.dialogflow.v2.GcsDestination" + }, + { + "name": "export_full_content", + "type": "TYPE_BOOL" + }, + { + "name": "smart_messaging_partial_update", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2.DocumentsClient" + }, + "method": { + "shortName": "ExportDocument", + "fullName": "google.cloud.dialogflow.v2.Documents.ExportDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_ListEntityTypes_async", + "title": "dialogflow listEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all entity types in the specified agent.", + "canonical": true, + "file": "entity_types.list_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListEntityTypesResponse", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "ListEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.ListEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_GetEntityType_async", + "title": "dialogflow getEntityType Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified entity type.", + "canonical": true, + "file": "entity_types.get_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.GetEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "GetEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.GetEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_CreateEntityType_async", + "title": "dialogflow createEntityType Sample", + "origin": "API_DEFINITION", + "description": " Creates an entity type in the specified agent. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.create_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.CreateEntityType", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type", + "type": ".google.cloud.dialogflow.v2.EntityType" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "CreateEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.CreateEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_UpdateEntityType_async", + "title": "dialogflow updateEntityType Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified entity type. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.update_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType", + "async": true, + "parameters": [ + { + "name": "entity_type", + "type": ".google.cloud.dialogflow.v2.EntityType" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "UpdateEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.UpdateEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_DeleteEntityType_async", + "title": "dialogflow deleteEntityType Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified entity type. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.delete_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "DeleteEntityType", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.DeleteEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async", + "title": "dialogflow batchUpdateEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Updates/Creates multiple entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_update_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_batch_uri", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_batch_inline", + "type": ".google.cloud.dialogflow.v2.EntityTypeBatch" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchUpdateEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async", + "title": "dialogflow batchDeleteEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Deletes entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_delete_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_names", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchDeleteEntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async", + "title": "dialogflow batchCreateEntities Sample", + "origin": "API_DEFINITION", + "description": " Creates multiple new entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_create_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entities", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchCreateEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchCreateEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async", + "title": "dialogflow batchUpdateEntities Sample", + "origin": "API_DEFINITION", + "description": " Updates or creates multiple entities in the specified entity type. This method does not affect entities in the entity type that aren't explicitly specified in the request. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_update_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entities", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchUpdateEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchUpdateEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async", + "title": "dialogflow batchDeleteEntities Sample", + "origin": "API_DEFINITION", + "description": " Deletes entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_delete_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_values", + "type": "TYPE_STRING[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.EntityTypesClient" + }, + "method": { + "shortName": "BatchDeleteEntities", + "fullName": "google.cloud.dialogflow.v2.EntityTypes.BatchDeleteEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_ListEnvironments_async", + "title": "dialogflow listEnvironments Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all non-default environments of the specified agent.", + "canonical": true, + "file": "environments.list_environments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEnvironments", + "fullName": "google.cloud.dialogflow.v2.Environments.ListEnvironments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListEnvironmentsResponse", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "ListEnvironments", + "fullName": "google.cloud.dialogflow.v2.Environments.ListEnvironments", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_GetEnvironment_async", + "title": "dialogflow getEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent environment.", + "canonical": true, + "file": "environments.get_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "GetEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_CreateEnvironment_async", + "title": "dialogflow createEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent environment.", + "canonical": true, + "file": "environments.create_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.CreateEnvironment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "environment", + "type": ".google.cloud.dialogflow.v2.Environment" + }, + { + "name": "environment_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "CreateEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.CreateEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_UpdateEnvironment_async", + "title": "dialogflow updateEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified agent environment. This method allows you to deploy new agent versions into the environment. When an environment is pointed to a new agent version by setting `environment.agent_version`, the environment is temporarily set to the `LOADING` state. During that time, the environment continues serving the previous version of the agent. After the new agent version is done loading, the environment is set back to the `RUNNING` state. You can use \"-\" as Environment ID in environment name to update an agent version in the default environment. WARNING: this will negate all recent changes to the draft agent and can't be undone. You may want to save the draft agent to a version before calling this method.", + "canonical": true, + "file": "environments.update_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.UpdateEnvironment", + "async": true, + "parameters": [ + { + "name": "environment", + "type": ".google.cloud.dialogflow.v2.Environment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_load_to_draft_and_discard_changes", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "UpdateEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.UpdateEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_DeleteEnvironment_async", + "title": "dialogflow deleteEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified agent environment.", + "canonical": true, + "file": "environments.delete_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.DeleteEnvironment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "DeleteEnvironment", + "fullName": "google.cloud.dialogflow.v2.Environments.DeleteEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Environments_GetEnvironmentHistory_async", + "title": "dialogflow getEnvironmentHistory Sample", + "origin": "API_DEFINITION", + "description": " Gets the history of the specified environment.", + "canonical": true, + "file": "environments.get_environment_history.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEnvironmentHistory", + "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.EnvironmentHistory", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2.EnvironmentsClient" + }, + "method": { + "shortName": "GetEnvironmentHistory", + "fullName": "google.cloud.dialogflow.v2.Environments.GetEnvironmentHistory", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Fulfillments_GetFulfillment_async", + "title": "dialogflow getFulfillment Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the fulfillment.", + "canonical": true, + "file": "fulfillments.get_fulfillment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFulfillment", + "fullName": "google.cloud.dialogflow.v2.Fulfillments.GetFulfillment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Fulfillment", + "client": { + "shortName": "FulfillmentsClient", + "fullName": "google.cloud.dialogflow.v2.FulfillmentsClient" + }, + "method": { + "shortName": "GetFulfillment", + "fullName": "google.cloud.dialogflow.v2.Fulfillments.GetFulfillment", + "service": { + "shortName": "Fulfillments", + "fullName": "google.cloud.dialogflow.v2.Fulfillments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async", + "title": "dialogflow updateFulfillment Sample", + "origin": "API_DEFINITION", + "description": " Updates the fulfillment.", + "canonical": true, + "file": "fulfillments.update_fulfillment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFulfillment", + "fullName": "google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment", + "async": true, + "parameters": [ + { + "name": "fulfillment", + "type": ".google.cloud.dialogflow.v2.Fulfillment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Fulfillment", + "client": { + "shortName": "FulfillmentsClient", + "fullName": "google.cloud.dialogflow.v2.FulfillmentsClient" + }, + "method": { + "shortName": "UpdateFulfillment", + "fullName": "google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment", + "service": { + "shortName": "Fulfillments", + "fullName": "google.cloud.dialogflow.v2.Fulfillments" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_ListIntents_async", + "title": "dialogflow listIntents Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all intents in the specified agent.", + "canonical": true, + "file": "intents.list_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.ListIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListIntentsResponse", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "ListIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.ListIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_GetIntent_async", + "title": "dialogflow getIntent Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified intent.", + "canonical": true, + "file": "intents.get_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.GetIntent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "GetIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.GetIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_CreateIntent_async", + "title": "dialogflow createIntent Sample", + "origin": "API_DEFINITION", + "description": " Creates an intent in the specified agent. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.create_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.CreateIntent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intent", + "type": ".google.cloud.dialogflow.v2.Intent" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "CreateIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.CreateIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_UpdateIntent_async", + "title": "dialogflow updateIntent Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified intent. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.update_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.UpdateIntent", + "async": true, + "parameters": [ + { + "name": "intent", + "type": ".google.cloud.dialogflow.v2.Intent" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "UpdateIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.UpdateIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_DeleteIntent_async", + "title": "dialogflow deleteIntent Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified intent and its direct or indirect followup intents. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.delete_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.DeleteIntent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "DeleteIntent", + "fullName": "google.cloud.dialogflow.v2.Intents.DeleteIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_BatchUpdateIntents_async", + "title": "dialogflow batchUpdateIntents Sample", + "origin": "API_DEFINITION", + "description": " Updates/Creates multiple intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2.BatchUpdateIntentsResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.batch_update_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 81, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.BatchUpdateIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intent_batch_uri", + "type": "TYPE_STRING" + }, + { + "name": "intent_batch_inline", + "type": ".google.cloud.dialogflow.v2.IntentBatch" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2.IntentView" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "BatchUpdateIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.BatchUpdateIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Intents_BatchDeleteIntents_async", + "title": "dialogflow batchDeleteIntents Sample", + "origin": "API_DEFINITION", + "description": " Deletes intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.batch_delete_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.BatchDeleteIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intents", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2.IntentsClient" + }, + "method": { + "shortName": "BatchDeleteIntents", + "fullName": "google.cloud.dialogflow.v2.Intents.BatchDeleteIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async", + "title": "dialogflow listKnowledgeBases Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all knowledge bases of the specified agent.", + "canonical": true, + "file": "knowledge_bases.list_knowledge_bases.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListKnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListKnowledgeBasesResponse", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "ListKnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.ListKnowledgeBases", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async", + "title": "dialogflow getKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified knowledge base.", + "canonical": true, + "file": "knowledge_bases.get_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "GetKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.GetKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async", + "title": "dialogflow createKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Creates a knowledge base.", + "canonical": true, + "file": "knowledge_bases.create_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "knowledge_base", + "type": ".google.cloud.dialogflow.v2.KnowledgeBase" + } + ], + "resultType": ".google.cloud.dialogflow.v2.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "CreateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.CreateKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async", + "title": "dialogflow deleteKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified knowledge base.", + "canonical": true, + "file": "knowledge_bases.delete_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "DeleteKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.DeleteKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async", + "title": "dialogflow updateKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified knowledge base.", + "canonical": true, + "file": "knowledge_bases.update_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "knowledge_base", + "type": ".google.cloud.dialogflow.v2.KnowledgeBase" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBasesClient" + }, + "method": { + "shortName": "UpdateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases.UpdateKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_CreateParticipant_async", + "title": "dialogflow createParticipant Sample", + "origin": "API_DEFINITION", + "description": " Creates a new participant in a conversation.", + "canonical": true, + "file": "participants.create_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.CreateParticipant", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "participant", + "type": ".google.cloud.dialogflow.v2.Participant" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "CreateParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.CreateParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_GetParticipant_async", + "title": "dialogflow getParticipant Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a conversation participant.", + "canonical": true, + "file": "participants.get_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.GetParticipant", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "GetParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.GetParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_ListParticipants_async", + "title": "dialogflow listParticipants Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all participants in the specified conversation.", + "canonical": true, + "file": "participants.list_participants.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListParticipants", + "fullName": "google.cloud.dialogflow.v2.Participants.ListParticipants", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListParticipantsResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "ListParticipants", + "fullName": "google.cloud.dialogflow.v2.Participants.ListParticipants", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_UpdateParticipant_async", + "title": "dialogflow updateParticipant Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified participant.", + "canonical": true, + "file": "participants.update_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.UpdateParticipant", + "async": true, + "parameters": [ + { + "name": "participant", + "type": ".google.cloud.dialogflow.v2.Participant" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "UpdateParticipant", + "fullName": "google.cloud.dialogflow.v2.Participants.UpdateParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_AnalyzeContent_async", + "title": "dialogflow analyzeContent Sample", + "origin": "API_DEFINITION", + "description": " Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation. Note: Always use agent versions for production traffic sent to virtual agents. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "participants.analyze_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 93, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeContent", + "fullName": "google.cloud.dialogflow.v2.Participants.AnalyzeContent", + "async": true, + "parameters": [ + { + "name": "participant", + "type": "TYPE_STRING" + }, + { + "name": "text_input", + "type": ".google.cloud.dialogflow.v2.TextInput" + }, + { + "name": "event_input", + "type": ".google.cloud.dialogflow.v2.EventInput" + }, + { + "name": "reply_audio_config", + "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2.QueryParameters" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" + }, + { + "name": "cx_parameters", + "type": ".google.protobuf.Struct" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.AnalyzeContentResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "AnalyzeContent", + "fullName": "google.cloud.dialogflow.v2.Participants.AnalyzeContent", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async", + "title": "dialogflow streamingAnalyzeContent Sample", + "origin": "API_DEFINITION", + "description": " Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation. Note: This method is only available through the gRPC API (not REST). The top-level message sent to the client by the server is `StreamingAnalyzeContentResponse`. Multiple response messages can be returned in order. The first one or more messages contain the `recognition_result` field. Each result represents a more complete transcript of what the user said. The next message contains the `reply_text` field and potentially the `reply_audio` field. The message can also contain the `automated_agent_reply` field. Note: Always use agent versions for production traffic sent to virtual agents. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "participants.streaming_analyze_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 117, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingAnalyzeContent", + "fullName": "google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent", + "async": true, + "parameters": [ + { + "name": "participant", + "type": "TYPE_STRING" + }, + { + "name": "audio_config", + "type": ".google.cloud.dialogflow.v2.InputAudioConfig" + }, + { + "name": "text_config", + "type": ".google.cloud.dialogflow.v2.InputTextConfig" + }, + { + "name": "reply_audio_config", + "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + }, + { + "name": "input_text", + "type": "TYPE_STRING" + }, + { + "name": "input_dtmf", + "type": ".google.cloud.dialogflow.v2.TelephonyDtmfEvents" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2.QueryParameters" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" + }, + { + "name": "cx_parameters", + "type": ".google.protobuf.Struct" + }, + { + "name": "enable_partial_automated_agent_reply", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "StreamingAnalyzeContent", + "fullName": "google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_SuggestArticles_async", + "title": "dialogflow suggestArticles Sample", + "origin": "API_DEFINITION", + "description": " Gets suggested articles for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_articles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestArticles", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestArticles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SuggestArticlesResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "SuggestArticles", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestArticles", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_SuggestFaqAnswers_async", + "title": "dialogflow suggestFaqAnswers Sample", + "origin": "API_DEFINITION", + "description": " Gets suggested faq answers for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_faq_answers.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestFaqAnswers", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2.AssistQueryParameters" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SuggestFaqAnswersResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "SuggestFaqAnswers", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestFaqAnswers", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Participants_SuggestSmartReplies_async", + "title": "dialogflow suggestSmartReplies Sample", + "origin": "API_DEFINITION", + "description": " Gets smart replies for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_smart_replies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestSmartReplies", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestSmartReplies", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "current_text_input", + "type": ".google.cloud.dialogflow.v2.TextInput" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SuggestSmartRepliesResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2.ParticipantsClient" + }, + "method": { + "shortName": "SuggestSmartReplies", + "fullName": "google.cloud.dialogflow.v2.Participants.SuggestSmartReplies", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async", + "title": "dialogflow listSessionEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all session entity types in the specified session. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.list_session_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListSessionEntityTypesResponse", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "ListSessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.ListSessionEntityTypes", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async", + "title": "dialogflow getSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified session entity type. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.get_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "GetSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.GetSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async", + "title": "dialogflow createSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " Creates a session entity type. If the specified session entity type already exists, overrides the session entity type. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.create_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "session_entity_type", + "type": ".google.cloud.dialogflow.v2.SessionEntityType" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "CreateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.CreateSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async", + "title": "dialogflow updateSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified session entity type. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.update_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType", + "async": true, + "parameters": [ + { + "name": "session_entity_type", + "type": ".google.cloud.dialogflow.v2.SessionEntityType" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "UpdateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.UpdateSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async", + "title": "dialogflow deleteSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified session entity type. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.delete_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypesClient" + }, + "method": { + "shortName": "DeleteSessionEntityType", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes.DeleteSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Sessions_DetectIntent_async", + "title": "dialogflow detectIntent Sample", + "origin": "API_DEFINITION", + "description": " Processes a natural language query and returns structured, actionable data as a result. This method is not idempotent, because it may cause contexts and session entity types to be updated, which in turn might affect results of future queries. If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [AnalyzeContent][google.cloud.dialogflow.v2.Participants.AnalyzeContent] instead of `DetectIntent`. `AnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "sessions.detect_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 100, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetectIntent", + "fullName": "google.cloud.dialogflow.v2.Sessions.DetectIntent", + "async": true, + "parameters": [ + { + "name": "session", + "type": "TYPE_STRING" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2.QueryParameters" + }, + { + "name": "query_input", + "type": ".google.cloud.dialogflow.v2.QueryInput" + }, + { + "name": "output_audio_config", + "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" + }, + { + "name": "output_audio_config_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.dialogflow.v2.DetectIntentResponse", + "client": { + "shortName": "SessionsClient", + "fullName": "google.cloud.dialogflow.v2.SessionsClient" + }, + "method": { + "shortName": "DetectIntent", + "fullName": "google.cloud.dialogflow.v2.Sessions.DetectIntent", + "service": { + "shortName": "Sessions", + "fullName": "google.cloud.dialogflow.v2.Sessions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Sessions_StreamingDetectIntent_async", + "title": "dialogflow streamingDetectIntent Sample", + "origin": "API_DEFINITION", + "description": " Processes a natural language query in audio format in a streaming fashion and returns structured, actionable data as a result. This method is only available via the gRPC API (not REST). If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [StreamingAnalyzeContent][google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent] instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "sessions.streaming_detect_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 115, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingDetectIntent", + "fullName": "google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent", + "async": true, + "parameters": [ + { + "name": "session", + "type": "TYPE_STRING" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2.QueryParameters" + }, + { + "name": "query_input", + "type": ".google.cloud.dialogflow.v2.QueryInput" + }, + { + "name": "single_utterance", + "type": "TYPE_BOOL" + }, + { + "name": "output_audio_config", + "type": ".google.cloud.dialogflow.v2.OutputAudioConfig" + }, + { + "name": "output_audio_config_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.dialogflow.v2.StreamingDetectIntentResponse", + "client": { + "shortName": "SessionsClient", + "fullName": "google.cloud.dialogflow.v2.SessionsClient" + }, + "method": { + "shortName": "StreamingDetectIntent", + "fullName": "google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent", + "service": { + "shortName": "Sessions", + "fullName": "google.cloud.dialogflow.v2.Sessions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_ListVersions_async", + "title": "dialogflow listVersions Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all versions of the specified agent.", + "canonical": true, + "file": "versions.list_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVersions", + "fullName": "google.cloud.dialogflow.v2.Versions.ListVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.ListVersionsResponse", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "ListVersions", + "fullName": "google.cloud.dialogflow.v2.Versions.ListVersions", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_GetVersion_async", + "title": "dialogflow getVersion Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent version.", + "canonical": true, + "file": "versions.get_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.GetVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "GetVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.GetVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_CreateVersion_async", + "title": "dialogflow createVersion Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent version. The new version points to the agent instance in the \"default\" environment.", + "canonical": true, + "file": "versions.create_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.CreateVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "version", + "type": ".google.cloud.dialogflow.v2.Version" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "CreateVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.CreateVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_UpdateVersion_async", + "title": "dialogflow updateVersion Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified agent version. Note that this method does not allow you to update the state of the agent the given version points to. It allows you to update only mutable properties of the version resource.", + "canonical": true, + "file": "versions.update_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.UpdateVersion", + "async": true, + "parameters": [ + { + "name": "version", + "type": ".google.cloud.dialogflow.v2.Version" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "UpdateVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.UpdateVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2_generated_Versions_DeleteVersion_async", + "title": "dialogflow deleteVersion Sample", + "origin": "API_DEFINITION", + "description": " Delete the specified agent version.", + "canonical": true, + "file": "versions.delete_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.DeleteVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2.VersionsClient" + }, + "method": { + "shortName": "DeleteVersion", + "fullName": "google.cloud.dialogflow.v2.Versions.DeleteVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2.Versions" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js new file mode 100644 index 00000000000..f67e4e95493 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.create_version.js @@ -0,0 +1,69 @@ +// 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. +// +// ** 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, version) { + // [START dialogflow_v2_generated_Versions_CreateVersion_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 agent to create a version for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The version to create. + */ + // const version = {} + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callCreateVersion() { + // Construct request + const request = { + parent, + version, + }; + + // Run request + const response = await dialogflowClient.createVersion(request); + console.log(response); + } + + callCreateVersion(); + // [END dialogflow_v2_generated_Versions_CreateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js new file mode 100644 index 00000000000..d087ace525f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.delete_version.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Versions_DeleteVersion_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 name of the version to delete. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callDeleteVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteVersion(request); + console.log(response); + } + + callDeleteVersion(); + // [END dialogflow_v2_generated_Versions_DeleteVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js new file mode 100644 index 00000000000..ad84c7c82ff --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.get_version.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Versions_GetVersion_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 name of the version. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callGetVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getVersion(request); + console.log(response); + } + + callGetVersion(); + // [END dialogflow_v2_generated_Versions_GetVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js new file mode 100644 index 00000000000..15e8e1e850d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.list_versions.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Versions_ListVersions_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 agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callListVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVersions(); + // [END dialogflow_v2_generated_Versions_ListVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js b/packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js new file mode 100644 index 00000000000..ee0e78f352a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2/versions.update_version.js @@ -0,0 +1,70 @@ +// 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. +// +// ** 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(version, updateMask) { + // [START dialogflow_v2_generated_Versions_UpdateVersion_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 version to update. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const version = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callUpdateVersion() { + // Construct request + const request = { + version, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateVersion(request); + console.log(response); + } + + callUpdateVersion(); + // [END dialogflow_v2_generated_Versions_UpdateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js new file mode 100644 index 00000000000..7568a097c38 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.delete_agent.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Agents_DeleteAgent_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 that the agent to delete is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callDeleteAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAgent(request); + console.log(response); + } + + callDeleteAgent(); + // [END dialogflow_v2beta1_generated_Agents_DeleteAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js new file mode 100644 index 00000000000..bcfceaf88ab --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.export_agent.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Agents_ExportAgent_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 that the agent to export is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The + * Google Cloud Storage (https://cloud.google.com/storage/docs/) + * URI to export the agent to. + * The format of this URI must be `gs:///`. + * If left unspecified, the serialized agent is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callExportAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.exportAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportAgent(); + // [END dialogflow_v2beta1_generated_Agents_ExportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js new file mode 100644 index 00000000000..a6bca6a47b6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_agent.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Agents_GetAgent_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 that the agent to fetch is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callGetAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getAgent(request); + console.log(response); + } + + callGetAgent(); + // [END dialogflow_v2beta1_generated_Agents_GetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js new file mode 100644 index 00000000000..2b0ded3b158 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.get_validation_result.js @@ -0,0 +1,71 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Agents_GetValidationResult_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 that the agent is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The language for which you want a validation result. If not + * specified, the agent's default language is used. Many + * languages (https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. Note: languages must be enabled in the agent before they can + * be used. + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callGetValidationResult() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.getValidationResult(request); + console.log(response); + } + + callGetValidationResult(); + // [END dialogflow_v2beta1_generated_Agents_GetValidationResult_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js new file mode 100644 index 00000000000..0e5cc2a7e94 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.import_agent.js @@ -0,0 +1,78 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Agents_ImportAgent_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 that the agent to import is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callImportAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.importAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportAgent(); + // [END dialogflow_v2beta1_generated_Agents_ImportAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js new file mode 100644 index 00000000000..827e0e509eb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.restore_agent.js @@ -0,0 +1,78 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Agents_RestoreAgent_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 that the agent to restore is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * Dialogflow access + * control (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + */ + // const agentUri = 'abc123' + /** + * Zip compressed raw byte content for agent. + */ + // const agentContent = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callRestoreAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.restoreAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callRestoreAgent(); + // [END dialogflow_v2beta1_generated_Agents_RestoreAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js new file mode 100644 index 00000000000..55792ca6aee --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.search_agents.js @@ -0,0 +1,74 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Agents_SearchAgents_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 to list agents from. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callSearchAgents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.searchAgentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callSearchAgents(); + // [END dialogflow_v2beta1_generated_Agents_SearchAgents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js new file mode 100644 index 00000000000..09788da9aa9 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.set_agent.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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(agent) { + // [START dialogflow_v2beta1_generated_Agents_SetAgent_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 agent to update. + */ + // const agent = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callSetAgent() { + // Construct request + const request = { + agent, + }; + + // Run request + const response = await dialogflowClient.setAgent(request); + console.log(response); + } + + callSetAgent(); + // [END dialogflow_v2beta1_generated_Agents_SetAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js new file mode 100644 index 00000000000..4451ade78cf --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/agents.train_agent.js @@ -0,0 +1,64 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Agents_TrainAgent_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 that the agent to train is associated with. + * Format: `projects/` or + * `projects//locations/`. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {AgentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AgentsClient(); + + async function callTrainAgent() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.trainAgent(request); + const [response] = await operation.promise(); + console.log(response); + } + + callTrainAgent(); + // [END dialogflow_v2beta1_generated_Agents_TrainAgent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js new file mode 100644 index 00000000000..246fb647b86 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.get_answer_record.js @@ -0,0 +1,62 @@ +// 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. +// +// ** 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() { + // [START dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_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 name of the answer record to retrieve. + * Format: `projects//locations//answerRecords/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callGetAnswerRecord() { + // Construct request + const request = { + }; + + // Run request + const response = await dialogflowClient.getAnswerRecord(request); + console.log(response); + } + + callGetAnswerRecord(); + // [END dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js new file mode 100644 index 00000000000..6e8f2d41f58 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.list_answer_records.js @@ -0,0 +1,83 @@ +// 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. +// +// ** 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() { + // [START dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_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 to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. Filters to restrict results to specific answer records. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + */ + // const pageSize = 1234 + /** + * Optional. The + * ListAnswerRecordsResponse.next_page_token google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token + * value returned from a previous list request used to continue listing on + * the next page. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callListAnswerRecords() { + // Construct request + const request = { + }; + + // Run request + const iterable = await dialogflowClient.listAnswerRecordsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAnswerRecords(); + // [END dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js new file mode 100644 index 00000000000..904438926c3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/answer_records.update_answer_record.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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(answerRecord) { + // [START dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_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. Answer record to update. + */ + // const answerRecord = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {AnswerRecordsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new AnswerRecordsClient(); + + async function callUpdateAnswerRecord() { + // Construct request + const request = { + answerRecord, + }; + + // Run request + const response = await dialogflowClient.updateAnswerRecord(request); + console.log(response); + } + + callUpdateAnswerRecord(); + // [END dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js new file mode 100644 index 00000000000..f75ab2546eb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.create_context.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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, context) { + // [START dialogflow_v2beta1_generated_Contexts_CreateContext_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 session to create a context for. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Required. The context to create. + */ + // const context = {} + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callCreateContext() { + // Construct request + const request = { + parent, + context, + }; + + // Run request + const response = await dialogflowClient.createContext(request); + console.log(response); + } + + callCreateContext(); + // [END dialogflow_v2beta1_generated_Contexts_CreateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js new file mode 100644 index 00000000000..5d804090ffc --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_all_contexts.js @@ -0,0 +1,72 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_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 name of the session to delete all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified we assume default 'draft' environment. If + * `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callDeleteAllContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.deleteAllContexts(request); + console.log(response); + } + + callDeleteAllContexts(); + // [END dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js new file mode 100644 index 00000000000..358c10041f9 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.delete_context.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Contexts_DeleteContext_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 name of the context to delete. Supported formats: + * - `projects//agent/sessions//contexts/`, + * - `projects//locations//agent/sessions//contexts/`, + * - `projects//agent/environments//users//sessions//contexts/`, + * - `projects//locations//agent/environments//users//sessions//contexts/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callDeleteContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteContext(request); + console.log(response); + } + + callDeleteContext(); + // [END dialogflow_v2beta1_generated_Contexts_DeleteContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js new file mode 100644 index 00000000000..900998726cc --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.get_context.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Contexts_GetContext_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 name of the context. Supported formats: + * - `projects//agent/sessions//contexts/`, + * - `projects//locations//agent/sessions//contexts/`, + * - `projects//agent/environments//users//sessions//contexts/`, + * - `projects//locations//agent/environments//users//sessions//contexts/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callGetContext() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getContext(request); + console.log(response); + } + + callGetContext(); + // [END dialogflow_v2beta1_generated_Contexts_GetContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js new file mode 100644 index 00000000000..64fabb5b2cb --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.list_contexts.js @@ -0,0 +1,83 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Contexts_ListContexts_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 session to list all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callListContexts() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listContextsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListContexts(); + // [END dialogflow_v2beta1_generated_Contexts_ListContexts_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js new file mode 100644 index 00000000000..b8670e512db --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/contexts.update_context.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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(context) { + // [START dialogflow_v2beta1_generated_Contexts_UpdateContext_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 context to update. + */ + // const context = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ContextsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ContextsClient(); + + async function callUpdateContext() { + // Construct request + const request = { + context, + }; + + // Run request + const response = await dialogflowClient.updateContext(request); + console.log(response); + } + + callUpdateContext(); + // [END dialogflow_v2beta1_generated_Contexts_UpdateContext_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js new file mode 100644 index 00000000000..46ab5c9bc5f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.clear_suggestion_feature_config.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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(conversationProfile, participantRole, suggestionFeatureType) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_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 Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + */ + // const conversationProfile = 'abc123' + /** + * Required. The participant role to remove the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + */ + // const participantRole = {} + /** + * Required. The type of the suggestion feature to remove. + */ + // const suggestionFeatureType = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callClearSuggestionFeatureConfig() { + // Construct request + const request = { + conversationProfile, + participantRole, + suggestionFeatureType, + }; + + // Run request + const [operation] = await dialogflowClient.clearSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callClearSuggestionFeatureConfig(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js new file mode 100644 index 00000000000..2aa68468163 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.create_conversation_profile.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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, conversationProfile) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_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 to create a conversation profile for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation profile to create. + */ + // const conversationProfile = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callCreateConversationProfile() { + // Construct request + const request = { + parent, + conversationProfile, + }; + + // Run request + const response = await dialogflowClient.createConversationProfile(request); + console.log(response); + } + + callCreateConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js new file mode 100644 index 00000000000..ed1539ec95a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.delete_conversation_profile.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_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 name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callDeleteConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteConversationProfile(request); + console.log(response); + } + + callDeleteConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js new file mode 100644 index 00000000000..d46d62ae134 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.get_conversation_profile.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_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 conversation profile. + * Format: `projects//locations//conversationProfiles/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callGetConversationProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversationProfile(request); + console.log(response); + } + + callGetConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js new file mode 100644 index 00000000000..c61024a3c87 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.list_conversation_profiles.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_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 to list all conversation profiles from. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callListConversationProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationProfilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversationProfiles(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js new file mode 100644 index 00000000000..5823e47f213 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.set_suggestion_feature_config.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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(conversationProfile, participantRole, suggestionFeatureConfig) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_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 Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + */ + // const conversationProfile = 'abc123' + /** + * Required. The participant role to add or update the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + */ + // const participantRole = {} + /** + * Required. The suggestion feature config to add or update. + */ + // const suggestionFeatureConfig = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callSetSuggestionFeatureConfig() { + // Construct request + const request = { + conversationProfile, + participantRole, + suggestionFeatureConfig, + }; + + // Run request + const [operation] = await dialogflowClient.setSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callSetSuggestionFeatureConfig(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js new file mode 100644 index 00000000000..78ea9ed9bda --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversation_profiles.update_conversation_profile.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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(conversationProfile, updateMask) { + // [START dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_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 conversation profile to update. + */ + // const conversationProfile = {} + /** + * Required. The mask to control which fields to update. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ConversationProfilesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationProfilesClient(); + + async function callUpdateConversationProfile() { + // Construct request + const request = { + conversationProfile, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateConversationProfile(request); + console.log(response); + } + + callUpdateConversationProfile(); + // [END dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js new file mode 100644 index 00000000000..23afc4a719a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.batch_create_messages.js @@ -0,0 +1,70 @@ +// 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. +// +// ** 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, requests) { + // [START dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_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 identifier of the conversation to create message. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Required. A maximum of 1000 Messages can be created in a batch. + * CreateMessageRequest.message.send_time is required. All created + * messages will have identical Message.create_time google.cloud.dialogflow.v2beta1.Message.create_time. + */ + // const requests = 1234 + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callBatchCreateMessages() { + // Construct request + const request = { + parent, + requests, + }; + + // Run request + const response = await dialogflowClient.batchCreateMessages(request); + console.log(response); + } + + callBatchCreateMessages(); + // [END dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js new file mode 100644 index 00000000000..a7af3e43013 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.complete_conversation.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Conversations_CompleteConversation_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 identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callCompleteConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.completeConversation(request); + console.log(response); + } + + callCompleteConversation(); + // [END dialogflow_v2beta1_generated_Conversations_CompleteConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js new file mode 100644 index 00000000000..c6f79f3c11f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.create_conversation.js @@ -0,0 +1,79 @@ +// 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. +// +// ** 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, conversation) { + // [START dialogflow_v2beta1_generated_Conversations_CreateConversation_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 identifier of the project creating the conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The conversation to create. + */ + // const conversation = {} + /** + * Optional. Identifier of the conversation. Generally it's auto generated by Google. + * Only set it if you cannot wait for the response to return a + * auto-generated one to you. + * The conversation ID must be compliant with the regression fomula + * "a-zA-Z a-zA-Z0-9_-*" with the characters length in range of 3,64. + * If the field is provided, the caller is resposible for + * 1. the uniqueness of the ID, otherwise the request will be rejected. + * 2. the consistency for whether to use custom ID or not under a project to + * better ensure uniqueness. + */ + // const conversationId = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callCreateConversation() { + // Construct request + const request = { + parent, + conversation, + }; + + // Run request + const response = await dialogflowClient.createConversation(request); + console.log(response); + } + + callCreateConversation(); + // [END dialogflow_v2beta1_generated_Conversations_CreateConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js new file mode 100644 index 00000000000..e408a83384a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.get_conversation.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Conversations_GetConversation_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 name of the conversation. Format: + * `projects//locations//conversations/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callGetConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getConversation(request); + console.log(response); + } + + callGetConversation(); + // [END dialogflow_v2beta1_generated_Conversations_GetConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js new file mode 100644 index 00000000000..81e76c97e9c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_conversations.js @@ -0,0 +1,91 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Conversations_ListConversations_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 to list all conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * `lifecycle_state = "COMPLETED"` + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callListConversations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversations(); + // [END dialogflow_v2beta1_generated_Conversations_ListConversations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js new file mode 100644 index 00000000000..239e3bff07c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.list_messages.js @@ -0,0 +1,84 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Conversations_ListMessages_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 name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + */ + // const parent = 'abc123' + /** + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"`. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callListMessages() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listMessagesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMessages(); + // [END dialogflow_v2beta1_generated_Conversations_ListMessages_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.suggest_conversation_summary.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.suggest_conversation_summary.js new file mode 100644 index 00000000000..18d9ac2df60 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/conversations.suggest_conversation_summary.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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(conversation) { + // [START dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_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 conversation to fetch suggestion for. + * Format: `projects//locations//conversations/`. + */ + // const conversation = 'abc123' + /** + * The name of the latest conversation message used as context for + * compiling suggestion. If empty, the latest message of the conversation will + * be used. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Max number of messages prior to and including + * latest_message to use as context when compiling the + * suggestion. By default 500 and at most 1000. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callSuggestConversationSummary() { + // Construct request + const request = { + conversation, + }; + + // Run request + const response = await dialogflowClient.suggestConversationSummary(request); + console.log(response); + } + + callSuggestConversationSummary(); + // [END dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js new file mode 100644 index 00000000000..d552bdb3c21 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.create_document.js @@ -0,0 +1,74 @@ +// 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. +// +// ** 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, document) { + // [START dialogflow_v2beta1_generated_Documents_CreateDocument_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 knowledge base to create a document for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * Required. The document to create. + */ + // const document = {} + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callCreateDocument() { + // Construct request + const request = { + parent, + document, + }; + + // Run request + const [operation] = await dialogflowClient.createDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateDocument(); + // [END dialogflow_v2beta1_generated_Documents_CreateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js new file mode 100644 index 00000000000..db20422b45e --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.delete_document.js @@ -0,0 +1,64 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Documents_DeleteDocument_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 name of the document to delete. + * Format: `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callDeleteDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.deleteDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteDocument(); + // [END dialogflow_v2beta1_generated_Documents_DeleteDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js new file mode 100644 index 00000000000..2388357475b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.get_document.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Documents_GetDocument_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 name of the document to retrieve. + * Format `projects//locations//knowledgeBases//documents/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callGetDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getDocument(request); + console.log(response); + } + + callGetDocument(); + // [END dialogflow_v2beta1_generated_Documents_GetDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js new file mode 100644 index 00000000000..3f6bf3e843a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.import_documents.js @@ -0,0 +1,82 @@ +// 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. +// +// ** 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, documentTemplate) { + // [START dialogflow_v2beta1_generated_Documents_ImportDocuments_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 knowledge base to import documents into. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The Google Cloud Storage location for the documents. + * The path can include a wildcard. + * These URIs may have the forms + * `gs:///`. + * `gs:////*.`. + */ + // const gcsSource = {} + /** + * Required. Document template used for importing all the documents. + */ + // const documentTemplate = {} + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callImportDocuments() { + // Construct request + const request = { + parent, + documentTemplate, + }; + + // Run request + const [operation] = await dialogflowClient.importDocuments(request); + const [response] = await operation.promise(); + console.log(response); + } + + callImportDocuments(); + // [END dialogflow_v2beta1_generated_Documents_ImportDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js new file mode 100644 index 00000000000..af65dd941f5 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.list_documents.js @@ -0,0 +1,92 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Documents_ListDocuments_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 knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * AND ... + * The following fields and operators are supported: + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * Examples: + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callListDocuments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listDocumentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListDocuments(); + // [END dialogflow_v2beta1_generated_Documents_ListDocuments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js new file mode 100644 index 00000000000..f1e5778505f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.reload_document.js @@ -0,0 +1,74 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Documents_ReloadDocument_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 name of the document to reload. + * Format: `projects//locations//knowledgeBases//documents/` + */ + // const name = 'abc123' + /** + * The path for a Cloud Storage source file for reloading document content. + * If not provided, the Document's existing source will be reloaded. + */ + // const gcsSource = {} + /** + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + */ + // const importGcsCustomMetadata = true + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callReloadDocument() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await dialogflowClient.reloadDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callReloadDocument(); + // [END dialogflow_v2beta1_generated_Documents_ReloadDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js new file mode 100644 index 00000000000..e46ab841b5a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/documents.update_document.js @@ -0,0 +1,68 @@ +// 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. +// +// ** 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(document) { + // [START dialogflow_v2beta1_generated_Documents_UpdateDocument_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 document to update. + */ + // const document = {} + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {DocumentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new DocumentsClient(); + + async function callUpdateDocument() { + // Construct request + const request = { + document, + }; + + // Run request + const [operation] = await dialogflowClient.updateDocument(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateDocument(); + // [END dialogflow_v2beta1_generated_Documents_UpdateDocument_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js new file mode 100644 index 00000000000..db4da1cc2c9 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_create_entities.js @@ -0,0 +1,79 @@ +// 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. +// +// ** 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, entities) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_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 name of the entity type to create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const parent = 'abc123' + /** + * Required. The entities to create. + */ + // const entities = 1234 + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchCreateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchCreateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchCreateEntities(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js new file mode 100644 index 00000000000..ac62a1ce5c2 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entities.js @@ -0,0 +1,81 @@ +// 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. +// +// ** 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, entityValues) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_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 name of the entity type to delete entries for. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const parent = 'abc123' + /** + * Required. The reference `values` of the entities to delete. Note that + * these are not fully-qualified names, i.e. they don't start with + * `projects/`. + */ + // const entityValues = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchDeleteEntities() { + // Construct request + const request = { + parent, + entityValues, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteEntities(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js new file mode 100644 index 00000000000..caabef66668 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_delete_entity_types.js @@ -0,0 +1,71 @@ +// 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. +// +// ** 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, entityTypeNames) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_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 name of the agent to delete all entities types for. + * Supported formats: + * - `projects//agent`, + * - `projects//locations//agent`. + */ + // const parent = 'abc123' + /** + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + */ + // const entityTypeNames = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchDeleteEntityTypes() { + // Construct request + const request = { + parent, + entityTypeNames, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteEntityTypes(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js new file mode 100644 index 00000000000..4a4c08803b3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entities.js @@ -0,0 +1,83 @@ +// 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. +// +// ** 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, entities) { + // [START dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_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 name of the entity type to update or create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const parent = 'abc123' + /** + * Required. The entities to update or create. + */ + // const entities = 1234 + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchUpdateEntities() { + // Construct request + const request = { + parent, + entities, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntities(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateEntities(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js new file mode 100644 index 00000000000..0ac513a6d9a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.batch_update_entity_types.js @@ -0,0 +1,88 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_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 name of the agent to update or create entity types in. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing entity types to update + * or create. The file format can either be a serialized proto (of + * EntityBatch type) or a JSON object. Note: The URI must start with + * "gs://". + */ + // const entityTypeBatchUri = 'abc123' + /** + * The collection of entity types to update or create. + */ + // const entityTypeBatchInline = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callBatchUpdateEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateEntityTypes(); + // [END dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js new file mode 100644 index 00000000000..97aba8a357c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.create_entity_type.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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, entityType) { + // [START dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_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 agent to create a entity type for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The entity type to create. + */ + // const entityType = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callCreateEntityType() { + // Construct request + const request = { + parent, + entityType, + }; + + // Run request + const response = await dialogflowClient.createEntityType(request); + console.log(response); + } + + callCreateEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js new file mode 100644 index 00000000000..2bb6ad5c66c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.delete_entity_type.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_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 name of the entity type to delete. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callDeleteEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEntityType(request); + console.log(response); + } + + callDeleteEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js new file mode 100644 index 00000000000..fd0b856a2e1 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.get_entity_type.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_EntityTypes_GetEntityType_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 name of the entity type. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + */ + // const name = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callGetEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEntityType(request); + console.log(response); + } + + callGetEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js new file mode 100644 index 00000000000..a2276da5bbc --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.list_entity_types.js @@ -0,0 +1,83 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_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 agent to list all entity types from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callListEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEntityTypes(); + // [END dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js new file mode 100644 index 00000000000..aa87205c946 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/entity_types.update_entity_type.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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(entityType) { + // [START dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_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 entity type to update. + */ + // const entityType = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {EntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EntityTypesClient(); + + async function callUpdateEntityType() { + // Construct request + const request = { + entityType, + }; + + // Run request + const response = await dialogflowClient.updateEntityType(request); + console.log(response); + } + + callUpdateEntityType(); + // [END dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js new file mode 100644 index 00000000000..d1ac1e20e7c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.create_environment.js @@ -0,0 +1,74 @@ +// 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. +// +// ** 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, environment, environmentId) { + // [START dialogflow_v2beta1_generated_Environments_CreateEnvironment_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 agent to create an environment for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The environment to create. + */ + // const environment = {} + /** + * Required. The unique id of the new environment. + */ + // const environmentId = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callCreateEnvironment() { + // Construct request + const request = { + parent, + environment, + environmentId, + }; + + // Run request + const response = await dialogflowClient.createEnvironment(request); + console.log(response); + } + + callCreateEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_CreateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js new file mode 100644 index 00000000000..03704937bf8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.delete_environment.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Environments_DeleteEnvironment_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 name of the environment to delete. + * / Format: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callDeleteEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteEnvironment(request); + console.log(response); + } + + callDeleteEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js new file mode 100644 index 00000000000..086269c194d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Environments_GetEnvironment_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 name of the environment. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callGetEnvironment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getEnvironment(request); + console.log(response); + } + + callGetEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_GetEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js new file mode 100644 index 00000000000..0fe14234de6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.get_environment_history.js @@ -0,0 +1,76 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_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 name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callGetEnvironmentHistory() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.getEnvironmentHistoryAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callGetEnvironmentHistory(); + // [END dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js new file mode 100644 index 00000000000..b13bb94f6b6 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.list_environments.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Environments_ListEnvironments_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 agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callListEnvironments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listEnvironmentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListEnvironments(); + // [END dialogflow_v2beta1_generated_Environments_ListEnvironments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js new file mode 100644 index 00000000000..1c30a30ef3d --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/environments.update_environment.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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(environment, updateMask) { + // [START dialogflow_v2beta1_generated_Environments_UpdateEnvironment_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 environment to update. + */ + // const environment = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. This field is used to prevent accidental overwrite of the draft + * environment, which is an operation that cannot be undone. To confirm that + * the caller desires this overwrite, this field must be explicitly set to + * true when updating the draft environment (environment ID = `-`). + */ + // const allowLoadToDraftAndDiscardChanges = true + + // Imports the Dialogflow library + const {EnvironmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new EnvironmentsClient(); + + async function callUpdateEnvironment() { + // Construct request + const request = { + environment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateEnvironment(request); + console.log(response); + } + + callUpdateEnvironment(); + // [END dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js new file mode 100644 index 00000000000..91cb58b2b60 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.get_fulfillment.js @@ -0,0 +1,64 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_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 name of the fulfillment. + * Supported formats: + * - `projects//agent/fulfillment` + * - `projects//locations//agent/fulfillment` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function callGetFulfillment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getFulfillment(request); + console.log(response); + } + + callGetFulfillment(); + // [END dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js new file mode 100644 index 00000000000..bb043db9083 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/fulfillments.update_fulfillment.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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(fulfillment, updateMask) { + // [START dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_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 fulfillment to update. + */ + // const fulfillment = {} + /** + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {FulfillmentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new FulfillmentsClient(); + + async function callUpdateFulfillment() { + // Construct request + const request = { + fulfillment, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateFulfillment(request); + console.log(response); + } + + callUpdateFulfillment(); + // [END dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js new file mode 100644 index 00000000000..6aaec0ced80 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_delete_intents.js @@ -0,0 +1,71 @@ +// 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. +// +// ** 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, intents) { + // [START dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_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 name of the agent to delete all entities types for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + */ + // const intents = 1234 + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callBatchDeleteIntents() { + // Construct request + const request = { + parent, + intents, + }; + + // Run request + const [operation] = await dialogflowClient.batchDeleteIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchDeleteIntents(); + // [END dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js new file mode 100644 index 00000000000..e2b9ec8b262 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.batch_update_intents.js @@ -0,0 +1,91 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_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 name of the agent to update or create intents in. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * The URI to a Google Cloud Storage file containing intents to update or + * create. The file format can either be a serialized proto (of IntentBatch + * type) or JSON object. Note: The URI must start with "gs://". + */ + // const intentBatchUri = 'abc123' + /** + * The collection of intents to update or create. + */ + // const intentBatchInline = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callBatchUpdateIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await dialogflowClient.batchUpdateIntents(request); + const [response] = await operation.promise(); + console.log(response); + } + + callBatchUpdateIntents(); + // [END dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js new file mode 100644 index 00000000000..1bdb28a223c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.create_intent.js @@ -0,0 +1,81 @@ +// 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. +// +// ** 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, intent) { + // [START dialogflow_v2beta1_generated_Intents_CreateIntent_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 agent to create a intent for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The intent to create. + */ + // const intent = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callCreateIntent() { + // Construct request + const request = { + parent, + intent, + }; + + // Run request + const response = await dialogflowClient.createIntent(request); + console.log(response); + } + + callCreateIntent(); + // [END dialogflow_v2beta1_generated_Intents_CreateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js new file mode 100644 index 00000000000..64b530cd709 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.delete_intent.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Intents_DeleteIntent_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 name of the intent to delete. If this intent has direct or + * indirect followup intents, we also delete them. + * Supported formats: + * - `projects//agent/intents/` + * - `projects//locations//agent/intents/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callDeleteIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteIntent(request); + console.log(response); + } + + callDeleteIntent(); + // [END dialogflow_v2beta1_generated_Intents_DeleteIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js new file mode 100644 index 00000000000..3f00eb8f302 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.get_intent.js @@ -0,0 +1,76 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Intents_GetIntent_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 name of the intent. + * Supported formats: + * - `projects//agent/intents/` + * - `projects//locations//agent/intents/` + */ + // const name = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callGetIntent() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getIntent(request); + console.log(response); + } + + callGetIntent(); + // [END dialogflow_v2beta1_generated_Intents_GetIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js new file mode 100644 index 00000000000..529499a739f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.list_intents.js @@ -0,0 +1,92 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Intents_ListIntents_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 agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + */ + // const parent = 'abc123' + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callListIntents() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listIntentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListIntents(); + // [END dialogflow_v2beta1_generated_Intents_ListIntents_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js new file mode 100644 index 00000000000..ee7c7bc9005 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/intents.update_intent.js @@ -0,0 +1,77 @@ +// 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. +// +// ** 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(intent) { + // [START dialogflow_v2beta1_generated_Intents_UpdateIntent_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 intent to update. + */ + // const intent = {} + /** + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * Multilingual intent and entity + * data (https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + */ + // const languageCode = 'abc123' + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + /** + * Optional. The resource view to apply to the returned intent. + */ + // const intentView = {} + + // Imports the Dialogflow library + const {IntentsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new IntentsClient(); + + async function callUpdateIntent() { + // Construct request + const request = { + intent, + }; + + // Run request + const response = await dialogflowClient.updateIntent(request); + console.log(response); + } + + callUpdateIntent(); + // [END dialogflow_v2beta1_generated_Intents_UpdateIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js new file mode 100644 index 00000000000..e94541196c3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.create_knowledge_base.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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, knowledgeBase) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_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 to create a knowledge base for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Required. The knowledge base to create. + */ + // const knowledgeBase = {} + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callCreateKnowledgeBase() { + // Construct request + const request = { + parent, + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.createKnowledgeBase(request); + console.log(response); + } + + callCreateKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js new file mode 100644 index 00000000000..c04b4806ab0 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.delete_knowledge_base.js @@ -0,0 +1,68 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_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 name of the knowledge base to delete. + * Format: `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + /** + * Optional. Force deletes the knowledge base. When set to true, any documents + * in the knowledge base are also deleted. + */ + // const force = true + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callDeleteKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteKnowledgeBase(request); + console.log(response); + } + + callDeleteKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js new file mode 100644 index 00000000000..e87bfd0db99 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.get_knowledge_base.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_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 name of the knowledge base to retrieve. + * Format `projects//locations//knowledgeBases/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callGetKnowledgeBase() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getKnowledgeBase(request); + console.log(response); + } + + callGetKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js new file mode 100644 index 00000000000..714cd8fa804 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.list_knowledge_bases.js @@ -0,0 +1,95 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_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 to list of knowledge bases for. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + */ + // const pageSize = 1234 + /** + * The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * AND ... + * The following fields and operators are supported: + * * display_name with has(:) operator + * * language_code with equals(=) operator + * Examples: + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callListKnowledgeBases() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listKnowledgeBasesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListKnowledgeBases(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js new file mode 100644 index 00000000000..6d7dad33ee9 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/knowledge_bases.update_knowledge_base.js @@ -0,0 +1,67 @@ +// 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. +// +// ** 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(knowledgeBase) { + // [START dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_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 knowledge base to update. + */ + // const knowledgeBase = {} + /** + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {KnowledgeBasesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new KnowledgeBasesClient(); + + async function callUpdateKnowledgeBase() { + // Construct request + const request = { + knowledgeBase, + }; + + // Run request + const response = await dialogflowClient.updateKnowledgeBase(request); + console.log(response); + } + + callUpdateKnowledgeBase(); + // [END dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js new file mode 100644 index 00000000000..f5dac9c24e8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.analyze_content.js @@ -0,0 +1,135 @@ +// 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. +// +// ** 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(participant) { + // [START dialogflow_v2beta1_generated_Participants_AnalyzeContent_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 name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * The natural language text to be processed. + */ + // const textInput = {} + /** + * The natural language speech audio to be processed. + */ + // const audioInput = {} + /** + * An input event to send to Dialogflow. + */ + // const eventInput = {} + /** + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * AnalyzeContent. If this configuration is not supplied, speech synthesis + * is disabled. + */ + // const replyAudioConfig = {} + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = {} + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + /** + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxParameters = {} + /** + * The unique identifier of the CX page to override the `current_page` in the + * session. + * Format: `projects//locations//agents//flows//pages/`. + * If `cx_current_page` is specified, the previous state of the session will + * be ignored by Dialogflow CX, including the previous + * page QueryResult.current_page and the previous session + * parameters QueryResult.parameters. In most cases, `cx_current_page` and + * `cx_parameters` should be configured together to direct a session to a + * specific state. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxCurrentPage = 'abc123' + /** + * Optional. The send time of the message from end user or human agent's + * perspective. It is used for identifying the same message under one + * participant. + * Given two messages under the same participant: + * - If send time are different regardless of whether the content of the + * messages are exactly the same, the conversation will regard them as + * two distinct messages sent by the participant. + * - If send time is the same regardless of whether the content of the + * messages are exactly the same, the conversation will regard them as + * same message, and ignore the message received later. + * If the value is not provided, a new request will always be regarded as a + * new message without any de-duplication. + */ + // const messageSendTime = {} + /** + * A unique identifier for this request. Restricted to 36 ASCII characters. + * A random UUID is recommended. + * This request is only idempotent if a `request_id` is provided. + */ + // const requestId = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callAnalyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const response = await dialogflowClient.analyzeContent(request); + console.log(response); + } + + callAnalyzeContent(); + // [END dialogflow_v2beta1_generated_Participants_AnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js new file mode 100644 index 00000000000..5001938dfad --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.compile_suggestion.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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() { + // [START dialogflow_v2beta1_generated_Participants_CompileSuggestion_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 name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * latest_message to use as context when compiling the + * suggestion. If zero or less than zero, 20 is used. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callCompileSuggestion() { + // Construct request + const request = { + }; + + // Run request + const response = await dialogflowClient.compileSuggestion(request); + console.log(response); + } + + callCompileSuggestion(); + // [END dialogflow_v2beta1_generated_Participants_CompileSuggestion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js new file mode 100644 index 00000000000..59d6e263e47 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.create_participant.js @@ -0,0 +1,68 @@ +// 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. +// +// ** 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, participant) { + // [START dialogflow_v2beta1_generated_Participants_CreateParticipant_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 identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Required. The participant to create. + */ + // const participant = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callCreateParticipant() { + // Construct request + const request = { + parent, + participant, + }; + + // Run request + const response = await dialogflowClient.createParticipant(request); + console.log(response); + } + + callCreateParticipant(); + // [END dialogflow_v2beta1_generated_Participants_CreateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js new file mode 100644 index 00000000000..1ed6d03766f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.get_participant.js @@ -0,0 +1,63 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Participants_GetParticipant_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 name of the participant. Format: + * `projects//locations//conversations//participants/`. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callGetParticipant() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getParticipant(request); + console.log(response); + } + + callGetParticipant(); + // [END dialogflow_v2beta1_generated_Participants_GetParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js new file mode 100644 index 00000000000..f7daa2cb3ef --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_participants.js @@ -0,0 +1,74 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Participants_ListParticipants_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 conversation to list all participants from. + * Format: `projects//locations//conversations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callListParticipants() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listParticipantsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListParticipants(); + // [END dialogflow_v2beta1_generated_Participants_ListParticipants_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js new file mode 100644 index 00000000000..01be69c5f23 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.list_suggestions.js @@ -0,0 +1,83 @@ +// 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. +// +// ** 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() { + // [START dialogflow_v2beta1_generated_Participants_ListSuggestions_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 name of the participant to fetch suggestions for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. The + * default value is 100; the maximum value is 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * Optional. Filter on suggestions fields. Currently predicates on + * `create_time` and `create_time_epoch_microseconds` are supported. + * `create_time` only support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"` + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callListSuggestions() { + // Construct request + const request = { + }; + + // Run request + const iterable = await dialogflowClient.listSuggestionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSuggestions(); + // [END dialogflow_v2beta1_generated_Participants_ListSuggestions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.streaming_analyze_content.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.streaming_analyze_content.js new file mode 100644 index 00000000000..885759143f3 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.streaming_analyze_content.js @@ -0,0 +1,140 @@ +// 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. +// +// ** 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(participant) { + // [START dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_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 name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + */ + // const participant = 'abc123' + /** + * Instructs the speech recognizer how to process the speech audio. + */ + // const audioConfig = {} + /** + * The natural language text to be processed. + */ + // const textConfig = {} + /** + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * StreamingAnalyzeContent. If this configuration is not supplied, speech + * synthesis is disabled. + */ + // const replyAudioConfig = {} + /** + * The input audio content to be recognized. Must be sent if `audio_config` + * is set in the first message. The complete audio over all streaming + * messages must not exceed 1 minute. + */ + // const inputAudio = 'Buffer.from('string')' + /** + * The UTF-8 encoded natural language text to be processed. Must be sent if + * `text_config` is set in the first message. Text length must not exceed + * 256 bytes for virtual agent interactions. The `input_text` field can be + * only sent once. + */ + // const inputText = 'abc123' + /** + * The DTMF digits used to invoke intent and fill in parameter value. + * This input is ignored if the previous response indicated that DTMF input + * is not accepted. + */ + // const inputDtmf = {} + /** + * Parameters for a Dialogflow virtual-agent query. + */ + // const queryParams = {} + /** + * Parameters for a human assist query. + */ + // const assistQueryParams = {} + /** + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxParameters = {} + /** + * The unique identifier of the CX page to override the `current_page` in the + * session. + * Format: `projects//locations//agents//flows//pages/`. + * If `cx_current_page` is specified, the previous state of the session will + * be ignored by Dialogflow CX, including the previous + * page QueryResult.current_page and the previous session + * parameters QueryResult.parameters. In most cases, `cx_current_page` and + * `cx_parameters` should be configured together to direct a session to a + * specific state. + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + */ + // const cxCurrentPage = 'abc123' + /** + * Enable partial virtual agent responses. If this flag is not enabled, + * response stream still contains only one final response even if some + * `Fulfillment`s in Dialogflow virtual agent have been configured to return + * partial responses. + */ + // const enablePartialAutomatedAgentReply = true + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callStreamingAnalyzeContent() { + // Construct request + const request = { + participant, + }; + + // Run request + const stream = await dialogflowClient.streamingAnalyzeContent(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingAnalyzeContent(); + // [END dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js new file mode 100644 index 00000000000..038326b97be --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_articles.js @@ -0,0 +1,80 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Participants_SuggestArticles_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 name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * latest_message google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message to use as context + * when compiling the suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + /** + * Optional. Parameters for a human assist query. + */ + // const assistQueryParams = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestArticles() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestArticles(request); + console.log(response); + } + + callSuggestArticles(); + // [END dialogflow_v2beta1_generated_Participants_SuggestArticles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js new file mode 100644 index 00000000000..cebe5ce478a --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_faq_answers.js @@ -0,0 +1,80 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_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 name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * latest_message to use as context when compiling the + * suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + /** + * Optional. Parameters for a human assist query. + */ + // const assistQueryParams = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestFaqAnswers() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestFaqAnswers(request); + console.log(response); + } + + callSuggestFaqAnswers(); + // [END dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js new file mode 100644 index 00000000000..15a27996149 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.suggest_smart_replies.js @@ -0,0 +1,82 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_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 name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + */ + // const parent = 'abc123' + /** + * The current natural language text segment to compile suggestion + * for. This provides a way for user to get follow up smart reply suggestion + * after a smart reply selection, without sending a text message. + */ + // const currentTextInput = {} + /** + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * Format: `projects//locations//conversations//messages/`. + */ + // const latestMessage = 'abc123' + /** + * Optional. Max number of messages prior to and including + * latest_message to use as context when compiling the + * suggestion. By default 20 and at most 50. + */ + // const contextSize = 1234 + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callSuggestSmartReplies() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await dialogflowClient.suggestSmartReplies(request); + console.log(response); + } + + callSuggestSmartReplies(); + // [END dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js new file mode 100644 index 00000000000..214454f94f8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/participants.update_participant.js @@ -0,0 +1,66 @@ +// 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. +// +// ** 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(participant, updateMask) { + // [START dialogflow_v2beta1_generated_Participants_UpdateParticipant_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 participant to update. + */ + // const participant = {} + /** + * Required. The mask to specify which fields to update. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {ParticipantsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new ParticipantsClient(); + + async function callUpdateParticipant() { + // Construct request + const request = { + participant, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateParticipant(request); + console.log(response); + } + + callUpdateParticipant(); + // [END dialogflow_v2beta1_generated_Participants_UpdateParticipant_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js new file mode 100644 index 00000000000..4ed022ae6d8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.create_session_entity_type.js @@ -0,0 +1,78 @@ +// 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. +// +// ** 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, sessionEntityType) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_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 session to create a session entity type for. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Required. The session entity type to create. + */ + // const sessionEntityType = {} + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callCreateSessionEntityType() { + // Construct request + const request = { + parent, + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.createSessionEntityType(request); + console.log(response); + } + + callCreateSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js new file mode 100644 index 00000000000..f99c287db0b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.delete_session_entity_type.js @@ -0,0 +1,74 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_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 name of the entity type to delete. + * Supported formats: + * - `projects//agent/sessions//entityTypes/` + * - `projects//locations//agent/sessions//entityTypes/` + * - `projects//agent/environments//users//sessions//entityTypes/` + * - `projects//locations//agent/environments/ + * /users//sessions//entityTypes/` + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callDeleteSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteSessionEntityType(request); + console.log(response); + } + + callDeleteSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js new file mode 100644 index 00000000000..a3aafbd9d94 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.get_session_entity_type.js @@ -0,0 +1,73 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_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 name of the session entity type. Supported formats: + * - `projects//agent/sessions//entityTypes/` + * - `projects//locations//agent/sessions//entityTypes/` + * - `projects//agent/environments//users//sessions//entityTypes/` + * - `projects//locations//agent/environments/ + * /users//sessions//entityTypes/` + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callGetSessionEntityType() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getSessionEntityType(request); + console.log(response); + } + + callGetSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js new file mode 100644 index 00000000000..0a6afad6ea7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.list_session_entity_types.js @@ -0,0 +1,84 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_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 session to list all session entity types from. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callListSessionEntityTypes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listSessionEntityTypesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSessionEntityTypes(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js new file mode 100644 index 00000000000..04cb5585741 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/session_entity_types.update_session_entity_type.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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(sessionEntityType) { + // [START dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_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 session entity type to update. + */ + // const sessionEntityType = {} + /** + * Optional. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {SessionEntityTypesClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionEntityTypesClient(); + + async function callUpdateSessionEntityType() { + // Construct request + const request = { + sessionEntityType, + }; + + // Run request + const response = await dialogflowClient.updateSessionEntityType(request); + console.log(response); + } + + callUpdateSessionEntityType(); + // [END dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js new file mode 100644 index 00000000000..9069bdd82f5 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.detect_intent.js @@ -0,0 +1,114 @@ +// 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. +// +// ** 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(session, queryInput) { + // [START dialogflow_v2beta1_generated_Sessions_DetectIntent_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 name of the session this query is sent to. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment + * (`Environment ID` might be referred to as environment name at some places). + * If `User ID` is not specified, we are using "-". It's up to the API caller + * to choose an appropriate `Session ID` and `User Id`. They can be a random + * number or some type of user and session identifiers (preferably hashed). + * The length of the `Session ID` and `User ID` must not exceed 36 characters. + * For more information, see the API interactions + * guide (https://cloud.google.com/dialogflow/docs/api-overview). + * Note: Always use agent versions for production traffic. + * See Versions and + * environments (https://cloud.google.com/dialogflow/es/docs/agents-versions). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = {} + /** + * Required. The input specification. It can be set to: + * 1. an audio config + * which instructs the speech recognizer how to process the speech audio, + * 2. a conversational query in the form of text, or + * 3. an event that specifies which intent to trigger. + */ + // const queryInput = {} + /** + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + */ + // const outputAudioConfig = {} + /** + * Mask for output_audio_config google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * If unspecified or empty, output_audio_config google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config replaces the agent-level + * config in its entirety. + */ + // const outputAudioConfigMask = {} + /** + * The natural language speech audio to be processed. This field + * should be populated iff `query_input` is set to an input audio config. + * A single request can contain up to 1 minute of speech audio data. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function callDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const response = await dialogflowClient.detectIntent(request); + console.log(response); + } + + callDetectIntent(); + // [END dialogflow_v2beta1_generated_Sessions_DetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js new file mode 100644 index 00000000000..52d75538ff7 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/sessions.streaming_detect_intent.js @@ -0,0 +1,130 @@ +// 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. +// +// ** 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(session, queryInput) { + // [START dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_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 name of the session the query is sent to. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we are using "-". It's up to the API caller + * to choose an appropriate `Session ID` and `User Id`. They can be a random + * number or some type of user and session identifiers (preferably hashed). + * The length of the `Session ID` and `User ID` must not exceed 36 characters. + * For more information, see the API interactions + * guide (https://cloud.google.com/dialogflow/docs/api-overview). + * Note: Always use agent versions for production traffic. + * See Versions and + * environments (https://cloud.google.com/dialogflow/es/docs/agents-versions). + */ + // const session = 'abc123' + /** + * The parameters of this query. + */ + // const queryParams = {} + /** + * Required. The input specification. It can be set to: + * 1. an audio config which instructs the speech recognizer how to process + * the speech audio, + * 2. a conversational query in the form of text, or + * 3. an event that specifies which intent to trigger. + */ + // const queryInput = {} + /** + * DEPRECATED. Please use InputAudioConfig.single_utterance google.cloud.dialogflow.v2beta1.InputAudioConfig.single_utterance instead. + * If `false` (default), recognition does not cease until the + * client closes the stream. + * If `true`, the recognizer will detect a single spoken utterance in input + * audio. Recognition ceases when it detects the audio's voice has + * stopped or paused. In this case, once a detected intent is received, the + * client should close the stream and start a new request with a new stream as + * needed. + * This setting is ignored when `query_input` is a piece of text or an event. + */ + // const singleUtterance = true + /** + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + */ + // const outputAudioConfig = {} + /** + * Mask for output_audio_config google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * If unspecified or empty, output_audio_config google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest.output_audio_config replaces the agent-level + * config in its entirety. + */ + // const outputAudioConfigMask = {} + /** + * The input audio content to be recognized. Must be sent if + * `query_input` was set to a streaming input audio config. The complete audio + * over all streaming messages must not exceed 1 minute. + */ + // const inputAudio = 'Buffer.from('string')' + + // Imports the Dialogflow library + const {SessionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new SessionsClient(); + + async function callStreamingDetectIntent() { + // Construct request + const request = { + session, + queryInput, + }; + + // Run request + const stream = await dialogflowClient.streamingDetectIntent(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingDetectIntent(); + // [END dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json b/packages/google-cloud-dialogflow/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json new file mode 100644 index 00000000000..9959fd82dcc --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/snippet_metadata.google.cloud.dialogflow.v2beta1.json @@ -0,0 +1,4327 @@ +{ + "clientLibrary": { + "name": "nodejs-dialogflow", + "version": "5.3.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.dialogflow.v2beta1", + "version": "v2beta1" + } + ] + }, + "snippets": [ + { + "regionTag": "dialogflow_v2beta1_generated_Agents_GetAgent_async", + "title": "dialogflow getAgent Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent.", + "canonical": true, + "file": "agents.get_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Agent", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "GetAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_SetAgent_async", + "title": "dialogflow setAgent Sample", + "origin": "API_DEFINITION", + "description": " Creates/updates the specified agent. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.set_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.SetAgent", + "async": true, + "parameters": [ + { + "name": "agent", + "type": ".google.cloud.dialogflow.v2beta1.Agent" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Agent", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "SetAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.SetAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_DeleteAgent_async", + "title": "dialogflow deleteAgent Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified agent.", + "canonical": true, + "file": "agents.delete_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.DeleteAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "DeleteAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.DeleteAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_SearchAgents_async", + "title": "dialogflow searchAgents Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of agents. Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id \"-\". Refer to [List Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).", + "canonical": true, + "file": "agents.search_agents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SearchAgents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.SearchAgents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SearchAgentsResponse", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "SearchAgents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.SearchAgents", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_TrainAgent_async", + "title": "dialogflow trainAgent Sample", + "origin": "API_DEFINITION", + "description": " Trains the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.train_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TrainAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.TrainAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "TrainAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.TrainAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_ExportAgent_async", + "title": "dialogflow exportAgent Sample", + "origin": "API_DEFINITION", + "description": " Exports the specified agent to a ZIP file. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [ExportAgentResponse][google.cloud.dialogflow.v2beta1.ExportAgentResponse]", + "canonical": true, + "file": "agents.export_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExportAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.ExportAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "ExportAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.ExportAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_ImportAgent_async", + "title": "dialogflow importAgent Sample", + "origin": "API_DEFINITION", + "description": " Imports the specified agent from a ZIP file. Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from [ImportAgentRequest][google.cloud.dialogflow.v2beta1.ImportAgentRequest]. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when importing is complete, not when it is done training. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.import_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.ImportAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + }, + { + "name": "agent_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "ImportAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.ImportAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_RestoreAgent_async", + "title": "dialogflow restoreAgent Sample", + "origin": "API_DEFINITION", + "description": " Restores the specified agent from a ZIP file. Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2beta1.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) The operation only tracks when restoring is complete, not when it is done training. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "agents.restore_agent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.RestoreAgent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "agent_uri", + "type": "TYPE_STRING" + }, + { + "name": "agent_content", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "RestoreAgent", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.RestoreAgent", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Agents_GetValidationResult_async", + "title": "dialogflow getValidationResult Sample", + "origin": "API_DEFINITION", + "description": " Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.", + "canonical": true, + "file": "agents.get_validation_result.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetValidationResult", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetValidationResult", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ValidationResult", + "client": { + "shortName": "AgentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AgentsClient" + }, + "method": { + "shortName": "GetValidationResult", + "fullName": "google.cloud.dialogflow.v2beta1.Agents.GetValidationResult", + "service": { + "shortName": "Agents", + "fullName": "google.cloud.dialogflow.v2beta1.Agents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async", + "title": "dialogflow getAnswerRecord Sample", + "origin": "API_DEFINITION", + "description": " Deprecated. Retrieves a specific answer record.", + "canonical": true, + "file": "answer_records.get_answer_record.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetAnswerRecord", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecord", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.AnswerRecord", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecordsClient" + }, + "method": { + "shortName": "GetAnswerRecord", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.GetAnswerRecord", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async", + "title": "dialogflow listAnswerRecords Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all answer records in the specified project in reverse chronological order.", + "canonical": true, + "file": "answer_records.list_answer_records.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListAnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecordsClient" + }, + "method": { + "shortName": "ListAnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.ListAnswerRecords", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async", + "title": "dialogflow updateAnswerRecord Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified answer record.", + "canonical": true, + "file": "answer_records.update_answer_record.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateAnswerRecord", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord", + "async": true, + "parameters": [ + { + "name": "answer_record", + "type": ".google.cloud.dialogflow.v2beta1.AnswerRecord" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.AnswerRecord", + "client": { + "shortName": "AnswerRecordsClient", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecordsClient" + }, + "method": { + "shortName": "UpdateAnswerRecord", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords.UpdateAnswerRecord", + "service": { + "shortName": "AnswerRecords", + "fullName": "google.cloud.dialogflow.v2beta1.AnswerRecords" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_ListContexts_async", + "title": "dialogflow listContexts Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all contexts in the specified session.", + "canonical": true, + "file": "contexts.list_contexts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListContexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.ListContexts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListContextsResponse", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "ListContexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.ListContexts", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_GetContext_async", + "title": "dialogflow getContext Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified context.", + "canonical": true, + "file": "contexts.get_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.GetContext", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "GetContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.GetContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_CreateContext_async", + "title": "dialogflow createContext Sample", + "origin": "API_DEFINITION", + "description": " Creates a context. If the specified context already exists, overrides the context.", + "canonical": true, + "file": "contexts.create_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.CreateContext", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "context", + "type": ".google.cloud.dialogflow.v2beta1.Context" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "CreateContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.CreateContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_UpdateContext_async", + "title": "dialogflow updateContext Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified context.", + "canonical": true, + "file": "contexts.update_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.UpdateContext", + "async": true, + "parameters": [ + { + "name": "context", + "type": ".google.cloud.dialogflow.v2beta1.Context" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Context", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "UpdateContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.UpdateContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_DeleteContext_async", + "title": "dialogflow deleteContext Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified context.", + "canonical": true, + "file": "contexts.delete_context.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteContext", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "DeleteContext", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteContext", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async", + "title": "dialogflow deleteAllContexts Sample", + "origin": "API_DEFINITION", + "description": " Deletes all active contexts in the specified session.", + "canonical": true, + "file": "contexts.delete_all_contexts.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteAllContexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ContextsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ContextsClient" + }, + "method": { + "shortName": "DeleteAllContexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts", + "service": { + "shortName": "Contexts", + "fullName": "google.cloud.dialogflow.v2beta1.Contexts" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async", + "title": "dialogflow listConversationProfiles Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversation profiles in the specified project.", + "canonical": true, + "file": "conversation_profiles.list_conversation_profiles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListConversationProfilesResponse", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "ListConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ListConversationProfiles", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async", + "title": "dialogflow getConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified conversation profile.", + "canonical": true, + "file": "conversation_profiles.get_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "GetConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async", + "title": "dialogflow createConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Creates a conversation profile in the specified project. [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] aren't populated in the response. You can retrieve them via [GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile] API.", + "canonical": true, + "file": "conversation_profiles.create_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation_profile", + "type": ".google.cloud.dialogflow.v2beta1.ConversationProfile" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "CreateConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.CreateConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async", + "title": "dialogflow updateConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified conversation profile. [ConversationProfile.CreateTime][] and [ConversationProfile.UpdateTime][] aren't populated in the response. You can retrieve them via [GetConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile] API.", + "canonical": true, + "file": "conversation_profiles.update_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfile", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": ".google.cloud.dialogflow.v2beta1.ConversationProfile" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ConversationProfile", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "UpdateConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.UpdateConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async", + "title": "dialogflow deleteConversationProfile Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified conversation profile.", + "canonical": true, + "file": "conversation_profiles.delete_conversation_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "DeleteConversationProfile", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.DeleteConversationProfile", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async", + "title": "dialogflow setSuggestionFeatureConfig Sample", + "origin": "API_DEFINITION", + "description": " Adds or updates a suggestion feature in a conversation profile. If the conversation profile contains the type of suggestion feature for the participant role, it will update it. Otherwise it will insert the suggestion feature. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile] If a long running operation to add or update suggestion feature config for the same conversation profile, participant role and suggestion feature type exists, please cancel the existing long running operation before sending such request, otherwise the request will be rejected.", + "canonical": true, + "file": "conversation_profiles.set_suggestion_feature_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.SetSuggestionFeatureConfig", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": "TYPE_STRING" + }, + { + "name": "participant_role", + "type": ".google.cloud.dialogflow.v2beta1.Participant.Role" + }, + { + "name": "suggestion_feature_config", + "type": ".google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "SetSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.SetSuggestionFeatureConfig", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async", + "title": "dialogflow clearSuggestionFeatureConfig Sample", + "origin": "API_DEFINITION", + "description": " Clears a suggestion feature from a conversation profile for the given participant role. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: [ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata] - `response`: [ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]", + "canonical": true, + "file": "conversation_profiles.clear_suggestion_feature_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ClearSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ClearSuggestionFeatureConfig", + "async": true, + "parameters": [ + { + "name": "conversation_profile", + "type": "TYPE_STRING" + }, + { + "name": "participant_role", + "type": ".google.cloud.dialogflow.v2beta1.Participant.Role" + }, + { + "name": "suggestion_feature_type", + "type": ".google.cloud.dialogflow.v2beta1.SuggestionFeature.Type" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "ConversationProfilesClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfilesClient" + }, + "method": { + "shortName": "ClearSuggestionFeatureConfig", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles.ClearSuggestionFeatureConfig", + "service": { + "shortName": "ConversationProfiles", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationProfiles" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_CreateConversation_async", + "title": "dialogflow createConversation Sample", + "origin": "API_DEFINITION", + "description": " Creates a new conversation. Conversations are auto-completed after 24 hours. Conversation Lifecycle: There are two stages during a conversation: Automated Agent Stage and Assist Stage. For Automated Agent Stage, there will be a dialogflow agent responding to user queries. For Assist Stage, there's no dialogflow agent responding to user queries. But we will provide suggestions which are generated from conversation. If [Conversation.conversation_profile][google.cloud.dialogflow.v2beta1.Conversation.conversation_profile] is configured for a dialogflow agent, conversation will start from `Automated Agent Stage`, otherwise, it will start from `Assist Stage`. And during `Automated Agent Stage`, once an [Intent][google.cloud.dialogflow.v2beta1.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2beta1.Intent.live_agent_handoff] is triggered, conversation will transfer to Assist Stage.", + "canonical": true, + "file": "conversations.create_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CreateConversation", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "conversation", + "type": ".google.cloud.dialogflow.v2beta1.Conversation" + }, + { + "name": "conversation_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "CreateConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CreateConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_ListConversations_async", + "title": "dialogflow listConversations Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all conversations in the specified project.", + "canonical": true, + "file": "conversations.list_conversations.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListConversations", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListConversationsResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "ListConversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListConversations", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_GetConversation_async", + "title": "dialogflow getConversation Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specific conversation.", + "canonical": true, + "file": "conversations.get_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.GetConversation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "GetConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.GetConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_CompleteConversation_async", + "title": "dialogflow completeConversation Sample", + "origin": "API_DEFINITION", + "description": " Completes the specified conversation. Finished conversations are purged from the database after 30 days.", + "canonical": true, + "file": "conversations.complete_conversation.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompleteConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Conversation", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "CompleteConversation", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async", + "title": "dialogflow batchCreateMessages Sample", + "origin": "API_DEFINITION", + "description": " Batch ingests messages to conversation. Customers can use this RPC to ingest historical messages to conversation.", + "canonical": true, + "file": "conversations.batch_create_messages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateMessages", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.BatchCreateMessages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "requests", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "BatchCreateMessages", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.BatchCreateMessages", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_ListMessages_async", + "title": "dialogflow listMessages Sample", + "origin": "API_DEFINITION", + "description": " Lists messages that belong to a given conversation. `messages` are ordered by `create_time` in descending order. To fetch updates without duplication, send request with filter `create_time_epoch_microseconds > [first item's create_time of previous request]` and empty page_token.", + "canonical": true, + "file": "conversations.list_messages.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMessages", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListMessages", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListMessagesResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "ListMessages", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.ListMessages", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async", + "title": "dialogflow suggestConversationSummary Sample", + "origin": "API_DEFINITION", + "description": " Suggest summary for a conversation based on specific historical messages. The range of the messages to be used for summary can be specified in the request.", + "canonical": true, + "file": "conversations.suggest_conversation_summary.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestConversationSummary", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary", + "async": true, + "parameters": [ + { + "name": "conversation", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse", + "client": { + "shortName": "ConversationsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ConversationsClient" + }, + "method": { + "shortName": "SuggestConversationSummary", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations.SuggestConversationSummary", + "service": { + "shortName": "Conversations", + "fullName": "google.cloud.dialogflow.v2beta1.Conversations" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_ListDocuments_async", + "title": "dialogflow listDocuments Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all documents of the knowledge base. Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.list_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListDocuments", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ListDocuments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListDocumentsResponse", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "ListDocuments", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ListDocuments", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_GetDocument_async", + "title": "dialogflow getDocument Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified document. Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.get_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.GetDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Document", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "GetDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.GetDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_CreateDocument_async", + "title": "dialogflow createDocument Sample", + "origin": "API_DEFINITION", + "description": " Creates a new document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.create_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.CreateDocument", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "document", + "type": ".google.cloud.dialogflow.v2beta1.Document" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "CreateDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.CreateDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_ImportDocuments_async", + "title": "dialogflow importDocuments Sample", + "origin": "API_DEFINITION", + "description": " Create documents by importing data from external sources. Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [ImportDocumentsResponse][google.cloud.dialogflow.v2beta1.ImportDocumentsResponse]", + "canonical": true, + "file": "documents.import_documents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ImportDocuments", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ImportDocuments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "gcs_source", + "type": ".google.cloud.dialogflow.v2beta1.GcsSources" + }, + { + "name": "document_template", + "type": ".google.cloud.dialogflow.v2beta1.ImportDocumentTemplate" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "ImportDocuments", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ImportDocuments", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_DeleteDocument_async", + "title": "dialogflow deleteDocument Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.delete_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.DeleteDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "DeleteDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.DeleteDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_UpdateDocument_async", + "title": "dialogflow updateDocument Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified document. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.update_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.UpdateDocument", + "async": true, + "parameters": [ + { + "name": "document", + "type": ".google.cloud.dialogflow.v2beta1.Document" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "UpdateDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.UpdateDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Documents_ReloadDocument_async", + "title": "dialogflow reloadDocument Sample", + "origin": "API_DEFINITION", + "description": " Reloads the specified document from its specified source, content_uri or content. The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes. Note: If the document source is Google Cloud Storage URI, its metadata will be replaced with the custom metadata from Google Cloud Storage if the `import_gcs_custom_metadata` field is set to true in the request. This method is a [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The returned `Operation` type has the following method-specific fields: - `metadata`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata] - `response`: [Document][google.cloud.dialogflow.v2beta1.Document] Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; only use `projects.knowledgeBases.documents`.", + "canonical": true, + "file": "documents.reload_document.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReloadDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ReloadDocument", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "gcs_source", + "type": ".google.cloud.dialogflow.v2beta1.GcsSource" + }, + { + "name": "import_gcs_custom_metadata", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DocumentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.DocumentsClient" + }, + "method": { + "shortName": "ReloadDocument", + "fullName": "google.cloud.dialogflow.v2beta1.Documents.ReloadDocument", + "service": { + "shortName": "Documents", + "fullName": "google.cloud.dialogflow.v2beta1.Documents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async", + "title": "dialogflow listEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all entity types in the specified agent.", + "canonical": true, + "file": "entity_types.list_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListEntityTypesResponse", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "ListEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async", + "title": "dialogflow getEntityType Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified entity type.", + "canonical": true, + "file": "entity_types.get_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "GetEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async", + "title": "dialogflow createEntityType Sample", + "origin": "API_DEFINITION", + "description": " Creates an entity type in the specified agent. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.create_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type", + "type": ".google.cloud.dialogflow.v2beta1.EntityType" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "CreateEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.CreateEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async", + "title": "dialogflow updateEntityType Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified entity type. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.update_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType", + "async": true, + "parameters": [ + { + "name": "entity_type", + "type": ".google.cloud.dialogflow.v2beta1.EntityType" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.EntityType", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "UpdateEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.UpdateEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async", + "title": "dialogflow deleteEntityType Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified entity type. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.delete_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "DeleteEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.DeleteEntityType", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async", + "title": "dialogflow batchUpdateEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Updates/Creates multiple entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateEntityTypesResponse][google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_update_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 80, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_batch_uri", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_batch_inline", + "type": ".google.cloud.dialogflow.v2beta1.EntityTypeBatch" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchUpdateEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async", + "title": "dialogflow batchDeleteEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Deletes entity types in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_delete_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_type_names", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchDeleteEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntityTypes", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async", + "title": "dialogflow batchCreateEntities Sample", + "origin": "API_DEFINITION", + "description": " Creates multiple new entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_create_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 71, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchCreateEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entities", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchCreateEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchCreateEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async", + "title": "dialogflow batchUpdateEntities Sample", + "origin": "API_DEFINITION", + "description": " Updates or creates multiple entities in the specified entity type. This method does not affect entities in the entity type that aren't explicitly specified in the request. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training). This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)", + "canonical": true, + "file": "entity_types.batch_update_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entities", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchUpdateEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchUpdateEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async", + "title": "dialogflow batchDeleteEntities Sample", + "origin": "API_DEFINITION", + "description": " Deletes entities in the specified entity type. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "entity_types.batch_delete_entities.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "entity_values", + "type": "TYPE_STRING[]" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "EntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypesClient" + }, + "method": { + "shortName": "BatchDeleteEntities", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes.BatchDeleteEntities", + "service": { + "shortName": "EntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.EntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_ListEnvironments_async", + "title": "dialogflow listEnvironments Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all non-draft environments of the specified agent.", + "canonical": true, + "file": "environments.list_environments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEnvironments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.ListEnvironments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListEnvironmentsResponse", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "ListEnvironments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.ListEnvironments", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_GetEnvironment_async", + "title": "dialogflow getEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent environment.", + "canonical": true, + "file": "environments.get_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "GetEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_CreateEnvironment_async", + "title": "dialogflow createEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent environment.", + "canonical": true, + "file": "environments.create_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.CreateEnvironment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "environment", + "type": ".google.cloud.dialogflow.v2beta1.Environment" + }, + { + "name": "environment_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "CreateEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.CreateEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async", + "title": "dialogflow updateEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified agent environment. This method allows you to deploy new agent versions into the environment. When an environment is pointed to a new agent version by setting `environment.agent_version`, the environment is temporarily set to the `LOADING` state. During that time, the environment keeps on serving the previous version of the agent. After the new agent version is done loading, the environment is set back to the `RUNNING` state. You can use \"-\" as Environment ID in environment name to update version in \"draft\" environment. WARNING: this will negate all recent changes to draft and can't be undone. You may want to save the draft to a version before calling this function.", + "canonical": true, + "file": "environments.update_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironment", + "async": true, + "parameters": [ + { + "name": "environment", + "type": ".google.cloud.dialogflow.v2beta1.Environment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "allow_load_to_draft_and_discard_changes", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Environment", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "UpdateEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.UpdateEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async", + "title": "dialogflow deleteEnvironment Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified agent environment.", + "canonical": true, + "file": "environments.delete_environment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "DeleteEnvironment", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.DeleteEnvironment", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async", + "title": "dialogflow getEnvironmentHistory Sample", + "origin": "API_DEFINITION", + "description": " Gets the history of the specified environment.", + "canonical": true, + "file": "environments.get_environment_history.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetEnvironmentHistory", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.EnvironmentHistory", + "client": { + "shortName": "EnvironmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.EnvironmentsClient" + }, + "method": { + "shortName": "GetEnvironmentHistory", + "fullName": "google.cloud.dialogflow.v2beta1.Environments.GetEnvironmentHistory", + "service": { + "shortName": "Environments", + "fullName": "google.cloud.dialogflow.v2beta1.Environments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async", + "title": "dialogflow getFulfillment Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the fulfillment.", + "canonical": true, + "file": "fulfillments.get_fulfillment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetFulfillment", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Fulfillment", + "client": { + "shortName": "FulfillmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.FulfillmentsClient" + }, + "method": { + "shortName": "GetFulfillment", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.GetFulfillment", + "service": { + "shortName": "Fulfillments", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async", + "title": "dialogflow updateFulfillment Sample", + "origin": "API_DEFINITION", + "description": " Updates the fulfillment.", + "canonical": true, + "file": "fulfillments.update_fulfillment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateFulfillment", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillment", + "async": true, + "parameters": [ + { + "name": "fulfillment", + "type": ".google.cloud.dialogflow.v2beta1.Fulfillment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Fulfillment", + "client": { + "shortName": "FulfillmentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.FulfillmentsClient" + }, + "method": { + "shortName": "UpdateFulfillment", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments.UpdateFulfillment", + "service": { + "shortName": "Fulfillments", + "fullName": "google.cloud.dialogflow.v2beta1.Fulfillments" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_ListIntents_async", + "title": "dialogflow listIntents Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all intents in the specified agent.", + "canonical": true, + "file": "intents.list_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 84, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.ListIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListIntentsResponse", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "ListIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.ListIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_GetIntent_async", + "title": "dialogflow getIntent Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified intent.", + "canonical": true, + "file": "intents.get_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.GetIntent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "GetIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.GetIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_CreateIntent_async", + "title": "dialogflow createIntent Sample", + "origin": "API_DEFINITION", + "description": " Creates an intent in the specified agent. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.create_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.CreateIntent", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intent", + "type": ".google.cloud.dialogflow.v2beta1.Intent" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "CreateIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.CreateIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_UpdateIntent_async", + "title": "dialogflow updateIntent Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified intent. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.update_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 69, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.UpdateIntent", + "async": true, + "parameters": [ + { + "name": "intent", + "type": ".google.cloud.dialogflow.v2beta1.Intent" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Intent", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "UpdateIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.UpdateIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_DeleteIntent_async", + "title": "dialogflow deleteIntent Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified intent and its direct or indirect followup intents. Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.delete_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.DeleteIntent", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "DeleteIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.DeleteIntent", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async", + "title": "dialogflow batchUpdateIntents Sample", + "origin": "API_DEFINITION", + "description": " Updates/Creates multiple intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: [BatchUpdateIntentsResponse][google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse] Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.batch_update_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchUpdateIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intent_batch_uri", + "type": "TYPE_STRING" + }, + { + "name": "intent_batch_inline", + "type": ".google.cloud.dialogflow.v2beta1.IntentBatch" + }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "intent_view", + "type": ".google.cloud.dialogflow.v2beta1.IntentView" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "BatchUpdateIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchUpdateIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async", + "title": "dialogflow batchDeleteIntents Sample", + "origin": "API_DEFINITION", + "description": " Deletes intents in the specified agent. This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields: - `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).", + "canonical": true, + "file": "intents.batch_delete_intents.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "BatchDeleteIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "intents", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "IntentsClient", + "fullName": "google.cloud.dialogflow.v2beta1.IntentsClient" + }, + "method": { + "shortName": "BatchDeleteIntents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents", + "service": { + "shortName": "Intents", + "fullName": "google.cloud.dialogflow.v2beta1.Intents" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async", + "title": "dialogflow listKnowledgeBases Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all knowledge bases of the specified agent. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.list_knowledge_bases.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListKnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListKnowledgeBasesResponse", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "ListKnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async", + "title": "dialogflow getKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.get_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "GetKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async", + "title": "dialogflow createKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Creates a knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.create_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "knowledge_base", + "type": ".google.cloud.dialogflow.v2beta1.KnowledgeBase" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "CreateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async", + "title": "dialogflow deleteKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.delete_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "DeleteKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async", + "title": "dialogflow updateKnowledgeBase Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified knowledge base. Note: The `projects.agent.knowledgeBases` resource is deprecated; only use `projects.knowledgeBases`.", + "canonical": true, + "file": "knowledge_bases.update_knowledge_base.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase", + "async": true, + "parameters": [ + { + "name": "knowledge_base", + "type": ".google.cloud.dialogflow.v2beta1.KnowledgeBase" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.KnowledgeBase", + "client": { + "shortName": "KnowledgeBasesClient", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBasesClient" + }, + "method": { + "shortName": "UpdateKnowledgeBase", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases.UpdateKnowledgeBase", + "service": { + "shortName": "KnowledgeBases", + "fullName": "google.cloud.dialogflow.v2beta1.KnowledgeBases" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_CreateParticipant_async", + "title": "dialogflow createParticipant Sample", + "origin": "API_DEFINITION", + "description": " Creates a new participant in a conversation.", + "canonical": true, + "file": "participants.create_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.CreateParticipant", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "participant", + "type": ".google.cloud.dialogflow.v2beta1.Participant" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "CreateParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.CreateParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_GetParticipant_async", + "title": "dialogflow getParticipant Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a conversation participant.", + "canonical": true, + "file": "participants.get_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.GetParticipant", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "GetParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.GetParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_ListParticipants_async", + "title": "dialogflow listParticipants Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all participants in the specified conversation.", + "canonical": true, + "file": "participants.list_participants.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListParticipants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListParticipants", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListParticipantsResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "ListParticipants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListParticipants", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_UpdateParticipant_async", + "title": "dialogflow updateParticipant Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified participant.", + "canonical": true, + "file": "participants.update_participant.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.UpdateParticipant", + "async": true, + "parameters": [ + { + "name": "participant", + "type": ".google.cloud.dialogflow.v2beta1.Participant" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Participant", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "UpdateParticipant", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.UpdateParticipant", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_AnalyzeContent_async", + "title": "dialogflow analyzeContent Sample", + "origin": "API_DEFINITION", + "description": " Adds a text (chat, for example), or audio (phone recording, for example) message from a participant into the conversation. Note: Always use agent versions for production traffic sent to virtual agents. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "participants.analyze_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 127, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AnalyzeContent", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent", + "async": true, + "parameters": [ + { + "name": "participant", + "type": "TYPE_STRING" + }, + { + "name": "text_input", + "type": ".google.cloud.dialogflow.v2beta1.TextInput" + }, + { + "name": "audio_input", + "type": ".google.cloud.dialogflow.v2beta1.AudioInput" + }, + { + "name": "event_input", + "type": ".google.cloud.dialogflow.v2beta1.EventInput" + }, + { + "name": "reply_audio_config", + "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" + }, + { + "name": "cx_parameters", + "type": ".google.protobuf.Struct" + }, + { + "name": "cx_current_page", + "type": "TYPE_STRING" + }, + { + "name": "message_send_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.AnalyzeContentResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "AnalyzeContent", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async", + "title": "dialogflow streamingAnalyzeContent Sample", + "origin": "API_DEFINITION", + "description": " Adds a text (e.g., chat) or audio (e.g., phone recording) message from a participant into the conversation. Note: This method is only available through the gRPC API (not REST). The top-level message sent to the client by the server is `StreamingAnalyzeContentResponse`. Multiple response messages can be returned in order. The first one or more messages contain the `recognition_result` field. Each result represents a more complete transcript of what the user said. The next message contains the `reply_text` field, and potentially the `reply_audio` and/or the `automated_agent_reply` fields. Note: Always use agent versions for production traffic sent to virtual agents. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "participants.streaming_analyze_content.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 132, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingAnalyzeContent", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent", + "async": true, + "parameters": [ + { + "name": "participant", + "type": "TYPE_STRING" + }, + { + "name": "audio_config", + "type": ".google.cloud.dialogflow.v2beta1.InputAudioConfig" + }, + { + "name": "text_config", + "type": ".google.cloud.dialogflow.v2beta1.InputTextConfig" + }, + { + "name": "reply_audio_config", + "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + }, + { + "name": "input_text", + "type": "TYPE_STRING" + }, + { + "name": "input_dtmf", + "type": ".google.cloud.dialogflow.v2beta1.TelephonyDtmfEvents" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" + }, + { + "name": "cx_parameters", + "type": ".google.protobuf.Struct" + }, + { + "name": "cx_current_page", + "type": "TYPE_STRING" + }, + { + "name": "enable_partial_automated_agent_reply", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "StreamingAnalyzeContent", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_SuggestArticles_async", + "title": "dialogflow suggestArticles Sample", + "origin": "API_DEFINITION", + "description": " Gets suggested articles for a participant based on specific historical messages. Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion based on the provided conversation context in the real time.", + "canonical": true, + "file": "participants.suggest_articles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestArticles", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestArticles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SuggestArticlesResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "SuggestArticles", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestArticles", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async", + "title": "dialogflow suggestFaqAnswers Sample", + "origin": "API_DEFINITION", + "description": " Gets suggested faq answers for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_faq_answers.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestFaqAnswers", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + }, + { + "name": "assist_query_params", + "type": ".google.cloud.dialogflow.v2beta1.AssistQueryParameters" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "SuggestFaqAnswers", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async", + "title": "dialogflow suggestSmartReplies Sample", + "origin": "API_DEFINITION", + "description": " Gets smart replies for a participant based on specific historical messages.", + "canonical": true, + "file": "participants.suggest_smart_replies.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SuggestSmartReplies", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "current_text_input", + "type": ".google.cloud.dialogflow.v2beta1.TextInput" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "SuggestSmartReplies", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_ListSuggestions_async", + "title": "dialogflow listSuggestions Sample", + "origin": "API_DEFINITION", + "description": " Deprecated: Use inline suggestion, event based suggestion or Suggestion* API instead. See [HumanAgentAssistantConfig.name][google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name] for more details. Removal Date: 2020-09-01. Retrieves suggestions for live agents. This method should be used by human agent client software to fetch auto generated suggestions in real-time, while the conversation with an end user is in progress. The functionality is implemented in terms of the [list pagination](https://cloud.google.com/apis/design/design_patterns#list_pagination) design pattern. The client app should use the `next_page_token` field to fetch the next batch of suggestions. `suggestions` are sorted by `create_time` in descending order. To fetch latest suggestion, just set `page_size` to 1. To fetch new suggestions without duplication, send request with filter `create_time_epoch_microseconds > [first item's create_time of previous request]` and empty page_token.", + "canonical": true, + "file": "participants.list_suggestions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSuggestions", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListSuggestions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListSuggestionsResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "ListSuggestions", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.ListSuggestions", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Participants_CompileSuggestion_async", + "title": "dialogflow compileSuggestion Sample", + "origin": "API_DEFINITION", + "description": " Deprecated. use [SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles] and [SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers] instead. Gets suggestions for a participant based on specific historical messages. Note that [ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions] will only list the auto-generated suggestions, while [CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion] will try to compile suggestion based on the provided conversation context in the real time.", + "canonical": true, + "file": "participants.compile_suggestion.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CompileSuggestion", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "latest_message", + "type": "TYPE_STRING" + }, + { + "name": "context_size", + "type": "TYPE_INT32" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.CompileSuggestionResponse", + "client": { + "shortName": "ParticipantsClient", + "fullName": "google.cloud.dialogflow.v2beta1.ParticipantsClient" + }, + "method": { + "shortName": "CompileSuggestion", + "fullName": "google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion", + "service": { + "shortName": "Participants", + "fullName": "google.cloud.dialogflow.v2beta1.Participants" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async", + "title": "dialogflow listSessionEntityTypes Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all session entity types in the specified session. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.list_session_entity_types.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListSessionEntityTypesResponse", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "ListSessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async", + "title": "dialogflow getSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified session entity type. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.get_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "GetSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async", + "title": "dialogflow createSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " Creates a session entity type. If the specified session entity type already exists, overrides the session entity type. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.create_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "session_entity_type", + "type": ".google.cloud.dialogflow.v2beta1.SessionEntityType" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "CreateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.CreateSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async", + "title": "dialogflow updateSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified session entity type. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.update_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType", + "async": true, + "parameters": [ + { + "name": "session_entity_type", + "type": ".google.cloud.dialogflow.v2beta1.SessionEntityType" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.SessionEntityType", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "UpdateSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.UpdateSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async", + "title": "dialogflow deleteSessionEntityType Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified session entity type. This method doesn't work with Google Assistant integration. Contact Dialogflow support if you need to use session entities with Google Assistant integration.", + "canonical": true, + "file": "session_entity_types.delete_session_entity_type.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SessionEntityTypesClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypesClient" + }, + "method": { + "shortName": "DeleteSessionEntityType", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes.DeleteSessionEntityType", + "service": { + "shortName": "SessionEntityTypes", + "fullName": "google.cloud.dialogflow.v2beta1.SessionEntityTypes" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Sessions_DetectIntent_async", + "title": "dialogflow detectIntent Sample", + "origin": "API_DEFINITION", + "description": " Processes a natural language query and returns structured, actionable data as a result. This method is not idempotent, because it may cause contexts and session entity types to be updated, which in turn might affect results of future queries. If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent] instead of `DetectIntent`. `AnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "sessions.detect_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 106, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DetectIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions.DetectIntent", + "async": true, + "parameters": [ + { + "name": "session", + "type": "TYPE_STRING" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" + }, + { + "name": "query_input", + "type": ".google.cloud.dialogflow.v2beta1.QueryInput" + }, + { + "name": "output_audio_config", + "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" + }, + { + "name": "output_audio_config_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.DetectIntentResponse", + "client": { + "shortName": "SessionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionsClient" + }, + "method": { + "shortName": "DetectIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions.DetectIntent", + "service": { + "shortName": "Sessions", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async", + "title": "dialogflow streamingDetectIntent Sample", + "origin": "API_DEFINITION", + "description": " Processes a natural language query in audio format in a streaming fashion and returns structured, actionable data as a result. This method is only available via the gRPC API (not REST). If you might use [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) or other CCAI products now or in the future, consider using [StreamingAnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent] instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has additional functionality for Agent Assist and other CCAI products. Note: Always use agent versions for production traffic. See [Versions and environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).", + "canonical": true, + "file": "sessions.streaming_detect_intent.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 122, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingDetectIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent", + "async": true, + "parameters": [ + { + "name": "session", + "type": "TYPE_STRING" + }, + { + "name": "query_params", + "type": ".google.cloud.dialogflow.v2beta1.QueryParameters" + }, + { + "name": "query_input", + "type": ".google.cloud.dialogflow.v2beta1.QueryInput" + }, + { + "name": "single_utterance", + "type": "TYPE_BOOL" + }, + { + "name": "output_audio_config", + "type": ".google.cloud.dialogflow.v2beta1.OutputAudioConfig" + }, + { + "name": "output_audio_config_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "input_audio", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse", + "client": { + "shortName": "SessionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.SessionsClient" + }, + "method": { + "shortName": "StreamingDetectIntent", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions.StreamingDetectIntent", + "service": { + "shortName": "Sessions", + "fullName": "google.cloud.dialogflow.v2beta1.Sessions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_ListVersions_async", + "title": "dialogflow listVersions Sample", + "origin": "API_DEFINITION", + "description": " Returns the list of all versions of the specified agent.", + "canonical": true, + "file": "versions.list_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListVersions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.ListVersions", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.ListVersionsResponse", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "ListVersions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.ListVersions", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_GetVersion_async", + "title": "dialogflow getVersion Sample", + "origin": "API_DEFINITION", + "description": " Retrieves the specified agent version.", + "canonical": true, + "file": "versions.get_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.GetVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "GetVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.GetVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_CreateVersion_async", + "title": "dialogflow createVersion Sample", + "origin": "API_DEFINITION", + "description": " Creates an agent version. The new version points to the agent instance in the \"default\" environment.", + "canonical": true, + "file": "versions.create_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.CreateVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "version", + "type": ".google.cloud.dialogflow.v2beta1.Version" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "CreateVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.CreateVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_UpdateVersion_async", + "title": "dialogflow updateVersion Sample", + "origin": "API_DEFINITION", + "description": " Updates the specified agent version. Note that this method does not allow you to update the state of the agent the given version points to. It allows you to update only mutable properties of the version resource.", + "canonical": true, + "file": "versions.update_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.UpdateVersion", + "async": true, + "parameters": [ + { + "name": "version", + "type": ".google.cloud.dialogflow.v2beta1.Version" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.dialogflow.v2beta1.Version", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "UpdateVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.UpdateVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + }, + { + "regionTag": "dialogflow_v2beta1_generated_Versions_DeleteVersion_async", + "title": "dialogflow deleteVersion Sample", + "origin": "API_DEFINITION", + "description": " Delete the specified agent version.", + "canonical": true, + "file": "versions.delete_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.DeleteVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "VersionsClient", + "fullName": "google.cloud.dialogflow.v2beta1.VersionsClient" + }, + "method": { + "shortName": "DeleteVersion", + "fullName": "google.cloud.dialogflow.v2beta1.Versions.DeleteVersion", + "service": { + "shortName": "Versions", + "fullName": "google.cloud.dialogflow.v2beta1.Versions" + } + } + } + } + ] +} \ No newline at end of file diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js new file mode 100644 index 00000000000..73e1b0b6a17 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.create_version.js @@ -0,0 +1,69 @@ +// 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. +// +// ** 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, version) { + // [START dialogflow_v2beta1_generated_Versions_CreateVersion_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 agent to create a version for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Required. The version to create. + */ + // const version = {} + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callCreateVersion() { + // Construct request + const request = { + parent, + version, + }; + + // Run request + const response = await dialogflowClient.createVersion(request); + console.log(response); + } + + callCreateVersion(); + // [END dialogflow_v2beta1_generated_Versions_CreateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js new file mode 100644 index 00000000000..7ab8dcac00b --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.delete_version.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Versions_DeleteVersion_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 name of the version to delete. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callDeleteVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.deleteVersion(request); + console.log(response); + } + + callDeleteVersion(); + // [END dialogflow_v2beta1_generated_Versions_DeleteVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js new file mode 100644 index 00000000000..b164412ede8 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.get_version.js @@ -0,0 +1,65 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Versions_GetVersion_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 name of the version. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const name = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callGetVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await dialogflowClient.getVersion(request); + console.log(response); + } + + callGetVersion(); + // [END dialogflow_v2beta1_generated_Versions_GetVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js new file mode 100644 index 00000000000..1e1c949724f --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.list_versions.js @@ -0,0 +1,75 @@ +// 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. +// +// ** 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 dialogflow_v2beta1_generated_Versions_ListVersions_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 agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callListVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListVersions(); + // [END dialogflow_v2beta1_generated_Versions_ListVersions_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js new file mode 100644 index 00000000000..fe66dcd53e4 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/generated/v2beta1/versions.update_version.js @@ -0,0 +1,70 @@ +// 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. +// +// ** 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(version, updateMask) { + // [START dialogflow_v2beta1_generated_Versions_UpdateVersion_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 version to update. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + */ + // const version = {} + /** + * Required. The mask to control which fields get updated. + */ + // const updateMask = {} + + // Imports the Dialogflow library + const {VersionsClient} = require('@google-cloud/dialogflow').v2beta1; + + // Instantiates a client + const dialogflowClient = new VersionsClient(); + + async function callUpdateVersion() { + // Construct request + const request = { + version, + updateMask, + }; + + // Run request + const response = await dialogflowClient.updateVersion(request); + console.log(response); + } + + callUpdateVersion(); + // [END dialogflow_v2beta1_generated_Versions_UpdateVersion_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/package.json b/packages/google-cloud-dialogflow/samples/package.json new file mode 100644 index 00000000000..9f1d6ab401c --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/package.json @@ -0,0 +1,27 @@ +{ + "name": "nodejs-docs-samples-conversation", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "repository": "googleapis/nodejs-dialogflow", + "files": [ + "*.js", + "resources" + ], + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "test": "mocha test --timeout=600000" + }, + "dependencies": { + "@google-cloud/dialogflow": "^5.3.0", + "pb-util": "^1.0.0", + "uuid": "^9.0.0", + "yargs": "^16.0.0" + }, + "devDependencies": { + "chai": "^4.2.0", + "mocha": "^8.0.0" + } +} diff --git a/packages/google-cloud-dialogflow/samples/quickstart.js b/packages/google-cloud-dialogflow/samples/quickstart.js new file mode 100644 index 00000000000..730609f8c73 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/quickstart.js @@ -0,0 +1,89 @@ +// 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. +// +// ** 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 dialogflow_v2_generated_Conversations_ListConversations_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 to list all conversation. + * Format: `projects//locations/`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * `lifecycle_state = "COMPLETED"` + * For more information about filtering, see + * API Filtering (https://aip.dev/160). + */ + // const filter = 'abc123' + + // Imports the Dialogflow library + const {ConversationsClient} = require('@google-cloud/dialogflow').v2; + + // Instantiates a client + const dialogflowClient = new ConversationsClient(); + + async function callListConversations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await dialogflowClient.listConversationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversations(); + // [END dialogflow_v2_generated_Conversations_ListConversations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-dialogflow/samples/test/quickstart.test.js b/packages/google-cloud-dialogflow/samples/test/quickstart.test.js new file mode 100644 index 00000000000..dc6c764d751 --- /dev/null +++ b/packages/google-cloud-dialogflow/samples/test/quickstart.test.js @@ -0,0 +1,44 @@ +// 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. + +'use strict'; + +const assert = require('assert'); +const path = require('path'); +const cp = require('child_process'); +const {describe, it, before} = require('mocha'); +const {ConversationsClient} = require('@google-cloud/dialogflow').v2; +const dialogflowClient = new ConversationsClient(); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const cwd = path.join(__dirname, '..'); + +describe('Quickstart', () => { + let projectId; + + before(async () => { + projectId = await dialogflowClient.getProjectId(); + }); + + it('should run quickstart', async () => { + const output = execSync( + `node ./quickstart.js projects/${projectId}/locations/global`, + { + cwd, + } + ); + assert(output !== null); + }); +}); diff --git a/packages/google-cloud-dialogflow/src/index.ts b/packages/google-cloud-dialogflow/src/index.ts new file mode 100644 index 00000000000..c9baf47c7b0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/index.ts @@ -0,0 +1,100 @@ +// 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. +// +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** +// ** All changes to this file may be overwritten. ** + +import * as v2 from './v2'; +import * as v2beta1 from './v2beta1'; + +const AgentsClient = v2.AgentsClient; +type AgentsClient = v2.AgentsClient; +const AnswerRecordsClient = v2.AnswerRecordsClient; +type AnswerRecordsClient = v2.AnswerRecordsClient; +const ContextsClient = v2.ContextsClient; +type ContextsClient = v2.ContextsClient; +const ConversationDatasetsClient = v2.ConversationDatasetsClient; +type ConversationDatasetsClient = v2.ConversationDatasetsClient; +const ConversationModelsClient = v2.ConversationModelsClient; +type ConversationModelsClient = v2.ConversationModelsClient; +const ConversationProfilesClient = v2.ConversationProfilesClient; +type ConversationProfilesClient = v2.ConversationProfilesClient; +const ConversationsClient = v2.ConversationsClient; +type ConversationsClient = v2.ConversationsClient; +const DocumentsClient = v2.DocumentsClient; +type DocumentsClient = v2.DocumentsClient; +const EntityTypesClient = v2.EntityTypesClient; +type EntityTypesClient = v2.EntityTypesClient; +const EnvironmentsClient = v2.EnvironmentsClient; +type EnvironmentsClient = v2.EnvironmentsClient; +const FulfillmentsClient = v2.FulfillmentsClient; +type FulfillmentsClient = v2.FulfillmentsClient; +const IntentsClient = v2.IntentsClient; +type IntentsClient = v2.IntentsClient; +const KnowledgeBasesClient = v2.KnowledgeBasesClient; +type KnowledgeBasesClient = v2.KnowledgeBasesClient; +const ParticipantsClient = v2.ParticipantsClient; +type ParticipantsClient = v2.ParticipantsClient; +const SessionEntityTypesClient = v2.SessionEntityTypesClient; +type SessionEntityTypesClient = v2.SessionEntityTypesClient; +const SessionsClient = v2.SessionsClient; +type SessionsClient = v2.SessionsClient; +const VersionsClient = v2.VersionsClient; +type VersionsClient = v2.VersionsClient; + +export { + v2, + v2beta1, + AgentsClient, + AnswerRecordsClient, + ContextsClient, + ConversationDatasetsClient, + ConversationModelsClient, + ConversationProfilesClient, + ConversationsClient, + DocumentsClient, + EntityTypesClient, + EnvironmentsClient, + FulfillmentsClient, + IntentsClient, + KnowledgeBasesClient, + ParticipantsClient, + SessionEntityTypesClient, + SessionsClient, + VersionsClient, +}; +export default { + v2, + v2beta1, + AgentsClient, + AnswerRecordsClient, + ContextsClient, + ConversationDatasetsClient, + ConversationModelsClient, + ConversationProfilesClient, + ConversationsClient, + DocumentsClient, + EntityTypesClient, + EnvironmentsClient, + FulfillmentsClient, + IntentsClient, + KnowledgeBasesClient, + ParticipantsClient, + SessionEntityTypesClient, + SessionsClient, + VersionsClient, +}; +import * as protos from '../protos/protos'; +export {protos}; diff --git a/packages/google-cloud-dialogflow/src/v2/agents_client.ts b/packages/google-cloud-dialogflow/src/v2/agents_client.ts new file mode 100644 index 00000000000..bbf23bf76e2 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/agents_client.ts @@ -0,0 +1,4616 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2/agents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './agents_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Agent|Agents}. + * @class + * @memberof v2 + */ +export class AgentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + agentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AgentsClient. + * + * @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 AgentsClient({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 AgentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + searchAgents: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'agents' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const trainAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const trainAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const exportAgentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ExportAgentResponse' + ) as gax.protobuf.Type; + const exportAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const importAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const importAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const restoreAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const restoreAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + trainAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + trainAgentResponse.decode.bind(trainAgentResponse), + trainAgentMetadata.decode.bind(trainAgentMetadata) + ), + exportAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportAgentResponse.decode.bind(exportAgentResponse), + exportAgentMetadata.decode.bind(exportAgentMetadata) + ), + importAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importAgentResponse.decode.bind(importAgentResponse), + importAgentMetadata.decode.bind(importAgentMetadata) + ), + restoreAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreAgentResponse.decode.bind(restoreAgentResponse), + restoreAgentMetadata.decode.bind(restoreAgentMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Agents', + 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.agentsStub) { + return this.agentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Agents. + this.agentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Agents' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Agents, + 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 agentsStubMethods = [ + 'getAgent', + 'setAgent', + 'deleteAgent', + 'searchAgents', + 'trainAgent', + 'exportAgent', + 'importAgent', + 'restoreAgent', + 'getValidationResult', + ]; + for (const methodName of agentsStubMethods) { + const callPromise = this.agentsStub.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.agentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to fetch is associated with. + * Format: `projects/`. + * @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 [Agent]{@link google.cloud.dialogflow.v2.Agent}. + * 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/v2/agents.get_agent.js + * region_tag:dialogflow_v2_generated_Agents_GetAgent_async + */ + getAgent( + request?: protos.google.cloud.dialogflow.v2.IGetAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest | undefined, + {} | undefined + ] + >; + getAgent( + request: protos.google.cloud.dialogflow.v2.IGetAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest | null | undefined, + {} | null | undefined + > + ): void; + getAgent( + request: protos.google.cloud.dialogflow.v2.IGetAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest | null | undefined, + {} | null | undefined + > + ): void; + getAgent( + request?: protos.google.cloud.dialogflow.v2.IGetAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.IGetAgentRequest | 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.getAgent(request, options, callback); + } + /** + * Creates/updates the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Agent} request.agent + * Required. The agent to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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 [Agent]{@link google.cloud.dialogflow.v2.Agent}. + * 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/v2/agents.set_agent.js + * region_tag:dialogflow_v2_generated_Agents_SetAgent_async + */ + setAgent( + request?: protos.google.cloud.dialogflow.v2.ISetAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest | undefined, + {} | undefined + ] + >; + setAgent( + request: protos.google.cloud.dialogflow.v2.ISetAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest | null | undefined, + {} | null | undefined + > + ): void; + setAgent( + request: protos.google.cloud.dialogflow.v2.ISetAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest | null | undefined, + {} | null | undefined + > + ): void; + setAgent( + request?: protos.google.cloud.dialogflow.v2.ISetAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAgent, + protos.google.cloud.dialogflow.v2.ISetAgentRequest | 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({ + 'agent.parent': request.agent!.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.setAgent(request, options, callback); + } + /** + * Deletes the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to delete is associated with. + * Format: `projects/`. + * @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/v2/agents.delete_agent.js + * region_tag:dialogflow_v2_generated_Agents_DeleteAgent_async + */ + deleteAgent( + request?: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest | undefined, + {} | undefined + ] + >; + deleteAgent( + request: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteAgent( + request: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteAgent( + request?: protos.google.cloud.dialogflow.v2.IDeleteAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteAgentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAgentRequest | 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.deleteAgent(request, options, callback); + } + /** + * Gets agent validation result. Agent validation is performed during + * training time and is updated automatically when training is completed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent is associated with. + * Format: `projects/`. + * @param {string} [request.languageCode] + * Optional. The language for which you want a validation result. If not + * specified, the agent's default language is used. [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. Note: languages must be enabled in the agent before they can + * be used. + * @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 [ValidationResult]{@link google.cloud.dialogflow.v2.ValidationResult}. + * 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/v2/agents.get_validation_result.js + * region_tag:dialogflow_v2_generated_Agents_GetValidationResult_async + */ + getValidationResult( + request?: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IValidationResult, + protos.google.cloud.dialogflow.v2.IGetValidationResultRequest | undefined, + {} | undefined + ] + >; + getValidationResult( + request: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IValidationResult, + | protos.google.cloud.dialogflow.v2.IGetValidationResultRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getValidationResult( + request: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IValidationResult, + | protos.google.cloud.dialogflow.v2.IGetValidationResultRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getValidationResult( + request?: protos.google.cloud.dialogflow.v2.IGetValidationResultRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IValidationResult, + | protos.google.cloud.dialogflow.v2.IGetValidationResultRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IValidationResult, + | protos.google.cloud.dialogflow.v2.IGetValidationResultRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IValidationResult, + protos.google.cloud.dialogflow.v2.IGetValidationResultRequest | 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.getValidationResult(request, options, callback); + } + + /** + * Trains the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to train is associated with. + * Format: `projects/`. + * @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/v2/agents.train_agent.js + * region_tag:dialogflow_v2_generated_Agents_TrainAgent_async + */ + trainAgent( + request?: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + trainAgent( + request: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + trainAgent( + request: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + trainAgent( + request?: protos.google.cloud.dialogflow.v2.ITrainAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.trainAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `trainAgent()`. + * @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/v2/agents.train_agent.js + * region_tag:dialogflow_v2_generated_Agents_TrainAgent_async + */ + async checkTrainAgentProgress( + name: string + ): Promise< + LROperation + > { + 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.trainAgent, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Exports the specified agent to a ZIP file. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2.ExportAgentResponse|ExportAgentResponse} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to export is associated with. + * Format: `projects/`. + * @param {string} request.agentUri + * Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/) + * URI to export the agent to. + * The format of this URI must be `gs:///`. + * If left unspecified, the serialized agent is returned inline. + * + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @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/v2/agents.export_agent.js + * region_tag:dialogflow_v2_generated_Agents_ExportAgent_async + */ + exportAgent( + request?: protos.google.cloud.dialogflow.v2.IExportAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + exportAgent( + request: protos.google.cloud.dialogflow.v2.IExportAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportAgent( + request: protos.google.cloud.dialogflow.v2.IExportAgentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportAgent( + request?: protos.google.cloud.dialogflow.v2.IExportAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + 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.exportAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `exportAgent()`. + * @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/v2/agents.export_agent.js + * region_tag:dialogflow_v2_generated_Agents_ExportAgent_async + */ + async checkExportAgentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.ExportAgentResponse, + protos.google.protobuf.Struct + > + > { + 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.exportAgent, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.ExportAgentResponse, + protos.google.protobuf.Struct + >; + } + /** + * Imports the specified agent from a ZIP file. + * + * Uploads new intents and entity types without deleting the existing ones. + * Intents and entity types with the same name are replaced with the new + * versions from {@link google.cloud.dialogflow.v2.ImportAgentRequest|ImportAgentRequest}. After the import, the imported draft + * agent will be trained automatically (unless disabled in agent settings). + * However, once the import is done, training may not be completed yet. Please + * call {@link google.cloud.dialogflow.v2.Agents.TrainAgent|TrainAgent} and wait for the operation it returns in order to train + * explicitly. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * The operation only tracks when importing is complete, not when it is done + * training. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to import is associated with. + * Format: `projects/`. + * @param {string} request.agentUri + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @param {Buffer} request.agentContent + * Zip compressed raw byte content for agent. + * @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/v2/agents.import_agent.js + * region_tag:dialogflow_v2_generated_Agents_ImportAgent_async + */ + importAgent( + request?: protos.google.cloud.dialogflow.v2.IImportAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importAgent( + request: protos.google.cloud.dialogflow.v2.IImportAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importAgent( + request: protos.google.cloud.dialogflow.v2.IImportAgentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importAgent( + request?: protos.google.cloud.dialogflow.v2.IImportAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.importAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importAgent()`. + * @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/v2/agents.import_agent.js + * region_tag:dialogflow_v2_generated_Agents_ImportAgent_async + */ + async checkImportAgentProgress( + name: string + ): Promise< + LROperation + > { + 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.importAgent, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Restores the specified agent from a ZIP file. + * + * Replaces the current agent version with a new one. All the intents and + * entity types in the older version are deleted. After the restore, the + * restored draft agent will be trained automatically (unless disabled in + * agent settings). However, once the restore is done, training may not be + * completed yet. Please call {@link google.cloud.dialogflow.v2.Agents.TrainAgent|TrainAgent} and wait for the operation it + * returns in order to train explicitly. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * The operation only tracks when restoring is complete, not when it is done + * training. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to restore is associated with. + * Format: `projects/`. + * @param {string} request.agentUri + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @param {Buffer} request.agentContent + * Zip compressed raw byte content for agent. + * @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/v2/agents.restore_agent.js + * region_tag:dialogflow_v2_generated_Agents_RestoreAgent_async + */ + restoreAgent( + request?: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + restoreAgent( + request: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + restoreAgent( + request: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + restoreAgent( + request?: protos.google.cloud.dialogflow.v2.IRestoreAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.restoreAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `restoreAgent()`. + * @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/v2/agents.restore_agent.js + * region_tag:dialogflow_v2_generated_Agents_RestoreAgent_async + */ + async checkRestoreAgentProgress( + name: string + ): Promise< + LROperation + > { + 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.restoreAgent, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Returns the list of agents. + * + * Since there is at most one conversational agent per project, this method is + * useful primarily for listing all agents across projects the caller has + * access to. One can achieve that with a wildcard project collection id "-". + * Refer to [List + * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list agents from. + * Format: `projects/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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 [Agent]{@link google.cloud.dialogflow.v2.Agent}. + * 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 `searchAgentsAsync()` + * 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. + */ + searchAgents( + request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAgent[], + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest | null, + protos.google.cloud.dialogflow.v2.ISearchAgentsResponse + ] + >; + searchAgents( + request: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + | protos.google.cloud.dialogflow.v2.ISearchAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IAgent + > + ): void; + searchAgents( + request: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + | protos.google.cloud.dialogflow.v2.ISearchAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IAgent + > + ): void; + searchAgents( + request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + | protos.google.cloud.dialogflow.v2.ISearchAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IAgent + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + | protos.google.cloud.dialogflow.v2.ISearchAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IAgent + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAgent[], + protos.google.cloud.dialogflow.v2.ISearchAgentsRequest | null, + protos.google.cloud.dialogflow.v2.ISearchAgentsResponse + ] + > | 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.searchAgents(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 to list agents from. + * Format: `projects/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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 [Agent]{@link google.cloud.dialogflow.v2.Agent} 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 `searchAgentsAsync()` + * 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. + */ + searchAgentsStream( + request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + 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['searchAgents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAgents.createStream( + this.innerApiCalls.searchAgents as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `searchAgents`, 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 to list agents from. + * Format: `projects/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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 + * [Agent]{@link google.cloud.dialogflow.v2.Agent}. 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/v2/agents.search_agents.js + * region_tag:dialogflow_v2_generated_Agents_SearchAgents_async + */ + searchAgentsAsync( + request?: protos.google.cloud.dialogflow.v2.ISearchAgentsRequest, + 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['searchAgents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAgents.asyncIterate( + this.innerApiCalls['searchAgents'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.agentsStub && !this._terminated) { + return this.agentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/agents_client_config.json b/packages/google-cloud-dialogflow/src/v2/agents_client_config.json new file mode 100644 index 00000000000..93d6e00d8f9 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/agents_client_config.json @@ -0,0 +1,74 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Agents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "GetAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SetAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SearchAgents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "TrainAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ExportAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ImportAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "RestoreAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetValidationResult": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/agents_proto_list.json b/packages/google-cloud-dialogflow/src/v2/agents_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/agents_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/answer_records_client.ts b/packages/google-cloud-dialogflow/src/v2/answer_records_client.ts new file mode 100644 index 00000000000..a5f35b2fb31 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/answer_records_client.ts @@ -0,0 +1,3450 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2/answer_records_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './answer_records_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.AnswerRecord|AnswerRecords}. + * @class + * @memberof v2 + */ +export class AnswerRecordsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + answerRecordsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AnswerRecordsClient. + * + * @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 AnswerRecordsClient({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 AnswerRecordsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listAnswerRecords: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'answerRecords' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.AnswerRecords', + 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.answerRecordsStub) { + return this.answerRecordsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.AnswerRecords. + this.answerRecordsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.AnswerRecords' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.AnswerRecords, + 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 answerRecordsStubMethods = [ + 'listAnswerRecords', + 'updateAnswerRecord', + ]; + for (const methodName of answerRecordsStubMethods) { + const callPromise = this.answerRecordsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.answerRecordsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Updates the specified answer record. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.AnswerRecord} request.answerRecord + * Required. Answer record to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @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 [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord}. + * 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/v2/answer_records.update_answer_record.js + * region_tag:dialogflow_v2_generated_AnswerRecords_UpdateAnswerRecord_async + */ + updateAnswerRecord( + request?: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAnswerRecord, + protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest | undefined, + {} | undefined + ] + >; + updateAnswerRecord( + request: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAnswerRecord, + | protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAnswerRecord( + request: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAnswerRecord, + | protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAnswerRecord( + request?: protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IAnswerRecord, + | protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IAnswerRecord, + | protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAnswerRecord, + protos.google.cloud.dialogflow.v2.IUpdateAnswerRecordRequest | 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({ + 'answer_record.name': request.answerRecord!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAnswerRecord(request, options, callback); + } + + /** + * Returns the list of all answer records in the specified project in reverse + * chronological order. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {string} [request.filter] + * Optional. Filters to restrict results to specific answer records. + * + * Marked deprecated as it hasn't been, and isn't currently, supported. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} [request.pageToken] + * Optional. The + * {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @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 [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord}. + * 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 `listAnswerRecordsAsync()` + * 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. + */ + listAnswerRecords( + request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAnswerRecord[], + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest | null, + protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse + ] + >; + listAnswerRecords( + request: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + | protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IAnswerRecord + > + ): void; + listAnswerRecords( + request: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + | protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IAnswerRecord + > + ): void; + listAnswerRecords( + request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + | protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IAnswerRecord + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + | protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IAnswerRecord + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAnswerRecord[], + protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest | null, + protos.google.cloud.dialogflow.v2.IListAnswerRecordsResponse + ] + > | 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.listAnswerRecords(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 to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {string} [request.filter] + * Optional. Filters to restrict results to specific answer records. + * + * Marked deprecated as it hasn't been, and isn't currently, supported. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} [request.pageToken] + * Optional. The + * {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @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 [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord} 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 `listAnswerRecordsAsync()` + * 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. + */ + listAnswerRecordsStream( + request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + 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['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.createStream( + this.innerApiCalls.listAnswerRecords as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listAnswerRecords`, 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 to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {string} [request.filter] + * Optional. Filters to restrict results to specific answer records. + * + * Marked deprecated as it hasn't been, and isn't currently, supported. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} [request.pageToken] + * Optional. The + * {@link google.cloud.dialogflow.v2.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @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 + * [AnswerRecord]{@link google.cloud.dialogflow.v2.AnswerRecord}. 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/v2/answer_records.list_answer_records.js + * region_tag:dialogflow_v2_generated_AnswerRecords_ListAnswerRecords_async + */ + listAnswerRecordsAsync( + request?: protos.google.cloud.dialogflow.v2.IListAnswerRecordsRequest, + 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['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.asyncIterate( + this.innerApiCalls['listAnswerRecords'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.answerRecordsStub && !this._terminated) { + return this.answerRecordsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/answer_records_client_config.json b/packages/google-cloud-dialogflow/src/v2/answer_records_client_config.json new file mode 100644 index 00000000000..cc29e1ea884 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/answer_records_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.AnswerRecords": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListAnswerRecords": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateAnswerRecord": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/answer_records_proto_list.json b/packages/google-cloud-dialogflow/src/v2/answer_records_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/answer_records_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/contexts_client.ts b/packages/google-cloud-dialogflow/src/v2/contexts_client.ts new file mode 100644 index 00000000000..687fbee947b --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/contexts_client.ts @@ -0,0 +1,3854 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2/contexts_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './contexts_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Context|Contexts}. + * @class + * @memberof v2 + */ +export class ContextsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + contextsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ContextsClient. + * + * @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 ContextsClient({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 ContextsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listContexts: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'contexts' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Contexts', + 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.contextsStub) { + return this.contextsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Contexts. + this.contextsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Contexts' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Contexts, + 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 contextsStubMethods = [ + 'listContexts', + 'getContext', + 'createContext', + 'updateContext', + 'deleteContext', + 'deleteAllContexts', + ]; + for (const methodName of contextsStubMethods) { + const callPromise = this.contextsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.contextsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context. Format: + * `projects//agent/sessions//contexts/` + * or `projects//agent/environments//users//sessions//contexts/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @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 [Context]{@link google.cloud.dialogflow.v2.Context}. + * 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/v2/contexts.get_context.js + * region_tag:dialogflow_v2_generated_Contexts_GetContext_async + */ + getContext( + request?: protos.google.cloud.dialogflow.v2.IGetContextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest | undefined, + {} | undefined + ] + >; + getContext( + request: protos.google.cloud.dialogflow.v2.IGetContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest | null | undefined, + {} | null | undefined + > + ): void; + getContext( + request: protos.google.cloud.dialogflow.v2.IGetContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest | null | undefined, + {} | null | undefined + > + ): void; + getContext( + request?: protos.google.cloud.dialogflow.v2.IGetContextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IContext, + | protos.google.cloud.dialogflow.v2.IGetContextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IGetContextRequest | 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.getContext(request, options, callback); + } + /** + * Creates a context. + * + * If the specified context already exists, overrides the context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to create a context for. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {google.cloud.dialogflow.v2.Context} request.context + * Required. The context to create. + * @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 [Context]{@link google.cloud.dialogflow.v2.Context}. + * 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/v2/contexts.create_context.js + * region_tag:dialogflow_v2_generated_Contexts_CreateContext_async + */ + createContext( + request?: protos.google.cloud.dialogflow.v2.ICreateContextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.ICreateContextRequest | undefined, + {} | undefined + ] + >; + createContext( + request: protos.google.cloud.dialogflow.v2.ICreateContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + | protos.google.cloud.dialogflow.v2.ICreateContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createContext( + request: protos.google.cloud.dialogflow.v2.ICreateContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + | protos.google.cloud.dialogflow.v2.ICreateContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createContext( + request?: protos.google.cloud.dialogflow.v2.ICreateContextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IContext, + | protos.google.cloud.dialogflow.v2.ICreateContextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IContext, + | protos.google.cloud.dialogflow.v2.ICreateContextRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.ICreateContextRequest | 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.createContext(request, options, callback); + } + /** + * Updates the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Context} request.context + * Required. The context to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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 [Context]{@link google.cloud.dialogflow.v2.Context}. + * 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/v2/contexts.update_context.js + * region_tag:dialogflow_v2_generated_Contexts_UpdateContext_async + */ + updateContext( + request?: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IUpdateContextRequest | undefined, + {} | undefined + ] + >; + updateContext( + request: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + | protos.google.cloud.dialogflow.v2.IUpdateContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateContext( + request: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IContext, + | protos.google.cloud.dialogflow.v2.IUpdateContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateContext( + request?: protos.google.cloud.dialogflow.v2.IUpdateContextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IContext, + | protos.google.cloud.dialogflow.v2.IUpdateContextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IContext, + | protos.google.cloud.dialogflow.v2.IUpdateContextRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IContext, + protos.google.cloud.dialogflow.v2.IUpdateContextRequest | 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({ + 'context.name': request.context!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateContext(request, options, callback); + } + /** + * Deletes the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context to delete. Format: + * `projects//agent/sessions//contexts/` + * or `projects//agent/environments//users//sessions//contexts/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @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/v2/contexts.delete_context.js + * region_tag:dialogflow_v2_generated_Contexts_DeleteContext_async + */ + deleteContext( + request?: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteContextRequest | undefined, + {} | undefined + ] + >; + deleteContext( + request: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteContext( + request: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteContext( + request?: protos.google.cloud.dialogflow.v2.IDeleteContextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteContextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteContextRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteContextRequest | 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.deleteContext(request, options, callback); + } + /** + * Deletes all active contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the session to delete all contexts from. Format: + * `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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/v2/contexts.delete_all_contexts.js + * region_tag:dialogflow_v2_generated_Contexts_DeleteAllContexts_async + */ + deleteAllContexts( + request?: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest | undefined, + {} | undefined + ] + >; + deleteAllContexts( + request: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteAllContexts( + request: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteAllContexts( + request?: protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteAllContextsRequest | 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.deleteAllContexts(request, options, callback); + } + + /** + * Returns the list of all contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all contexts from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Context]{@link google.cloud.dialogflow.v2.Context}. + * 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 `listContextsAsync()` + * 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. + */ + listContexts( + request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IContext[], + protos.google.cloud.dialogflow.v2.IListContextsRequest | null, + protos.google.cloud.dialogflow.v2.IListContextsResponse + ] + >; + listContexts( + request: protos.google.cloud.dialogflow.v2.IListContextsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListContextsRequest, + | protos.google.cloud.dialogflow.v2.IListContextsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IContext + > + ): void; + listContexts( + request: protos.google.cloud.dialogflow.v2.IListContextsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListContextsRequest, + | protos.google.cloud.dialogflow.v2.IListContextsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IContext + > + ): void; + listContexts( + request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListContextsRequest, + | protos.google.cloud.dialogflow.v2.IListContextsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IContext + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListContextsRequest, + | protos.google.cloud.dialogflow.v2.IListContextsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IContext + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IContext[], + protos.google.cloud.dialogflow.v2.IListContextsRequest | null, + protos.google.cloud.dialogflow.v2.IListContextsResponse + ] + > | 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.listContexts(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 session to list all contexts from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Context]{@link google.cloud.dialogflow.v2.Context} 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 `listContextsAsync()` + * 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. + */ + listContextsStream( + request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, + 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['listContexts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listContexts.createStream( + this.innerApiCalls.listContexts as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listContexts`, 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 session to list all contexts from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Context]{@link google.cloud.dialogflow.v2.Context}. 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/v2/contexts.list_contexts.js + * region_tag:dialogflow_v2_generated_Contexts_ListContexts_async + */ + listContextsAsync( + request?: protos.google.cloud.dialogflow.v2.IListContextsRequest, + 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['listContexts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listContexts.asyncIterate( + this.innerApiCalls['listContexts'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project: string, session: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.contextsStub && !this._terminated) { + return this.contextsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/contexts_client_config.json b/packages/google-cloud-dialogflow/src/v2/contexts_client_config.json new file mode 100644 index 00000000000..c44e6aaa4fb --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/contexts_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Contexts": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListContexts": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteAllContexts": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/contexts_proto_list.json b/packages/google-cloud-dialogflow/src/v2/contexts_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/contexts_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_datasets_client.ts b/packages/google-cloud-dialogflow/src/v2/conversation_datasets_client.ts new file mode 100644 index 00000000000..25d215cede0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversation_datasets_client.ts @@ -0,0 +1,4210 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2/conversation_datasets_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversation_datasets_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Conversation datasets. + * + * Conversation datasets contain raw conversation files and their + * customizable metadata that can be used for model training. + * @class + * @memberof v2 + */ +export class ConversationDatasetsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + conversationDatasetsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationDatasetsClient. + * + * @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 ConversationDatasetsClient({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 ConversationDatasetsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listConversationDatasets: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'conversationDatasets' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createConversationDatasetResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationDataset' + ) as gax.protobuf.Type; + const createConversationDatasetMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata' + ) as gax.protobuf.Type; + const deleteConversationDatasetResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteConversationDatasetMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata' + ) as gax.protobuf.Type; + const importConversationDataResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ImportConversationDataOperationResponse' + ) as gax.protobuf.Type; + const importConversationDataMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConversationDataset: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConversationDatasetResponse.decode.bind( + createConversationDatasetResponse + ), + createConversationDatasetMetadata.decode.bind( + createConversationDatasetMetadata + ) + ), + deleteConversationDataset: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConversationDatasetResponse.decode.bind( + deleteConversationDatasetResponse + ), + deleteConversationDatasetMetadata.decode.bind( + deleteConversationDatasetMetadata + ) + ), + importConversationData: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importConversationDataResponse.decode.bind( + importConversationDataResponse + ), + importConversationDataMetadata.decode.bind( + importConversationDataMetadata + ) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.ConversationDatasets', + 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.conversationDatasetsStub) { + return this.conversationDatasetsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.ConversationDatasets. + this.conversationDatasetsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.ConversationDatasets' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.ConversationDatasets, + 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 conversationDatasetsStubMethods = [ + 'createConversationDataset', + 'getConversationDataset', + 'listConversationDatasets', + 'deleteConversationDataset', + 'importConversationData', + ]; + for (const methodName of conversationDatasetsStubMethods) { + const callPromise = this.conversationDatasetsStub.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.conversationDatasetsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified conversation dataset. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation dataset to retrieve. Format: + * `projects//locations//conversationDatasets/` + * @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 [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset}. + * 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/v2/conversation_datasets.get_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_GetConversationDataset_async + */ + getConversationDataset( + request?: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationDataset, + ( + | protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest + | undefined + ), + {} | undefined + ] + >; + getConversationDataset( + request: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationDataset, + | protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationDataset( + request: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationDataset, + | protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationDataset( + request?: protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IConversationDataset, + | protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationDataset, + | protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationDataset, + ( + | protos.google.cloud.dialogflow.v2.IGetConversationDatasetRequest + | 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.getConversationDataset( + request, + options, + callback + ); + } + + /** + * Creates a new conversation dataset. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata|CreateConversationDatasetOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ConversationDataset|ConversationDataset} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create conversation dataset for. Format: + * `projects//locations/` + * @param {google.cloud.dialogflow.v2.ConversationDataset} request.conversationDataset + * Required. The conversation dataset to create. + * @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/v2/conversation_datasets.create_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async + */ + createConversationDataset( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createConversationDataset( + request: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createConversationDataset( + request: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createConversationDataset( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationDatasetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata + >, + 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.createConversationDataset( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `createConversationDataset()`. + * @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/v2/conversation_datasets.create_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_CreateConversationDataset_async + */ + async checkCreateConversationDatasetProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.ConversationDataset, + protos.google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + > + > { + 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.createConversationDataset, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.ConversationDataset, + protos.google.cloud.dialogflow.v2.CreateConversationDatasetOperationMetadata + >; + } + /** + * Deletes the specified conversation dataset. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata|DeleteConversationDatasetOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation dataset to delete. Format: + * `projects//locations//conversationDatasets/` + * @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/v2/conversation_datasets.delete_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async + */ + deleteConversationDataset( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteConversationDataset( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteConversationDataset( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteConversationDataset( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConversationDataset( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `deleteConversationDataset()`. + * @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/v2/conversation_datasets.delete_conversation_dataset.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_DeleteConversationDataset_async + */ + async checkDeleteConversationDatasetProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + > + > { + 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.deleteConversationDataset, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.DeleteConversationDatasetOperationMetadata + >; + } + /** + * Import data into the specified conversation dataset. Note that it + * is not allowed to import data to a conversation dataset that + * already has data in it. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata|ImportConversationDataOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ImportConversationDataOperationResponse|ImportConversationDataOperationResponse} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Dataset resource name. Format: + * `projects//locations//conversationDatasets/` + * @param {google.cloud.dialogflow.v2.InputConfig} request.inputConfig + * Required. Configuration describing where to import data from. + * @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/v2/conversation_datasets.import_conversation_data.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async + */ + importConversationData( + request?: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importConversationData( + request: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importConversationData( + request: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importConversationData( + request?: protos.google.cloud.dialogflow.v2.IImportConversationDataRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.importConversationData( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `importConversationData()`. + * @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/v2/conversation_datasets.import_conversation_data.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_ImportConversationData_async + */ + async checkImportConversationDataProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.ImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + > + > { + 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.importConversationData, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.ImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.ImportConversationDataOperationMetadata + >; + } + /** + * Returns the list of all conversation datasets in the specified + * project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project and location name to list all conversation datasets for. + * Format: `projects//locations/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation datasets to return in a single + * page. By default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset}. + * 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 `listConversationDatasetsAsync()` + * 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. + */ + listConversationDatasets( + request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationDataset[], + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse + ] + >; + listConversationDatasets( + request: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationDataset + > + ): void; + listConversationDatasets( + request: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationDataset + > + ): void; + listConversationDatasets( + request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationDataset + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationDataset + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationDataset[], + protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationDatasetsResponse + ] + > | 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.listConversationDatasets( + 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 and location name to list all conversation datasets for. + * Format: `projects//locations/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation datasets to return in a single + * page. By default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset} 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 `listConversationDatasetsAsync()` + * 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. + */ + listConversationDatasetsStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + 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['listConversationDatasets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationDatasets.createStream( + this.innerApiCalls.listConversationDatasets as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listConversationDatasets`, 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 and location name to list all conversation datasets for. + * Format: `projects//locations/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation datasets to return in a single + * page. By default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [ConversationDataset]{@link google.cloud.dialogflow.v2.ConversationDataset}. 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/v2/conversation_datasets.list_conversation_datasets.js + * region_tag:dialogflow_v2_generated_ConversationDatasets_ListConversationDatasets_async + */ + listConversationDatasetsAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationDatasetsRequest, + 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['listConversationDatasets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationDatasets.asyncIterate( + this.innerApiCalls['listConversationDatasets'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * 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 project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.conversationDatasetsStub && !this._terminated) { + return this.conversationDatasetsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_datasets_client_config.json b/packages/google-cloud-dialogflow/src/v2/conversation_datasets_client_config.json new file mode 100644 index 00000000000..6553edd4445 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversation_datasets_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.ConversationDatasets": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "CreateConversationDataset": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationDataset": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversationDatasets": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteConversationDataset": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ImportConversationData": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_datasets_proto_list.json b/packages/google-cloud-dialogflow/src/v2/conversation_datasets_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversation_datasets_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_models_client.ts b/packages/google-cloud-dialogflow/src/v2/conversation_models_client.ts new file mode 100644 index 00000000000..472fbb181e3 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversation_models_client.ts @@ -0,0 +1,4804 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2/conversation_models_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversation_models_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Manages a collection of models for human agent assistant. + * @class + * @memberof v2 + */ +export class ConversationModelsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + conversationModelsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationModelsClient. + * + * @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 ConversationModelsClient({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 ConversationModelsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listConversationModels: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'conversationModels' + ), + listConversationModelEvaluations: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'conversationModelEvaluations' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createConversationModelResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationModel' + ) as gax.protobuf.Type; + const createConversationModelMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata' + ) as gax.protobuf.Type; + const deleteConversationModelResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteConversationModelMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata' + ) as gax.protobuf.Type; + const deployConversationModelResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deployConversationModelMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata' + ) as gax.protobuf.Type; + const undeployConversationModelResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const undeployConversationModelMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata' + ) as gax.protobuf.Type; + const createConversationModelEvaluationResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationModelEvaluation' + ) as gax.protobuf.Type; + const createConversationModelEvaluationMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConversationModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConversationModelResponse.decode.bind( + createConversationModelResponse + ), + createConversationModelMetadata.decode.bind( + createConversationModelMetadata + ) + ), + deleteConversationModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConversationModelResponse.decode.bind( + deleteConversationModelResponse + ), + deleteConversationModelMetadata.decode.bind( + deleteConversationModelMetadata + ) + ), + deployConversationModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deployConversationModelResponse.decode.bind( + deployConversationModelResponse + ), + deployConversationModelMetadata.decode.bind( + deployConversationModelMetadata + ) + ), + undeployConversationModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + undeployConversationModelResponse.decode.bind( + undeployConversationModelResponse + ), + undeployConversationModelMetadata.decode.bind( + undeployConversationModelMetadata + ) + ), + createConversationModelEvaluation: + new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConversationModelEvaluationResponse.decode.bind( + createConversationModelEvaluationResponse + ), + createConversationModelEvaluationMetadata.decode.bind( + createConversationModelEvaluationMetadata + ) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.ConversationModels', + 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.conversationModelsStub) { + return this.conversationModelsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.ConversationModels. + this.conversationModelsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.ConversationModels' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.ConversationModels, + 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 conversationModelsStubMethods = [ + 'createConversationModel', + 'getConversationModel', + 'listConversationModels', + 'deleteConversationModel', + 'deployConversationModel', + 'undeployConversationModel', + 'getConversationModelEvaluation', + 'listConversationModelEvaluations', + 'createConversationModelEvaluation', + ]; + for (const methodName of conversationModelsStubMethods) { + const callPromise = this.conversationModelsStub.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.conversationModelsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Gets conversation model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model to retrieve. Format: + * `projects//conversationModels/` + * @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 [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel}. + * 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/v2/conversation_models.get_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_GetConversationModel_async + */ + getConversationModel( + request?: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationModel, + ( + | protos.google.cloud.dialogflow.v2.IGetConversationModelRequest + | undefined + ), + {} | undefined + ] + >; + getConversationModel( + request: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationModel, + | protos.google.cloud.dialogflow.v2.IGetConversationModelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationModel( + request: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationModel, + | protos.google.cloud.dialogflow.v2.IGetConversationModelRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationModel( + request?: protos.google.cloud.dialogflow.v2.IGetConversationModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IConversationModel, + | protos.google.cloud.dialogflow.v2.IGetConversationModelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationModel, + | protos.google.cloud.dialogflow.v2.IGetConversationModelRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationModel, + ( + | protos.google.cloud.dialogflow.v2.IGetConversationModelRequest + | 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.getConversationModel(request, options, callback); + } + /** + * Gets an evaluation of conversation model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model evaluation resource name. Format: + * `projects//conversationModels//evaluations/` + * @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 [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation}. + * 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/v2/conversation_models.get_conversation_model_evaluation.js + * region_tag:dialogflow_v2_generated_ConversationModels_GetConversationModelEvaluation_async + */ + getConversationModelEvaluation( + request?: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + ( + | protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest + | undefined + ), + {} | undefined + ] + >; + getConversationModelEvaluation( + request: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + | protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationModelEvaluation( + request: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + | protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationModelEvaluation( + request?: protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + | protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + | protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + ( + | protos.google.cloud.dialogflow.v2.IGetConversationModelEvaluationRequest + | 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.getConversationModelEvaluation( + request, + options, + callback + ); + } + + /** + * Creates a model. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata|CreateConversationModelOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ConversationModel|ConversationModel} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The project to create conversation model for. Format: + * `projects/` + * @param {google.cloud.dialogflow.v2.ConversationModel} request.conversationModel + * Required. The conversation model to create. + * @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/v2/conversation_models.create_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModel_async + */ + createConversationModel( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createConversationModel( + request: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createConversationModel( + request: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createConversationModel( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata + >, + 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.createConversationModel( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `createConversationModel()`. + * @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/v2/conversation_models.create_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModel_async + */ + async checkCreateConversationModelProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.ConversationModel, + protos.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + > + > { + 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.createConversationModel, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.ConversationModel, + protos.google.cloud.dialogflow.v2.CreateConversationModelOperationMetadata + >; + } + /** + * Deletes a model. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata|DeleteConversationModelOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model to delete. Format: + * `projects//conversationModels/` + * @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/v2/conversation_models.delete_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async + */ + deleteConversationModel( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteConversationModel( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteConversationModel( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteConversationModel( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConversationModel( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `deleteConversationModel()`. + * @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/v2/conversation_models.delete_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_DeleteConversationModel_async + */ + async checkDeleteConversationModelProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + > + > { + 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.deleteConversationModel, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.DeleteConversationModelOperationMetadata + >; + } + /** + * Deploys a model. If a model is already deployed, deploying it + * has no effect. A model can only serve prediction requests after it gets + * deployed. For article suggestion, custom model will not be used unless + * it is deployed. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata|DeployConversationModelOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model to deploy. Format: + * `projects//conversationModels/` + * @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/v2/conversation_models.deploy_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_DeployConversationModel_async + */ + deployConversationModel( + request?: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deployConversationModel( + request: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deployConversationModel( + request: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deployConversationModel( + request?: protos.google.cloud.dialogflow.v2.IDeployConversationModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deployConversationModel( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `deployConversationModel()`. + * @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/v2/conversation_models.deploy_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_DeployConversationModel_async + */ + async checkDeployConversationModelProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + > + > { + 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.deployConversationModel, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.DeployConversationModelOperationMetadata + >; + } + /** + * Undeploys a model. If the model is not deployed this method has no effect. + * If the model is currently being used: + * - For article suggestion, article suggestion will fallback to the default + * model if model is undeployed. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata|UndeployConversationModelOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The conversation model to undeploy. Format: + * `projects//conversationModels/` + * @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/v2/conversation_models.undeploy_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async + */ + undeployConversationModel( + request?: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + undeployConversationModel( + request: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + undeployConversationModel( + request: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + undeployConversationModel( + request?: protos.google.cloud.dialogflow.v2.IUndeployConversationModelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.undeployConversationModel( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `undeployConversationModel()`. + * @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/v2/conversation_models.undeploy_conversation_model.js + * region_tag:dialogflow_v2_generated_ConversationModels_UndeployConversationModel_async + */ + async checkUndeployConversationModelProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + > + > { + 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.undeployConversationModel, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.UndeployConversationModelOperationMetadata + >; + } + /** + * Creates evaluation of a conversation model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation model resource name. Format: + * `projects//locations//conversationModels/` + * @param {google.cloud.dialogflow.v2.ConversationModelEvaluation} request.conversationModelEvaluation + * Required. The conversation model evaluation to be created. + * @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/v2/conversation_models.create_conversation_model_evaluation.js + * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async + */ + createConversationModelEvaluation( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createConversationModelEvaluation( + request: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createConversationModelEvaluation( + request: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createConversationModelEvaluation( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata + >, + 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.createConversationModelEvaluation( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `createConversationModelEvaluation()`. + * @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/v2/conversation_models.create_conversation_model_evaluation.js + * region_tag:dialogflow_v2_generated_ConversationModels_CreateConversationModelEvaluation_async + */ + async checkCreateConversationModelEvaluationProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.ConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + > + > { + 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.createConversationModelEvaluation, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.ConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationOperationMetadata + >; + } + /** + * Lists conversation models. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation models for. + * Format: `projects/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation models to return in a single + * page. By default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel}. + * 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 `listConversationModelsAsync()` + * 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. + */ + listConversationModels( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationModel[], + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationModelsResponse + ] + >; + listConversationModels( + request: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationModelsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationModel + > + ): void; + listConversationModels( + request: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationModelsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationModel + > + ): void; + listConversationModels( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationModelsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationModel + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationModelsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationModel + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationModel[], + protos.google.cloud.dialogflow.v2.IListConversationModelsRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationModelsResponse + ] + > | 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.listConversationModels( + 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 to list all conversation models for. + * Format: `projects/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation models to return in a single + * page. By default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel} 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 `listConversationModelsAsync()` + * 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. + */ + listConversationModelsStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + 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['listConversationModels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationModels.createStream( + this.innerApiCalls.listConversationModels as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listConversationModels`, 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 to list all conversation models for. + * Format: `projects/` + * @param {number} [request.pageSize] + * Optional. Maximum number of conversation models to return in a single + * page. By default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [ConversationModel]{@link google.cloud.dialogflow.v2.ConversationModel}. 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/v2/conversation_models.list_conversation_models.js + * region_tag:dialogflow_v2_generated_ConversationModels_ListConversationModels_async + */ + listConversationModelsAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelsRequest, + 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['listConversationModels']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationModels.asyncIterate( + this.innerApiCalls['listConversationModels'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists evaluations of a conversation model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation model resource name. Format: + * `projects//conversationModels/` + * @param {number} [request.pageSize] + * Optional. Maximum number of evaluations to return in a + * single page. By default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation}. + * 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 `listConversationModelEvaluationsAsync()` + * 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. + */ + listConversationModelEvaluations( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[], + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse + ] + >; + listConversationModelEvaluations( + request: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation + > + ): void; + listConversationModelEvaluations( + request: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation + > + ): void; + listConversationModelEvaluations( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[], + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsResponse + ] + > | 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.listConversationModelEvaluations( + 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 conversation model resource name. Format: + * `projects//conversationModels/` + * @param {number} [request.pageSize] + * Optional. Maximum number of evaluations to return in a + * single page. By default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation} 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 `listConversationModelEvaluationsAsync()` + * 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. + */ + listConversationModelEvaluationsStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + 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['listConversationModelEvaluations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationModelEvaluations.createStream( + this.innerApiCalls.listConversationModelEvaluations as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listConversationModelEvaluations`, 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 conversation model resource name. Format: + * `projects//conversationModels/` + * @param {number} [request.pageSize] + * Optional. Maximum number of evaluations to return in a + * single page. By default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [ConversationModelEvaluation]{@link google.cloud.dialogflow.v2.ConversationModelEvaluation}. 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/v2/conversation_models.list_conversation_model_evaluations.js + * region_tag:dialogflow_v2_generated_ConversationModels_ListConversationModelEvaluations_async + */ + listConversationModelEvaluationsAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationModelEvaluationsRequest, + 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['listConversationModelEvaluations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationModelEvaluations.asyncIterate( + this.innerApiCalls['listConversationModelEvaluations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.conversationModelsStub && !this._terminated) { + return this.conversationModelsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_models_client_config.json b/packages/google-cloud-dialogflow/src/v2/conversation_models_client_config.json new file mode 100644 index 00000000000..8f65b8621ef --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversation_models_client_config.json @@ -0,0 +1,74 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.ConversationModels": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "CreateConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversationModels": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeployConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UndeployConversationModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationModelEvaluation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversationModelEvaluations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateConversationModelEvaluation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_models_proto_list.json b/packages/google-cloud-dialogflow/src/v2/conversation_models_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversation_models_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client.ts b/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client.ts new file mode 100644 index 00000000000..f1c9a4307c6 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client.ts @@ -0,0 +1,4398 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2/conversation_profiles_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversation_profiles_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.ConversationProfile|ConversationProfiles}. + * @class + * @memberof v2 + */ +export class ConversationProfilesClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + conversationProfilesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationProfilesClient. + * + * @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 ConversationProfilesClient({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 ConversationProfilesClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + cXSecuritySettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securitySettings/{security_settings}' + ), + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listConversationProfiles: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'conversationProfiles' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const setSuggestionFeatureConfigResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationProfile' + ) as gax.protobuf.Type; + const setSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata' + ) as gax.protobuf.Type; + const clearSuggestionFeatureConfigResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ConversationProfile' + ) as gax.protobuf.Type; + const clearSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + setSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setSuggestionFeatureConfigResponse.decode.bind( + setSuggestionFeatureConfigResponse + ), + setSuggestionFeatureConfigMetadata.decode.bind( + setSuggestionFeatureConfigMetadata + ) + ), + clearSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + clearSuggestionFeatureConfigResponse.decode.bind( + clearSuggestionFeatureConfigResponse + ), + clearSuggestionFeatureConfigMetadata.decode.bind( + clearSuggestionFeatureConfigMetadata + ) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.ConversationProfiles', + 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.conversationProfilesStub) { + return this.conversationProfilesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.ConversationProfiles. + this.conversationProfilesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.ConversationProfiles' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.ConversationProfiles, + 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 conversationProfilesStubMethods = [ + 'listConversationProfiles', + 'getConversationProfile', + 'createConversationProfile', + 'updateConversationProfile', + 'deleteConversationProfile', + 'setSuggestionFeatureConfig', + 'clearSuggestionFeatureConfig', + ]; + for (const methodName of conversationProfilesStubMethods) { + const callPromise = this.conversationProfilesStub.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.conversationProfilesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified conversation profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the conversation profile. + * Format: `projects//locations//conversationProfiles/`. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. + * 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/v2/conversation_profiles.get_conversation_profile.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_GetConversationProfile_async + */ + getConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest + | undefined + ), + {} | undefined + ] + >; + getConversationProfile( + request: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationProfile( + request: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2.IGetConversationProfileRequest + | 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.getConversationProfile( + request, + options, + callback + ); + } + /** + * Creates a conversation profile in the specified project. + * + * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} + * aren't populated in the response. You can retrieve them via + * {@link google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create a conversation profile for. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2.ConversationProfile} request.conversationProfile + * Required. The conversation profile to create. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. + * 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/v2/conversation_profiles.create_conversation_profile.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_CreateConversationProfile_async + */ + createConversationProfile( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest + | undefined + ), + {} | undefined + ] + >; + createConversationProfile( + request: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createConversationProfile( + request: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createConversationProfile( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2.ICreateConversationProfileRequest + | 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.createConversationProfile( + request, + options, + callback + ); + } + /** + * Updates the specified conversation profile. + * + * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} + * aren't populated in the response. You can retrieve them via + * {@link google.cloud.dialogflow.v2.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.ConversationProfile} request.conversationProfile + * Required. The conversation profile to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields to update. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. + * 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/v2/conversation_profiles.update_conversation_profile.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_UpdateConversationProfile_async + */ + updateConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest + | undefined + ), + {} | undefined + ] + >; + updateConversationProfile( + request: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateConversationProfile( + request: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversationProfile, + | protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2.IUpdateConversationProfileRequest + | 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({ + 'conversation_profile.name': request.conversationProfile!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConversationProfile( + request, + options, + callback + ); + } + /** + * Deletes the specified conversation profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + * @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/v2/conversation_profiles.delete_conversation_profile.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_DeleteConversationProfile_async + */ + deleteConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest + | undefined + ), + {} | undefined + ] + >; + deleteConversationProfile( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteConversationProfile( + request: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteConversationProfile( + request?: protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2.IDeleteConversationProfileRequest + | 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.deleteConversationProfile( + request, + options, + callback + ); + } + + /** + * Adds or updates a suggestion feature in a conversation profile. + * If the conversation profile contains the type of suggestion feature for + * the participant role, it will update it. Otherwise it will insert the + * suggestion feature. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata|SetSuggestionFeatureConfigOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ConversationProfile|ConversationProfile} + * + * If a long running operation to add or update suggestion feature + * config for the same conversation profile, participant role and suggestion + * feature type exists, please cancel the existing long running operation + * before sending such request, otherwise the request will be rejected. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversationProfile + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + * @param {google.cloud.dialogflow.v2.Participant.Role} request.participantRole + * Required. The participant role to add or update the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + * @param {google.cloud.dialogflow.v2.HumanAgentAssistantConfig.SuggestionFeatureConfig} request.suggestionFeatureConfig + * Required. The suggestion feature config to add or update. + * @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/v2/conversation_profiles.set_suggestion_feature_config.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async + */ + setSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata + >, + 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({ + conversation_profile: request.conversationProfile ?? '', + }); + this.initialize(); + return this.innerApiCalls.setSuggestionFeatureConfig( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `setSuggestionFeatureConfig()`. + * @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/v2/conversation_profiles.set_suggestion_feature_config.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_SetSuggestionFeatureConfig_async + */ + async checkSetSuggestionFeatureConfigProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.ConversationProfile, + protos.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + > + > { + 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.setSuggestionFeatureConfig, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.ConversationProfile, + protos.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigOperationMetadata + >; + } + /** + * Clears a suggestion feature from a conversation profile for the given + * participant role. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata|ClearSuggestionFeatureConfigOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ConversationProfile|ConversationProfile} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversationProfile + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + * @param {google.cloud.dialogflow.v2.Participant.Role} request.participantRole + * Required. The participant role to remove the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + * @param {google.cloud.dialogflow.v2.SuggestionFeature.Type} request.suggestionFeatureType + * Required. The type of the suggestion feature to remove. + * @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/v2/conversation_profiles.clear_suggestion_feature_config.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async + */ + clearSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + clearSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + clearSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + clearSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata + >, + 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({ + conversation_profile: request.conversationProfile ?? '', + }); + this.initialize(); + return this.innerApiCalls.clearSuggestionFeatureConfig( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `clearSuggestionFeatureConfig()`. + * @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/v2/conversation_profiles.clear_suggestion_feature_config.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async + */ + async checkClearSuggestionFeatureConfigProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.ConversationProfile, + protos.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + > + > { + 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.clearSuggestionFeatureConfig, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.ConversationProfile, + protos.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigOperationMetadata + >; + } + /** + * Returns the list of all conversation profiles in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. + * 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 `listConversationProfilesAsync()` + * 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. + */ + listConversationProfiles( + request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationProfile[], + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse + ] + >; + listConversationProfiles( + request: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + | protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationProfile + > + ): void; + listConversationProfiles( + request: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + | protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationProfile + > + ): void; + listConversationProfiles( + request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + | protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationProfile + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + | protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversationProfile + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversationProfile[], + protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationProfilesResponse + ] + > | 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.listConversationProfiles( + 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 to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile} 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 `listConversationProfilesAsync()` + * 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. + */ + listConversationProfilesStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + 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['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.createStream( + this.innerApiCalls.listConversationProfiles as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listConversationProfiles`, 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 to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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 + * [ConversationProfile]{@link google.cloud.dialogflow.v2.ConversationProfile}. 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/v2/conversation_profiles.list_conversation_profiles.js + * region_tag:dialogflow_v2_generated_ConversationProfiles_ListConversationProfiles_async + */ + listConversationProfilesAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationProfilesRequest, + 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['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.asyncIterate( + this.innerApiCalls['listConversationProfiles'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cXSecuritySettings resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} security_settings + * @returns {string} Resource name string. + */ + cXSecuritySettingsPath( + project: string, + location: string, + securitySettings: string + ) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.render({ + project: project, + location: location, + security_settings: securitySettings, + }); + } + + /** + * Parse the project from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match( + cXSecuritySettingsName + ).project; + } + + /** + * Parse the location from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match( + cXSecuritySettingsName + ).location; + } + + /** + * Parse the security_settings from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the security_settings. + */ + matchSecuritySettingsFromCXSecuritySettingsName( + cXSecuritySettingsName: string + ) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match( + cXSecuritySettingsName + ).security_settings; + } + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.conversationProfilesStub && !this._terminated) { + return this.conversationProfilesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client_config.json b/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client_config.json new file mode 100644 index 00000000000..655ad79beb0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversation_profiles_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.ConversationProfiles": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListConversationProfiles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SetSuggestionFeatureConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ClearSuggestionFeatureConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/conversation_profiles_proto_list.json b/packages/google-cloud-dialogflow/src/v2/conversation_profiles_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversation_profiles_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/conversations_client.ts b/packages/google-cloud-dialogflow/src/v2/conversations_client.ts new file mode 100644 index 00000000000..5419f6dec1e --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversations_client.ts @@ -0,0 +1,3926 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2/conversations_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversations_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Conversation|Conversations}. + * @class + * @memberof v2 + */ +export class ConversationsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + conversationsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationsClient. + * + * @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 ConversationsClient({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 ConversationsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listConversations: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'conversations' + ), + listMessages: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'messages' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Conversations', + 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.conversationsStub) { + return this.conversationsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Conversations. + this.conversationsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Conversations' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Conversations, + 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 conversationsStubMethods = [ + 'createConversation', + 'listConversations', + 'getConversation', + 'completeConversation', + 'listMessages', + ]; + for (const methodName of conversationsStubMethods) { + const callPromise = this.conversationsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.conversationsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 a new conversation. Conversations are auto-completed after 24 + * hours. + * + * Conversation Lifecycle: + * There are two stages during a conversation: Automated Agent Stage and + * Assist Stage. + * + * For Automated Agent Stage, there will be a dialogflow agent responding to + * user queries. + * + * For Assist Stage, there's no dialogflow agent responding to user queries. + * But we will provide suggestions which are generated from conversation. + * + * If {@link google.cloud.dialogflow.v2.Conversation.conversation_profile|Conversation.conversation_profile} is configured for a dialogflow + * agent, conversation will start from `Automated Agent Stage`, otherwise, it + * will start from `Assist Stage`. And during `Automated Agent Stage`, once an + * {@link google.cloud.dialogflow.v2.Intent|Intent} with {@link google.cloud.dialogflow.v2.Intent.live_agent_handoff|Intent.live_agent_handoff} is triggered, conversation + * will transfer to Assist Stage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the project creating the conversation. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2.Conversation} request.conversation + * Required. The conversation to create. + * @param {string} [request.conversationId] + * Optional. Identifier of the conversation. Generally it's auto generated by Google. + * Only set it if you cannot wait for the response to return a + * auto-generated one to you. + * + * The conversation ID must be compliant with the regression fomula + * "{@link a-zA-Z0-9_-|a-zA-Z}*" with the characters length in range of [3,64]. + * If the field is provided, the caller is resposible for + * 1. the uniqueness of the ID, otherwise the request will be rejected. + * 2. the consistency for whether to use custom ID or not under a project to + * better ensure uniqueness. + * @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 [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. + * 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/v2/conversations.create_conversation.js + * region_tag:dialogflow_v2_generated_Conversations_CreateConversation_async + */ + createConversation( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICreateConversationRequest | undefined, + {} | undefined + ] + >; + createConversation( + request: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.ICreateConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createConversation( + request: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.ICreateConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createConversation( + request?: protos.google.cloud.dialogflow.v2.ICreateConversationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.ICreateConversationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.ICreateConversationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.ICreateConversationRequest | 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.createConversation(request, options, callback); + } + /** + * Retrieves the specific conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation. Format: + * `projects//locations//conversations/`. + * @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 [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. + * 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/v2/conversations.get_conversation.js + * region_tag:dialogflow_v2_generated_Conversations_GetConversation_async + */ + getConversation( + request?: protos.google.cloud.dialogflow.v2.IGetConversationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.IGetConversationRequest | undefined, + {} | undefined + ] + >; + getConversation( + request: protos.google.cloud.dialogflow.v2.IGetConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.IGetConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversation( + request: protos.google.cloud.dialogflow.v2.IGetConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.IGetConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversation( + request?: protos.google.cloud.dialogflow.v2.IGetConversationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.IGetConversationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.IGetConversationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversation, + protos.google.cloud.dialogflow.v2.IGetConversationRequest | 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.getConversation(request, options, callback); + } + /** + * Completes the specified conversation. Finished conversations are purged + * from the database after 30 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + * @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 [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. + * 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/v2/conversations.complete_conversation.js + * region_tag:dialogflow_v2_generated_Conversations_CompleteConversation_async + */ + completeConversation( + request?: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversation, + ( + | protos.google.cloud.dialogflow.v2.ICompleteConversationRequest + | undefined + ), + {} | undefined + ] + >; + completeConversation( + request: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.ICompleteConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + completeConversation( + request: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.ICompleteConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + completeConversation( + request?: protos.google.cloud.dialogflow.v2.ICompleteConversationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.ICompleteConversationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IConversation, + | protos.google.cloud.dialogflow.v2.ICompleteConversationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversation, + ( + | protos.google.cloud.dialogflow.v2.ICompleteConversationRequest + | 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.completeConversation(request, options, callback); + } + + /** + * Returns the list of all conversations in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. + * 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 `listConversationsAsync()` + * 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. + */ + listConversations( + request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversation[], + protos.google.cloud.dialogflow.v2.IListConversationsRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationsResponse + ] + >; + listConversations( + request: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversation + > + ): void; + listConversations( + request: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversation + > + ): void; + listConversations( + request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversation + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListConversationsRequest, + | protos.google.cloud.dialogflow.v2.IListConversationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IConversation + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IConversation[], + protos.google.cloud.dialogflow.v2.IListConversationsRequest | null, + protos.google.cloud.dialogflow.v2.IListConversationsResponse + ] + > | 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.listConversations(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 to list all conversation. + * Format: `projects//locations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Conversation]{@link google.cloud.dialogflow.v2.Conversation} 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 `listConversationsAsync()` + * 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. + */ + listConversationsStream( + request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + 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['listConversations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversations.createStream( + this.innerApiCalls.listConversations as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listConversations`, 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 to list all conversation. + * Format: `projects//locations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 + * [Conversation]{@link google.cloud.dialogflow.v2.Conversation}. 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/v2/conversations.list_conversations.js + * region_tag:dialogflow_v2_generated_Conversations_ListConversations_async + */ + listConversationsAsync( + request?: protos.google.cloud.dialogflow.v2.IListConversationsRequest, + 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['listConversations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversations.asyncIterate( + this.innerApiCalls['listConversations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists messages that belong to a given conversation. + * `messages` are ordered by `create_time` in descending order. To fetch + * updates without duplication, send request with filter + * `create_time_epoch_microseconds > + * [first item's create_time of previous request]` and empty page_token. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} [request.filter] + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > 2017-01-15T01:30:15.01Z`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Message]{@link google.cloud.dialogflow.v2.Message}. + * 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 `listMessagesAsync()` + * 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. + */ + listMessages( + request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IMessage[], + protos.google.cloud.dialogflow.v2.IListMessagesRequest | null, + protos.google.cloud.dialogflow.v2.IListMessagesResponse + ] + >; + listMessages( + request: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListMessagesRequest, + | protos.google.cloud.dialogflow.v2.IListMessagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IMessage + > + ): void; + listMessages( + request: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListMessagesRequest, + | protos.google.cloud.dialogflow.v2.IListMessagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IMessage + > + ): void; + listMessages( + request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListMessagesRequest, + | protos.google.cloud.dialogflow.v2.IListMessagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IMessage + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListMessagesRequest, + | protos.google.cloud.dialogflow.v2.IListMessagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IMessage + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IMessage[], + protos.google.cloud.dialogflow.v2.IListMessagesRequest | null, + protos.google.cloud.dialogflow.v2.IListMessagesResponse + ] + > | 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.listMessages(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 name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} [request.filter] + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > 2017-01-15T01:30:15.01Z`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Message]{@link google.cloud.dialogflow.v2.Message} 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 `listMessagesAsync()` + * 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. + */ + listMessagesStream( + request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + 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['listMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMessages.createStream( + this.innerApiCalls.listMessages as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listMessages`, 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 name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} [request.filter] + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > 2017-01-15T01:30:15.01Z`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Message]{@link google.cloud.dialogflow.v2.Message}. 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/v2/conversations.list_messages.js + * region_tag:dialogflow_v2_generated_Conversations_ListMessages_async + */ + listMessagesAsync( + request?: protos.google.cloud.dialogflow.v2.IListMessagesRequest, + 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['listMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMessages.asyncIterate( + this.innerApiCalls['listMessages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.conversationsStub && !this._terminated) { + return this.conversationsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/conversations_client_config.json b/packages/google-cloud-dialogflow/src/v2/conversations_client_config.json new file mode 100644 index 00000000000..2718600c519 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversations_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Conversations": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "CreateConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CompleteConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListMessages": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/conversations_proto_list.json b/packages/google-cloud-dialogflow/src/v2/conversations_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/conversations_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/documents_client.ts b/packages/google-cloud-dialogflow/src/v2/documents_client.ts new file mode 100644 index 00000000000..ae10f27ee06 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/documents_client.ts @@ -0,0 +1,4709 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2/documents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './documents_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing knowledge {@link google.cloud.dialogflow.v2.Document|Documents}. + * @class + * @memberof v2 + */ +export class DocumentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + documentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DocumentsClient. + * + * @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 DocumentsClient({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 DocumentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listDocuments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'documents' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.Document' + ) as gax.protobuf.Type; + const createDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + const importDocumentsResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.ImportDocumentsResponse' + ) as gax.protobuf.Type; + const importDocumentsMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + const deleteDocumentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + const updateDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.Document' + ) as gax.protobuf.Type; + const updateDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + const reloadDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.Document' + ) as gax.protobuf.Type; + const reloadDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + const exportDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.Document' + ) as gax.protobuf.Type; + const exportDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createDocumentResponse.decode.bind(createDocumentResponse), + createDocumentMetadata.decode.bind(createDocumentMetadata) + ), + importDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importDocumentsResponse.decode.bind(importDocumentsResponse), + importDocumentsMetadata.decode.bind(importDocumentsMetadata) + ), + deleteDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteDocumentResponse.decode.bind(deleteDocumentResponse), + deleteDocumentMetadata.decode.bind(deleteDocumentMetadata) + ), + updateDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateDocumentResponse.decode.bind(updateDocumentResponse), + updateDocumentMetadata.decode.bind(updateDocumentMetadata) + ), + reloadDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reloadDocumentResponse.decode.bind(reloadDocumentResponse), + reloadDocumentMetadata.decode.bind(reloadDocumentMetadata) + ), + exportDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportDocumentResponse.decode.bind(exportDocumentResponse), + exportDocumentMetadata.decode.bind(exportDocumentMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Documents', + 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.documentsStub) { + return this.documentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Documents. + this.documentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Documents' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Documents, + 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 documentsStubMethods = [ + 'listDocuments', + 'getDocument', + 'createDocument', + 'importDocuments', + 'deleteDocument', + 'updateDocument', + 'reloadDocument', + 'exportDocument', + ]; + for (const methodName of documentsStubMethods) { + const callPromise = this.documentsStub.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.documentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified document. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to retrieve. + * Format `projects//locations//knowledgeBases//documents/`. + * @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 [Document]{@link google.cloud.dialogflow.v2.Document}. + * 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/v2/documents.get_document.js + * region_tag:dialogflow_v2_generated_Documents_GetDocument_async + */ + getDocument( + request?: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest | undefined, + {} | undefined + ] + >; + getDocument( + request: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest | null | undefined, + {} | null | undefined + > + ): void; + getDocument( + request: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest | null | undefined, + {} | null | undefined + > + ): void; + getDocument( + request?: protos.google.cloud.dialogflow.v2.IGetDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IDocument, + | protos.google.cloud.dialogflow.v2.IGetDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IGetDocumentRequest | 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.getDocument(request, options, callback); + } + + /** + * Creates a new document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to create a document for. + * Format: `projects//locations//knowledgeBases/`. + * @param {google.cloud.dialogflow.v2.Document} request.document + * Required. The document to create. + * @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/v2/documents.create_document.js + * region_tag:dialogflow_v2_generated_Documents_CreateDocument_async + */ + createDocument( + request?: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createDocument( + request: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createDocument( + request: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createDocument( + request?: protos.google.cloud.dialogflow.v2.ICreateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + 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.createDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createDocument()`. + * @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/v2/documents.create_document.js + * region_tag:dialogflow_v2_generated_Documents_CreateDocument_async + */ + async checkCreateDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + > + > { + 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.createDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + >; + } + /** + * Creates documents by importing data from external sources. + * Dialogflow supports up to 350 documents in each request. If you try to + * import more, Dialogflow will return an error. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.ImportDocumentsResponse|ImportDocumentsResponse} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to import documents into. + * Format: `projects//locations//knowledgeBases/`. + * @param {google.cloud.dialogflow.v2.GcsSources} request.gcsSource + * The Google Cloud Storage location for the documents. + * The path can include a wildcard. + * + * These URIs may have the forms + * `gs:///`. + * `gs:////*.`. + * @param {google.cloud.dialogflow.v2.ImportDocumentTemplate} request.documentTemplate + * Required. Document template used for importing all the documents. + * @param {boolean} request.importGcsCustomMetadata + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * @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/v2/documents.import_documents.js + * region_tag:dialogflow_v2_generated_Documents_ImportDocuments_async + */ + importDocuments( + request?: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importDocuments( + request: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importDocuments( + request: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importDocuments( + request?: protos.google.cloud.dialogflow.v2.IImportDocumentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + 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.importDocuments(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importDocuments()`. + * @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/v2/documents.import_documents.js + * region_tag:dialogflow_v2_generated_Documents_ImportDocuments_async + */ + async checkImportDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.ImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + > + > { + 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.importDocuments, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.ImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + >; + } + /** + * Deletes the specified document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to delete. + * Format: `projects//locations//knowledgeBases//documents/`. + * @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/v2/documents.delete_document.js + * region_tag:dialogflow_v2_generated_Documents_DeleteDocument_async + */ + deleteDocument( + request?: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteDocument( + request: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteDocument( + request: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteDocument( + request?: protos.google.cloud.dialogflow.v2.IDeleteDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteDocument()`. + * @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/v2/documents.delete_document.js + * region_tag:dialogflow_v2_generated_Documents_DeleteDocument_async + */ + async checkDeleteDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + > + > { + 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.deleteDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + >; + } + /** + * Updates the specified document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Document} request.document + * Required. The document to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + * @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/v2/documents.update_document.js + * region_tag:dialogflow_v2_generated_Documents_UpdateDocument_async + */ + updateDocument( + request?: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateDocument( + request: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateDocument( + request: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateDocument( + request?: protos.google.cloud.dialogflow.v2.IUpdateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + 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({ + 'document.name': request.document!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateDocument()`. + * @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/v2/documents.update_document.js + * region_tag:dialogflow_v2_generated_Documents_UpdateDocument_async + */ + async checkUpdateDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + > + > { + 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.updateDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + >; + } + /** + * Reloads the specified document from its specified source, content_uri or + * content. The previously loaded content of the document will be deleted. + * Note: Even when the content of the document has not changed, there still + * may be side effects because of internal implementation changes. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to reload. + * Format: `projects//locations//knowledgeBases//documents/` + * @param {string} [request.contentUri] + * Optional. The path of gcs source file for reloading document content. For now, + * only gcs uri is supported. + * + * For documents stored in Google Cloud Storage, these URIs must have + * the form `gs:///`. + * @param {boolean} [request.importGcsCustomMetadata] + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * @param {boolean} [request.smartMessagingPartialUpdate] + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. + * @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/v2/documents.reload_document.js + * region_tag:dialogflow_v2_generated_Documents_ReloadDocument_async + */ + reloadDocument( + request?: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + reloadDocument( + request: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reloadDocument( + request: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reloadDocument( + request?: protos.google.cloud.dialogflow.v2.IReloadDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.reloadDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `reloadDocument()`. + * @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/v2/documents.reload_document.js + * region_tag:dialogflow_v2_generated_Documents_ReloadDocument_async + */ + async checkReloadDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + > + > { + 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.reloadDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + >; + } + /** + * Exports a smart messaging candidate document into the specified + * destination. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2.Document|Document} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + * @param {google.cloud.dialogflow.v2.GcsDestination} request.gcsDestination + * Cloud Storage file path to export the document. + * @param {boolean} request.exportFullContent + * When enabled, export the full content of the document including empirical + * probability. + * @param {boolean} request.smartMessagingPartialUpdate + * When enabled, export the smart messaging allowlist document for partial + * update. + * @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/v2/documents.export_document.js + * region_tag:dialogflow_v2_generated_Documents_ExportDocument_async + */ + exportDocument( + request?: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + exportDocument( + request: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportDocument( + request: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportDocument( + request?: protos.google.cloud.dialogflow.v2.IExportDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.exportDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `exportDocument()`. + * @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/v2/documents.export_document.js + * region_tag:dialogflow_v2_generated_Documents_ExportDocument_async + */ + async checkExportDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + > + > { + 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.exportDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.Document, + protos.google.cloud.dialogflow.v2.KnowledgeOperationMetadata + >; + } + /** + * Returns the list of all documents of the knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Document]{@link google.cloud.dialogflow.v2.Document}. + * 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 `listDocumentsAsync()` + * 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. + */ + listDocuments( + request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IDocument[], + protos.google.cloud.dialogflow.v2.IListDocumentsRequest | null, + protos.google.cloud.dialogflow.v2.IListDocumentsResponse + ] + >; + listDocuments( + request: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + | protos.google.cloud.dialogflow.v2.IListDocumentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IDocument + > + ): void; + listDocuments( + request: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + | protos.google.cloud.dialogflow.v2.IListDocumentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IDocument + > + ): void; + listDocuments( + request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + | protos.google.cloud.dialogflow.v2.IListDocumentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IDocument + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + | protos.google.cloud.dialogflow.v2.IListDocumentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IDocument + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IDocument[], + protos.google.cloud.dialogflow.v2.IListDocumentsRequest | null, + protos.google.cloud.dialogflow.v2.IListDocumentsResponse + ] + > | 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.listDocuments(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 knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Document]{@link google.cloud.dialogflow.v2.Document} 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 `listDocumentsAsync()` + * 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. + */ + listDocumentsStream( + request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + 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['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDocuments.createStream( + this.innerApiCalls.listDocuments as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listDocuments`, 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 knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 + * [Document]{@link google.cloud.dialogflow.v2.Document}. 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/v2/documents.list_documents.js + * region_tag:dialogflow_v2_generated_Documents_ListDocuments_async + */ + listDocumentsAsync( + request?: protos.google.cloud.dialogflow.v2.IListDocumentsRequest, + 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['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDocuments.asyncIterate( + this.innerApiCalls['listDocuments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.documentsStub && !this._terminated) { + return this.documentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/documents_client_config.json b/packages/google-cloud-dialogflow/src/v2/documents_client_config.json new file mode 100644 index 00000000000..e9c31efb148 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/documents_client_config.json @@ -0,0 +1,69 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Documents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ImportDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ReloadDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ExportDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/documents_proto_list.json b/packages/google-cloud-dialogflow/src/v2/documents_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/documents_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2/entity_types_client.ts new file mode 100644 index 00000000000..224bd48e133 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/entity_types_client.ts @@ -0,0 +1,4847 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2/entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './entity_types_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.EntityType|EntityTypes}. + * @class + * @memberof v2 + */ +export class EntityTypesClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + entityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EntityTypesClient. + * + * @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 EntityTypesClient({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 EntityTypesClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listEntityTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'entityTypes' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const batchUpdateEntityTypesResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse' + ) as gax.protobuf.Type; + const batchUpdateEntityTypesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchDeleteEntityTypesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchDeleteEntityTypesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchCreateEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchCreateEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchUpdateEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchUpdateEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchDeleteEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchDeleteEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchUpdateEntityTypes: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateEntityTypesResponse.decode.bind( + batchUpdateEntityTypesResponse + ), + batchUpdateEntityTypesMetadata.decode.bind( + batchUpdateEntityTypesMetadata + ) + ), + batchDeleteEntityTypes: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteEntityTypesResponse.decode.bind( + batchDeleteEntityTypesResponse + ), + batchDeleteEntityTypesMetadata.decode.bind( + batchDeleteEntityTypesMetadata + ) + ), + batchCreateEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchCreateEntitiesResponse.decode.bind(batchCreateEntitiesResponse), + batchCreateEntitiesMetadata.decode.bind(batchCreateEntitiesMetadata) + ), + batchUpdateEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateEntitiesResponse.decode.bind(batchUpdateEntitiesResponse), + batchUpdateEntitiesMetadata.decode.bind(batchUpdateEntitiesMetadata) + ), + batchDeleteEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteEntitiesResponse.decode.bind(batchDeleteEntitiesResponse), + batchDeleteEntitiesMetadata.decode.bind(batchDeleteEntitiesMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.EntityTypes', + 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.entityTypesStub) { + return this.entityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.EntityTypes. + this.entityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.EntityTypes' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.EntityTypes, + 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 entityTypesStubMethods = [ + 'listEntityTypes', + 'getEntityType', + 'createEntityType', + 'updateEntityType', + 'deleteEntityType', + 'batchUpdateEntityTypes', + 'batchDeleteEntityTypes', + 'batchCreateEntities', + 'batchUpdateEntities', + 'batchDeleteEntities', + ]; + for (const methodName of entityTypesStubMethods) { + const callPromise = this.entityTypesStub.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.entityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type. + * Format: `projects//agent/entityTypes/`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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 [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. + * 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/v2/entity_types.get_entity_type.js + * region_tag:dialogflow_v2_generated_EntityTypes_GetEntityType_async + */ + getEntityType( + request?: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest | undefined, + {} | undefined + ] + >; + getEntityType( + request: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEntityType( + request: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEntityType( + request?: protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IGetEntityTypeRequest | 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.getEntityType(request, options, callback); + } + /** + * Creates an entity type in the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a entity type for. + * Format: `projects//agent`. + * @param {google.cloud.dialogflow.v2.EntityType} request.entityType + * Required. The entity type to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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 [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. + * 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/v2/entity_types.create_entity_type.js + * region_tag:dialogflow_v2_generated_EntityTypes_CreateEntityType_async + */ + createEntityType( + request?: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest | undefined, + {} | undefined + ] + >; + createEntityType( + request: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createEntityType( + request: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createEntityType( + request?: protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.ICreateEntityTypeRequest | 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.createEntityType(request, options, callback); + } + /** + * Updates the specified entity type. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.EntityType} request.entityType + * Required. The entity type to update. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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 [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. + * 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/v2/entity_types.update_entity_type.js + * region_tag:dialogflow_v2_generated_EntityTypes_UpdateEntityType_async + */ + updateEntityType( + request?: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest | undefined, + {} | undefined + ] + >; + updateEntityType( + request: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateEntityType( + request: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateEntityType( + request?: protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEntityType, + | protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEntityType, + protos.google.cloud.dialogflow.v2.IUpdateEntityTypeRequest | 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({ + 'entity_type.name': request.entityType!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEntityType(request, options, callback); + } + /** + * Deletes the specified entity type. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type to delete. + * Format: `projects//agent/entityTypes/`. + * @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/v2/entity_types.delete_entity_type.js + * region_tag:dialogflow_v2_generated_EntityTypes_DeleteEntityType_async + */ + deleteEntityType( + request?: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest | undefined, + {} | undefined + ] + >; + deleteEntityType( + request: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEntityType( + request: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEntityType( + request?: protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEntityTypeRequest | 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.deleteEntityType(request, options, callback); + } + + /** + * Updates/Creates multiple entity types in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse|BatchUpdateEntityTypesResponse} + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to update or create entity types in. + * Format: `projects//agent`. + * @param {string} request.entityTypeBatchUri + * The URI to a Google Cloud Storage file containing entity types to update + * or create. The file format can either be a serialized proto (of + * EntityBatch type) or a JSON object. Note: The URI must start with + * "gs://". + * @param {google.cloud.dialogflow.v2.EntityTypeBatch} request.entityTypeBatchInline + * The collection of entity types to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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/v2/entity_types.batch_update_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async + */ + batchUpdateEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchUpdateEntityTypes( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateEntityTypes( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + 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.batchUpdateEntityTypes( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `batchUpdateEntityTypes()`. + * @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/v2/entity_types.batch_update_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntityTypes_async + */ + async checkBatchUpdateEntityTypesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse, + protos.google.protobuf.Struct + > + > { + 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.batchUpdateEntityTypes, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesResponse, + protos.google.protobuf.Struct + >; + } + /** + * Deletes entity types in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to delete all entities types for. Format: + * `projects//agent`. + * @param {string[]} request.entityTypeNames + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + * @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/v2/entity_types.batch_delete_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async + */ + batchDeleteEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchDeleteEntityTypes( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteEntityTypes( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchDeleteEntityTypes( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `batchDeleteEntityTypes()`. + * @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/v2/entity_types.batch_delete_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async + */ + async checkBatchDeleteEntityTypesProgress( + name: string + ): Promise< + LROperation + > { + 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.batchDeleteEntityTypes, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Creates multiple new entities in the specified entity type. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to create entities in. Format: + * `projects//agent/entityTypes/`. + * @param {number[]} request.entities + * Required. The entities to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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/v2/entity_types.batch_create_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async + */ + batchCreateEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchCreateEntities( + request: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchCreateEntities( + request: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchCreateEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchCreateEntitiesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchCreateEntities(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchCreateEntities()`. + * @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/v2/entity_types.batch_create_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchCreateEntities_async + */ + async checkBatchCreateEntitiesProgress( + name: string + ): Promise< + LROperation + > { + 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.batchCreateEntities, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Updates or creates multiple entities in the specified entity type. This + * method does not affect entities in the entity type that aren't explicitly + * specified in the request. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to update or create entities in. + * Format: `projects//agent/entityTypes/`. + * @param {number[]} request.entities + * Required. The entities to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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/v2/entity_types.batch_update_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async + */ + batchUpdateEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchUpdateEntities( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateEntities( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateEntitiesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchUpdateEntities(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchUpdateEntities()`. + * @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/v2/entity_types.batch_update_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchUpdateEntities_async + */ + async checkBatchUpdateEntitiesProgress( + name: string + ): Promise< + LROperation + > { + 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.batchUpdateEntities, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Deletes entities in the specified entity type. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to delete entries for. Format: + * `projects//agent/entityTypes/`. + * @param {string[]} request.entityValues + * Required. The reference `values` of the entities to delete. Note that + * these are not fully-qualified names, i.e. they don't start with + * `projects/`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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/v2/entity_types.batch_delete_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async + */ + batchDeleteEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchDeleteEntities( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteEntities( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteEntities( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteEntitiesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchDeleteEntities(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchDeleteEntities()`. + * @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/v2/entity_types.batch_delete_entities.js + * region_tag:dialogflow_v2_generated_EntityTypes_BatchDeleteEntities_async + */ + async checkBatchDeleteEntitiesProgress( + name: string + ): Promise< + LROperation + > { + 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.batchDeleteEntities, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Returns the list of all entity types in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types from. + * Format: `projects//agent`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. + * 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 `listEntityTypesAsync()` + * 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. + */ + listEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEntityType[], + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest | null, + protos.google.cloud.dialogflow.v2.IListEntityTypesResponse + ] + >; + listEntityTypes( + request: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.v2.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IEntityType + > + ): void; + listEntityTypes( + request: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.v2.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IEntityType + > + ): void; + listEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.v2.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IEntityType + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.v2.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IEntityType + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEntityType[], + protos.google.cloud.dialogflow.v2.IListEntityTypesRequest | null, + protos.google.cloud.dialogflow.v2.IListEntityTypesResponse + ] + > | 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.listEntityTypes(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 agent to list all entity types from. + * Format: `projects//agent`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [EntityType]{@link google.cloud.dialogflow.v2.EntityType} 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 `listEntityTypesAsync()` + * 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. + */ + listEntityTypesStream( + request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + 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['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.createStream( + this.innerApiCalls.listEntityTypes as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listEntityTypes`, 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 agent to list all entity types from. + * Format: `projects//agent`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [EntityType]{@link google.cloud.dialogflow.v2.EntityType}. 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/v2/entity_types.list_entity_types.js + * region_tag:dialogflow_v2_generated_EntityTypes_ListEntityTypes_async + */ + listEntityTypesAsync( + request?: protos.google.cloud.dialogflow.v2.IListEntityTypesRequest, + 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['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.asyncIterate( + this.innerApiCalls['listEntityTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.entityTypesStub && !this._terminated) { + return this.entityTypesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/entity_types_client_config.json b/packages/google-cloud-dialogflow/src/v2/entity_types_client_config.json new file mode 100644 index 00000000000..55fa402652a --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/entity_types_client_config.json @@ -0,0 +1,79 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.EntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchCreateEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/entity_types_proto_list.json b/packages/google-cloud-dialogflow/src/v2/entity_types_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/entity_types_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/environments_client.ts b/packages/google-cloud-dialogflow/src/v2/environments_client.ts new file mode 100644 index 00000000000..1458e367550 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/environments_client.ts @@ -0,0 +1,3949 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2/environments_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './environments_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Environment|Environments}. + * @class + * @memberof v2 + */ +export class EnvironmentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + environmentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EnvironmentsClient. + * + * @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 EnvironmentsClient({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 EnvironmentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listEnvironments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'environments' + ), + getEnvironmentHistory: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'entries' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Environments', + 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.environmentsStub) { + return this.environmentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Environments. + this.environmentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Environments' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Environments, + 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 environmentsStubMethods = [ + 'listEnvironments', + 'getEnvironment', + 'createEnvironment', + 'updateEnvironment', + 'deleteEnvironment', + 'getEnvironmentHistory', + ]; + for (const methodName of environmentsStubMethods) { + const callPromise = this.environmentsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.environmentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the environment. + * Supported formats: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @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 [Environment]{@link google.cloud.dialogflow.v2.Environment}. + * 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/v2/environments.get_environment.js + * region_tag:dialogflow_v2_generated_Environments_GetEnvironment_async + */ + getEnvironment( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest | undefined, + {} | undefined + ] + >; + getEnvironment( + request: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEnvironment( + request: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEnvironment( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IGetEnvironmentRequest | 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.getEnvironment(request, options, callback); + } + /** + * Creates an agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create an environment for. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2.Environment} request.environment + * Required. The environment to create. + * @param {string} request.environmentId + * Required. The unique id of the new environment. + * @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 [Environment]{@link google.cloud.dialogflow.v2.Environment}. + * 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/v2/environments.create_environment.js + * region_tag:dialogflow_v2_generated_Environments_CreateEnvironment_async + */ + createEnvironment( + request?: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest | undefined, + {} | undefined + ] + >; + createEnvironment( + request: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createEnvironment( + request: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createEnvironment( + request?: protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.ICreateEnvironmentRequest | 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.createEnvironment(request, options, callback); + } + /** + * Updates the specified agent environment. + * + * This method allows you to deploy new agent versions into the environment. + * When an environment is pointed to a new agent version by setting + * `environment.agent_version`, the environment is temporarily set to the + * `LOADING` state. During that time, the environment continues serving the + * previous version of the agent. After the new agent version is done loading, + * the environment is set back to the `RUNNING` state. + * You can use "-" as Environment ID in environment name to update an agent + * version in the default environment. WARNING: this will negate all recent + * changes to the draft agent and can't be undone. You may want to save the + * draft agent to a version before calling this method. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Environment} request.environment + * Required. The environment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @param {boolean} [request.allowLoadToDraftAndDiscardChanges] + * Optional. This field is used to prevent accidental overwrite of the default + * environment, which is an operation that cannot be undone. To confirm that + * the caller desires this overwrite, this field must be explicitly set to + * true when updating the default environment (environment 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 [Environment]{@link google.cloud.dialogflow.v2.Environment}. + * 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/v2/environments.update_environment.js + * region_tag:dialogflow_v2_generated_Environments_UpdateEnvironment_async + */ + updateEnvironment( + request?: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest | undefined, + {} | undefined + ] + >; + updateEnvironment( + request: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateEnvironment( + request: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateEnvironment( + request?: protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IEnvironment, + | protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEnvironment, + protos.google.cloud.dialogflow.v2.IUpdateEnvironmentRequest | 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({ + 'environment.name': request.environment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEnvironment(request, options, callback); + } + /** + * Deletes the specified agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the environment to delete. + * / Format: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @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/v2/environments.delete_environment.js + * region_tag:dialogflow_v2_generated_Environments_DeleteEnvironment_async + */ + deleteEnvironment( + request?: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest | undefined, + {} | undefined + ] + >; + deleteEnvironment( + request: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEnvironment( + request: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEnvironment( + request?: protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteEnvironmentRequest | 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.deleteEnvironment(request, options, callback); + } + + /** + * Returns the list of all non-default environments of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all environments from. + * Format: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Environment]{@link google.cloud.dialogflow.v2.Environment}. + * 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 `listEnvironmentsAsync()` + * 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. + */ + listEnvironments( + request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEnvironment[], + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest | null, + protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse + ] + >; + listEnvironments( + request: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IEnvironment + > + ): void; + listEnvironments( + request: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IEnvironment + > + ): void; + listEnvironments( + request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IEnvironment + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IEnvironment + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IEnvironment[], + protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest | null, + protos.google.cloud.dialogflow.v2.IListEnvironmentsResponse + ] + > | 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.listEnvironments(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 agent to list all environments from. + * Format: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Environment]{@link google.cloud.dialogflow.v2.Environment} 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 `listEnvironmentsAsync()` + * 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. + */ + listEnvironmentsStream( + request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + 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['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEnvironments.createStream( + this.innerApiCalls.listEnvironments as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listEnvironments`, 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 agent to list all environments from. + * Format: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Environment]{@link google.cloud.dialogflow.v2.Environment}. 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/v2/environments.list_environments.js + * region_tag:dialogflow_v2_generated_Environments_ListEnvironments_async + */ + listEnvironmentsAsync( + request?: protos.google.cloud.dialogflow.v2.IListEnvironmentsRequest, + 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['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEnvironments.asyncIterate( + this.innerApiCalls['listEnvironments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets the history of the specified environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the environment to retrieve history for. + * Supported formats: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Entry]{@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry}. + * 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 `getEnvironmentHistoryAsync()` + * 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. + */ + getEnvironmentHistory( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[], + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest | null, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory + ] + >; + getEnvironmentHistory( + request: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory | null | undefined, + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry + > + ): void; + getEnvironmentHistory( + request: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory | null | undefined, + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry + > + ): void; + getEnvironmentHistory( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + | protos.google.cloud.dialogflow.v2.IEnvironmentHistory + | null + | undefined, + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory | null | undefined, + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[], + protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest | null, + protos.google.cloud.dialogflow.v2.IEnvironmentHistory + ] + > | 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.getEnvironmentHistory(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 name of the environment to retrieve history for. + * Supported formats: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Entry]{@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry} 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 `getEnvironmentHistoryAsync()` + * 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. + */ + getEnvironmentHistoryStream( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + 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['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.createStream( + this.innerApiCalls.getEnvironmentHistory as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `getEnvironmentHistory`, 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 name of the environment to retrieve history for. + * Supported formats: + * + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * + * The environment ID for the default environment is `-`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Entry]{@link google.cloud.dialogflow.v2.EnvironmentHistory.Entry}. 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/v2/environments.get_environment_history.js + * region_tag:dialogflow_v2_generated_Environments_GetEnvironmentHistory_async + */ + getEnvironmentHistoryAsync( + request?: protos.google.cloud.dialogflow.v2.IGetEnvironmentHistoryRequest, + 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['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.asyncIterate( + this.innerApiCalls['getEnvironmentHistory'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.environmentsStub && !this._terminated) { + return this.environmentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/environments_client_config.json b/packages/google-cloud-dialogflow/src/v2/environments_client_config.json new file mode 100644 index 00000000000..30cdbacb873 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/environments_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Environments": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListEnvironments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEnvironmentHistory": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/environments_proto_list.json b/packages/google-cloud-dialogflow/src/v2/environments_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/environments_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/fulfillments_client.ts b/packages/google-cloud-dialogflow/src/v2/fulfillments_client.ts new file mode 100644 index 00000000000..0033cc54558 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/fulfillments_client.ts @@ -0,0 +1,3269 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/fulfillments_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './fulfillments_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Fulfillment|Fulfillments}. + * @class + * @memberof v2 + */ +export class FulfillmentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + fulfillmentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FulfillmentsClient. + * + * @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 FulfillmentsClient({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 FulfillmentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Fulfillments', + 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.fulfillmentsStub) { + return this.fulfillmentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Fulfillments. + this.fulfillmentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Fulfillments' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Fulfillments, + 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 fulfillmentsStubMethods = ['getFulfillment', 'updateFulfillment']; + for (const methodName of fulfillmentsStubMethods) { + const callPromise = this.fulfillmentsStub.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.fulfillmentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the fulfillment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the fulfillment. + * Format: `projects//agent/fulfillment`. + * @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 [Fulfillment]{@link google.cloud.dialogflow.v2.Fulfillment}. + * 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/v2/fulfillments.get_fulfillment.js + * region_tag:dialogflow_v2_generated_Fulfillments_GetFulfillment_async + */ + getFulfillment( + request?: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest | undefined, + {} | undefined + ] + >; + getFulfillment( + request: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + | protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getFulfillment( + request: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + | protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getFulfillment( + request?: protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + | protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + | protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IGetFulfillmentRequest | 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.getFulfillment(request, options, callback); + } + /** + * Updates the fulfillment. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Fulfillment} request.fulfillment + * Required. The fulfillment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * @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 [Fulfillment]{@link google.cloud.dialogflow.v2.Fulfillment}. + * 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/v2/fulfillments.update_fulfillment.js + * region_tag:dialogflow_v2_generated_Fulfillments_UpdateFulfillment_async + */ + updateFulfillment( + request?: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest | undefined, + {} | undefined + ] + >; + updateFulfillment( + request: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + | protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateFulfillment( + request: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + | protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateFulfillment( + request?: protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + | protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IFulfillment, + | protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IFulfillment, + protos.google.cloud.dialogflow.v2.IUpdateFulfillmentRequest | 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({ + 'fulfillment.name': request.fulfillment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFulfillment(request, options, callback); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.fulfillmentsStub && !this._terminated) { + return this.fulfillmentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/fulfillments_client_config.json b/packages/google-cloud-dialogflow/src/v2/fulfillments_client_config.json new file mode 100644 index 00000000000..615e86feb97 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/fulfillments_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Fulfillments": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "GetFulfillment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateFulfillment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/fulfillments_proto_list.json b/packages/google-cloud-dialogflow/src/v2/fulfillments_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/fulfillments_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/gapic_metadata.json b/packages/google-cloud-dialogflow/src/v2/gapic_metadata.json new file mode 100644 index 00000000000..7065b59334f --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/gapic_metadata.json @@ -0,0 +1,1329 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.dialogflow.v2", + "libraryPackage": "@google-cloud/dialogflow", + "services": { + "Agents": { + "clients": { + "grpc": { + "libraryClient": "AgentsClient", + "rpcs": { + "GetAgent": { + "methods": [ + "getAgent" + ] + }, + "SetAgent": { + "methods": [ + "setAgent" + ] + }, + "DeleteAgent": { + "methods": [ + "deleteAgent" + ] + }, + "GetValidationResult": { + "methods": [ + "getValidationResult" + ] + }, + "TrainAgent": { + "methods": [ + "trainAgent" + ] + }, + "ExportAgent": { + "methods": [ + "exportAgent" + ] + }, + "ImportAgent": { + "methods": [ + "importAgent" + ] + }, + "RestoreAgent": { + "methods": [ + "restoreAgent" + ] + }, + "SearchAgents": { + "methods": [ + "searchAgents", + "searchAgentsStream", + "searchAgentsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AgentsClient", + "rpcs": { + "GetAgent": { + "methods": [ + "getAgent" + ] + }, + "SetAgent": { + "methods": [ + "setAgent" + ] + }, + "DeleteAgent": { + "methods": [ + "deleteAgent" + ] + }, + "GetValidationResult": { + "methods": [ + "getValidationResult" + ] + }, + "TrainAgent": { + "methods": [ + "trainAgent" + ] + }, + "ExportAgent": { + "methods": [ + "exportAgent" + ] + }, + "ImportAgent": { + "methods": [ + "importAgent" + ] + }, + "RestoreAgent": { + "methods": [ + "restoreAgent" + ] + }, + "SearchAgents": { + "methods": [ + "searchAgents", + "searchAgentsStream", + "searchAgentsAsync" + ] + } + } + } + } + }, + "AnswerRecords": { + "clients": { + "grpc": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "UpdateAnswerRecord": { + "methods": [ + "updateAnswerRecord" + ] + }, + "ListAnswerRecords": { + "methods": [ + "listAnswerRecords", + "listAnswerRecordsStream", + "listAnswerRecordsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "UpdateAnswerRecord": { + "methods": [ + "updateAnswerRecord" + ] + }, + "ListAnswerRecords": { + "methods": [ + "listAnswerRecords", + "listAnswerRecordsStream", + "listAnswerRecordsAsync" + ] + } + } + } + } + }, + "Contexts": { + "clients": { + "grpc": { + "libraryClient": "ContextsClient", + "rpcs": { + "GetContext": { + "methods": [ + "getContext" + ] + }, + "CreateContext": { + "methods": [ + "createContext" + ] + }, + "UpdateContext": { + "methods": [ + "updateContext" + ] + }, + "DeleteContext": { + "methods": [ + "deleteContext" + ] + }, + "DeleteAllContexts": { + "methods": [ + "deleteAllContexts" + ] + }, + "ListContexts": { + "methods": [ + "listContexts", + "listContextsStream", + "listContextsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ContextsClient", + "rpcs": { + "GetContext": { + "methods": [ + "getContext" + ] + }, + "CreateContext": { + "methods": [ + "createContext" + ] + }, + "UpdateContext": { + "methods": [ + "updateContext" + ] + }, + "DeleteContext": { + "methods": [ + "deleteContext" + ] + }, + "DeleteAllContexts": { + "methods": [ + "deleteAllContexts" + ] + }, + "ListContexts": { + "methods": [ + "listContexts", + "listContextsStream", + "listContextsAsync" + ] + } + } + } + } + }, + "ConversationDatasets": { + "clients": { + "grpc": { + "libraryClient": "ConversationDatasetsClient", + "rpcs": { + "GetConversationDataset": { + "methods": [ + "getConversationDataset" + ] + }, + "CreateConversationDataset": { + "methods": [ + "createConversationDataset" + ] + }, + "DeleteConversationDataset": { + "methods": [ + "deleteConversationDataset" + ] + }, + "ImportConversationData": { + "methods": [ + "importConversationData" + ] + }, + "ListConversationDatasets": { + "methods": [ + "listConversationDatasets", + "listConversationDatasetsStream", + "listConversationDatasetsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationDatasetsClient", + "rpcs": { + "GetConversationDataset": { + "methods": [ + "getConversationDataset" + ] + }, + "CreateConversationDataset": { + "methods": [ + "createConversationDataset" + ] + }, + "DeleteConversationDataset": { + "methods": [ + "deleteConversationDataset" + ] + }, + "ImportConversationData": { + "methods": [ + "importConversationData" + ] + }, + "ListConversationDatasets": { + "methods": [ + "listConversationDatasets", + "listConversationDatasetsStream", + "listConversationDatasetsAsync" + ] + } + } + } + } + }, + "ConversationModels": { + "clients": { + "grpc": { + "libraryClient": "ConversationModelsClient", + "rpcs": { + "GetConversationModel": { + "methods": [ + "getConversationModel" + ] + }, + "GetConversationModelEvaluation": { + "methods": [ + "getConversationModelEvaluation" + ] + }, + "CreateConversationModel": { + "methods": [ + "createConversationModel" + ] + }, + "DeleteConversationModel": { + "methods": [ + "deleteConversationModel" + ] + }, + "DeployConversationModel": { + "methods": [ + "deployConversationModel" + ] + }, + "UndeployConversationModel": { + "methods": [ + "undeployConversationModel" + ] + }, + "CreateConversationModelEvaluation": { + "methods": [ + "createConversationModelEvaluation" + ] + }, + "ListConversationModels": { + "methods": [ + "listConversationModels", + "listConversationModelsStream", + "listConversationModelsAsync" + ] + }, + "ListConversationModelEvaluations": { + "methods": [ + "listConversationModelEvaluations", + "listConversationModelEvaluationsStream", + "listConversationModelEvaluationsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationModelsClient", + "rpcs": { + "GetConversationModel": { + "methods": [ + "getConversationModel" + ] + }, + "GetConversationModelEvaluation": { + "methods": [ + "getConversationModelEvaluation" + ] + }, + "CreateConversationModel": { + "methods": [ + "createConversationModel" + ] + }, + "DeleteConversationModel": { + "methods": [ + "deleteConversationModel" + ] + }, + "DeployConversationModel": { + "methods": [ + "deployConversationModel" + ] + }, + "UndeployConversationModel": { + "methods": [ + "undeployConversationModel" + ] + }, + "CreateConversationModelEvaluation": { + "methods": [ + "createConversationModelEvaluation" + ] + }, + "ListConversationModels": { + "methods": [ + "listConversationModels", + "listConversationModelsStream", + "listConversationModelsAsync" + ] + }, + "ListConversationModelEvaluations": { + "methods": [ + "listConversationModelEvaluations", + "listConversationModelEvaluationsStream", + "listConversationModelEvaluationsAsync" + ] + } + } + } + } + }, + "ConversationProfiles": { + "clients": { + "grpc": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "SetSuggestionFeatureConfig": { + "methods": [ + "setSuggestionFeatureConfig" + ] + }, + "ClearSuggestionFeatureConfig": { + "methods": [ + "clearSuggestionFeatureConfig" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "SetSuggestionFeatureConfig": { + "methods": [ + "setSuggestionFeatureConfig" + ] + }, + "ClearSuggestionFeatureConfig": { + "methods": [ + "clearSuggestionFeatureConfig" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + } + } + }, + "Conversations": { + "clients": { + "grpc": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "CompleteConversation": { + "methods": [ + "completeConversation" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListMessages": { + "methods": [ + "listMessages", + "listMessagesStream", + "listMessagesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "CompleteConversation": { + "methods": [ + "completeConversation" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListMessages": { + "methods": [ + "listMessages", + "listMessagesStream", + "listMessagesAsync" + ] + } + } + } + } + }, + "Documents": { + "clients": { + "grpc": { + "libraryClient": "DocumentsClient", + "rpcs": { + "GetDocument": { + "methods": [ + "getDocument" + ] + }, + "CreateDocument": { + "methods": [ + "createDocument" + ] + }, + "ImportDocuments": { + "methods": [ + "importDocuments" + ] + }, + "DeleteDocument": { + "methods": [ + "deleteDocument" + ] + }, + "UpdateDocument": { + "methods": [ + "updateDocument" + ] + }, + "ReloadDocument": { + "methods": [ + "reloadDocument" + ] + }, + "ExportDocument": { + "methods": [ + "exportDocument" + ] + }, + "ListDocuments": { + "methods": [ + "listDocuments", + "listDocumentsStream", + "listDocumentsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DocumentsClient", + "rpcs": { + "GetDocument": { + "methods": [ + "getDocument" + ] + }, + "CreateDocument": { + "methods": [ + "createDocument" + ] + }, + "ImportDocuments": { + "methods": [ + "importDocuments" + ] + }, + "DeleteDocument": { + "methods": [ + "deleteDocument" + ] + }, + "UpdateDocument": { + "methods": [ + "updateDocument" + ] + }, + "ReloadDocument": { + "methods": [ + "reloadDocument" + ] + }, + "ExportDocument": { + "methods": [ + "exportDocument" + ] + }, + "ListDocuments": { + "methods": [ + "listDocuments", + "listDocumentsStream", + "listDocumentsAsync" + ] + } + } + } + } + }, + "EntityTypes": { + "clients": { + "grpc": { + "libraryClient": "EntityTypesClient", + "rpcs": { + "GetEntityType": { + "methods": [ + "getEntityType" + ] + }, + "CreateEntityType": { + "methods": [ + "createEntityType" + ] + }, + "UpdateEntityType": { + "methods": [ + "updateEntityType" + ] + }, + "DeleteEntityType": { + "methods": [ + "deleteEntityType" + ] + }, + "BatchUpdateEntityTypes": { + "methods": [ + "batchUpdateEntityTypes" + ] + }, + "BatchDeleteEntityTypes": { + "methods": [ + "batchDeleteEntityTypes" + ] + }, + "BatchCreateEntities": { + "methods": [ + "batchCreateEntities" + ] + }, + "BatchUpdateEntities": { + "methods": [ + "batchUpdateEntities" + ] + }, + "BatchDeleteEntities": { + "methods": [ + "batchDeleteEntities" + ] + }, + "ListEntityTypes": { + "methods": [ + "listEntityTypes", + "listEntityTypesStream", + "listEntityTypesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EntityTypesClient", + "rpcs": { + "GetEntityType": { + "methods": [ + "getEntityType" + ] + }, + "CreateEntityType": { + "methods": [ + "createEntityType" + ] + }, + "UpdateEntityType": { + "methods": [ + "updateEntityType" + ] + }, + "DeleteEntityType": { + "methods": [ + "deleteEntityType" + ] + }, + "BatchUpdateEntityTypes": { + "methods": [ + "batchUpdateEntityTypes" + ] + }, + "BatchDeleteEntityTypes": { + "methods": [ + "batchDeleteEntityTypes" + ] + }, + "BatchCreateEntities": { + "methods": [ + "batchCreateEntities" + ] + }, + "BatchUpdateEntities": { + "methods": [ + "batchUpdateEntities" + ] + }, + "BatchDeleteEntities": { + "methods": [ + "batchDeleteEntities" + ] + }, + "ListEntityTypes": { + "methods": [ + "listEntityTypes", + "listEntityTypesStream", + "listEntityTypesAsync" + ] + } + } + } + } + }, + "Environments": { + "clients": { + "grpc": { + "libraryClient": "EnvironmentsClient", + "rpcs": { + "GetEnvironment": { + "methods": [ + "getEnvironment" + ] + }, + "CreateEnvironment": { + "methods": [ + "createEnvironment" + ] + }, + "UpdateEnvironment": { + "methods": [ + "updateEnvironment" + ] + }, + "DeleteEnvironment": { + "methods": [ + "deleteEnvironment" + ] + }, + "ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }, + "GetEnvironmentHistory": { + "methods": [ + "getEnvironmentHistory", + "getEnvironmentHistoryStream", + "getEnvironmentHistoryAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EnvironmentsClient", + "rpcs": { + "GetEnvironment": { + "methods": [ + "getEnvironment" + ] + }, + "CreateEnvironment": { + "methods": [ + "createEnvironment" + ] + }, + "UpdateEnvironment": { + "methods": [ + "updateEnvironment" + ] + }, + "DeleteEnvironment": { + "methods": [ + "deleteEnvironment" + ] + }, + "ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }, + "GetEnvironmentHistory": { + "methods": [ + "getEnvironmentHistory", + "getEnvironmentHistoryStream", + "getEnvironmentHistoryAsync" + ] + } + } + } + } + }, + "Fulfillments": { + "clients": { + "grpc": { + "libraryClient": "FulfillmentsClient", + "rpcs": { + "GetFulfillment": { + "methods": [ + "getFulfillment" + ] + }, + "UpdateFulfillment": { + "methods": [ + "updateFulfillment" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FulfillmentsClient", + "rpcs": { + "GetFulfillment": { + "methods": [ + "getFulfillment" + ] + }, + "UpdateFulfillment": { + "methods": [ + "updateFulfillment" + ] + } + } + } + } + }, + "Intents": { + "clients": { + "grpc": { + "libraryClient": "IntentsClient", + "rpcs": { + "GetIntent": { + "methods": [ + "getIntent" + ] + }, + "CreateIntent": { + "methods": [ + "createIntent" + ] + }, + "UpdateIntent": { + "methods": [ + "updateIntent" + ] + }, + "DeleteIntent": { + "methods": [ + "deleteIntent" + ] + }, + "BatchUpdateIntents": { + "methods": [ + "batchUpdateIntents" + ] + }, + "BatchDeleteIntents": { + "methods": [ + "batchDeleteIntents" + ] + }, + "ListIntents": { + "methods": [ + "listIntents", + "listIntentsStream", + "listIntentsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "IntentsClient", + "rpcs": { + "GetIntent": { + "methods": [ + "getIntent" + ] + }, + "CreateIntent": { + "methods": [ + "createIntent" + ] + }, + "UpdateIntent": { + "methods": [ + "updateIntent" + ] + }, + "DeleteIntent": { + "methods": [ + "deleteIntent" + ] + }, + "BatchUpdateIntents": { + "methods": [ + "batchUpdateIntents" + ] + }, + "BatchDeleteIntents": { + "methods": [ + "batchDeleteIntents" + ] + }, + "ListIntents": { + "methods": [ + "listIntents", + "listIntentsStream", + "listIntentsAsync" + ] + } + } + } + } + }, + "KnowledgeBases": { + "clients": { + "grpc": { + "libraryClient": "KnowledgeBasesClient", + "rpcs": { + "GetKnowledgeBase": { + "methods": [ + "getKnowledgeBase" + ] + }, + "CreateKnowledgeBase": { + "methods": [ + "createKnowledgeBase" + ] + }, + "DeleteKnowledgeBase": { + "methods": [ + "deleteKnowledgeBase" + ] + }, + "UpdateKnowledgeBase": { + "methods": [ + "updateKnowledgeBase" + ] + }, + "ListKnowledgeBases": { + "methods": [ + "listKnowledgeBases", + "listKnowledgeBasesStream", + "listKnowledgeBasesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "KnowledgeBasesClient", + "rpcs": { + "GetKnowledgeBase": { + "methods": [ + "getKnowledgeBase" + ] + }, + "CreateKnowledgeBase": { + "methods": [ + "createKnowledgeBase" + ] + }, + "DeleteKnowledgeBase": { + "methods": [ + "deleteKnowledgeBase" + ] + }, + "UpdateKnowledgeBase": { + "methods": [ + "updateKnowledgeBase" + ] + }, + "ListKnowledgeBases": { + "methods": [ + "listKnowledgeBases", + "listKnowledgeBasesStream", + "listKnowledgeBasesAsync" + ] + } + } + } + } + }, + "Participants": { + "clients": { + "grpc": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "CreateParticipant": { + "methods": [ + "createParticipant" + ] + }, + "GetParticipant": { + "methods": [ + "getParticipant" + ] + }, + "UpdateParticipant": { + "methods": [ + "updateParticipant" + ] + }, + "AnalyzeContent": { + "methods": [ + "analyzeContent" + ] + }, + "SuggestArticles": { + "methods": [ + "suggestArticles" + ] + }, + "SuggestFaqAnswers": { + "methods": [ + "suggestFaqAnswers" + ] + }, + "SuggestSmartReplies": { + "methods": [ + "suggestSmartReplies" + ] + }, + "StreamingAnalyzeContent": { + "methods": [ + "streamingAnalyzeContent" + ] + }, + "ListParticipants": { + "methods": [ + "listParticipants", + "listParticipantsStream", + "listParticipantsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "CreateParticipant": { + "methods": [ + "createParticipant" + ] + }, + "GetParticipant": { + "methods": [ + "getParticipant" + ] + }, + "UpdateParticipant": { + "methods": [ + "updateParticipant" + ] + }, + "AnalyzeContent": { + "methods": [ + "analyzeContent" + ] + }, + "SuggestArticles": { + "methods": [ + "suggestArticles" + ] + }, + "SuggestFaqAnswers": { + "methods": [ + "suggestFaqAnswers" + ] + }, + "SuggestSmartReplies": { + "methods": [ + "suggestSmartReplies" + ] + }, + "ListParticipants": { + "methods": [ + "listParticipants", + "listParticipantsStream", + "listParticipantsAsync" + ] + } + } + } + } + }, + "SessionEntityTypes": { + "clients": { + "grpc": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": { + "GetSessionEntityType": { + "methods": [ + "getSessionEntityType" + ] + }, + "CreateSessionEntityType": { + "methods": [ + "createSessionEntityType" + ] + }, + "UpdateSessionEntityType": { + "methods": [ + "updateSessionEntityType" + ] + }, + "DeleteSessionEntityType": { + "methods": [ + "deleteSessionEntityType" + ] + }, + "ListSessionEntityTypes": { + "methods": [ + "listSessionEntityTypes", + "listSessionEntityTypesStream", + "listSessionEntityTypesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": { + "GetSessionEntityType": { + "methods": [ + "getSessionEntityType" + ] + }, + "CreateSessionEntityType": { + "methods": [ + "createSessionEntityType" + ] + }, + "UpdateSessionEntityType": { + "methods": [ + "updateSessionEntityType" + ] + }, + "DeleteSessionEntityType": { + "methods": [ + "deleteSessionEntityType" + ] + }, + "ListSessionEntityTypes": { + "methods": [ + "listSessionEntityTypes", + "listSessionEntityTypesStream", + "listSessionEntityTypesAsync" + ] + } + } + } + } + }, + "Sessions": { + "clients": { + "grpc": { + "libraryClient": "SessionsClient", + "rpcs": { + "DetectIntent": { + "methods": [ + "detectIntent" + ] + }, + "StreamingDetectIntent": { + "methods": [ + "streamingDetectIntent" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SessionsClient", + "rpcs": { + "DetectIntent": { + "methods": [ + "detectIntent" + ] + } + } + } + } + }, + "Versions": { + "clients": { + "grpc": { + "libraryClient": "VersionsClient", + "rpcs": { + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "CreateVersion": { + "methods": [ + "createVersion" + ] + }, + "UpdateVersion": { + "methods": [ + "updateVersion" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "VersionsClient", + "rpcs": { + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "CreateVersion": { + "methods": [ + "createVersion" + ] + }, + "UpdateVersion": { + "methods": [ + "updateVersion" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/index.ts b/packages/google-cloud-dialogflow/src/v2/index.ts new file mode 100644 index 00000000000..2decccc0a50 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/index.ts @@ -0,0 +1,35 @@ +// 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. +// +// ** 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 {AgentsClient} from './agents_client'; +export {AnswerRecordsClient} from './answer_records_client'; +export {ContextsClient} from './contexts_client'; +export {ConversationDatasetsClient} from './conversation_datasets_client'; +export {ConversationModelsClient} from './conversation_models_client'; +export {ConversationProfilesClient} from './conversation_profiles_client'; +export {ConversationsClient} from './conversations_client'; +export {DocumentsClient} from './documents_client'; +export {EntityTypesClient} from './entity_types_client'; +export {EnvironmentsClient} from './environments_client'; +export {FulfillmentsClient} from './fulfillments_client'; +export {IntentsClient} from './intents_client'; +export {KnowledgeBasesClient} from './knowledge_bases_client'; +export {ParticipantsClient} from './participants_client'; +export {SessionEntityTypesClient} from './session_entity_types_client'; +export {SessionsClient} from './sessions_client'; +export {VersionsClient} from './versions_client'; diff --git a/packages/google-cloud-dialogflow/src/v2/intents_client.ts b/packages/google-cloud-dialogflow/src/v2/intents_client.ts new file mode 100644 index 00000000000..dd81ce10f24 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/intents_client.ts @@ -0,0 +1,4325 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2/intents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './intents_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Intent|Intents}. + * @class + * @memberof v2 + */ +export class IntentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + intentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IntentsClient. + * + * @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 IntentsClient({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 IntentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listIntents: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'intents' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + {post: '/v2/{name=projects/*/locations/*/operations/*}:cancel'}, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const batchUpdateIntentsResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2.BatchUpdateIntentsResponse' + ) as gax.protobuf.Type; + const batchUpdateIntentsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchDeleteIntentsResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchDeleteIntentsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchUpdateIntents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateIntentsResponse.decode.bind(batchUpdateIntentsResponse), + batchUpdateIntentsMetadata.decode.bind(batchUpdateIntentsMetadata) + ), + batchDeleteIntents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteIntentsResponse.decode.bind(batchDeleteIntentsResponse), + batchDeleteIntentsMetadata.decode.bind(batchDeleteIntentsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Intents', + 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.intentsStub) { + return this.intentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Intents. + this.intentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Intents' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Intents, + 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 intentsStubMethods = [ + 'listIntents', + 'getIntent', + 'createIntent', + 'updateIntent', + 'deleteIntent', + 'batchUpdateIntents', + 'batchDeleteIntents', + ]; + for (const methodName of intentsStubMethods) { + const callPromise = this.intentsStub.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.intentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified intent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent. + * Format: `projects//agent/intents/`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @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 [Intent]{@link google.cloud.dialogflow.v2.Intent}. + * 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/v2/intents.get_intent.js + * region_tag:dialogflow_v2_generated_Intents_GetIntent_async + */ + getIntent( + request?: protos.google.cloud.dialogflow.v2.IGetIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest | undefined, + {} | undefined + ] + >; + getIntent( + request: protos.google.cloud.dialogflow.v2.IGetIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + getIntent( + request: protos.google.cloud.dialogflow.v2.IGetIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + getIntent( + request?: protos.google.cloud.dialogflow.v2.IGetIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IIntent, + | protos.google.cloud.dialogflow.v2.IGetIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IGetIntentRequest | 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.getIntent(request, options, callback); + } + /** + * Creates an intent in the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a intent for. + * Format: `projects//agent`. + * @param {google.cloud.dialogflow.v2.Intent} request.intent + * Required. The intent to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @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 [Intent]{@link google.cloud.dialogflow.v2.Intent}. + * 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/v2/intents.create_intent.js + * region_tag:dialogflow_v2_generated_Intents_CreateIntent_async + */ + createIntent( + request?: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest | undefined, + {} | undefined + ] + >; + createIntent( + request: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + createIntent( + request: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + createIntent( + request?: protos.google.cloud.dialogflow.v2.ICreateIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IIntent, + | protos.google.cloud.dialogflow.v2.ICreateIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.ICreateIntentRequest | 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.createIntent(request, options, callback); + } + /** + * Updates the specified intent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Intent} request.intent + * Required. The intent to update. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @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 [Intent]{@link google.cloud.dialogflow.v2.Intent}. + * 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/v2/intents.update_intent.js + * region_tag:dialogflow_v2_generated_Intents_UpdateIntent_async + */ + updateIntent( + request?: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest | undefined, + {} | undefined + ] + >; + updateIntent( + request: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + updateIntent( + request: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + updateIntent( + request?: protos.google.cloud.dialogflow.v2.IUpdateIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IIntent, + | protos.google.cloud.dialogflow.v2.IUpdateIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IIntent, + protos.google.cloud.dialogflow.v2.IUpdateIntentRequest | 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({ + 'intent.name': request.intent!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateIntent(request, options, callback); + } + /** + * Deletes the specified intent and its direct or indirect followup intents. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent to delete. If this intent has direct or + * indirect followup intents, we also delete them. + * Format: `projects//agent/intents/`. + * @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/v2/intents.delete_intent.js + * region_tag:dialogflow_v2_generated_Intents_DeleteIntent_async + */ + deleteIntent( + request?: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest | undefined, + {} | undefined + ] + >; + deleteIntent( + request: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteIntent( + request: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + deleteIntent( + request?: protos.google.cloud.dialogflow.v2.IDeleteIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteIntentRequest | 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.deleteIntent(request, options, callback); + } + + /** + * Updates/Creates multiple intents in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2.BatchUpdateIntentsResponse|BatchUpdateIntentsResponse} + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to update or create intents in. + * Format: `projects//agent`. + * @param {string} request.intentBatchUri + * The URI to a Google Cloud Storage file containing intents to update or + * create. The file format can either be a serialized proto (of IntentBatch + * type) or JSON object. Note: The URI must start with "gs://". + * @param {google.cloud.dialogflow.v2.IntentBatch} request.intentBatchInline + * The collection of intents to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @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/v2/intents.batch_update_intents.js + * region_tag:dialogflow_v2_generated_Intents_BatchUpdateIntents_async + */ + batchUpdateIntents( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchUpdateIntents( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateIntents( + request: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateIntents( + request?: protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + 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.batchUpdateIntents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchUpdateIntents()`. + * @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/v2/intents.batch_update_intents.js + * region_tag:dialogflow_v2_generated_Intents_BatchUpdateIntents_async + */ + async checkBatchUpdateIntentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2.BatchUpdateIntentsResponse, + protos.google.protobuf.Struct + > + > { + 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.batchUpdateIntents, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2.BatchUpdateIntentsResponse, + protos.google.protobuf.Struct + >; + } + /** + * Deletes intents in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to delete all entities types for. Format: + * `projects//agent`. + * @param {number[]} request.intents + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + * @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/v2/intents.batch_delete_intents.js + * region_tag:dialogflow_v2_generated_Intents_BatchDeleteIntents_async + */ + batchDeleteIntents( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchDeleteIntents( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteIntents( + request: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteIntents( + request?: protos.google.cloud.dialogflow.v2.IBatchDeleteIntentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchDeleteIntents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchDeleteIntents()`. + * @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/v2/intents.batch_delete_intents.js + * region_tag:dialogflow_v2_generated_Intents_BatchDeleteIntents_async + */ + async checkBatchDeleteIntentsProgress( + name: string + ): Promise< + LROperation + > { + 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.batchDeleteIntents, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Returns the list of all intents in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Intent]{@link google.cloud.dialogflow.v2.Intent}. + * 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 `listIntentsAsync()` + * 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. + */ + listIntents( + request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IIntent[], + protos.google.cloud.dialogflow.v2.IListIntentsRequest | null, + protos.google.cloud.dialogflow.v2.IListIntentsResponse + ] + >; + listIntents( + request: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListIntentsRequest, + protos.google.cloud.dialogflow.v2.IListIntentsResponse | null | undefined, + protos.google.cloud.dialogflow.v2.IIntent + > + ): void; + listIntents( + request: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListIntentsRequest, + protos.google.cloud.dialogflow.v2.IListIntentsResponse | null | undefined, + protos.google.cloud.dialogflow.v2.IIntent + > + ): void; + listIntents( + request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListIntentsRequest, + | protos.google.cloud.dialogflow.v2.IListIntentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IIntent + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListIntentsRequest, + protos.google.cloud.dialogflow.v2.IListIntentsResponse | null | undefined, + protos.google.cloud.dialogflow.v2.IIntent + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IIntent[], + protos.google.cloud.dialogflow.v2.IListIntentsRequest | null, + protos.google.cloud.dialogflow.v2.IListIntentsResponse + ] + > | 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.listIntents(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 agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Intent]{@link google.cloud.dialogflow.v2.Intent} 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 `listIntentsAsync()` + * 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. + */ + listIntentsStream( + request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + 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['listIntents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIntents.createStream( + this.innerApiCalls.listIntents as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listIntents`, 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 agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2.IntentView} [request.intentView] + * Optional. The resource view to apply to the returned intent. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Intent]{@link google.cloud.dialogflow.v2.Intent}. 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/v2/intents.list_intents.js + * region_tag:dialogflow_v2_generated_Intents_ListIntents_async + */ + listIntentsAsync( + request?: protos.google.cloud.dialogflow.v2.IListIntentsRequest, + 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['listIntents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIntents.asyncIterate( + this.innerApiCalls['listIntents'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.intentsStub && !this._terminated) { + return this.intentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/intents_client_config.json b/packages/google-cloud-dialogflow/src/v2/intents_client_config.json new file mode 100644 index 00000000000..ad20f4c607d --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/intents_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Intents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/intents_proto_list.json b/packages/google-cloud-dialogflow/src/v2/intents_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/intents_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client.ts b/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client.ts new file mode 100644 index 00000000000..103a7f76430 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client.ts @@ -0,0 +1,3782 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2/knowledge_bases_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './knowledge_bases_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.KnowledgeBase|KnowledgeBases}. + * @class + * @memberof v2 + */ +export class KnowledgeBasesClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + knowledgeBasesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of KnowledgeBasesClient. + * + * @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 KnowledgeBasesClient({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 KnowledgeBasesClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listKnowledgeBases: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'knowledgeBases' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.KnowledgeBases', + 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.knowledgeBasesStub) { + return this.knowledgeBasesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.KnowledgeBases. + this.knowledgeBasesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.KnowledgeBases' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.KnowledgeBases, + 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 knowledgeBasesStubMethods = [ + 'listKnowledgeBases', + 'getKnowledgeBase', + 'createKnowledgeBase', + 'deleteKnowledgeBase', + 'updateKnowledgeBase', + ]; + for (const methodName of knowledgeBasesStubMethods) { + const callPromise = this.knowledgeBasesStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.knowledgeBasesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the knowledge base to retrieve. + * Format `projects//locations//knowledgeBases/`. + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. + * 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/v2/knowledge_bases.get_knowledge_base.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_GetKnowledgeBase_async + */ + getKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest | undefined, + {} | undefined + ] + >; + getKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IGetKnowledgeBaseRequest | 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.getKnowledgeBase(request, options, callback); + } + /** + * Creates a knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create a knowledge base for. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2.KnowledgeBase} request.knowledgeBase + * Required. The knowledge base to create. + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. + * 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/v2/knowledge_bases.create_knowledge_base.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_CreateKnowledgeBase_async + */ + createKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest | undefined, + {} | undefined + ] + >; + createKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.ICreateKnowledgeBaseRequest | 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.createKnowledgeBase(request, options, callback); + } + /** + * Deletes the specified knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the knowledge base to delete. + * Format: `projects//locations//knowledgeBases/`. + * @param {boolean} [request.force] + * Optional. Force deletes the knowledge base. When set to true, any documents + * in the knowledge base are also deleted. + * @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/v2/knowledge_bases.delete_knowledge_base.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_DeleteKnowledgeBase_async + */ + deleteKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest | undefined, + {} | undefined + ] + >; + deleteKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteKnowledgeBaseRequest | 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.deleteKnowledgeBase(request, options, callback); + } + /** + * Updates the specified knowledge base. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.KnowledgeBase} request.knowledgeBase + * Required. The knowledge base to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. + * 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/v2/knowledge_bases.update_knowledge_base.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_UpdateKnowledgeBase_async + */ + updateKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest | undefined, + {} | undefined + ] + >; + updateKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateKnowledgeBase( + request: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IKnowledgeBase, + protos.google.cloud.dialogflow.v2.IUpdateKnowledgeBaseRequest | 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({ + 'knowledge_base.name': request.knowledgeBase!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateKnowledgeBase(request, options, callback); + } + + /** + * Returns the list of all knowledge bases of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list of knowledge bases for. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. + * 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 `listKnowledgeBasesAsync()` + * 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. + */ + listKnowledgeBases( + request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IKnowledgeBase[], + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest | null, + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse + ] + >; + listKnowledgeBases( + request: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + | protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IKnowledgeBase + > + ): void; + listKnowledgeBases( + request: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + | protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IKnowledgeBase + > + ): void; + listKnowledgeBases( + request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + | protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IKnowledgeBase + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + | protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IKnowledgeBase + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IKnowledgeBase[], + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest | null, + protos.google.cloud.dialogflow.v2.IListKnowledgeBasesResponse + ] + > | 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.listKnowledgeBases(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 to list of knowledge bases for. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase} 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 `listKnowledgeBasesAsync()` + * 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. + */ + listKnowledgeBasesStream( + request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + 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['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.createStream( + this.innerApiCalls.listKnowledgeBases as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listKnowledgeBases`, 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 to list of knowledge bases for. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 + * [KnowledgeBase]{@link google.cloud.dialogflow.v2.KnowledgeBase}. 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/v2/knowledge_bases.list_knowledge_bases.js + * region_tag:dialogflow_v2_generated_KnowledgeBases_ListKnowledgeBases_async + */ + listKnowledgeBasesAsync( + request?: protos.google.cloud.dialogflow.v2.IListKnowledgeBasesRequest, + 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['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.asyncIterate( + this.innerApiCalls['listKnowledgeBases'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.knowledgeBasesStub && !this._terminated) { + return this.knowledgeBasesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client_config.json b/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client_config.json new file mode 100644 index 00000000000..580ef4d8686 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/knowledge_bases_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.KnowledgeBases": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListKnowledgeBases": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/knowledge_bases_proto_list.json b/packages/google-cloud-dialogflow/src/v2/knowledge_bases_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/knowledge_bases_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/participants_client.ts b/packages/google-cloud-dialogflow/src/v2/participants_client.ts new file mode 100644 index 00000000000..e51a395bc15 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/participants_client.ts @@ -0,0 +1,4112 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform, PassThrough} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/participants_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './participants_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Participant|Participants}. + * @class + * @memberof v2 + */ +export class ParticipantsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + participantsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ParticipantsClient. + * + * @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 ParticipantsClient({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 ParticipantsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listParticipants: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'participants' + ), + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + streamingAnalyzeContent: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + opts.fallback === 'rest' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Participants', + 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.participantsStub) { + return this.participantsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Participants. + this.participantsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Participants' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Participants, + 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 participantsStubMethods = [ + 'createParticipant', + 'getParticipant', + 'listParticipants', + 'updateParticipant', + 'analyzeContent', + 'streamingAnalyzeContent', + 'suggestArticles', + 'suggestFaqAnswers', + 'suggestSmartReplies', + ]; + for (const methodName of participantsStubMethods) { + const callPromise = this.participantsStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit( + 'error', + new this._gaxModule.GoogleError( + 'The client has already been closed.' + ) + ); + }); + return stream; + } + 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.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.participantsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 a new participant in a conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + * @param {google.cloud.dialogflow.v2.Participant} request.participant + * Required. The participant to create. + * @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 [Participant]{@link google.cloud.dialogflow.v2.Participant}. + * 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/v2/participants.create_participant.js + * region_tag:dialogflow_v2_generated_Participants_CreateParticipant_async + */ + createParticipant( + request?: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.ICreateParticipantRequest | undefined, + {} | undefined + ] + >; + createParticipant( + request: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.ICreateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createParticipant( + request: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.ICreateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createParticipant( + request?: protos.google.cloud.dialogflow.v2.ICreateParticipantRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.ICreateParticipantRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.ICreateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.ICreateParticipantRequest | 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.createParticipant(request, options, callback); + } + /** + * Retrieves a conversation participant. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the participant. Format: + * `projects//locations//conversations//participants/`. + * @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 [Participant]{@link google.cloud.dialogflow.v2.Participant}. + * 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/v2/participants.get_participant.js + * region_tag:dialogflow_v2_generated_Participants_GetParticipant_async + */ + getParticipant( + request?: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IGetParticipantRequest | undefined, + {} | undefined + ] + >; + getParticipant( + request: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.IGetParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getParticipant( + request: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.IGetParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getParticipant( + request?: protos.google.cloud.dialogflow.v2.IGetParticipantRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.IGetParticipantRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.IGetParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IGetParticipantRequest | 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.getParticipant(request, options, callback); + } + /** + * Updates the specified participant. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Participant} request.participant + * Required. The participant to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to specify which fields to update. + * @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 [Participant]{@link google.cloud.dialogflow.v2.Participant}. + * 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/v2/participants.update_participant.js + * region_tag:dialogflow_v2_generated_Participants_UpdateParticipant_async + */ + updateParticipant( + request?: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest | undefined, + {} | undefined + ] + >; + updateParticipant( + request: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateParticipant( + request: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateParticipant( + request?: protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IParticipant, + | protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IParticipant, + protos.google.cloud.dialogflow.v2.IUpdateParticipantRequest | 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({ + 'participant.name': request.participant!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateParticipant(request, options, callback); + } + /** + * Adds a text (chat, for example), or audio (phone recording, for example) + * message from a participant into the conversation. + * + * Note: Always use agent versions for production traffic + * sent to virtual agents. See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.participant + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + * @param {google.cloud.dialogflow.v2.TextInput} request.textInput + * The natural language text to be processed. + * @param {google.cloud.dialogflow.v2.EventInput} request.eventInput + * An input event to send to Dialogflow. + * @param {google.cloud.dialogflow.v2.OutputAudioConfig} request.replyAudioConfig + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * AnalyzeContent. If this configuration is not supplied, speech synthesis + * is disabled. + * @param {google.cloud.dialogflow.v2.QueryParameters} request.queryParams + * Parameters for a Dialogflow virtual-agent query. + * @param {google.cloud.dialogflow.v2.AssistQueryParameters} request.assistQueryParams + * Parameters for a human assist query. + * @param {google.protobuf.Struct} request.cxParameters + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + * @param {string} request.requestId + * A unique identifier for this request. Restricted to 36 ASCII characters. + * A random UUID is recommended. + * This request is only idempotent if a `request_id` is provided. + * @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 [AnalyzeContentResponse]{@link google.cloud.dialogflow.v2.AnalyzeContentResponse}. + * 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/v2/participants.analyze_content.js + * region_tag:dialogflow_v2_generated_Participants_AnalyzeContent_async + */ + analyzeContent( + request?: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest | undefined, + {} | undefined + ] + >; + analyzeContent( + request: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + | protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + analyzeContent( + request: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + | protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + analyzeContent( + request?: protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + | protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + | protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2.IAnalyzeContentRequest | 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({ + participant: request.participant ?? '', + }); + this.initialize(); + return this.innerApiCalls.analyzeContent(request, options, callback); + } + /** + * Gets suggested articles for a participant based on specific historical + * messages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} [request.latestMessage] + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} [request.contextSize] + * Optional. Max number of messages prior to and including + * {@link google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message|latest_message} to use as context + * when compiling the suggestion. By default 20 and at most 50. + * @param {google.cloud.dialogflow.v2.AssistQueryParameters} request.assistQueryParams + * Parameters for a human assist query. + * @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 [SuggestArticlesResponse]{@link google.cloud.dialogflow.v2.SuggestArticlesResponse}. + * 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/v2/participants.suggest_articles.js + * region_tag:dialogflow_v2_generated_Participants_SuggestArticles_async + */ + suggestArticles( + request?: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest | undefined, + {} | undefined + ] + >; + suggestArticles( + request: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + | protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestArticles( + request: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + | protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestArticles( + request?: protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + | protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + | protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse, + protos.google.cloud.dialogflow.v2.ISuggestArticlesRequest | 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.suggestArticles(request, options, callback); + } + /** + * Gets suggested faq answers for a participant based on specific historical + * messages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} [request.latestMessage] + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} [request.contextSize] + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + * @param {google.cloud.dialogflow.v2.AssistQueryParameters} request.assistQueryParams + * Parameters for a human assist query. + * @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 [SuggestFaqAnswersResponse]{@link google.cloud.dialogflow.v2.SuggestFaqAnswersResponse}. + * 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/v2/participants.suggest_faq_answers.js + * region_tag:dialogflow_v2_generated_Participants_SuggestFaqAnswers_async + */ + suggestFaqAnswers( + request?: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest | undefined, + {} | undefined + ] + >; + suggestFaqAnswers( + request: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + | protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestFaqAnswers( + request: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + | protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestFaqAnswers( + request?: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + | protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + | protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse, + protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersRequest | 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.suggestFaqAnswers(request, options, callback); + } + /** + * Gets smart replies for a participant based on specific historical + * messages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {google.cloud.dialogflow.v2.TextInput} request.currentTextInput + * The current natural language text segment to compile suggestion + * for. This provides a way for user to get follow up smart reply suggestion + * after a smart reply selection, without sending a text message. + * @param {string} request.latestMessage + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} request.contextSize + * Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + * @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 [SuggestSmartRepliesResponse]{@link google.cloud.dialogflow.v2.SuggestSmartRepliesResponse}. + * 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/v2/participants.suggest_smart_replies.js + * region_tag:dialogflow_v2_generated_Participants_SuggestSmartReplies_async + */ + suggestSmartReplies( + request?: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest | undefined, + {} | undefined + ] + >; + suggestSmartReplies( + request: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + | protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestSmartReplies( + request: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + | protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestSmartReplies( + request?: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + | protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + | protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse, + protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesRequest | 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.suggestSmartReplies(request, options, callback); + } + + /** + * Adds a text (chat, for example), or audio (phone recording, for example) + * message from a participant into the conversation. + * Note: This method is only available through the gRPC API (not REST). + * + * The top-level message sent to the client by the server is + * `StreamingAnalyzeContentResponse`. Multiple response messages can be + * returned in order. The first one or more messages contain the + * `recognition_result` field. Each result represents a more complete + * transcript of what the user said. The next message contains the + * `reply_text` field and potentially the `reply_audio` field. The message can + * also contain the `automated_agent_reply` field. + * + * Note: Always use agent versions for production traffic + * sent to virtual agents. See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + * @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 is both readable and writable. It accepts objects + * representing [StreamingAnalyzeContentRequest]{@link google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest} for write() method, and + * will emit objects representing [StreamingAnalyzeContentResponse]{@link google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse} on 'data' event asynchronously. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) + * for more details and examples. + * @example include:samples/generated/v2/participants.streaming_analyze_content.js + * region_tag:dialogflow_v2_generated_Participants_StreamingAnalyzeContent_async + */ + streamingAnalyzeContent(options?: CallOptions): gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingAnalyzeContent(null, options); + } + + /** + * Returns the list of all participants in the specified conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Participant]{@link google.cloud.dialogflow.v2.Participant}. + * 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 `listParticipantsAsync()` + * 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. + */ + listParticipants( + request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IParticipant[], + protos.google.cloud.dialogflow.v2.IListParticipantsRequest | null, + protos.google.cloud.dialogflow.v2.IListParticipantsResponse + ] + >; + listParticipants( + request: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + | protos.google.cloud.dialogflow.v2.IListParticipantsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IParticipant + > + ): void; + listParticipants( + request: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + | protos.google.cloud.dialogflow.v2.IListParticipantsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IParticipant + > + ): void; + listParticipants( + request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + | protos.google.cloud.dialogflow.v2.IListParticipantsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IParticipant + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + | protos.google.cloud.dialogflow.v2.IListParticipantsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IParticipant + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IParticipant[], + protos.google.cloud.dialogflow.v2.IListParticipantsRequest | null, + protos.google.cloud.dialogflow.v2.IListParticipantsResponse + ] + > | 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.listParticipants(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 conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Participant]{@link google.cloud.dialogflow.v2.Participant} 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 `listParticipantsAsync()` + * 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. + */ + listParticipantsStream( + request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + 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['listParticipants']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listParticipants.createStream( + this.innerApiCalls.listParticipants as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listParticipants`, 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 conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Participant]{@link google.cloud.dialogflow.v2.Participant}. 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/v2/participants.list_participants.js + * region_tag:dialogflow_v2_generated_Participants_ListParticipants_async + */ + listParticipantsAsync( + request?: protos.google.cloud.dialogflow.v2.IListParticipantsRequest, + 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['listParticipants']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listParticipants.asyncIterate( + this.innerApiCalls['listParticipants'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.participantsStub && !this._terminated) { + return this.participantsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/participants_client_config.json b/packages/google-cloud-dialogflow/src/v2/participants_client_config.json new file mode 100644 index 00000000000..e81ecec6eea --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/participants_client_config.json @@ -0,0 +1,74 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Participants": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "CreateParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListParticipants": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "AnalyzeContent": { + "timeout_millis": 220000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "StreamingAnalyzeContent": { + "timeout_millis": 220000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SuggestArticles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestFaqAnswers": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestSmartReplies": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/participants_proto_list.json b/packages/google-cloud-dialogflow/src/v2/participants_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/participants_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.ts new file mode 100644 index 00000000000..3fb414e4e39 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/session_entity_types_client.ts @@ -0,0 +1,3826 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2/session_entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './session_entity_types_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.SessionEntityType|SessionEntityTypes}. + * @class + * @memberof v2 + */ +export class SessionEntityTypesClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionEntityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionEntityTypesClient. + * + * @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 SessionEntityTypesClient({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 SessionEntityTypesClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listSessionEntityTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'sessionEntityTypes' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.SessionEntityTypes', + 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.sessionEntityTypesStub) { + return this.sessionEntityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.SessionEntityTypes. + this.sessionEntityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.SessionEntityTypes' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.SessionEntityTypes, + 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 sessionEntityTypesStubMethods = [ + 'listSessionEntityTypes', + 'getSessionEntityType', + 'createSessionEntityType', + 'updateSessionEntityType', + 'deleteSessionEntityType', + ]; + for (const methodName of sessionEntityTypesStubMethods) { + const callPromise = this.sessionEntityTypesStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionEntityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the session entity type. Format: + * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. + * 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/v2/session_entity_types.get_session_entity_type.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_GetSessionEntityType_async + */ + getSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + getSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2.IGetSessionEntityTypeRequest + | 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.getSessionEntityType(request, options, callback); + } + /** + * Creates a session entity type. + * + * If the specified session entity type already exists, overrides the session + * entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to create a session entity type for. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {google.cloud.dialogflow.v2.SessionEntityType} request.sessionEntityType + * Required. The session entity type to create. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. + * 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/v2/session_entity_types.create_session_entity_type.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_CreateSessionEntityType_async + */ + createSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + createSessionEntityType( + request: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createSessionEntityType( + request: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2.ICreateSessionEntityTypeRequest + | 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.createSessionEntityType( + request, + options, + callback + ); + } + /** + * Updates the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.SessionEntityType} request.sessionEntityType + * Required. The session entity type to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. + * 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/v2/session_entity_types.update_session_entity_type.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_UpdateSessionEntityType_async + */ + updateSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.ISessionEntityType, + | protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2.IUpdateSessionEntityTypeRequest + | 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({ + 'session_entity_type.name': request.sessionEntityType!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSessionEntityType( + request, + options, + callback + ); + } + /** + * Deletes the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type to delete. Format: + * `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @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/v2/session_entity_types.delete_session_entity_type.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_DeleteSessionEntityType_async + */ + deleteSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteSessionEntityType( + request?: protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2.IDeleteSessionEntityTypeRequest + | 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.deleteSessionEntityType( + request, + options, + callback + ); + } + + /** + * Returns the list of all session entity types in the specified session. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. + * 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 `listSessionEntityTypesAsync()` + * 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. + */ + listSessionEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISessionEntityType[], + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest | null, + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse + ] + >; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.ISessionEntityType + > + ): void; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.ISessionEntityType + > + ): void; + listSessionEntityTypes( + request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.ISessionEntityType + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.ISessionEntityType + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.ISessionEntityType[], + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest | null, + protos.google.cloud.dialogflow.v2.IListSessionEntityTypesResponse + ] + > | 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.listSessionEntityTypes( + 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 session to list all session entity types from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType} 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 `listSessionEntityTypesAsync()` + * 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. + */ + listSessionEntityTypesStream( + request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + 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['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.createStream( + this.innerApiCalls.listSessionEntityTypes as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listSessionEntityTypes`, 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 session to list all session entity types from. + * Format: `projects//agent/sessions/` or + * `projects//agent/environments//users// + * sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. If `User ID` is not specified, we assume default '-' user. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [SessionEntityType]{@link google.cloud.dialogflow.v2.SessionEntityType}. 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/v2/session_entity_types.list_session_entity_types.js + * region_tag:dialogflow_v2_generated_SessionEntityTypes_ListSessionEntityTypes_async + */ + listSessionEntityTypesAsync( + request?: protos.google.cloud.dialogflow.v2.IListSessionEntityTypesRequest, + 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['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.asyncIterate( + this.innerApiCalls['listSessionEntityTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project: string, session: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.sessionEntityTypesStub && !this._terminated) { + return this.sessionEntityTypesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/session_entity_types_client_config.json b/packages/google-cloud-dialogflow/src/v2/session_entity_types_client_config.json new file mode 100644 index 00000000000..52a412a1243 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/session_entity_types_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.SessionEntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListSessionEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/session_entity_types_proto_list.json b/packages/google-cloud-dialogflow/src/v2/session_entity_types_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/session_entity_types_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/sessions_client.ts b/packages/google-cloud-dialogflow/src/v2/sessions_client.ts new file mode 100644 index 00000000000..d250a85637d --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/sessions_client.ts @@ -0,0 +1,3588 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {PassThrough} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2/sessions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sessions_client_config.json'; +const version = require('../../../package.json').version; + +/** + * A service used for session interactions. + * + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * @class + * @memberof v2 + */ +export class SessionsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionsClient. + * + * @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 SessionsClient({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 SessionsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + streamingDetectIntent: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + opts.fallback === 'rest' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Sessions', + 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.sessionsStub) { + return this.sessionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Sessions. + this.sessionsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Sessions' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Sessions, + 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 sessionsStubMethods = ['detectIntent', 'streamingDetectIntent']; + for (const methodName of sessionsStubMethods) { + const callPromise = this.sessionsStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit( + 'error', + new this._gaxModule.GoogleError( + 'The client has already been closed.' + ) + ); + }); + return stream; + } + 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.stream[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Processes a natural language query and returns structured, actionable data + * as a result. This method is not idempotent, because it may cause contexts + * and session entity types to be updated, which in turn might affect + * results of future queries. + * + * If you might use + * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + * or other CCAI products now or in the future, consider using + * {@link google.cloud.dialogflow.v2.Participants.AnalyzeContent|AnalyzeContent} + * instead of `DetectIntent`. `AnalyzeContent` has additional + * functionality for Agent Assist and other CCAI products. + * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.session + * Required. The name of the session this query is sent to. Format: + * `projects//agent/sessions/`, or + * `projects//agent/environments//users//sessions/`. If `Environment ID` is not specified, we assume + * default 'draft' environment (`Environment ID` might be referred to as + * environment name at some places). If `User ID` is not specified, we are + * using "-". It's up to the API caller to choose an appropriate `Session ID` + * and `User Id`. They can be a random number or some type of user and session + * identifiers (preferably hashed). The length of the `Session ID` and + * `User ID` must not exceed 36 characters. + * + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * @param {google.cloud.dialogflow.v2.QueryParameters} request.queryParams + * The parameters of this query. + * @param {google.cloud.dialogflow.v2.QueryInput} request.queryInput + * Required. The input specification. It can be set to: + * + * 1. an audio config + * which instructs the speech recognizer how to process the speech audio, + * + * 2. a conversational query in the form of text, or + * + * 3. an event that specifies which intent to trigger. + * @param {google.cloud.dialogflow.v2.OutputAudioConfig} request.outputAudioConfig + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + * @param {google.protobuf.FieldMask} request.outputAudioConfigMask + * Mask for {@link google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config|output_audio_config} indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * + * If unspecified or empty, {@link google.cloud.dialogflow.v2.DetectIntentRequest.output_audio_config|output_audio_config} replaces the agent-level + * config in its entirety. + * @param {Buffer} request.inputAudio + * The natural language speech audio to be processed. This field + * should be populated iff `query_input` is set to an input audio config. + * A single request can contain up to 1 minute of speech audio data. + * @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 [DetectIntentResponse]{@link google.cloud.dialogflow.v2.DetectIntentResponse}. + * 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/v2/sessions.detect_intent.js + * region_tag:dialogflow_v2_generated_Sessions_DetectIntent_async + */ + detectIntent( + request?: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest | undefined, + {} | undefined + ] + >; + detectIntent( + request: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + detectIntent( + request: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest | null | undefined, + {} | null | undefined + > + ): void; + detectIntent( + request?: protos.google.cloud.dialogflow.v2.IDetectIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + | protos.google.cloud.dialogflow.v2.IDetectIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2.IDetectIntentRequest | 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({ + session: request.session ?? '', + }); + this.initialize(); + return this.innerApiCalls.detectIntent(request, options, callback); + } + + /** + * Processes a natural language query in audio format in a streaming fashion + * and returns structured, actionable data as a result. This method is only + * available via the gRPC API (not REST). + * + * If you might use + * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + * or other CCAI products now or in the future, consider using + * {@link google.cloud.dialogflow.v2.Participants.StreamingAnalyzeContent|StreamingAnalyzeContent} + * instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has + * additional functionality for Agent Assist and other CCAI products. + * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + * @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 is both readable and writable. It accepts objects + * representing [StreamingDetectIntentRequest]{@link google.cloud.dialogflow.v2.StreamingDetectIntentRequest} for write() method, and + * will emit objects representing [StreamingDetectIntentResponse]{@link google.cloud.dialogflow.v2.StreamingDetectIntentResponse} on 'data' event asynchronously. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) + * for more details and examples. + * @example include:samples/generated/v2/sessions.streaming_detect_intent.js + * region_tag:dialogflow_v2_generated_Sessions_StreamingDetectIntent_async + */ + streamingDetectIntent(options?: CallOptions): gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingDetectIntent(null, options); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSession resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionPath( + project: string, + environment: string, + user: string, + session: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionName( + projectAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match( + projectAgentEnvironmentUserSessionName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionName( + projectAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match( + projectAgentEnvironmentUserSessionName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionName( + projectAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match( + projectAgentEnvironmentUserSessionName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionName( + projectAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match( + projectAgentEnvironmentUserSessionName + ).session; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project: string, session: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionPath( + project: string, + location: string, + environment: string, + user: string, + session: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).session; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentSessionPath( + project: string, + location: string, + session: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.render({ + project: project, + location: location, + session: session, + }); + } + + /** + * Parse the project from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.sessionsStub && !this._terminated) { + return this.sessionsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/sessions_client_config.json b/packages/google-cloud-dialogflow/src/v2/sessions_client_config.json new file mode 100644 index 00000000000..b9c1b92dab2 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/sessions_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Sessions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "DetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "StreamingDetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/sessions_proto_list.json b/packages/google-cloud-dialogflow/src/v2/sessions_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/sessions_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2/versions_client.ts b/packages/google-cloud-dialogflow/src/v2/versions_client.ts new file mode 100644 index 00000000000..c93bf0f86ad --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/versions_client.ts @@ -0,0 +1,3719 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2/versions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './versions_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2.Version|Versions}. + * @class + * @memberof v2 + */ +export class VersionsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + versionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of VersionsClient. + * + * @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 VersionsClient({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 VersionsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + conversationDatasetPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationDatasets/{conversation_dataset}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}' + ), + projectConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationModelPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}' + ), + projectLocationConversationModelEvaluationPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationModels/{conversation_model}/evaluations/{evaluation}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listVersions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'versions' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2.Versions', + 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.versionsStub) { + return this.versionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2.Versions. + this.versionsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2.Versions' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2.Versions, + 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 versionsStubMethods = [ + 'listVersions', + 'getVersion', + 'createVersion', + 'updateVersion', + 'deleteVersion', + ]; + for (const methodName of versionsStubMethods) { + const callPromise = this.versionsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.versionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified agent version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version. + * Supported formats: + * + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @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 [Version]{@link google.cloud.dialogflow.v2.Version}. + * 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/v2/versions.get_version.js + * region_tag:dialogflow_v2_generated_Versions_GetVersion_async + */ + getVersion( + request?: protos.google.cloud.dialogflow.v2.IGetVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest | undefined, + {} | undefined + ] + >; + getVersion( + request: protos.google.cloud.dialogflow.v2.IGetVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest | null | undefined, + {} | null | undefined + > + ): void; + getVersion( + request: protos.google.cloud.dialogflow.v2.IGetVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest | null | undefined, + {} | null | undefined + > + ): void; + getVersion( + request?: protos.google.cloud.dialogflow.v2.IGetVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IVersion, + | protos.google.cloud.dialogflow.v2.IGetVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest | null | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IGetVersionRequest | 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.getVersion(request, options, callback); + } + /** + * Creates an agent version. + * + * The new version points to the agent instance in the "default" environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a version for. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2.Version} request.version + * Required. The version to create. + * @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 [Version]{@link google.cloud.dialogflow.v2.Version}. + * 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/v2/versions.create_version.js + * region_tag:dialogflow_v2_generated_Versions_CreateVersion_async + */ + createVersion( + request?: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.ICreateVersionRequest | undefined, + {} | undefined + ] + >; + createVersion( + request: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + | protos.google.cloud.dialogflow.v2.ICreateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createVersion( + request: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + | protos.google.cloud.dialogflow.v2.ICreateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createVersion( + request?: protos.google.cloud.dialogflow.v2.ICreateVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IVersion, + | protos.google.cloud.dialogflow.v2.ICreateVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + | protos.google.cloud.dialogflow.v2.ICreateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.ICreateVersionRequest | 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.createVersion(request, options, callback); + } + /** + * Updates the specified agent version. + * + * Note that this method does not allow you to update the state of the agent + * the given version points to. It allows you to update only mutable + * properties of the version resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2.Version} request.version + * Required. The version to update. + * Supported formats: + * + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @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 [Version]{@link google.cloud.dialogflow.v2.Version}. + * 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/v2/versions.update_version.js + * region_tag:dialogflow_v2_generated_Versions_UpdateVersion_async + */ + updateVersion( + request?: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IUpdateVersionRequest | undefined, + {} | undefined + ] + >; + updateVersion( + request: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + | protos.google.cloud.dialogflow.v2.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateVersion( + request: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + | protos.google.cloud.dialogflow.v2.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateVersion( + request?: protos.google.cloud.dialogflow.v2.IUpdateVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2.IVersion, + | protos.google.cloud.dialogflow.v2.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2.IVersion, + | protos.google.cloud.dialogflow.v2.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IVersion, + protos.google.cloud.dialogflow.v2.IUpdateVersionRequest | 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({ + 'version.name': request.version!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateVersion(request, options, callback); + } + /** + * Delete the specified agent version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version to delete. + * Supported formats: + * + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @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/v2/versions.delete_version.js + * region_tag:dialogflow_v2_generated_Versions_DeleteVersion_async + */ + deleteVersion( + request?: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteVersionRequest | undefined, + {} | undefined + ] + >; + deleteVersion( + request: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteVersion( + request: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteVersion( + request?: protos.google.cloud.dialogflow.v2.IDeleteVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteVersionRequest | 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.deleteVersion(request, options, callback); + } + + /** + * Returns the list of all versions of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all versions from. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Version]{@link google.cloud.dialogflow.v2.Version}. + * 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 `listVersionsAsync()` + * 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. + */ + listVersions( + request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IVersion[], + protos.google.cloud.dialogflow.v2.IListVersionsRequest | null, + protos.google.cloud.dialogflow.v2.IListVersionsResponse + ] + >; + listVersions( + request: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListVersionsRequest, + | protos.google.cloud.dialogflow.v2.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IVersion + > + ): void; + listVersions( + request: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListVersionsRequest, + | protos.google.cloud.dialogflow.v2.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IVersion + > + ): void; + listVersions( + request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2.IListVersionsRequest, + | protos.google.cloud.dialogflow.v2.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IVersion + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2.IListVersionsRequest, + | protos.google.cloud.dialogflow.v2.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2.IVersion + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2.IVersion[], + protos.google.cloud.dialogflow.v2.IListVersionsRequest | null, + protos.google.cloud.dialogflow.v2.IListVersionsResponse + ] + > | 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.listVersions(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 agent to list all versions from. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Version]{@link google.cloud.dialogflow.v2.Version} 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 `listVersionsAsync()` + * 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. + */ + listVersionsStream( + request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + 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['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.createStream( + this.innerApiCalls.listVersions as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listVersions`, 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 agent to list all versions from. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Version]{@link google.cloud.dialogflow.v2.Version}. 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/v2/versions.list_versions.js + * region_tag:dialogflow_v2_generated_Versions_ListVersions_async + */ + listVersionsAsync( + request?: protos.google.cloud.dialogflow.v2.IListVersionsRequest, + 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['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.asyncIterate( + this.innerApiCalls['listVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified conversationDataset resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_dataset + * @returns {string} Resource name string. + */ + conversationDatasetPath( + project: string, + location: string, + conversationDataset: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.render({ + project: project, + location: location, + conversation_dataset: conversationDataset, + }); + } + + /** + * Parse the project from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).project; + } + + /** + * Parse the location from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationDatasetName(conversationDatasetName: string) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).location; + } + + /** + * Parse the conversation_dataset from ConversationDataset resource. + * + * @param {string} conversationDatasetName + * A fully-qualified path representing ConversationDataset resource. + * @returns {string} A string representing the conversation_dataset. + */ + matchConversationDatasetFromConversationDatasetName( + conversationDatasetName: string + ) { + return this.pathTemplates.conversationDatasetPathTemplate.match( + conversationDatasetName + ).conversation_dataset; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationModel resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectConversationModelPath(project: string, conversationModel: string) { + return this.pathTemplates.projectConversationModelPathTemplate.render({ + project: project, + conversation_model: conversationModel, + }); + } + + /** + * Parse the project from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModel resource. + * + * @param {string} projectConversationModelName + * A fully-qualified path representing project_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelName( + projectConversationModelName: string + ) { + return this.pathTemplates.projectConversationModelPathTemplate.match( + projectConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectConversationModelEvaluationPath( + project: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.render( + { + project: project, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).project; + } + + /** + * Parse the conversation_model from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectConversationModelEvaluation resource. + * + * @param {string} projectConversationModelEvaluationName + * A fully-qualified path representing project_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectConversationModelEvaluationName( + projectConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectConversationModelEvaluationPathTemplate.match( + projectConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @returns {string} Resource name string. + */ + projectLocationConversationModelPath( + project: string, + location: string, + conversationModel: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModel resource. + * + * @param {string} projectLocationConversationModelName + * A fully-qualified path representing project_location_conversation_model resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelName( + projectLocationConversationModelName: string + ) { + return this.pathTemplates.projectLocationConversationModelPathTemplate.match( + projectLocationConversationModelName + ).conversation_model; + } + + /** + * Return a fully-qualified projectLocationConversationModelEvaluation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_model + * @param {string} evaluation + * @returns {string} Resource name string. + */ + projectLocationConversationModelEvaluationPath( + project: string, + location: string, + conversationModel: string, + evaluation: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render( + { + project: project, + location: location, + conversation_model: conversationModel, + evaluation: evaluation, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).location; + } + + /** + * Parse the conversation_model from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the conversation_model. + */ + matchConversationModelFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).conversation_model; + } + + /** + * Parse the evaluation from ProjectLocationConversationModelEvaluation resource. + * + * @param {string} projectLocationConversationModelEvaluationName + * A fully-qualified path representing project_location_conversation_model_evaluation resource. + * @returns {string} A string representing the evaluation. + */ + matchEvaluationFromProjectLocationConversationModelEvaluationName( + projectLocationConversationModelEvaluationName: string + ) { + return this.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match( + projectLocationConversationModelEvaluationName + ).evaluation; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.versionsStub && !this._terminated) { + return this.versionsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/versions_client_config.json b/packages/google-cloud-dialogflow/src/v2/versions_client_config.json new file mode 100644 index 00000000000..db17e434d96 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/versions_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2.Versions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListVersions": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2/versions_proto_list.json b/packages/google-cloud-dialogflow/src/v2/versions_proto_list.json new file mode 100644 index 00000000000..15e06b6def0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2/versions_proto_list.json @@ -0,0 +1,25 @@ +[ + "../../protos/google/cloud/dialogflow/v2/agent.proto", + "../../protos/google/cloud/dialogflow/v2/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2/context.proto", + "../../protos/google/cloud/dialogflow/v2/conversation.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_dataset.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_model.proto", + "../../protos/google/cloud/dialogflow/v2/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2/document.proto", + "../../protos/google/cloud/dialogflow/v2/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/environment.proto", + "../../protos/google/cloud/dialogflow/v2/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2/gcs.proto", + "../../protos/google/cloud/dialogflow/v2/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2/intent.proto", + "../../protos/google/cloud/dialogflow/v2/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2/participant.proto", + "../../protos/google/cloud/dialogflow/v2/session.proto", + "../../protos/google/cloud/dialogflow/v2/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2/version.proto", + "../../protos/google/cloud/dialogflow/v2/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts new file mode 100644 index 00000000000..eda7e0caad3 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/agents_client.ts @@ -0,0 +1,4314 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2beta1/agents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './agents_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Agent|Agents}. + * @class + * @memberof v2beta1 + */ +export class AgentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + agentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AgentsClient. + * + * @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 AgentsClient({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 AgentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + searchAgents: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'agents' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2beta1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2beta1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2beta1/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + { + post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta1/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta1/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const trainAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const trainAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const exportAgentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ExportAgentResponse' + ) as gax.protobuf.Type; + const exportAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const importAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const importAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const restoreAgentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const restoreAgentMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + trainAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + trainAgentResponse.decode.bind(trainAgentResponse), + trainAgentMetadata.decode.bind(trainAgentMetadata) + ), + exportAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportAgentResponse.decode.bind(exportAgentResponse), + exportAgentMetadata.decode.bind(exportAgentMetadata) + ), + importAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importAgentResponse.decode.bind(importAgentResponse), + importAgentMetadata.decode.bind(importAgentMetadata) + ), + restoreAgent: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + restoreAgentResponse.decode.bind(restoreAgentResponse), + restoreAgentMetadata.decode.bind(restoreAgentMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Agents', + 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.agentsStub) { + return this.agentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Agents. + this.agentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Agents' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Agents, + 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 agentsStubMethods = [ + 'getAgent', + 'setAgent', + 'deleteAgent', + 'searchAgents', + 'trainAgent', + 'exportAgent', + 'importAgent', + 'restoreAgent', + 'getValidationResult', + ]; + for (const methodName of agentsStubMethods) { + const callPromise = this.agentsStub.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.agentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to fetch is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @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 [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. + * 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/v2beta1/agents.get_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_GetAgent_async + */ + getAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest | undefined, + {} | undefined + ] + >; + getAgent( + request: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + | protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAgent( + request: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + | protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + | protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + | protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.IGetAgentRequest | 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.getAgent(request, options, callback); + } + /** + * Creates/updates the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Agent} request.agent + * Required. The agent to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @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 [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. + * 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/v2beta1/agents.set_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_SetAgent_async + */ + setAgent( + request?: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest | undefined, + {} | undefined + ] + >; + setAgent( + request: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + | protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setAgent( + request: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + | protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + setAgent( + request?: protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + | protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAgent, + | protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAgent, + protos.google.cloud.dialogflow.v2beta1.ISetAgentRequest | 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({ + 'agent.parent': request.agent!.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.setAgent(request, options, callback); + } + /** + * Deletes the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to delete is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @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/v2beta1/agents.delete_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_DeleteAgent_async + */ + deleteAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest | undefined, + {} | undefined + ] + >; + deleteAgent( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteAgent( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteAgentRequest | 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.deleteAgent(request, options, callback); + } + /** + * Gets agent validation result. Agent validation is performed during + * training time and is updated automatically when training is completed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @param {string} [request.languageCode] + * Optional. The language for which you want a validation result. If not + * specified, the agent's default language is used. [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) + * are supported. Note: languages must be enabled in the agent before they can + * be used. + * @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 [ValidationResult]{@link google.cloud.dialogflow.v2beta1.ValidationResult}. + * 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/v2beta1/agents.get_validation_result.js + * region_tag:dialogflow_v2beta1_generated_Agents_GetValidationResult_async + */ + getValidationResult( + request?: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest + | undefined + ), + {} | undefined + ] + >; + getValidationResult( + request: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + | protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getValidationResult( + request: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + | protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getValidationResult( + request?: protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + | protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + | protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IValidationResult, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetValidationResultRequest + | 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.getValidationResult(request, options, callback); + } + + /** + * Trains the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to train is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @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/v2beta1/agents.train_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_TrainAgent_async + */ + trainAgent( + request?: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + trainAgent( + request: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + trainAgent( + request: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + trainAgent( + request?: protos.google.cloud.dialogflow.v2beta1.ITrainAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.trainAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `trainAgent()`. + * @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/v2beta1/agents.train_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_TrainAgent_async + */ + async checkTrainAgentProgress( + name: string + ): Promise< + LROperation + > { + 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.trainAgent, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Exports the specified agent to a ZIP file. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2beta1.ExportAgentResponse|ExportAgentResponse} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to export is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @param {string} request.agentUri + * Optional. The + * [Google Cloud Storage](https://cloud.google.com/storage/docs/) + * URI to export the agent to. + * The format of this URI must be `gs:///`. + * If left unspecified, the serialized agent is returned inline. + * + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @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/v2beta1/agents.export_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_ExportAgent_async + */ + exportAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + exportAgent( + request: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportAgent( + request: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + exportAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IExportAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >, + 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.exportAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `exportAgent()`. + * @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/v2beta1/agents.export_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_ExportAgent_async + */ + async checkExportAgentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2beta1.ExportAgentResponse, + protos.google.protobuf.Struct + > + > { + 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.exportAgent, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2beta1.ExportAgentResponse, + protos.google.protobuf.Struct + >; + } + /** + * Imports the specified agent from a ZIP file. + * + * Uploads new intents and entity types without deleting the existing ones. + * Intents and entity types with the same name are replaced with the new + * versions from {@link google.cloud.dialogflow.v2beta1.ImportAgentRequest|ImportAgentRequest}. After the import, the imported draft + * agent will be trained automatically (unless disabled in agent settings). + * However, once the import is done, training may not be completed yet. Please + * call {@link google.cloud.dialogflow.v2beta1.Agents.TrainAgent|TrainAgent} and wait for the operation it returns in order to train + * explicitly. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * The operation only tracks when importing is complete, not when it is done + * training. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to import is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @param {string} request.agentUri + * The URI to a Google Cloud Storage file containing the agent to import. + * Note: The URI must start with "gs://". + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @param {Buffer} request.agentContent + * Zip compressed raw byte content for agent. + * @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/v2beta1/agents.import_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_ImportAgent_async + */ + importAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importAgent( + request: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importAgent( + request: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IImportAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.importAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importAgent()`. + * @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/v2beta1/agents.import_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_ImportAgent_async + */ + async checkImportAgentProgress( + name: string + ): Promise< + LROperation + > { + 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.importAgent, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Restores the specified agent from a ZIP file. + * + * Replaces the current agent version with a new one. All the intents and + * entity types in the older version are deleted. After the restore, the + * restored draft agent will be trained automatically (unless disabled in + * agent settings). However, once the restore is done, training may not be + * completed yet. Please call {@link google.cloud.dialogflow.v2beta1.Agents.TrainAgent|TrainAgent} and wait for the operation it + * returns in order to train explicitly. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * The operation only tracks when restoring is complete, not when it is done + * training. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project that the agent to restore is associated with. + * Format: `projects/` or + * `projects//locations/`. + * @param {string} request.agentUri + * The URI to a Google Cloud Storage file containing the agent to restore. + * Note: The URI must start with "gs://". + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @param {Buffer} request.agentContent + * Zip compressed raw byte content for agent. + * @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/v2beta1/agents.restore_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_RestoreAgent_async + */ + restoreAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + restoreAgent( + request: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + restoreAgent( + request: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + restoreAgent( + request?: protos.google.cloud.dialogflow.v2beta1.IRestoreAgentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.restoreAgent(request, options, callback); + } + /** + * Check the status of the long running operation returned by `restoreAgent()`. + * @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/v2beta1/agents.restore_agent.js + * region_tag:dialogflow_v2beta1_generated_Agents_RestoreAgent_async + */ + async checkRestoreAgentProgress( + name: string + ): Promise< + LROperation + > { + 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.restoreAgent, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Returns the list of agents. + * Since there is at most one conversational agent per project, this method is + * useful primarily for listing all agents across projects the caller has + * access to. One can achieve that with a wildcard project collection id "-". + * Refer to [List + * Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list agents from. + * Format: `projects/` or + * `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. + * 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 `searchAgentsAsync()` + * 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. + */ + searchAgents( + request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAgent[], + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest | null, + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse + ] + >; + searchAgents( + request: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + | protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IAgent + > + ): void; + searchAgents( + request: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + | protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IAgent + > + ): void; + searchAgents( + request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + | protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IAgent + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + | protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IAgent + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAgent[], + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest | null, + protos.google.cloud.dialogflow.v2beta1.ISearchAgentsResponse + ] + > | 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.searchAgents(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 to list agents from. + * Format: `projects/` or + * `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [Agent]{@link google.cloud.dialogflow.v2beta1.Agent} 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 `searchAgentsAsync()` + * 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. + */ + searchAgentsStream( + request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + 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['searchAgents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAgents.createStream( + this.innerApiCalls.searchAgents as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `searchAgents`, 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 to list agents from. + * Format: `projects/` or + * `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Agent]{@link google.cloud.dialogflow.v2beta1.Agent}. 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/v2beta1/agents.search_agents.js + * region_tag:dialogflow_v2beta1_generated_Agents_SearchAgents_async + */ + searchAgentsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.ISearchAgentsRequest, + 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['searchAgents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.searchAgents.asyncIterate( + this.innerApiCalls['searchAgents'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.agentsStub && !this._terminated) { + return this.agentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/agents_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/agents_client_config.json new file mode 100644 index 00000000000..b73a09e593a --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/agents_client_config.json @@ -0,0 +1,74 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Agents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "GetAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SetAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SearchAgents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "TrainAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ExportAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ImportAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "RestoreAgent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetValidationResult": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/agents_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/agents_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/agents_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client.ts new file mode 100644 index 00000000000..a51e56d41f0 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client.ts @@ -0,0 +1,3215 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2beta1/answer_records_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './answer_records_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.AnswerRecord|AnswerRecords}. + * @class + * @memberof v2beta1 + */ +export class AnswerRecordsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + answerRecordsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of AnswerRecordsClient. + * + * @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 AnswerRecordsClient({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 AnswerRecordsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listAnswerRecords: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'answerRecords' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.AnswerRecords', + 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.answerRecordsStub) { + return this.answerRecordsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.AnswerRecords. + this.answerRecordsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.AnswerRecords' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.AnswerRecords, + 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 answerRecordsStubMethods = [ + 'getAnswerRecord', + 'listAnswerRecords', + 'updateAnswerRecord', + ]; + for (const methodName of answerRecordsStubMethods) { + const callPromise = this.answerRecordsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.answerRecordsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Deprecated. + * Retrieves a specific answer record. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the answer record to retrieve. + * Format: `projects//locations//answerRecords/`. + * @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 [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. + * 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/v2beta1/answer_records.get_answer_record.js + * region_tag:dialogflow_v2beta1_generated_AnswerRecords_GetAnswerRecord_async + * @deprecated GetAnswerRecord is deprecated and may be removed in a future version. + */ + getAnswerRecord( + request?: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest + | undefined + ), + {} | undefined + ] + >; + getAnswerRecord( + request: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + | protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAnswerRecord( + request: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + | protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getAnswerRecord( + request?: protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + | protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + | protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetAnswerRecordRequest + | 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(); + this.warn( + 'DEP$AnswerRecords-$GetAnswerRecord', + 'GetAnswerRecord is deprecated and may be removed in a future version.', + 'DeprecationWarning' + ); + return this.innerApiCalls.getAnswerRecord(request, options, callback); + } + /** + * Updates the specified answer record. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.AnswerRecord} request.answerRecord + * Required. Answer record to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @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 [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. + * 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/v2beta1/answer_records.update_answer_record.js + * region_tag:dialogflow_v2beta1_generated_AnswerRecords_UpdateAnswerRecord_async + */ + updateAnswerRecord( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest + | undefined + ), + {} | undefined + ] + >; + updateAnswerRecord( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + | protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAnswerRecord( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + | protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateAnswerRecord( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + | protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + | protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateAnswerRecordRequest + | 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({ + 'answer_record.name': request.answerRecord!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateAnswerRecord(request, options, callback); + } + + /** + * Returns the list of all answer records in the specified project in reverse + * chronological order. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {string} [request.filter] + * Optional. Filters to restrict results to specific answer records. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} request.pageSize + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} request.pageToken + * Optional. The + * {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @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 [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. + * 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 `listAnswerRecordsAsync()` + * 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. + */ + listAnswerRecords( + request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[], + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse + ] + >; + listAnswerRecords( + request: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord + > + ): void; + listAnswerRecords( + request: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord + > + ): void; + listAnswerRecords( + request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[], + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsResponse + ] + > | 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.listAnswerRecords(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 to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {string} [request.filter] + * Optional. Filters to restrict results to specific answer records. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} request.pageSize + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} request.pageToken + * Optional. The + * {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @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 [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord} 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 `listAnswerRecordsAsync()` + * 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. + */ + listAnswerRecordsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + 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['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.createStream( + this.innerApiCalls.listAnswerRecords as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listAnswerRecords`, 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 to list all answer records for in reverse + * chronological order. Format: `projects//locations/`. + * @param {string} [request.filter] + * Optional. Filters to restrict results to specific answer records. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} request.pageSize + * Optional. The maximum number of records to return in a single page. + * The server may return fewer records than this. If unspecified, we use 10. + * The maximum is 100. + * @param {string} request.pageToken + * Optional. The + * {@link google.cloud.dialogflow.v2beta1.ListAnswerRecordsResponse.next_page_token|ListAnswerRecordsResponse.next_page_token} + * value returned from a previous list request used to continue listing on + * the next page. + * @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 + * [AnswerRecord]{@link google.cloud.dialogflow.v2beta1.AnswerRecord}. 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/v2beta1/answer_records.list_answer_records.js + * region_tag:dialogflow_v2beta1_generated_AnswerRecords_ListAnswerRecords_async + */ + listAnswerRecordsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListAnswerRecordsRequest, + 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['listAnswerRecords']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnswerRecords.asyncIterate( + this.innerApiCalls['listAnswerRecords'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.answerRecordsStub && !this._terminated) { + return this.answerRecordsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client_config.json new file mode 100644 index 00000000000..34e2ae76e6c --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/answer_records_client_config.json @@ -0,0 +1,44 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.AnswerRecords": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "GetAnswerRecord": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListAnswerRecords": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateAnswerRecord": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/answer_records_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/answer_records_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/answer_records_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts new file mode 100644 index 00000000000..4656ee99c5c --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client.ts @@ -0,0 +1,3575 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2beta1/contexts_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './contexts_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Context|Contexts}. + * @class + * @memberof v2beta1 + */ +export class ContextsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + contextsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ContextsClient. + * + * @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 ContextsClient({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 ContextsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listContexts: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'contexts' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Contexts', + 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.contextsStub) { + return this.contextsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Contexts. + this.contextsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Contexts' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Contexts, + 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 contextsStubMethods = [ + 'listContexts', + 'getContext', + 'createContext', + 'updateContext', + 'deleteContext', + 'deleteAllContexts', + ]; + for (const methodName of contextsStubMethods) { + const callPromise = this.contextsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.contextsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context. Supported formats: + * - `projects//agent/sessions//contexts/`, + * - `projects//locations//agent/sessions//contexts/`, + * - `projects//agent/environments//users//sessions//contexts/`, + * - `projects//locations//agent/environments//users//sessions//contexts/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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 [Context]{@link google.cloud.dialogflow.v2beta1.Context}. + * 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/v2beta1/contexts.get_context.js + * region_tag:dialogflow_v2beta1_generated_Contexts_GetContext_async + */ + getContext( + request?: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IGetContextRequest | undefined, + {} | undefined + ] + >; + getContext( + request: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.IGetContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getContext( + request: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.IGetContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getContext( + request?: protos.google.cloud.dialogflow.v2beta1.IGetContextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.IGetContextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.IGetContextRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IGetContextRequest | 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.getContext(request, options, callback); + } + /** + * Creates a context. + * + * If the specified context already exists, overrides the context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to create a context for. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {google.cloud.dialogflow.v2beta1.Context} request.context + * Required. The context to create. + * @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 [Context]{@link google.cloud.dialogflow.v2beta1.Context}. + * 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/v2beta1/contexts.create_context.js + * region_tag:dialogflow_v2beta1_generated_Contexts_CreateContext_async + */ + createContext( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest | undefined, + {} | undefined + ] + >; + createContext( + request: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createContext( + request: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createContext( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.ICreateContextRequest | 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.createContext(request, options, callback); + } + /** + * Updates the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Context} request.context + * Required. The context to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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 [Context]{@link google.cloud.dialogflow.v2beta1.Context}. + * 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/v2beta1/contexts.update_context.js + * region_tag:dialogflow_v2beta1_generated_Contexts_UpdateContext_async + */ + updateContext( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest | undefined, + {} | undefined + ] + >; + updateContext( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateContext( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateContext( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IContext, + | protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IContext, + protos.google.cloud.dialogflow.v2beta1.IUpdateContextRequest | 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({ + 'context.name': request.context!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateContext(request, options, callback); + } + /** + * Deletes the specified context. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the context to delete. Supported formats: + * - `projects//agent/sessions//contexts/`, + * - `projects//locations//agent/sessions//contexts/`, + * - `projects//agent/environments//users//sessions//contexts/`, + * - `projects//locations//agent/environments//users//sessions//contexts/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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/v2beta1/contexts.delete_context.js + * region_tag:dialogflow_v2beta1_generated_Contexts_DeleteContext_async + */ + deleteContext( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest | undefined, + {} | undefined + ] + >; + deleteContext( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteContext( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteContext( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteContextRequest | 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.deleteContext(request, options, callback); + } + /** + * Deletes all active contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the session to delete all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified we assume default 'draft' environment. If + * `User ID` is not specified, we assume default '-' user. + * @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/v2beta1/contexts.delete_all_contexts.js + * region_tag:dialogflow_v2beta1_generated_Contexts_DeleteAllContexts_async + */ + deleteAllContexts( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest + | undefined + ), + {} | undefined + ] + >; + deleteAllContexts( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteAllContexts( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteAllContexts( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteAllContextsRequest + | 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.deleteAllContexts(request, options, callback); + } + + /** + * Returns the list of all contexts in the specified session. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [Context]{@link google.cloud.dialogflow.v2beta1.Context}. + * 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 `listContextsAsync()` + * 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. + */ + listContexts( + request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IContext[], + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListContextsResponse + ] + >; + listContexts( + request: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListContextsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IContext + > + ): void; + listContexts( + request: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListContextsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IContext + > + ): void; + listContexts( + request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListContextsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IContext + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListContextsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IContext + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IContext[], + protos.google.cloud.dialogflow.v2beta1.IListContextsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListContextsResponse + ] + > | 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.listContexts(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 session to list all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [Context]{@link google.cloud.dialogflow.v2beta1.Context} 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 `listContextsAsync()` + * 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. + */ + listContextsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + 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['listContexts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listContexts.createStream( + this.innerApiCalls.listContexts as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listContexts`, 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 session to list all contexts from. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Context]{@link google.cloud.dialogflow.v2beta1.Context}. 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/v2beta1/contexts.list_contexts.js + * region_tag:dialogflow_v2beta1_generated_Contexts_ListContexts_async + */ + listContextsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListContextsRequest, + 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['listContexts']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listContexts.asyncIterate( + this.innerApiCalls['listContexts'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project: string, session: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.contextsStub && !this._terminated) { + return this.contextsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/contexts_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client_config.json new file mode 100644 index 00000000000..d9e5c1a5b97 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/contexts_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Contexts": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListContexts": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteContext": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteAllContexts": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/contexts_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/contexts_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/contexts_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client.ts new file mode 100644 index 00000000000..48b1dcacef5 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client.ts @@ -0,0 +1,4059 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2beta1/conversation_profiles_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversation_profiles_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.ConversationProfile|ConversationProfiles}. + * @class + * @memberof v2beta1 + */ +export class ConversationProfilesClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + conversationProfilesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationProfilesClient. + * + * @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 ConversationProfilesClient({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 ConversationProfilesClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + cXSecuritySettingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/securitySettings/{security_settings}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listConversationProfiles: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'conversationProfiles' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2beta1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2beta1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2beta1/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + { + post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta1/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta1/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const setSuggestionFeatureConfigResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ConversationProfile' + ) as gax.protobuf.Type; + const setSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata' + ) as gax.protobuf.Type; + const clearSuggestionFeatureConfigResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ConversationProfile' + ) as gax.protobuf.Type; + const clearSuggestionFeatureConfigMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + setSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + setSuggestionFeatureConfigResponse.decode.bind( + setSuggestionFeatureConfigResponse + ), + setSuggestionFeatureConfigMetadata.decode.bind( + setSuggestionFeatureConfigMetadata + ) + ), + clearSuggestionFeatureConfig: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + clearSuggestionFeatureConfigResponse.decode.bind( + clearSuggestionFeatureConfigResponse + ), + clearSuggestionFeatureConfigMetadata.decode.bind( + clearSuggestionFeatureConfigMetadata + ) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.ConversationProfiles', + 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.conversationProfilesStub) { + return this.conversationProfilesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.ConversationProfiles. + this.conversationProfilesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.ConversationProfiles' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1 + .ConversationProfiles, + 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 conversationProfilesStubMethods = [ + 'listConversationProfiles', + 'getConversationProfile', + 'createConversationProfile', + 'updateConversationProfile', + 'deleteConversationProfile', + 'setSuggestionFeatureConfig', + 'clearSuggestionFeatureConfig', + ]; + for (const methodName of conversationProfilesStubMethods) { + const callPromise = this.conversationProfilesStub.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.conversationProfilesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified conversation profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the conversation profile. + * Format: `projects//locations//conversationProfiles/`. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. + * 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/v2beta1/conversation_profiles.get_conversation_profile.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_GetConversationProfile_async + */ + getConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest + | undefined + ), + {} | undefined + ] + >; + getConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetConversationProfileRequest + | 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.getConversationProfile( + request, + options, + callback + ); + } + /** + * Creates a conversation profile in the specified project. + * + * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} + * aren't populated in the response. You can retrieve them via + * {@link google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create a conversation profile for. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} request.conversationProfile + * Required. The conversation profile to create. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. + * 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/v2beta1/conversation_profiles.create_conversation_profile.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_CreateConversationProfile_async + */ + createConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest + | undefined + ), + {} | undefined + ] + >; + createConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationProfileRequest + | 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.createConversationProfile( + request, + options, + callback + ); + } + /** + * Updates the specified conversation profile. + * + * {@link |ConversationProfile.CreateTime} and {@link |ConversationProfile.UpdateTime} + * aren't populated in the response. You can retrieve them via + * {@link google.cloud.dialogflow.v2beta1.ConversationProfiles.GetConversationProfile|GetConversationProfile} API. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.ConversationProfile} request.conversationProfile + * Required. The conversation profile to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields to update. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. + * 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/v2beta1/conversation_profiles.update_conversation_profile.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_UpdateConversationProfile_async + */ + updateConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest + | undefined + ), + {} | undefined + ] + >; + updateConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + | protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateConversationProfileRequest + | 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({ + 'conversation_profile.name': request.conversationProfile!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConversationProfile( + request, + options, + callback + ); + } + /** + * Deletes the specified conversation profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation profile to delete. + * Format: `projects//locations//conversationProfiles/`. + * @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/v2beta1/conversation_profiles.delete_conversation_profile.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_DeleteConversationProfile_async + */ + deleteConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest + | undefined + ), + {} | undefined + ] + >; + deleteConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteConversationProfile( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteConversationProfile( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteConversationProfileRequest + | 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.deleteConversationProfile( + request, + options, + callback + ); + } + + /** + * Adds or updates a suggestion feature in a conversation profile. + * If the conversation profile contains the type of suggestion feature for + * the participant role, it will update it. Otherwise it will insert the + * suggestion feature. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata|SetSuggestionFeatureConfigOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.ConversationProfile|ConversationProfile} + * + * If a long running operation to add or update suggestion feature + * config for the same conversation profile, participant role and suggestion + * feature type exists, please cancel the existing long running operation + * before sending such request, otherwise the request will be rejected. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversationProfile + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + * @param {google.cloud.dialogflow.v2beta1.Participant.Role} request.participantRole + * Required. The participant role to add or update the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + * @param {google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.SuggestionFeatureConfig} request.suggestionFeatureConfig + * Required. The suggestion feature config to add or update. + * @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/v2beta1/conversation_profiles.set_suggestion_feature_config.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async + */ + setSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + setSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + setSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata + >, + 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({ + conversation_profile: request.conversationProfile ?? '', + }); + this.initialize(); + return this.innerApiCalls.setSuggestionFeatureConfig( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `setSuggestionFeatureConfig()`. + * @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/v2beta1/conversation_profiles.set_suggestion_feature_config.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_SetSuggestionFeatureConfig_async + */ + async checkSetSuggestionFeatureConfigProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2beta1.ConversationProfile, + protos.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + > + > { + 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.setSuggestionFeatureConfig, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2beta1.ConversationProfile, + protos.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata + >; + } + /** + * Clears a suggestion feature from a conversation profile for the given + * participant role. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata|ClearSuggestionFeatureConfigOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.ConversationProfile|ConversationProfile} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversationProfile + * Required. The Conversation Profile to add or update the suggestion feature + * config. Format: `projects//locations//conversationProfiles/`. + * @param {google.cloud.dialogflow.v2beta1.Participant.Role} request.participantRole + * Required. The participant role to remove the suggestion feature + * config. Only HUMAN_AGENT or END_USER can be used. + * @param {google.cloud.dialogflow.v2beta1.SuggestionFeature.Type} request.suggestionFeatureType + * Required. The type of the suggestion feature to remove. + * @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/v2beta1/conversation_profiles.clear_suggestion_feature_config.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async + */ + clearSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + clearSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + clearSuggestionFeatureConfig( + request: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + clearSuggestionFeatureConfig( + request?: protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata + >, + 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({ + conversation_profile: request.conversationProfile ?? '', + }); + this.initialize(); + return this.innerApiCalls.clearSuggestionFeatureConfig( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `clearSuggestionFeatureConfig()`. + * @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/v2beta1/conversation_profiles.clear_suggestion_feature_config.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_ClearSuggestionFeatureConfig_async + */ + async checkClearSuggestionFeatureConfigProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2beta1.ConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + > + > { + 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.clearSuggestionFeatureConfig, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2beta1.ConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata + >; + } + /** + * Returns the list of all conversation profiles in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. + * 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 `listConversationProfilesAsync()` + * 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. + */ + listConversationProfiles( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile[], + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse + ] + >; + listConversationProfiles( + request: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IConversationProfile + > + ): void; + listConversationProfiles( + request: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IConversationProfile + > + ): void; + listConversationProfiles( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IConversationProfile + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IConversationProfile + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversationProfile[], + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesResponse + ] + > | 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.listConversationProfiles( + 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 to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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 [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile} 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 `listConversationProfilesAsync()` + * 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. + */ + listConversationProfilesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + 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['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.createStream( + this.innerApiCalls.listConversationProfiles as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listConversationProfiles`, 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 to list all conversation profiles from. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @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 + * [ConversationProfile]{@link google.cloud.dialogflow.v2beta1.ConversationProfile}. 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/v2beta1/conversation_profiles.list_conversation_profiles.js + * region_tag:dialogflow_v2beta1_generated_ConversationProfiles_ListConversationProfiles_async + */ + listConversationProfilesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationProfilesRequest, + 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['listConversationProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversationProfiles.asyncIterate( + this.innerApiCalls['listConversationProfiles'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified cXSecuritySettings resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} security_settings + * @returns {string} Resource name string. + */ + cXSecuritySettingsPath( + project: string, + location: string, + securitySettings: string + ) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.render({ + project: project, + location: location, + security_settings: securitySettings, + }); + } + + /** + * Parse the project from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match( + cXSecuritySettingsName + ).project; + } + + /** + * Parse the location from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the location. + */ + matchLocationFromCXSecuritySettingsName(cXSecuritySettingsName: string) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match( + cXSecuritySettingsName + ).location; + } + + /** + * Parse the security_settings from CXSecuritySettings resource. + * + * @param {string} cXSecuritySettingsName + * A fully-qualified path representing CXSecuritySettings resource. + * @returns {string} A string representing the security_settings. + */ + matchSecuritySettingsFromCXSecuritySettingsName( + cXSecuritySettingsName: string + ) { + return this.pathTemplates.cXSecuritySettingsPathTemplate.match( + cXSecuritySettingsName + ).security_settings; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.conversationProfilesStub && !this._terminated) { + return this.conversationProfilesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client_config.json new file mode 100644 index 00000000000..080a39ac373 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.ConversationProfiles": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListConversationProfiles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteConversationProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SetSuggestionFeatureConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ClearSuggestionFeatureConfig": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/conversation_profiles_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/conversations_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/conversations_client.ts new file mode 100644 index 00000000000..1d8b57c76ba --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/conversations_client.ts @@ -0,0 +1,3818 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2beta1/conversations_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './conversations_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Conversation|Conversations}. + * @class + * @memberof v2beta1 + */ +export class ConversationsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + conversationsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ConversationsClient. + * + * @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 ConversationsClient({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 ConversationsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listConversations: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'conversations' + ), + listMessages: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'messages' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Conversations', + 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.conversationsStub) { + return this.conversationsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Conversations. + this.conversationsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Conversations' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Conversations, + 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 conversationsStubMethods = [ + 'createConversation', + 'listConversations', + 'getConversation', + 'completeConversation', + 'batchCreateMessages', + 'listMessages', + 'suggestConversationSummary', + ]; + for (const methodName of conversationsStubMethods) { + const callPromise = this.conversationsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.conversationsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 a new conversation. Conversations are auto-completed after 24 + * hours. + * + * Conversation Lifecycle: + * There are two stages during a conversation: Automated Agent Stage and + * Assist Stage. + * + * For Automated Agent Stage, there will be a dialogflow agent responding to + * user queries. + * + * For Assist Stage, there's no dialogflow agent responding to user queries. + * But we will provide suggestions which are generated from conversation. + * + * If {@link google.cloud.dialogflow.v2beta1.Conversation.conversation_profile|Conversation.conversation_profile} is configured for a dialogflow + * agent, conversation will start from `Automated Agent Stage`, otherwise, it + * will start from `Assist Stage`. And during `Automated Agent Stage`, once an + * {@link google.cloud.dialogflow.v2beta1.Intent|Intent} with {@link google.cloud.dialogflow.v2beta1.Intent.live_agent_handoff|Intent.live_agent_handoff} is triggered, conversation + * will transfer to Assist Stage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the project creating the conversation. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2beta1.Conversation} request.conversation + * Required. The conversation to create. + * @param {string} [request.conversationId] + * Optional. Identifier of the conversation. Generally it's auto generated by Google. + * Only set it if you cannot wait for the response to return a + * auto-generated one to you. + * + * The conversation ID must be compliant with the regression fomula + * "{@link a-zA-Z0-9_-|a-zA-Z}*" with the characters length in range of [3,64]. + * If the field is provided, the caller is resposible for + * 1. the uniqueness of the ID, otherwise the request will be rejected. + * 2. the consistency for whether to use custom ID or not under a project to + * better ensure uniqueness. + * @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 [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. + * 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/v2beta1/conversations.create_conversation.js + * region_tag:dialogflow_v2beta1_generated_Conversations_CreateConversation_async + */ + createConversation( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversation, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest + | undefined + ), + {} | undefined + ] + >; + createConversation( + request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createConversation( + request: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createConversation( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversation, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateConversationRequest + | 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.createConversation(request, options, callback); + } + /** + * Retrieves the specific conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation. Format: + * `projects//locations//conversations/`. + * @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 [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. + * 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/v2beta1/conversations.get_conversation.js + * region_tag:dialogflow_v2beta1_generated_Conversations_GetConversation_async + */ + getConversation( + request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversation, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest + | undefined + ), + {} | undefined + ] + >; + getConversation( + request: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversation( + request: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getConversation( + request?: protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversation, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetConversationRequest + | 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.getConversation(request, options, callback); + } + /** + * Completes the specified conversation. Finished conversations are purged + * from the database after 30 days. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Resource identifier of the conversation to close. + * Format: `projects//locations//conversations/`. + * @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 [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. + * 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/v2beta1/conversations.complete_conversation.js + * region_tag:dialogflow_v2beta1_generated_Conversations_CompleteConversation_async + */ + completeConversation( + request?: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversation, + ( + | protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest + | undefined + ), + {} | undefined + ] + >; + completeConversation( + request: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + completeConversation( + request: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest + | null + | undefined, + {} | null | undefined + > + ): void; + completeConversation( + request?: protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IConversation, + | protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversation, + ( + | protos.google.cloud.dialogflow.v2beta1.ICompleteConversationRequest + | 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.completeConversation(request, options, callback); + } + /** + * Batch ingests messages to conversation. Customers can use this RPC to + * ingest historical messages to conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the conversation to create message. + * Format: `projects//locations//conversations/`. + * @param {number[]} request.requests + * Required. A maximum of 1000 Messages can be created in a batch. + * {@link |CreateMessageRequest.message.send_time} is required. All created + * messages will have identical {@link google.cloud.dialogflow.v2beta1.Message.create_time|Message.create_time}. + * @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 [BatchCreateMessagesResponse]{@link google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse}. + * 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/v2beta1/conversations.batch_create_messages.js + * region_tag:dialogflow_v2beta1_generated_Conversations_BatchCreateMessages_async + */ + batchCreateMessages( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest + | undefined + ), + {} | undefined + ] + >; + batchCreateMessages( + request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + | protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + batchCreateMessages( + request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + | protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + batchCreateMessages( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + | protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + | protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesRequest + | 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.batchCreateMessages(request, options, callback); + } + /** + * Suggest summary for a conversation based on specific historical messages. + * The range of the messages to be used for summary can be specified in the + * request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.conversation + * Required. The conversation to fetch suggestion for. + * Format: `projects//locations//conversations/`. + * @param {string} request.latestMessage + * The name of the latest conversation message used as context for + * compiling suggestion. If empty, the latest message of the conversation will + * be used. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} request.contextSize + * Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 500 and at most 1000. + * @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 [SuggestConversationSummaryResponse]{@link google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse}. + * 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/v2beta1/conversations.suggest_conversation_summary.js + * region_tag:dialogflow_v2beta1_generated_Conversations_SuggestConversationSummary_async + */ + suggestConversationSummary( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest + | undefined + ), + {} | undefined + ] + >; + suggestConversationSummary( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestConversationSummary( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestConversationSummary( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryRequest + | 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({ + conversation: request.conversation ?? '', + }); + this.initialize(); + return this.innerApiCalls.suggestConversationSummary( + request, + options, + callback + ); + } + + /** + * Returns the list of all conversations in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project from which to list all conversation. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. + * 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 `listConversationsAsync()` + * 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. + */ + listConversations( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversation[], + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse + ] + >; + listConversations( + request: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IConversation + > + ): void; + listConversations( + request: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IConversation + > + ): void; + listConversations( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IConversation + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IConversation + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IConversation[], + protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListConversationsResponse + ] + > | 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.listConversations(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 to list all conversation. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation} 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 `listConversationsAsync()` + * 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. + */ + listConversationsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + 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['listConversations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversations.createStream( + this.innerApiCalls.listConversations as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listConversations`, 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 to list all conversation. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * A filter expression that filters conversations listed in the response. In + * general, the expression must specify the field name, a comparison operator, + * and the value to use for filtering: + *
    + *
  • The value must be a string, a number, or a boolean.
  • + *
  • The comparison operator must be either `=`,`!=`, `>`, or `<`.
  • + *
  • To filter on multiple expressions, separate the + * expressions with `AND` or `OR` (omitting both implies `AND`).
  • + *
  • For clarity, expressions can be enclosed in parentheses.
  • + *
+ * Only `lifecycle_state` can be filtered on in this way. For example, + * the following expression only returns `COMPLETED` conversations: + * + * `lifecycle_state = "COMPLETED"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 + * [Conversation]{@link google.cloud.dialogflow.v2beta1.Conversation}. 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/v2beta1/conversations.list_conversations.js + * region_tag:dialogflow_v2beta1_generated_Conversations_ListConversations_async + */ + listConversationsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListConversationsRequest, + 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['listConversations']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConversations.asyncIterate( + this.innerApiCalls['listConversations'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists messages that belong to a given conversation. + * `messages` are ordered by `create_time` in descending order. To fetch + * updates without duplication, send request with filter + * `create_time_epoch_microseconds > + * [first item's create_time of previous request]` and empty page_token. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} request.filter + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [Message]{@link google.cloud.dialogflow.v2beta1.Message}. + * 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 `listMessagesAsync()` + * 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. + */ + listMessages( + request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IMessage[], + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse + ] + >; + listMessages( + request: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IMessage + > + ): void; + listMessages( + request: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IMessage + > + ): void; + listMessages( + request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IMessage + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IMessage + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IMessage[], + protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListMessagesResponse + ] + > | 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.listMessages(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 name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} request.filter + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [Message]{@link google.cloud.dialogflow.v2beta1.Message} 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 `listMessagesAsync()` + * 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. + */ + listMessagesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + 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['listMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMessages.createStream( + this.innerApiCalls.listMessages as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listMessages`, 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 name of the conversation to list messages for. + * Format: `projects//locations//conversations/` + * @param {string} request.filter + * Optional. Filter on message fields. Currently predicates on `create_time` + * and `create_time_epoch_microseconds` are supported. `create_time` only + * support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"`. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Message]{@link google.cloud.dialogflow.v2beta1.Message}. 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/v2beta1/conversations.list_messages.js + * region_tag:dialogflow_v2beta1_generated_Conversations_ListMessages_async + */ + listMessagesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListMessagesRequest, + 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['listMessages']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMessages.asyncIterate( + this.innerApiCalls['listMessages'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.conversationsStub && !this._terminated) { + return this.conversationsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/conversations_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/conversations_client_config.json new file mode 100644 index 00000000000..62968c0bd5e --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/conversations_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Conversations": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "CreateConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListConversations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CompleteConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchCreateMessages": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListMessages": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestConversationSummary": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/conversations_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/conversations_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/conversations_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts new file mode 100644 index 00000000000..93420b014fc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/documents_client.ts @@ -0,0 +1,4222 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2beta1/documents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './documents_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing knowledge {@link google.cloud.dialogflow.v2beta1.Document|Documents}. + * @class + * @memberof v2beta1 + */ +export class DocumentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + documentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DocumentsClient. + * + * @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 DocumentsClient({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 DocumentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listDocuments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'documents' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2beta1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2beta1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2beta1/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + { + post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta1/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta1/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.Document' + ) as gax.protobuf.Type; + const createDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + const importDocumentsResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.ImportDocumentsResponse' + ) as gax.protobuf.Type; + const importDocumentsMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + const deleteDocumentResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const deleteDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + const updateDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.Document' + ) as gax.protobuf.Type; + const updateDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + const reloadDocumentResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.Document' + ) as gax.protobuf.Type; + const reloadDocumentMetadata = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createDocumentResponse.decode.bind(createDocumentResponse), + createDocumentMetadata.decode.bind(createDocumentMetadata) + ), + importDocuments: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + importDocumentsResponse.decode.bind(importDocumentsResponse), + importDocumentsMetadata.decode.bind(importDocumentsMetadata) + ), + deleteDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteDocumentResponse.decode.bind(deleteDocumentResponse), + deleteDocumentMetadata.decode.bind(deleteDocumentMetadata) + ), + updateDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateDocumentResponse.decode.bind(updateDocumentResponse), + updateDocumentMetadata.decode.bind(updateDocumentMetadata) + ), + reloadDocument: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + reloadDocumentResponse.decode.bind(reloadDocumentResponse), + reloadDocumentMetadata.decode.bind(reloadDocumentMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Documents', + 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.documentsStub) { + return this.documentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Documents. + this.documentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Documents' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Documents, + 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 documentsStubMethods = [ + 'listDocuments', + 'getDocument', + 'createDocument', + 'importDocuments', + 'deleteDocument', + 'updateDocument', + 'reloadDocument', + ]; + for (const methodName of documentsStubMethods) { + const callPromise = this.documentsStub.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.documentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified document. + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to retrieve. + * Format `projects//locations//knowledgeBases//documents/`. + * @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 [Document]{@link google.cloud.dialogflow.v2beta1.Document}. + * 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/v2beta1/documents.get_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_GetDocument_async + */ + getDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest | undefined, + {} | undefined + ] + >; + getDocument( + request: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IDocument, + | protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getDocument( + request: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IDocument, + | protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IDocument, + | protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IDocument, + | protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IGetDocumentRequest | 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.getDocument(request, options, callback); + } + + /** + * Creates a new document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.Document|Document} + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to create a document for. + * Format: `projects//locations//knowledgeBases/`. + * @param {google.cloud.dialogflow.v2beta1.Document} request.document + * Required. The document to create. + * @param {boolean} request.importGcsCustomMetadata + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * @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/v2beta1/documents.create_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_CreateDocument_async + */ + createDocument( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + createDocument( + request: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createDocument( + request: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + createDocument( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + 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.createDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createDocument()`. + * @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/v2beta1/documents.create_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_CreateDocument_async + */ + async checkCreateDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2beta1.Document, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + > + > { + 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.createDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2beta1.Document, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + >; + } + /** + * Create documents by importing data from external sources. + * Dialogflow supports up to 350 documents in each request. If you try to + * import more, Dialogflow will return an error. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.ImportDocumentsResponse|ImportDocumentsResponse} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to import documents into. + * Format: `projects//locations//knowledgeBases/`. + * @param {google.cloud.dialogflow.v2beta1.GcsSources} request.gcsSource + * The Google Cloud Storage location for the documents. + * The path can include a wildcard. + * + * These URIs may have the forms + * `gs:///`. + * `gs:////*.`. + * @param {google.cloud.dialogflow.v2beta1.ImportDocumentTemplate} request.documentTemplate + * Required. Document template used for importing all the documents. + * @param {boolean} request.importGcsCustomMetadata + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * @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/v2beta1/documents.import_documents.js + * region_tag:dialogflow_v2beta1_generated_Documents_ImportDocuments_async + */ + importDocuments( + request?: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + importDocuments( + request: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importDocuments( + request: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + importDocuments( + request?: protos.google.cloud.dialogflow.v2beta1.IImportDocumentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + 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.importDocuments(request, options, callback); + } + /** + * Check the status of the long running operation returned by `importDocuments()`. + * @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/v2beta1/documents.import_documents.js + * region_tag:dialogflow_v2beta1_generated_Documents_ImportDocuments_async + */ + async checkImportDocumentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2beta1.ImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + > + > { + 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.importDocuments, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2beta1.ImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + >; + } + /** + * Deletes the specified document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to delete. + * Format: `projects//locations//knowledgeBases//documents/`. + * @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/v2beta1/documents.delete_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_DeleteDocument_async + */ + deleteDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + deleteDocument( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteDocument( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + deleteDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteDocument()`. + * @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/v2beta1/documents.delete_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_DeleteDocument_async + */ + async checkDeleteDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + > + > { + 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.deleteDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + >; + } + /** + * Updates the specified document. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.Document|Document} + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Document} request.document + * Required. The document to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + * @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/v2beta1/documents.update_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_UpdateDocument_async + */ + updateDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + updateDocument( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateDocument( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + updateDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + 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({ + 'document.name': request.document!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateDocument()`. + * @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/v2beta1/documents.update_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_UpdateDocument_async + */ + async checkUpdateDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2beta1.Document, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + > + > { + 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.updateDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2beta1.Document, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + >; + } + /** + * Reloads the specified document from its specified source, content_uri or + * content. The previously loaded content of the document will be deleted. + * Note: Even when the content of the document has not changed, there still + * may be side effects because of internal implementation changes. + * Note: If the document source is Google Cloud Storage URI, its metadata will + * be replaced with the custom metadata from Google Cloud Storage if the + * `import_gcs_custom_metadata` field is set to true in the request. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: {@link google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata|KnowledgeOperationMetadata} + * - `response`: {@link google.cloud.dialogflow.v2beta1.Document|Document} + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the document to reload. + * Format: `projects//locations//knowledgeBases//documents/` + * @param {google.cloud.dialogflow.v2beta1.GcsSource} request.gcsSource + * The path for a Cloud Storage source file for reloading document content. + * If not provided, the Document's existing source will be reloaded. + * @param {boolean} request.importGcsCustomMetadata + * Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * @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/v2beta1/documents.reload_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_ReloadDocument_async + */ + reloadDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + reloadDocument( + request: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reloadDocument( + request: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + reloadDocument( + request?: protos.google.cloud.dialogflow.v2beta1.IReloadDocumentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >, + 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({ + name: request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.reloadDocument(request, options, callback); + } + /** + * Check the status of the long running operation returned by `reloadDocument()`. + * @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/v2beta1/documents.reload_document.js + * region_tag:dialogflow_v2beta1_generated_Documents_ReloadDocument_async + */ + async checkReloadDocumentProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2beta1.Document, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + > + > { + 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.reloadDocument, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2beta1.Document, + protos.google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + >; + } + /** + * Returns the list of all documents of the knowledge base. + * + * Note: The `projects.agent.knowledgeBases.documents` resource is deprecated; + * only use `projects.knowledgeBases.documents`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Document]{@link google.cloud.dialogflow.v2beta1.Document}. + * 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 `listDocumentsAsync()` + * 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. + */ + listDocuments( + request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IDocument[], + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse + ] + >; + listDocuments( + request: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IDocument + > + ): void; + listDocuments( + request: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IDocument + > + ): void; + listDocuments( + request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IDocument + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IDocument + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IDocument[], + protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListDocumentsResponse + ] + > | 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.listDocuments(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 knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Document]{@link google.cloud.dialogflow.v2beta1.Document} 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 `listDocumentsAsync()` + * 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. + */ + listDocumentsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + 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['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDocuments.createStream( + this.innerApiCalls.listDocuments as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listDocuments`, 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 knowledge base to list all documents for. + * Format: `projects//locations//knowledgeBases/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 + * [Document]{@link google.cloud.dialogflow.v2beta1.Document}. 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/v2beta1/documents.list_documents.js + * region_tag:dialogflow_v2beta1_generated_Documents_ListDocuments_async + */ + listDocumentsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListDocumentsRequest, + 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['listDocuments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listDocuments.asyncIterate( + this.innerApiCalls['listDocuments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.documentsStub && !this._terminated) { + return this.documentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/documents_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/documents_client_config.json new file mode 100644 index 00000000000..994669432ce --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/documents_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Documents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ImportDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ReloadDocument": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/documents_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/documents_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/documents_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts new file mode 100644 index 00000000000..0bba8c743b8 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client.ts @@ -0,0 +1,4551 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2beta1/entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './entity_types_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.EntityType|EntityTypes}. + * @class + * @memberof v2beta1 + */ +export class EntityTypesClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + entityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EntityTypesClient. + * + * @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 EntityTypesClient({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 EntityTypesClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listEntityTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'entityTypes' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2beta1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2beta1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2beta1/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + { + post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta1/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta1/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const batchUpdateEntityTypesResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse' + ) as gax.protobuf.Type; + const batchUpdateEntityTypesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchDeleteEntityTypesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchDeleteEntityTypesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchCreateEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchCreateEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchUpdateEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchUpdateEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchDeleteEntitiesResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchDeleteEntitiesMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchUpdateEntityTypes: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateEntityTypesResponse.decode.bind( + batchUpdateEntityTypesResponse + ), + batchUpdateEntityTypesMetadata.decode.bind( + batchUpdateEntityTypesMetadata + ) + ), + batchDeleteEntityTypes: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteEntityTypesResponse.decode.bind( + batchDeleteEntityTypesResponse + ), + batchDeleteEntityTypesMetadata.decode.bind( + batchDeleteEntityTypesMetadata + ) + ), + batchCreateEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchCreateEntitiesResponse.decode.bind(batchCreateEntitiesResponse), + batchCreateEntitiesMetadata.decode.bind(batchCreateEntitiesMetadata) + ), + batchUpdateEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateEntitiesResponse.decode.bind(batchUpdateEntitiesResponse), + batchUpdateEntitiesMetadata.decode.bind(batchUpdateEntitiesMetadata) + ), + batchDeleteEntities: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteEntitiesResponse.decode.bind(batchDeleteEntitiesResponse), + batchDeleteEntitiesMetadata.decode.bind(batchDeleteEntitiesMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.EntityTypes', + 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.entityTypesStub) { + return this.entityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.EntityTypes. + this.entityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.EntityTypes' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.EntityTypes, + 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 entityTypesStubMethods = [ + 'listEntityTypes', + 'getEntityType', + 'createEntityType', + 'updateEntityType', + 'deleteEntityType', + 'batchUpdateEntityTypes', + 'batchDeleteEntityTypes', + 'batchCreateEntities', + 'batchUpdateEntities', + 'batchDeleteEntities', + ]; + for (const methodName of entityTypesStubMethods) { + const callPromise = this.entityTypesStub.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.entityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified entity type. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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 [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. + * 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/v2beta1/entity_types.get_entity_type.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_GetEntityType_async + */ + getEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest | undefined, + {} | undefined + ] + >; + getEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + protos.google.cloud.dialogflow.v2beta1.IGetEntityTypeRequest | 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.getEntityType(request, options, callback); + } + /** + * Creates an entity type in the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a entity type for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2beta1.EntityType} request.entityType + * Required. The entity type to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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 [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. + * 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/v2beta1/entity_types.create_entity_type.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_CreateEntityType_async + */ + createEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + createEntityType( + request: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createEntityType( + request: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateEntityTypeRequest + | 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.createEntityType(request, options, callback); + } + /** + * Updates the specified entity type. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.EntityType} request.entityType + * Required. The entity type to update. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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 [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. + * 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/v2beta1/entity_types.update_entity_type.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_UpdateEntityType_async + */ + updateEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + updateEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEntityType, + | protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateEntityTypeRequest + | 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({ + 'entity_type.name': request.entityType!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEntityType(request, options, callback); + } + /** + * Deletes the specified entity type. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type to delete. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @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/v2beta1/entity_types.delete_entity_type.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_DeleteEntityType_async + */ + deleteEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + deleteEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteEntityTypeRequest + | 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.deleteEntityType(request, options, callback); + } + + /** + * Updates/Creates multiple entity types in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse|BatchUpdateEntityTypesResponse} + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to update or create entity types in. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} request.entityTypeBatchUri + * The URI to a Google Cloud Storage file containing entity types to update + * or create. The file format can either be a serialized proto (of + * EntityBatch type) or a JSON object. Note: The URI must start with + * "gs://". + * @param {google.cloud.dialogflow.v2beta1.EntityTypeBatch} request.entityTypeBatchInline + * The collection of entity types to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The mask to control which fields get updated. + * @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/v2beta1/entity_types.batch_update_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async + */ + batchUpdateEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchUpdateEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >, + 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.batchUpdateEntityTypes( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `batchUpdateEntityTypes()`. + * @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/v2beta1/entity_types.batch_update_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntityTypes_async + */ + async checkBatchUpdateEntityTypesProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse, + protos.google.protobuf.Struct + > + > { + 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.batchUpdateEntityTypes, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse, + protos.google.protobuf.Struct + >; + } + /** + * Deletes entity types in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to delete all entities types for. + * Supported formats: + * - `projects//agent`, + * - `projects//locations//agent`. + * @param {string[]} request.entityTypeNames + * Required. The names entity types to delete. All names must point to the + * same agent as `parent`. + * @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/v2beta1/entity_types.batch_delete_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async + */ + batchDeleteEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchDeleteEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchDeleteEntityTypes( + request, + options, + callback + ); + } + /** + * Check the status of the long running operation returned by `batchDeleteEntityTypes()`. + * @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/v2beta1/entity_types.batch_delete_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntityTypes_async + */ + async checkBatchDeleteEntityTypesProgress( + name: string + ): Promise< + LROperation + > { + 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.batchDeleteEntityTypes, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Creates multiple new entities in the specified entity type. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @param {number[]} request.entities + * Required. The entities to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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/v2beta1/entity_types.batch_create_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async + */ + batchCreateEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchCreateEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchCreateEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchCreateEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateEntitiesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchCreateEntities(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchCreateEntities()`. + * @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/v2beta1/entity_types.batch_create_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchCreateEntities_async + */ + async checkBatchCreateEntitiesProgress( + name: string + ): Promise< + LROperation + > { + 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.batchCreateEntities, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Updates or creates multiple entities in the specified entity type. This + * method does not affect entities in the entity type that aren't explicitly + * specified in the request. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to update or create entities in. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @param {number[]} request.entities + * Required. The entities to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @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/v2beta1/entity_types.batch_update_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async + */ + batchUpdateEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchUpdateEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntitiesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchUpdateEntities(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchUpdateEntities()`. + * @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/v2beta1/entity_types.batch_update_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchUpdateEntities_async + */ + async checkBatchUpdateEntitiesProgress( + name: string + ): Promise< + LROperation + > { + 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.batchUpdateEntities, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Deletes entities in the specified entity type. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the entity type to delete entries for. + * Supported formats: + * - `projects//agent/entityTypes/` + * - `projects//locations//agent/entityTypes/` + * @param {string[]} request.entityValues + * Required. The reference `values` of the entities to delete. Note that + * these are not fully-qualified names, i.e. they don't start with + * `projects/`. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @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/v2beta1/entity_types.batch_delete_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async + */ + batchDeleteEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchDeleteEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteEntities( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteEntities( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteEntitiesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchDeleteEntities(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchDeleteEntities()`. + * @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/v2beta1/entity_types.batch_delete_entities.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_BatchDeleteEntities_async + */ + async checkBatchDeleteEntitiesProgress( + name: string + ): Promise< + LROperation + > { + 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.batchDeleteEntities, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Returns the list of all entity types in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all entity types from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. + * 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 `listEntityTypesAsync()` + * 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. + */ + listEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEntityType[], + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse + ] + >; + listEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IEntityType + > + ): void; + listEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IEntityType + > + ): void; + listEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IEntityType + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IEntityType + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEntityType[], + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListEntityTypesResponse + ] + > | 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.listEntityTypes(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 agent to list all entity types from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType} 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 `listEntityTypesAsync()` + * 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. + */ + listEntityTypesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + 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['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.createStream( + this.innerApiCalls.listEntityTypes as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listEntityTypes`, 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 agent to list all entity types from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [EntityType]{@link google.cloud.dialogflow.v2beta1.EntityType}. 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/v2beta1/entity_types.list_entity_types.js + * region_tag:dialogflow_v2beta1_generated_EntityTypes_ListEntityTypes_async + */ + listEntityTypesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListEntityTypesRequest, + 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['listEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEntityTypes.asyncIterate( + this.innerApiCalls['listEntityTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.entityTypesStub && !this._terminated) { + return this.entityTypesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client_config.json new file mode 100644 index 00000000000..987e4260c42 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_client_config.json @@ -0,0 +1,79 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.EntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchCreateEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteEntities": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/entity_types_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/entity_types_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts new file mode 100644 index 00000000000..4902ef7ded2 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/environments_client.ts @@ -0,0 +1,3612 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2beta1/environments_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './environments_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Environment|Environments}. + * @class + * @memberof v2beta1 + */ +export class EnvironmentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + environmentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of EnvironmentsClient. + * + * @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 EnvironmentsClient({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 EnvironmentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listEnvironments: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'environments' + ), + getEnvironmentHistory: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'entries' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Environments', + 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.environmentsStub) { + return this.environmentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Environments. + this.environmentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Environments' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Environments, + 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 environmentsStubMethods = [ + 'listEnvironments', + 'getEnvironment', + 'createEnvironment', + 'updateEnvironment', + 'deleteEnvironment', + 'getEnvironmentHistory', + ]; + for (const methodName of environmentsStubMethods) { + const callPromise = this.environmentsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.environmentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the environment. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @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 [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. + * 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/v2beta1/environments.get_environment.js + * region_tag:dialogflow_v2beta1_generated_Environments_GetEnvironment_async + */ + getEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest | undefined, + {} | undefined + ] + >; + getEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentRequest | 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.getEnvironment(request, options, callback); + } + /** + * Creates an agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create an environment for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2beta1.Environment} request.environment + * Required. The environment to create. + * @param {string} request.environmentId + * Required. The unique id of the new environment. + * @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 [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. + * 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/v2beta1/environments.create_environment.js + * region_tag:dialogflow_v2beta1_generated_Environments_CreateEnvironment_async + */ + createEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest + | undefined + ), + {} | undefined + ] + >; + createEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateEnvironmentRequest + | 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.createEnvironment(request, options, callback); + } + /** + * Updates the specified agent environment. + * + * This method allows you to deploy new agent versions into the environment. + * When an environment is pointed to a new agent version by setting + * `environment.agent_version`, the environment is temporarily set to the + * `LOADING` state. During that time, the environment keeps on serving the + * previous version of the agent. After the new agent version is done loading, + * the environment is set back to the `RUNNING` state. + * You can use "-" as Environment ID in environment name to update version + * in "draft" environment. WARNING: this will negate all recent changes to + * draft and can't be undone. You may want to save the draft to a version + * before calling this function. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Environment} request.environment + * Required. The environment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @param {boolean} [request.allowLoadToDraftAndDiscardChanges] + * Optional. This field is used to prevent accidental overwrite of the draft + * environment, which is an operation that cannot be undone. To confirm that + * the caller desires this overwrite, this field must be explicitly set to + * true when updating the draft environment (environment 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 [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. + * 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/v2beta1/environments.update_environment.js + * region_tag:dialogflow_v2beta1_generated_Environments_UpdateEnvironment_async + */ + updateEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest + | undefined + ), + {} | undefined + ] + >; + updateEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + | protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEnvironment, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateEnvironmentRequest + | 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({ + 'environment.name': request.environment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateEnvironment(request, options, callback); + } + /** + * Deletes the specified agent environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the environment to delete. + * / Format: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @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/v2beta1/environments.delete_environment.js + * region_tag:dialogflow_v2beta1_generated_Environments_DeleteEnvironment_async + */ + deleteEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest + | undefined + ), + {} | undefined + ] + >; + deleteEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEnvironment( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteEnvironment( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteEnvironmentRequest + | 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.deleteEnvironment(request, options, callback); + } + + /** + * Returns the list of all non-draft environments of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. + * 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 `listEnvironmentsAsync()` + * 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. + */ + listEnvironments( + request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEnvironment[], + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse + ] + >; + listEnvironments( + request: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IEnvironment + > + ): void; + listEnvironments( + request: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IEnvironment + > + ): void; + listEnvironments( + request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IEnvironment + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IEnvironment + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IEnvironment[], + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsResponse + ] + > | 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.listEnvironments(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 agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Environment]{@link google.cloud.dialogflow.v2beta1.Environment} 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 `listEnvironmentsAsync()` + * 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. + */ + listEnvironmentsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + 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['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEnvironments.createStream( + this.innerApiCalls.listEnvironments as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listEnvironments`, 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 agent to list all environments from. + * Format: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Environment]{@link google.cloud.dialogflow.v2beta1.Environment}. 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/v2beta1/environments.list_environments.js + * region_tag:dialogflow_v2beta1_generated_Environments_ListEnvironments_async + */ + listEnvironmentsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListEnvironmentsRequest, + 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['listEnvironments']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listEnvironments.asyncIterate( + this.innerApiCalls['listEnvironments'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets the history of the specified environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Entry]{@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry}. + * 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 `getEnvironmentHistoryAsync()` + * 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. + */ + getEnvironmentHistory( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[], + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest | null, + protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory + ] + >; + getEnvironmentHistory( + request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + | protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry + > + ): void; + getEnvironmentHistory( + request: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + | protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry + > + ): void; + getEnvironmentHistory( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + | protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + | protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[], + protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest | null, + protos.google.cloud.dialogflow.v2beta1.IEnvironmentHistory + ] + > | 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.getEnvironmentHistory(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 name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Entry]{@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry} 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 `getEnvironmentHistoryAsync()` + * 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. + */ + getEnvironmentHistoryStream( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + 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['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.createStream( + this.innerApiCalls.getEnvironmentHistory as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `getEnvironmentHistory`, 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 name of the environment to retrieve history for. + * Supported formats: + * - `projects//agent/environments/` + * - `projects//locations//agent/environments/` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Entry]{@link google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry}. 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/v2beta1/environments.get_environment_history.js + * region_tag:dialogflow_v2beta1_generated_Environments_GetEnvironmentHistory_async + */ + getEnvironmentHistoryAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IGetEnvironmentHistoryRequest, + 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['getEnvironmentHistory']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.getEnvironmentHistory.asyncIterate( + this.innerApiCalls['getEnvironmentHistory'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.environmentsStub && !this._terminated) { + return this.environmentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/environments_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/environments_client_config.json new file mode 100644 index 00000000000..4fd9caa5715 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/environments_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Environments": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListEnvironments": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteEnvironment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetEnvironmentHistory": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/environments_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/environments_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/environments_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/fulfillments_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/fulfillments_client.ts new file mode 100644 index 00000000000..99a40bdf3f9 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/fulfillments_client.ts @@ -0,0 +1,2936 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/fulfillments_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './fulfillments_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Fulfillment|Fulfillments}. + * @class + * @memberof v2beta1 + */ +export class FulfillmentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + fulfillmentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of FulfillmentsClient. + * + * @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 FulfillmentsClient({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 FulfillmentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Fulfillments', + 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.fulfillmentsStub) { + return this.fulfillmentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Fulfillments. + this.fulfillmentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Fulfillments' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Fulfillments, + 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 fulfillmentsStubMethods = ['getFulfillment', 'updateFulfillment']; + for (const methodName of fulfillmentsStubMethods) { + const callPromise = this.fulfillmentsStub.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.fulfillmentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the fulfillment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the fulfillment. + * Supported formats: + * + * - `projects//agent/fulfillment` + * - `projects//locations//agent/fulfillment` + * @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 [Fulfillment]{@link google.cloud.dialogflow.v2beta1.Fulfillment}. + * 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/v2beta1/fulfillments.get_fulfillment.js + * region_tag:dialogflow_v2beta1_generated_Fulfillments_GetFulfillment_async + */ + getFulfillment( + request?: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest | undefined, + {} | undefined + ] + >; + getFulfillment( + request: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + | protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getFulfillment( + request: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + | protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getFulfillment( + request?: protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + | protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + | protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + protos.google.cloud.dialogflow.v2beta1.IGetFulfillmentRequest | 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.getFulfillment(request, options, callback); + } + /** + * Updates the fulfillment. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Fulfillment} request.fulfillment + * Required. The fulfillment to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * @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 [Fulfillment]{@link google.cloud.dialogflow.v2beta1.Fulfillment}. + * 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/v2beta1/fulfillments.update_fulfillment.js + * region_tag:dialogflow_v2beta1_generated_Fulfillments_UpdateFulfillment_async + */ + updateFulfillment( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest + | undefined + ), + {} | undefined + ] + >; + updateFulfillment( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + | protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateFulfillment( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + | protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateFulfillment( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + | protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + | protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IFulfillment, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateFulfillmentRequest + | 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({ + 'fulfillment.name': request.fulfillment!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateFulfillment(request, options, callback); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.fulfillmentsStub && !this._terminated) { + return this.fulfillmentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/fulfillments_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/fulfillments_client_config.json new file mode 100644 index 00000000000..b865673e9f2 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/fulfillments_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Fulfillments": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "GetFulfillment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateFulfillment": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/fulfillments_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/fulfillments_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/fulfillments_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/gapic_metadata.json b/packages/google-cloud-dialogflow/src/v2beta1/gapic_metadata.json new file mode 100644 index 00000000000..9e1a852b6ec --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/gapic_metadata.json @@ -0,0 +1,1193 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.dialogflow.v2beta1", + "libraryPackage": "@google-cloud/dialogflow", + "services": { + "Agents": { + "clients": { + "grpc": { + "libraryClient": "AgentsClient", + "rpcs": { + "GetAgent": { + "methods": [ + "getAgent" + ] + }, + "SetAgent": { + "methods": [ + "setAgent" + ] + }, + "DeleteAgent": { + "methods": [ + "deleteAgent" + ] + }, + "GetValidationResult": { + "methods": [ + "getValidationResult" + ] + }, + "TrainAgent": { + "methods": [ + "trainAgent" + ] + }, + "ExportAgent": { + "methods": [ + "exportAgent" + ] + }, + "ImportAgent": { + "methods": [ + "importAgent" + ] + }, + "RestoreAgent": { + "methods": [ + "restoreAgent" + ] + }, + "SearchAgents": { + "methods": [ + "searchAgents", + "searchAgentsStream", + "searchAgentsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AgentsClient", + "rpcs": { + "GetAgent": { + "methods": [ + "getAgent" + ] + }, + "SetAgent": { + "methods": [ + "setAgent" + ] + }, + "DeleteAgent": { + "methods": [ + "deleteAgent" + ] + }, + "GetValidationResult": { + "methods": [ + "getValidationResult" + ] + }, + "TrainAgent": { + "methods": [ + "trainAgent" + ] + }, + "ExportAgent": { + "methods": [ + "exportAgent" + ] + }, + "ImportAgent": { + "methods": [ + "importAgent" + ] + }, + "RestoreAgent": { + "methods": [ + "restoreAgent" + ] + }, + "SearchAgents": { + "methods": [ + "searchAgents", + "searchAgentsStream", + "searchAgentsAsync" + ] + } + } + } + } + }, + "AnswerRecords": { + "clients": { + "grpc": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "GetAnswerRecord": { + "methods": [ + "getAnswerRecord" + ] + }, + "UpdateAnswerRecord": { + "methods": [ + "updateAnswerRecord" + ] + }, + "ListAnswerRecords": { + "methods": [ + "listAnswerRecords", + "listAnswerRecordsStream", + "listAnswerRecordsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "AnswerRecordsClient", + "rpcs": { + "GetAnswerRecord": { + "methods": [ + "getAnswerRecord" + ] + }, + "UpdateAnswerRecord": { + "methods": [ + "updateAnswerRecord" + ] + }, + "ListAnswerRecords": { + "methods": [ + "listAnswerRecords", + "listAnswerRecordsStream", + "listAnswerRecordsAsync" + ] + } + } + } + } + }, + "Contexts": { + "clients": { + "grpc": { + "libraryClient": "ContextsClient", + "rpcs": { + "GetContext": { + "methods": [ + "getContext" + ] + }, + "CreateContext": { + "methods": [ + "createContext" + ] + }, + "UpdateContext": { + "methods": [ + "updateContext" + ] + }, + "DeleteContext": { + "methods": [ + "deleteContext" + ] + }, + "DeleteAllContexts": { + "methods": [ + "deleteAllContexts" + ] + }, + "ListContexts": { + "methods": [ + "listContexts", + "listContextsStream", + "listContextsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ContextsClient", + "rpcs": { + "GetContext": { + "methods": [ + "getContext" + ] + }, + "CreateContext": { + "methods": [ + "createContext" + ] + }, + "UpdateContext": { + "methods": [ + "updateContext" + ] + }, + "DeleteContext": { + "methods": [ + "deleteContext" + ] + }, + "DeleteAllContexts": { + "methods": [ + "deleteAllContexts" + ] + }, + "ListContexts": { + "methods": [ + "listContexts", + "listContextsStream", + "listContextsAsync" + ] + } + } + } + } + }, + "ConversationProfiles": { + "clients": { + "grpc": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "SetSuggestionFeatureConfig": { + "methods": [ + "setSuggestionFeatureConfig" + ] + }, + "ClearSuggestionFeatureConfig": { + "methods": [ + "clearSuggestionFeatureConfig" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationProfilesClient", + "rpcs": { + "GetConversationProfile": { + "methods": [ + "getConversationProfile" + ] + }, + "CreateConversationProfile": { + "methods": [ + "createConversationProfile" + ] + }, + "UpdateConversationProfile": { + "methods": [ + "updateConversationProfile" + ] + }, + "DeleteConversationProfile": { + "methods": [ + "deleteConversationProfile" + ] + }, + "SetSuggestionFeatureConfig": { + "methods": [ + "setSuggestionFeatureConfig" + ] + }, + "ClearSuggestionFeatureConfig": { + "methods": [ + "clearSuggestionFeatureConfig" + ] + }, + "ListConversationProfiles": { + "methods": [ + "listConversationProfiles", + "listConversationProfilesStream", + "listConversationProfilesAsync" + ] + } + } + } + } + }, + "Conversations": { + "clients": { + "grpc": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "CompleteConversation": { + "methods": [ + "completeConversation" + ] + }, + "BatchCreateMessages": { + "methods": [ + "batchCreateMessages" + ] + }, + "SuggestConversationSummary": { + "methods": [ + "suggestConversationSummary" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListMessages": { + "methods": [ + "listMessages", + "listMessagesStream", + "listMessagesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ConversationsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "CompleteConversation": { + "methods": [ + "completeConversation" + ] + }, + "BatchCreateMessages": { + "methods": [ + "batchCreateMessages" + ] + }, + "SuggestConversationSummary": { + "methods": [ + "suggestConversationSummary" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListMessages": { + "methods": [ + "listMessages", + "listMessagesStream", + "listMessagesAsync" + ] + } + } + } + } + }, + "Documents": { + "clients": { + "grpc": { + "libraryClient": "DocumentsClient", + "rpcs": { + "GetDocument": { + "methods": [ + "getDocument" + ] + }, + "CreateDocument": { + "methods": [ + "createDocument" + ] + }, + "ImportDocuments": { + "methods": [ + "importDocuments" + ] + }, + "DeleteDocument": { + "methods": [ + "deleteDocument" + ] + }, + "UpdateDocument": { + "methods": [ + "updateDocument" + ] + }, + "ReloadDocument": { + "methods": [ + "reloadDocument" + ] + }, + "ListDocuments": { + "methods": [ + "listDocuments", + "listDocumentsStream", + "listDocumentsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DocumentsClient", + "rpcs": { + "GetDocument": { + "methods": [ + "getDocument" + ] + }, + "CreateDocument": { + "methods": [ + "createDocument" + ] + }, + "ImportDocuments": { + "methods": [ + "importDocuments" + ] + }, + "DeleteDocument": { + "methods": [ + "deleteDocument" + ] + }, + "UpdateDocument": { + "methods": [ + "updateDocument" + ] + }, + "ReloadDocument": { + "methods": [ + "reloadDocument" + ] + }, + "ListDocuments": { + "methods": [ + "listDocuments", + "listDocumentsStream", + "listDocumentsAsync" + ] + } + } + } + } + }, + "EntityTypes": { + "clients": { + "grpc": { + "libraryClient": "EntityTypesClient", + "rpcs": { + "GetEntityType": { + "methods": [ + "getEntityType" + ] + }, + "CreateEntityType": { + "methods": [ + "createEntityType" + ] + }, + "UpdateEntityType": { + "methods": [ + "updateEntityType" + ] + }, + "DeleteEntityType": { + "methods": [ + "deleteEntityType" + ] + }, + "BatchUpdateEntityTypes": { + "methods": [ + "batchUpdateEntityTypes" + ] + }, + "BatchDeleteEntityTypes": { + "methods": [ + "batchDeleteEntityTypes" + ] + }, + "BatchCreateEntities": { + "methods": [ + "batchCreateEntities" + ] + }, + "BatchUpdateEntities": { + "methods": [ + "batchUpdateEntities" + ] + }, + "BatchDeleteEntities": { + "methods": [ + "batchDeleteEntities" + ] + }, + "ListEntityTypes": { + "methods": [ + "listEntityTypes", + "listEntityTypesStream", + "listEntityTypesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EntityTypesClient", + "rpcs": { + "GetEntityType": { + "methods": [ + "getEntityType" + ] + }, + "CreateEntityType": { + "methods": [ + "createEntityType" + ] + }, + "UpdateEntityType": { + "methods": [ + "updateEntityType" + ] + }, + "DeleteEntityType": { + "methods": [ + "deleteEntityType" + ] + }, + "BatchUpdateEntityTypes": { + "methods": [ + "batchUpdateEntityTypes" + ] + }, + "BatchDeleteEntityTypes": { + "methods": [ + "batchDeleteEntityTypes" + ] + }, + "BatchCreateEntities": { + "methods": [ + "batchCreateEntities" + ] + }, + "BatchUpdateEntities": { + "methods": [ + "batchUpdateEntities" + ] + }, + "BatchDeleteEntities": { + "methods": [ + "batchDeleteEntities" + ] + }, + "ListEntityTypes": { + "methods": [ + "listEntityTypes", + "listEntityTypesStream", + "listEntityTypesAsync" + ] + } + } + } + } + }, + "Environments": { + "clients": { + "grpc": { + "libraryClient": "EnvironmentsClient", + "rpcs": { + "GetEnvironment": { + "methods": [ + "getEnvironment" + ] + }, + "CreateEnvironment": { + "methods": [ + "createEnvironment" + ] + }, + "UpdateEnvironment": { + "methods": [ + "updateEnvironment" + ] + }, + "DeleteEnvironment": { + "methods": [ + "deleteEnvironment" + ] + }, + "ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }, + "GetEnvironmentHistory": { + "methods": [ + "getEnvironmentHistory", + "getEnvironmentHistoryStream", + "getEnvironmentHistoryAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "EnvironmentsClient", + "rpcs": { + "GetEnvironment": { + "methods": [ + "getEnvironment" + ] + }, + "CreateEnvironment": { + "methods": [ + "createEnvironment" + ] + }, + "UpdateEnvironment": { + "methods": [ + "updateEnvironment" + ] + }, + "DeleteEnvironment": { + "methods": [ + "deleteEnvironment" + ] + }, + "ListEnvironments": { + "methods": [ + "listEnvironments", + "listEnvironmentsStream", + "listEnvironmentsAsync" + ] + }, + "GetEnvironmentHistory": { + "methods": [ + "getEnvironmentHistory", + "getEnvironmentHistoryStream", + "getEnvironmentHistoryAsync" + ] + } + } + } + } + }, + "Fulfillments": { + "clients": { + "grpc": { + "libraryClient": "FulfillmentsClient", + "rpcs": { + "GetFulfillment": { + "methods": [ + "getFulfillment" + ] + }, + "UpdateFulfillment": { + "methods": [ + "updateFulfillment" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "FulfillmentsClient", + "rpcs": { + "GetFulfillment": { + "methods": [ + "getFulfillment" + ] + }, + "UpdateFulfillment": { + "methods": [ + "updateFulfillment" + ] + } + } + } + } + }, + "Intents": { + "clients": { + "grpc": { + "libraryClient": "IntentsClient", + "rpcs": { + "GetIntent": { + "methods": [ + "getIntent" + ] + }, + "CreateIntent": { + "methods": [ + "createIntent" + ] + }, + "UpdateIntent": { + "methods": [ + "updateIntent" + ] + }, + "DeleteIntent": { + "methods": [ + "deleteIntent" + ] + }, + "BatchUpdateIntents": { + "methods": [ + "batchUpdateIntents" + ] + }, + "BatchDeleteIntents": { + "methods": [ + "batchDeleteIntents" + ] + }, + "ListIntents": { + "methods": [ + "listIntents", + "listIntentsStream", + "listIntentsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "IntentsClient", + "rpcs": { + "GetIntent": { + "methods": [ + "getIntent" + ] + }, + "CreateIntent": { + "methods": [ + "createIntent" + ] + }, + "UpdateIntent": { + "methods": [ + "updateIntent" + ] + }, + "DeleteIntent": { + "methods": [ + "deleteIntent" + ] + }, + "BatchUpdateIntents": { + "methods": [ + "batchUpdateIntents" + ] + }, + "BatchDeleteIntents": { + "methods": [ + "batchDeleteIntents" + ] + }, + "ListIntents": { + "methods": [ + "listIntents", + "listIntentsStream", + "listIntentsAsync" + ] + } + } + } + } + }, + "KnowledgeBases": { + "clients": { + "grpc": { + "libraryClient": "KnowledgeBasesClient", + "rpcs": { + "GetKnowledgeBase": { + "methods": [ + "getKnowledgeBase" + ] + }, + "CreateKnowledgeBase": { + "methods": [ + "createKnowledgeBase" + ] + }, + "DeleteKnowledgeBase": { + "methods": [ + "deleteKnowledgeBase" + ] + }, + "UpdateKnowledgeBase": { + "methods": [ + "updateKnowledgeBase" + ] + }, + "ListKnowledgeBases": { + "methods": [ + "listKnowledgeBases", + "listKnowledgeBasesStream", + "listKnowledgeBasesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "KnowledgeBasesClient", + "rpcs": { + "GetKnowledgeBase": { + "methods": [ + "getKnowledgeBase" + ] + }, + "CreateKnowledgeBase": { + "methods": [ + "createKnowledgeBase" + ] + }, + "DeleteKnowledgeBase": { + "methods": [ + "deleteKnowledgeBase" + ] + }, + "UpdateKnowledgeBase": { + "methods": [ + "updateKnowledgeBase" + ] + }, + "ListKnowledgeBases": { + "methods": [ + "listKnowledgeBases", + "listKnowledgeBasesStream", + "listKnowledgeBasesAsync" + ] + } + } + } + } + }, + "Participants": { + "clients": { + "grpc": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "CreateParticipant": { + "methods": [ + "createParticipant" + ] + }, + "GetParticipant": { + "methods": [ + "getParticipant" + ] + }, + "UpdateParticipant": { + "methods": [ + "updateParticipant" + ] + }, + "AnalyzeContent": { + "methods": [ + "analyzeContent" + ] + }, + "SuggestArticles": { + "methods": [ + "suggestArticles" + ] + }, + "SuggestFaqAnswers": { + "methods": [ + "suggestFaqAnswers" + ] + }, + "SuggestSmartReplies": { + "methods": [ + "suggestSmartReplies" + ] + }, + "CompileSuggestion": { + "methods": [ + "compileSuggestion" + ] + }, + "StreamingAnalyzeContent": { + "methods": [ + "streamingAnalyzeContent" + ] + }, + "ListParticipants": { + "methods": [ + "listParticipants", + "listParticipantsStream", + "listParticipantsAsync" + ] + }, + "ListSuggestions": { + "methods": [ + "listSuggestions", + "listSuggestionsStream", + "listSuggestionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ParticipantsClient", + "rpcs": { + "CreateParticipant": { + "methods": [ + "createParticipant" + ] + }, + "GetParticipant": { + "methods": [ + "getParticipant" + ] + }, + "UpdateParticipant": { + "methods": [ + "updateParticipant" + ] + }, + "AnalyzeContent": { + "methods": [ + "analyzeContent" + ] + }, + "SuggestArticles": { + "methods": [ + "suggestArticles" + ] + }, + "SuggestFaqAnswers": { + "methods": [ + "suggestFaqAnswers" + ] + }, + "SuggestSmartReplies": { + "methods": [ + "suggestSmartReplies" + ] + }, + "CompileSuggestion": { + "methods": [ + "compileSuggestion" + ] + }, + "ListParticipants": { + "methods": [ + "listParticipants", + "listParticipantsStream", + "listParticipantsAsync" + ] + }, + "ListSuggestions": { + "methods": [ + "listSuggestions", + "listSuggestionsStream", + "listSuggestionsAsync" + ] + } + } + } + } + }, + "SessionEntityTypes": { + "clients": { + "grpc": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": { + "GetSessionEntityType": { + "methods": [ + "getSessionEntityType" + ] + }, + "CreateSessionEntityType": { + "methods": [ + "createSessionEntityType" + ] + }, + "UpdateSessionEntityType": { + "methods": [ + "updateSessionEntityType" + ] + }, + "DeleteSessionEntityType": { + "methods": [ + "deleteSessionEntityType" + ] + }, + "ListSessionEntityTypes": { + "methods": [ + "listSessionEntityTypes", + "listSessionEntityTypesStream", + "listSessionEntityTypesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SessionEntityTypesClient", + "rpcs": { + "GetSessionEntityType": { + "methods": [ + "getSessionEntityType" + ] + }, + "CreateSessionEntityType": { + "methods": [ + "createSessionEntityType" + ] + }, + "UpdateSessionEntityType": { + "methods": [ + "updateSessionEntityType" + ] + }, + "DeleteSessionEntityType": { + "methods": [ + "deleteSessionEntityType" + ] + }, + "ListSessionEntityTypes": { + "methods": [ + "listSessionEntityTypes", + "listSessionEntityTypesStream", + "listSessionEntityTypesAsync" + ] + } + } + } + } + }, + "Sessions": { + "clients": { + "grpc": { + "libraryClient": "SessionsClient", + "rpcs": { + "DetectIntent": { + "methods": [ + "detectIntent" + ] + }, + "StreamingDetectIntent": { + "methods": [ + "streamingDetectIntent" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SessionsClient", + "rpcs": { + "DetectIntent": { + "methods": [ + "detectIntent" + ] + } + } + } + } + }, + "Versions": { + "clients": { + "grpc": { + "libraryClient": "VersionsClient", + "rpcs": { + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "CreateVersion": { + "methods": [ + "createVersion" + ] + }, + "UpdateVersion": { + "methods": [ + "updateVersion" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "VersionsClient", + "rpcs": { + "GetVersion": { + "methods": [ + "getVersion" + ] + }, + "CreateVersion": { + "methods": [ + "createVersion" + ] + }, + "UpdateVersion": { + "methods": [ + "updateVersion" + ] + }, + "DeleteVersion": { + "methods": [ + "deleteVersion" + ] + }, + "ListVersions": { + "methods": [ + "listVersions", + "listVersionsStream", + "listVersionsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/index.ts b/packages/google-cloud-dialogflow/src/v2beta1/index.ts new file mode 100644 index 00000000000..d11d0540360 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/index.ts @@ -0,0 +1,33 @@ +// 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. +// +// ** 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 {AgentsClient} from './agents_client'; +export {AnswerRecordsClient} from './answer_records_client'; +export {ContextsClient} from './contexts_client'; +export {ConversationProfilesClient} from './conversation_profiles_client'; +export {ConversationsClient} from './conversations_client'; +export {DocumentsClient} from './documents_client'; +export {EntityTypesClient} from './entity_types_client'; +export {EnvironmentsClient} from './environments_client'; +export {FulfillmentsClient} from './fulfillments_client'; +export {IntentsClient} from './intents_client'; +export {KnowledgeBasesClient} from './knowledge_bases_client'; +export {ParticipantsClient} from './participants_client'; +export {SessionEntityTypesClient} from './session_entity_types_client'; +export {SessionsClient} from './sessions_client'; +export {VersionsClient} from './versions_client'; diff --git a/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts new file mode 100644 index 00000000000..a2a0978a138 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/intents_client.ts @@ -0,0 +1,4031 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} 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/v2beta1/intents_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './intents_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Intent|Intents}. + * @class + * @memberof v2beta1 + */ +export class IntentsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + intentsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of IntentsClient. + * + * @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 IntentsClient({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 IntentsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listIntents: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'intents' + ), + }; + + 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.cloud.location.Locations.GetLocation', + get: '/v2beta1/{name=projects/*/locations/*}', + }, + { + selector: 'google.cloud.location.Locations.ListLocations', + get: '/v2beta1/{name=projects/*}/locations', + }, + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2beta1/{name=projects/*/operations/*}:cancel', + additional_bindings: [ + { + post: '/v2beta1/{name=projects/*/locations/*/operations/*}:cancel', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2beta1/{name=projects/*/operations/*}', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*/operations/*}'}, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2beta1/{name=projects/*}/operations', + additional_bindings: [ + {get: '/v2beta1/{name=projects/*/locations/*}/operations'}, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const batchUpdateIntentsResponse = protoFilesRoot.lookup( + '.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse' + ) as gax.protobuf.Type; + const batchUpdateIntentsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + const batchDeleteIntentsResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty' + ) as gax.protobuf.Type; + const batchDeleteIntentsMetadata = protoFilesRoot.lookup( + '.google.protobuf.Struct' + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + batchUpdateIntents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchUpdateIntentsResponse.decode.bind(batchUpdateIntentsResponse), + batchUpdateIntentsMetadata.decode.bind(batchUpdateIntentsMetadata) + ), + batchDeleteIntents: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + batchDeleteIntentsResponse.decode.bind(batchDeleteIntentsResponse), + batchDeleteIntentsMetadata.decode.bind(batchDeleteIntentsMetadata) + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Intents', + 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.intentsStub) { + return this.intentsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Intents. + this.intentsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Intents' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Intents, + 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 intentsStubMethods = [ + 'listIntents', + 'getIntent', + 'createIntent', + 'updateIntent', + 'deleteIntent', + 'batchUpdateIntents', + 'batchDeleteIntents', + ]; + for (const methodName of intentsStubMethods) { + const callPromise = this.intentsStub.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.intentsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified intent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent. + * Supported formats: + * + * - `projects//agent/intents/` + * - `projects//locations//agent/intents/` + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @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 [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. + * 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/v2beta1/intents.get_intent.js + * region_tag:dialogflow_v2beta1_generated_Intents_GetIntent_async + */ + getIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest | undefined, + {} | undefined + ] + >; + getIntent( + request: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getIntent( + request: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IGetIntentRequest | 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.getIntent(request, options, callback); + } + /** + * Creates an intent in the specified agent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a intent for. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2beta1.Intent} request.intent + * Required. The intent to create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @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 [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. + * 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/v2beta1/intents.create_intent.js + * region_tag:dialogflow_v2beta1_generated_Intents_CreateIntent_async + */ + createIntent( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest | undefined, + {} | undefined + ] + >; + createIntent( + request: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createIntent( + request: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createIntent( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.ICreateIntentRequest | 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.createIntent(request, options, callback); + } + /** + * Updates the specified intent. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Intent} request.intent + * Required. The intent to update. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @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 [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. + * 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/v2beta1/intents.update_intent.js + * region_tag:dialogflow_v2beta1_generated_Intents_UpdateIntent_async + */ + updateIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest | undefined, + {} | undefined + ] + >; + updateIntent( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateIntent( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IIntent, + | protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IIntent, + protos.google.cloud.dialogflow.v2beta1.IUpdateIntentRequest | 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({ + 'intent.name': request.intent!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateIntent(request, options, callback); + } + /** + * Deletes the specified intent and its direct or indirect followup intents. + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the intent to delete. If this intent has direct or + * indirect followup intents, we also delete them. + * + * Supported formats: + * + * - `projects//agent/intents/` + * - `projects//locations//agent/intents/` + * @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/v2beta1/intents.delete_intent.js + * region_tag:dialogflow_v2beta1_generated_Intents_DeleteIntent_async + */ + deleteIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest | undefined, + {} | undefined + ] + >; + deleteIntent( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteIntent( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteIntentRequest | 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.deleteIntent(request, options, callback); + } + + /** + * Updates/Creates multiple intents in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: {@link google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse|BatchUpdateIntentsResponse} + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to update or create intents in. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {string} request.intentBatchUri + * The URI to a Google Cloud Storage file containing intents to update or + * create. The file format can either be a serialized proto (of IntentBatch + * type) or JSON object. Note: The URI must start with "gs://". + * @param {google.cloud.dialogflow.v2beta1.IntentBatch} request.intentBatchInline + * The collection of intents to update or create. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @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/v2beta1/intents.batch_update_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async + */ + batchUpdateIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchUpdateIntents( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateIntents( + request: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, + callback: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchUpdateIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >, + 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.batchUpdateIntents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchUpdateIntents()`. + * @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/v2beta1/intents.batch_update_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_BatchUpdateIntents_async + */ + async checkBatchUpdateIntentsProgress( + name: string + ): Promise< + LROperation< + protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse, + protos.google.protobuf.Struct + > + > { + 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.batchUpdateIntents, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse, + protos.google.protobuf.Struct + >; + } + /** + * Deletes intents in the specified agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train an agent prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/es/docs/training). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the agent to delete all entities types for. + * Supported formats: + * + * - `projects//agent` + * - `projects//locations//agent` + * @param {number[]} request.intents + * Required. The collection of intents to delete. Only intent `name` must be + * filled in. + * @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/v2beta1/intents.batch_delete_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async + */ + batchDeleteIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, + options?: CallOptions + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined + ] + >; + batchDeleteIntents( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteIntents( + request: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): void; + batchDeleteIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IBatchDeleteIntentsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >, + 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.batchDeleteIntents(request, options, callback); + } + /** + * Check the status of the long running operation returned by `batchDeleteIntents()`. + * @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/v2beta1/intents.batch_delete_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_BatchDeleteIntents_async + */ + async checkBatchDeleteIntentsProgress( + name: string + ): Promise< + LROperation + > { + 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.batchDeleteIntents, + this._gaxModule.createDefaultBackoffSettings() + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.protobuf.Struct + >; + } + /** + * Returns the list of all intents in the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. + * 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 `listIntentsAsync()` + * 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. + */ + listIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IIntent[], + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse + ] + >; + listIntents( + request: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IIntent + > + ): void; + listIntents( + request: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IIntent + > + ): void; + listIntents( + request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IIntent + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IIntent + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IIntent[], + protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListIntentsResponse + ] + > | 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.listIntents(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 agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [Intent]{@link google.cloud.dialogflow.v2beta1.Intent} 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 `listIntentsAsync()` + * 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. + */ + listIntentsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + 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['listIntents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIntents.createStream( + this.innerApiCalls.listIntents as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listIntents`, 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 agent to list all intents from. + * Format: `projects//agent` or `projects//locations//agent`. + * + * Alternatively, you can specify the environment to list intents for. + * Format: `projects//agent/environments/` + * or `projects//locations//agent/environments/`. + * Note: training phrases of the intents will not be returned for non-draft + * environment. + * @param {string} [request.languageCode] + * Optional. The language used to access language-specific data. + * If not specified, the agent's default language is used. + * For more information, see + * [Multilingual intent and entity + * data](https://cloud.google.com/dialogflow/docs/agents-multilingual#intent-entity). + * @param {google.cloud.dialogflow.v2beta1.IntentView} request.intentView + * Optional. The resource view to apply to the returned intent. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Intent]{@link google.cloud.dialogflow.v2beta1.Intent}. 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/v2beta1/intents.list_intents.js + * region_tag:dialogflow_v2beta1_generated_Intents_ListIntents_async + */ + listIntentsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListIntentsRequest, + 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['listIntents']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listIntents.asyncIterate( + this.innerApiCalls['listIntents'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#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 + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.intentsStub && !this._terminated) { + return this.intentsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/intents_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/intents_client_config.json new file mode 100644 index 00000000000..7f297576fb1 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/intents_client_config.json @@ -0,0 +1,64 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Intents": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteIntent": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchUpdateIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "BatchDeleteIntents": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/intents_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/intents_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/intents_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts new file mode 100644 index 00000000000..0c2db3751dd --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client.ts @@ -0,0 +1,3479 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2beta1/knowledge_bases_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './knowledge_bases_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.KnowledgeBase|KnowledgeBases}. + * @class + * @memberof v2beta1 + */ +export class KnowledgeBasesClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + knowledgeBasesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of KnowledgeBasesClient. + * + * @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 KnowledgeBasesClient({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 KnowledgeBasesClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listKnowledgeBases: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'knowledgeBases' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.KnowledgeBases', + 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.knowledgeBasesStub) { + return this.knowledgeBasesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.KnowledgeBases. + this.knowledgeBasesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.KnowledgeBases' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.KnowledgeBases, + 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 knowledgeBasesStubMethods = [ + 'listKnowledgeBases', + 'getKnowledgeBase', + 'createKnowledgeBase', + 'deleteKnowledgeBase', + 'updateKnowledgeBase', + ]; + for (const methodName of knowledgeBasesStubMethods) { + const callPromise = this.knowledgeBasesStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.knowledgeBasesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified knowledge base. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the knowledge base to retrieve. + * Format `projects//locations//knowledgeBases/`. + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. + * 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/v2beta1/knowledge_bases.get_knowledge_base.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_GetKnowledgeBase_async + */ + getKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest + | undefined + ), + {} | undefined + ] + >; + getKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetKnowledgeBaseRequest + | 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.getKnowledgeBase(request, options, callback); + } + /** + * Creates a knowledge base. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to create a knowledge base for. + * Format: `projects//locations/`. + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} request.knowledgeBase + * Required. The knowledge base to create. + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. + * 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/v2beta1/knowledge_bases.create_knowledge_base.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_CreateKnowledgeBase_async + */ + createKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest + | undefined + ), + {} | undefined + ] + >; + createKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateKnowledgeBaseRequest + | 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.createKnowledgeBase(request, options, callback); + } + /** + * Deletes the specified knowledge base. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the knowledge base to delete. + * Format: `projects//locations//knowledgeBases/`. + * @param {boolean} [request.force] + * Optional. Force deletes the knowledge base. When set to true, any documents + * in the knowledge base are also deleted. + * @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/v2beta1/knowledge_bases.delete_knowledge_base.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_DeleteKnowledgeBase_async + */ + deleteKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest + | undefined + ), + {} | undefined + ] + >; + deleteKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteKnowledgeBaseRequest + | 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.deleteKnowledgeBase(request, options, callback); + } + /** + * Updates the specified knowledge base. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.KnowledgeBase} request.knowledgeBase + * Required. The knowledge base to update. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Not specified means `update all`. + * Currently, only `display_name` can be updated, an InvalidArgument will be + * returned for attempting to update other fields. + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. + * 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/v2beta1/knowledge_bases.update_knowledge_base.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_UpdateKnowledgeBase_async + */ + updateKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest + | undefined + ), + {} | undefined + ] + >; + updateKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateKnowledgeBase( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateKnowledgeBase( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + | protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateKnowledgeBaseRequest + | 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({ + 'knowledge_base.name': request.knowledgeBase!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateKnowledgeBase(request, options, callback); + } + + /** + * Returns the list of all knowledge bases of the specified agent. + * + * Note: The `projects.agent.knowledgeBases` resource is deprecated; + * only use `projects.knowledgeBases`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The project to list of knowledge bases for. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. + * 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 `listKnowledgeBasesAsync()` + * 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. + */ + listKnowledgeBases( + request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[], + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse + ] + >; + listKnowledgeBases( + request: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase + > + ): void; + listKnowledgeBases( + request: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase + > + ): void; + listKnowledgeBases( + request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[], + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesResponse + ] + > | 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.listKnowledgeBases(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 to list of knowledge bases for. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase} 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 `listKnowledgeBasesAsync()` + * 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. + */ + listKnowledgeBasesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + 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['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.createStream( + this.innerApiCalls.listKnowledgeBases as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listKnowledgeBases`, 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 to list of knowledge bases for. + * Format: `projects//locations/`. + * @param {number} request.pageSize + * The maximum number of items to return in a single page. By + * default 10 and at most 100. + * @param {string} request.pageToken + * The next_page_token value returned from a previous list request. + * @param {string} request.filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 + * [KnowledgeBase]{@link google.cloud.dialogflow.v2beta1.KnowledgeBase}. 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/v2beta1/knowledge_bases.list_knowledge_bases.js + * region_tag:dialogflow_v2beta1_generated_KnowledgeBases_ListKnowledgeBases_async + */ + listKnowledgeBasesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListKnowledgeBasesRequest, + 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['listKnowledgeBases']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listKnowledgeBases.asyncIterate( + this.innerApiCalls['listKnowledgeBases'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.knowledgeBasesStub && !this._terminated) { + return this.knowledgeBasesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client_config.json new file mode 100644 index 00000000000..f563adcead4 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.KnowledgeBases": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListKnowledgeBases": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateKnowledgeBase": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/knowledge_bases_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/participants_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/participants_client.ts new file mode 100644 index 00000000000..c95e41a6260 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/participants_client.ts @@ -0,0 +1,4227 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {Transform, PassThrough} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/participants_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './participants_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Participant|Participants}. + * @class + * @memberof v2beta1 + */ +export class ParticipantsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + participantsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ParticipantsClient. + * + * @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 ParticipantsClient({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 ParticipantsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listParticipants: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'participants' + ), + listSuggestions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'suggestions' + ), + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + streamingAnalyzeContent: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + opts.fallback === 'rest' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Participants', + 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.participantsStub) { + return this.participantsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Participants. + this.participantsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Participants' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Participants, + 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 participantsStubMethods = [ + 'createParticipant', + 'getParticipant', + 'listParticipants', + 'updateParticipant', + 'analyzeContent', + 'streamingAnalyzeContent', + 'suggestArticles', + 'suggestFaqAnswers', + 'suggestSmartReplies', + 'listSuggestions', + 'compileSuggestion', + ]; + for (const methodName of participantsStubMethods) { + const callPromise = this.participantsStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit( + 'error', + new this._gaxModule.GoogleError( + 'The client has already been closed.' + ) + ); + }); + return stream; + } + 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.stream[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.participantsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 a new participant in a conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Resource identifier of the conversation adding the participant. + * Format: `projects//locations//conversations/`. + * @param {google.cloud.dialogflow.v2beta1.Participant} request.participant + * Required. The participant to create. + * @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 [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. + * 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/v2beta1/participants.create_participant.js + * region_tag:dialogflow_v2beta1_generated_Participants_CreateParticipant_async + */ + createParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest + | undefined + ), + {} | undefined + ] + >; + createParticipant( + request: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createParticipant( + request: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateParticipantRequest + | 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.createParticipant(request, options, callback); + } + /** + * Retrieves a conversation participant. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the participant. Format: + * `projects//locations//conversations//participants/`. + * @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 [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. + * 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/v2beta1/participants.get_participant.js + * region_tag:dialogflow_v2beta1_generated_Participants_GetParticipant_async + */ + getParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest | undefined, + {} | undefined + ] + >; + getParticipant( + request: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getParticipant( + request: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + protos.google.cloud.dialogflow.v2beta1.IGetParticipantRequest | 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.getParticipant(request, options, callback); + } + /** + * Updates the specified participant. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Participant} request.participant + * Required. The participant to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to specify which fields to update. + * @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 [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. + * 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/v2beta1/participants.update_participant.js + * region_tag:dialogflow_v2beta1_generated_Participants_UpdateParticipant_async + */ + updateParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest + | undefined + ), + {} | undefined + ] + >; + updateParticipant( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateParticipant( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateParticipant( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IParticipant, + | protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IParticipant, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateParticipantRequest + | 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({ + 'participant.name': request.participant!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateParticipant(request, options, callback); + } + /** + * Adds a text (chat, for example), or audio (phone recording, for example) + * message from a participant into the conversation. + * + * Note: Always use agent versions for production traffic + * sent to virtual agents. See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.participant + * Required. The name of the participant this text comes from. + * Format: `projects//locations//conversations//participants/`. + * @param {google.cloud.dialogflow.v2beta1.TextInput} request.textInput + * The natural language text to be processed. + * @param {google.cloud.dialogflow.v2beta1.AudioInput} request.audioInput + * The natural language speech audio to be processed. + * @param {google.cloud.dialogflow.v2beta1.EventInput} request.eventInput + * An input event to send to Dialogflow. + * @param {google.cloud.dialogflow.v2beta1.OutputAudioConfig} request.replyAudioConfig + * Speech synthesis configuration. + * The speech synthesis settings for a virtual agent that may be configured + * for the associated conversation profile are not used when calling + * AnalyzeContent. If this configuration is not supplied, speech synthesis + * is disabled. + * @param {google.cloud.dialogflow.v2beta1.QueryParameters} request.queryParams + * Parameters for a Dialogflow virtual-agent query. + * @param {google.cloud.dialogflow.v2beta1.AssistQueryParameters} request.assistQueryParams + * Parameters for a human assist query. + * @param {google.protobuf.Struct} request.cxParameters + * Additional parameters to be put into Dialogflow CX session parameters. To + * remove a parameter from the session, clients should explicitly set the + * parameter value to null. + * + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + * @param {string} request.cxCurrentPage + * The unique identifier of the CX page to override the `current_page` in the + * session. + * Format: `projects//locations//agents//flows//pages/`. + * + * If `cx_current_page` is specified, the previous state of the session will + * be ignored by Dialogflow CX, including the [previous + * page][QueryResult.current_page] and the [previous session + * parameters][QueryResult.parameters]. In most cases, `cx_current_page` and + * `cx_parameters` should be configured together to direct a session to a + * specific state. + * + * Note: this field should only be used if you are connecting to a Dialogflow + * CX agent. + * @param {google.protobuf.Timestamp} request.messageSendTime + * Optional. The send time of the message from end user or human agent's + * perspective. It is used for identifying the same message under one + * participant. + * + * Given two messages under the same participant: + * - If send time are different regardless of whether the content of the + * messages are exactly the same, the conversation will regard them as + * two distinct messages sent by the participant. + * - If send time is the same regardless of whether the content of the + * messages are exactly the same, the conversation will regard them as + * same message, and ignore the message received later. + * + * If the value is not provided, a new request will always be regarded as a + * new message without any de-duplication. + * @param {string} request.requestId + * A unique identifier for this request. Restricted to 36 ASCII characters. + * A random UUID is recommended. + * This request is only idempotent if a `request_id` is provided. + * @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 [AnalyzeContentResponse]{@link google.cloud.dialogflow.v2beta1.AnalyzeContentResponse}. + * 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/v2beta1/participants.analyze_content.js + * region_tag:dialogflow_v2beta1_generated_Participants_AnalyzeContent_async + */ + analyzeContent( + request?: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest | undefined, + {} | undefined + ] + >; + analyzeContent( + request: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + | protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + analyzeContent( + request: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + | protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + analyzeContent( + request?: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + | protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + | protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse, + protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentRequest | 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({ + participant: request.participant ?? '', + }); + this.initialize(); + return this.innerApiCalls.analyzeContent(request, options, callback); + } + /** + * Gets suggested articles for a participant based on specific historical + * messages. + * + * Note that {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} will only list the auto-generated + * suggestions, while {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} will try to compile suggestion + * based on the provided conversation context in the real time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} [request.latestMessage] + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} [request.contextSize] + * Optional. Max number of messages prior to and including + * {@link google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message|latest_message} to use as context + * when compiling the suggestion. By default 20 and at most 50. + * @param {google.cloud.dialogflow.v2beta1.AssistQueryParameters} [request.assistQueryParams] + * Optional. Parameters for a human assist query. + * @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 [SuggestArticlesResponse]{@link google.cloud.dialogflow.v2beta1.SuggestArticlesResponse}. + * 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/v2beta1/participants.suggest_articles.js + * region_tag:dialogflow_v2beta1_generated_Participants_SuggestArticles_async + */ + suggestArticles( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest + | undefined + ), + {} | undefined + ] + >; + suggestArticles( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestArticles( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestArticles( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesRequest + | 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.suggestArticles(request, options, callback); + } + /** + * Gets suggested faq answers for a participant based on specific historical + * messages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} [request.latestMessage] + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} [request.contextSize] + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + * @param {google.cloud.dialogflow.v2beta1.AssistQueryParameters} [request.assistQueryParams] + * Optional. Parameters for a human assist query. + * @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 [SuggestFaqAnswersResponse]{@link google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse}. + * 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/v2beta1/participants.suggest_faq_answers.js + * region_tag:dialogflow_v2beta1_generated_Participants_SuggestFaqAnswers_async + */ + suggestFaqAnswers( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest + | undefined + ), + {} | undefined + ] + >; + suggestFaqAnswers( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestFaqAnswers( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestFaqAnswers( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersRequest + | 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.suggestFaqAnswers(request, options, callback); + } + /** + * Gets smart replies for a participant based on specific historical + * messages. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {google.cloud.dialogflow.v2beta1.TextInput} request.currentTextInput + * The current natural language text segment to compile suggestion + * for. This provides a way for user to get follow up smart reply suggestion + * after a smart reply selection, without sending a text message. + * @param {string} request.latestMessage + * The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} request.contextSize + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. By default 20 and at most 50. + * @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 [SuggestSmartRepliesResponse]{@link google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse}. + * 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/v2beta1/participants.suggest_smart_replies.js + * region_tag:dialogflow_v2beta1_generated_Participants_SuggestSmartReplies_async + */ + suggestSmartReplies( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest + | undefined + ), + {} | undefined + ] + >; + suggestSmartReplies( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestSmartReplies( + request: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest + | null + | undefined, + {} | null | undefined + > + ): void; + suggestSmartReplies( + request?: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + | protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesRequest + | 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.suggestSmartReplies(request, options, callback); + } + /** + * Deprecated. use {@link google.cloud.dialogflow.v2beta1.Participants.SuggestArticles|SuggestArticles} and {@link google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers|SuggestFaqAnswers} instead. + * + * Gets suggestions for a participant based on specific historical + * messages. + * + * Note that {@link google.cloud.dialogflow.v2beta1.Participants.ListSuggestions|ListSuggestions} will only list the auto-generated + * suggestions, while {@link google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion|CompileSuggestion} will try to compile suggestion + * based on the provided conversation context in the real time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestion for. + * Format: `projects//locations//conversations//participants/`. + * @param {string} request.latestMessage + * Optional. The name of the latest conversation message to compile suggestion + * for. If empty, it will be the latest message of the conversation. + * + * Format: `projects//locations//conversations//messages/`. + * @param {number} request.contextSize + * Optional. Max number of messages prior to and including + * [latest_message] to use as context when compiling the + * suggestion. If zero or less than zero, 20 is used. + * @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 [CompileSuggestionResponse]{@link google.cloud.dialogflow.v2beta1.CompileSuggestionResponse}. + * 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/v2beta1/participants.compile_suggestion.js + * region_tag:dialogflow_v2beta1_generated_Participants_CompileSuggestion_async + * @deprecated CompileSuggestion is deprecated and may be removed in a future version. + */ + compileSuggestion( + request?: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest + | undefined + ), + {} | undefined + ] + >; + compileSuggestion( + request: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + | protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + compileSuggestion( + request: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + | protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + compileSuggestion( + request?: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + | protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + | protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse, + ( + | protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionRequest + | 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(); + this.warn( + 'DEP$Participants-$CompileSuggestion', + 'CompileSuggestion is deprecated and may be removed in a future version.', + 'DeprecationWarning' + ); + return this.innerApiCalls.compileSuggestion(request, options, callback); + } + + /** + * Adds a text (e.g., chat) or audio (e.g., phone recording) message from a + * participant into the conversation. + * Note: This method is only available through the gRPC API (not REST). + * + * The top-level message sent to the client by the server is + * `StreamingAnalyzeContentResponse`. Multiple response messages can be + * returned in order. The first one or more messages contain the + * `recognition_result` field. Each result represents a more complete + * transcript of what the user said. The next message contains the + * `reply_text` field, and potentially the `reply_audio` and/or the + * `automated_agent_reply` fields. + * + * Note: Always use agent versions for production traffic + * sent to virtual agents. See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + * @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 is both readable and writable. It accepts objects + * representing [StreamingAnalyzeContentRequest]{@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest} for write() method, and + * will emit objects representing [StreamingAnalyzeContentResponse]{@link google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse} on 'data' event asynchronously. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) + * for more details and examples. + * @example include:samples/generated/v2beta1/participants.streaming_analyze_content.js + * region_tag:dialogflow_v2beta1_generated_Participants_StreamingAnalyzeContent_async + */ + streamingAnalyzeContent(options?: CallOptions): gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingAnalyzeContent(null, options); + } + + /** + * Returns the list of all participants in the specified conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. + * 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 `listParticipantsAsync()` + * 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. + */ + listParticipants( + request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IParticipant[], + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse + ] + >; + listParticipants( + request: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IParticipant + > + ): void; + listParticipants( + request: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IParticipant + > + ): void; + listParticipants( + request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IParticipant + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IParticipant + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IParticipant[], + protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListParticipantsResponse + ] + > | 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.listParticipants(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 conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Participant]{@link google.cloud.dialogflow.v2beta1.Participant} 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 `listParticipantsAsync()` + * 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. + */ + listParticipantsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + 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['listParticipants']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listParticipants.createStream( + this.innerApiCalls.listParticipants as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listParticipants`, 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 conversation to list all participants from. + * Format: `projects//locations//conversations/`. + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Participant]{@link google.cloud.dialogflow.v2beta1.Participant}. 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/v2beta1/participants.list_participants.js + * region_tag:dialogflow_v2beta1_generated_Participants_ListParticipants_async + */ + listParticipantsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListParticipantsRequest, + 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['listParticipants']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listParticipants.asyncIterate( + this.innerApiCalls['listParticipants'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Deprecated: Use inline suggestion, event based suggestion or + * Suggestion* API instead. + * See {@link google.cloud.dialogflow.v2beta1.HumanAgentAssistantConfig.name|HumanAgentAssistantConfig.name} for more + * details. + * Removal Date: 2020-09-01. + * + * Retrieves suggestions for live agents. + * + * This method should be used by human agent client software to fetch auto + * generated suggestions in real-time, while the conversation with an end user + * is in progress. The functionality is implemented in terms of the + * [list + * pagination](https://cloud.google.com/apis/design/design_patterns#list_pagination) + * design pattern. The client app should use the `next_page_token` field + * to fetch the next batch of suggestions. `suggestions` are sorted by + * `create_time` in descending order. + * To fetch latest suggestion, just set `page_size` to 1. + * To fetch new suggestions without duplication, send request with filter + * `create_time_epoch_microseconds > [first item's create_time of previous + * request]` and empty page_token. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the participant to fetch suggestions for. + * Format: `projects//locations//conversations//participants/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. The + * default value is 100; the maximum value is 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * Optional. Filter on suggestions fields. Currently predicates on + * `create_time` and `create_time_epoch_microseconds` are supported. + * `create_time` only support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Suggestion]{@link google.cloud.dialogflow.v2beta1.Suggestion}. + * 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 `listSuggestionsAsync()` + * 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. + * @deprecated ListSuggestions is deprecated and may be removed in a future version. + */ + listSuggestions( + request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestion[], + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse + ] + >; + listSuggestions( + request: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.ISuggestion + > + ): void; + listSuggestions( + request: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.ISuggestion + > + ): void; + listSuggestions( + request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.ISuggestion + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.ISuggestion + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISuggestion[], + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListSuggestionsResponse + ] + > | 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(); + this.warn( + 'DEP$Participants-$ListSuggestions', + 'ListSuggestions is deprecated and may be removed in a future version.', + 'DeprecationWarning' + ); + return this.innerApiCalls.listSuggestions(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 name of the participant to fetch suggestions for. + * Format: `projects//locations//conversations//participants/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. The + * default value is 100; the maximum value is 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * Optional. Filter on suggestions fields. Currently predicates on + * `create_time` and `create_time_epoch_microseconds` are supported. + * `create_time` only support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 [Suggestion]{@link google.cloud.dialogflow.v2beta1.Suggestion} 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 `listSuggestionsAsync()` + * 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. + * @deprecated ListSuggestions is deprecated and may be removed in a future version. + */ + listSuggestionsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + 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['listSuggestions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + this.warn( + 'DEP$Participants-$ListSuggestions', + 'ListSuggestions is deprecated and may be removed in a future version.', + 'DeprecationWarning' + ); + return this.descriptors.page.listSuggestions.createStream( + this.innerApiCalls.listSuggestions as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listSuggestions`, 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 name of the participant to fetch suggestions for. + * Format: `projects//locations//conversations//participants/`. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. The + * default value is 100; the maximum value is 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @param {string} request.filter + * Optional. Filter on suggestions fields. Currently predicates on + * `create_time` and `create_time_epoch_microseconds` are supported. + * `create_time` only support milliseconds accuracy. E.g., + * `create_time_epoch_microseconds > 1551790877964485` or + * `create_time > "2017-01-15T01:30:15.01Z"` + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * @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 + * [Suggestion]{@link google.cloud.dialogflow.v2beta1.Suggestion}. 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/v2beta1/participants.list_suggestions.js + * region_tag:dialogflow_v2beta1_generated_Participants_ListSuggestions_async + * @deprecated ListSuggestions is deprecated and may be removed in a future version. + */ + listSuggestionsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListSuggestionsRequest, + 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['listSuggestions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + this.warn( + 'DEP$Participants-$ListSuggestions', + 'ListSuggestions is deprecated and may be removed in a future version.', + 'DeprecationWarning' + ); + return this.descriptors.page.listSuggestions.asyncIterate( + this.innerApiCalls['listSuggestions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.participantsStub && !this._terminated) { + return this.participantsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/participants_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/participants_client_config.json new file mode 100644 index 00000000000..2b59076003d --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/participants_client_config.json @@ -0,0 +1,84 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Participants": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "CreateParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListParticipants": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateParticipant": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "AnalyzeContent": { + "timeout_millis": 220000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "StreamingAnalyzeContent": { + "timeout_millis": 220000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SuggestArticles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestFaqAnswers": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "SuggestSmartReplies": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "ListSuggestions": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CompileSuggestion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/participants_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/participants_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/participants_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts new file mode 100644 index 00000000000..6d314c24df8 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client.ts @@ -0,0 +1,3532 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2beta1/session_entity_types_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './session_entity_types_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.SessionEntityType|SessionEntityTypes}. + * @class + * @memberof v2beta1 + */ +export class SessionEntityTypesClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionEntityTypesStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionEntityTypesClient. + * + * @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 SessionEntityTypesClient({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 SessionEntityTypesClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listSessionEntityTypes: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'sessionEntityTypes' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.SessionEntityTypes', + 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.sessionEntityTypesStub) { + return this.sessionEntityTypesStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.SessionEntityTypes. + this.sessionEntityTypesStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.SessionEntityTypes' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1 + .SessionEntityTypes, + 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 sessionEntityTypesStubMethods = [ + 'listSessionEntityTypes', + 'getSessionEntityType', + 'createSessionEntityType', + 'updateSessionEntityType', + 'deleteSessionEntityType', + ]; + for (const methodName of sessionEntityTypesStubMethods) { + const callPromise = this.sessionEntityTypesStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionEntityTypesStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the session entity type. Supported formats: + * - `projects//agent/sessions//entityTypes/` + * - `projects//locations//agent/sessions//entityTypes/` + * - `projects//agent/environments//users//sessions//entityTypes/` + * - `projects//locations//agent/environments/ + * /users//sessions//entityTypes/` + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. + * 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/v2beta1/session_entity_types.get_session_entity_type.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_GetSessionEntityType_async + */ + getSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + getSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.IGetSessionEntityTypeRequest + | 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.getSessionEntityType(request, options, callback); + } + /** + * Creates a session entity type. + * + * If the specified session entity type already exists, overrides the + * session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to create a session entity type for. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} request.sessionEntityType + * Required. The session entity type to create. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. + * 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/v2beta1/session_entity_types.create_session_entity_type.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_CreateSessionEntityType_async + */ + createSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + createSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.ICreateSessionEntityTypeRequest + | 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.createSessionEntityType( + request, + options, + callback + ); + } + /** + * Updates the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.SessionEntityType} request.sessionEntityType + * Required. The session entity type to update. + * @param {google.protobuf.FieldMask} request.updateMask + * Optional. The mask to control which fields get updated. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. + * 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/v2beta1/session_entity_types.update_session_entity_type.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_UpdateSessionEntityType_async + */ + updateSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + | protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType, + ( + | protos.google.cloud.dialogflow.v2beta1.IUpdateSessionEntityTypeRequest + | 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({ + 'session_entity_type.name': request.sessionEntityType!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateSessionEntityType( + request, + options, + callback + ); + } + /** + * Deletes the specified session entity type. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the entity type to delete. + * Supported formats: + * - `projects//agent/sessions//entityTypes/` + * - `projects//locations//agent/sessions//entityTypes/` + * - `projects//agent/environments//users//sessions//entityTypes/` + * - `projects//locations//agent/environments/ + * /users//sessions//entityTypes/` + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @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/v2beta1/session_entity_types.delete_session_entity_type.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_DeleteSessionEntityType_async + */ + deleteSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest + | undefined + ), + {} | undefined + ] + >; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteSessionEntityType( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteSessionEntityType( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.dialogflow.v2beta1.IDeleteSessionEntityTypeRequest + | 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.deleteSessionEntityType( + request, + options, + callback + ); + } + + /** + * Returns the list of all session entity types in the specified session. + * + * This method doesn't work with Google Assistant integration. + * Contact Dialogflow support if you need to use session entities + * with Google Assistant integration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The session to list all session entity types from. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. + * 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 `listSessionEntityTypesAsync()` + * 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. + */ + listSessionEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[], + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse + ] + >; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType + > + ): void; + listSessionEntityTypes( + request: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType + > + ): void; + listSessionEntityTypes( + request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + | protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[], + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesResponse + ] + > | 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.listSessionEntityTypes( + 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 session to list all session entity types from. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType} 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 `listSessionEntityTypesAsync()` + * 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. + */ + listSessionEntityTypesStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + 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['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.createStream( + this.innerApiCalls.listSessionEntityTypes as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listSessionEntityTypes`, 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 session to list all session entity types from. + * Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment. + * If `User ID` is not specified, we assume default '-' user. + * @param {number} request.pageSize + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @param {string} request.pageToken + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [SessionEntityType]{@link google.cloud.dialogflow.v2beta1.SessionEntityType}. 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/v2beta1/session_entity_types.list_session_entity_types.js + * region_tag:dialogflow_v2beta1_generated_SessionEntityTypes_ListSessionEntityTypes_async + */ + listSessionEntityTypesAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListSessionEntityTypesRequest, + 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['listSessionEntityTypes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSessionEntityTypes.asyncIterate( + this.innerApiCalls['listSessionEntityTypes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project: string, session: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.sessionEntityTypesStub && !this._terminated) { + return this.sessionEntityTypesStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client_config.json new file mode 100644 index 00000000000..f007c235e62 --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.SessionEntityTypes": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListSessionEntityTypes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteSessionEntityType": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/session_entity_types_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/sessions_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/sessions_client.ts new file mode 100644 index 00000000000..f3b75cdcc5b --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/sessions_client.ts @@ -0,0 +1,3258 @@ +// 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. +// +// ** 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, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import {PassThrough} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v2beta1/sessions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sessions_client_config.json'; +const version = require('../../../package.json').version; + +/** + * A service used for session interactions. + * + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * @class + * @memberof v2beta1 + */ +export class SessionsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + sessionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SessionsClient. + * + * @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 SessionsClient({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 SessionsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + streamingDetectIntent: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + opts.fallback === 'rest' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Sessions', + 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.sessionsStub) { + return this.sessionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Sessions. + this.sessionsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Sessions' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Sessions, + 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 sessionsStubMethods = ['detectIntent', 'streamingDetectIntent']; + for (const methodName of sessionsStubMethods) { + const callPromise = this.sessionsStub.then( + stub => + (...args: Array<{}>) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new PassThrough(); + setImmediate(() => { + stream.emit( + 'error', + new this._gaxModule.GoogleError( + 'The client has already been closed.' + ) + ); + }); + return stream; + } + 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.stream[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sessionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Processes a natural language query and returns structured, actionable data + * as a result. This method is not idempotent, because it may cause contexts + * and session entity types to be updated, which in turn might affect + * results of future queries. + * + * If you might use + * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + * or other CCAI products now or in the future, consider using + * {@link google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent|AnalyzeContent} + * instead of `DetectIntent`. `AnalyzeContent` has additional + * functionality for Agent Assist and other CCAI products. + * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.session + * Required. The name of the session this query is sent to. Supported formats: + * - `projects//agent/sessions/, + * - `projects//locations//agent/sessions/`, + * - `projects//agent/environments//users//sessions/`, + * - `projects//locations//agent/environments//users//sessions/`, + * + * If `Location ID` is not specified we assume default 'us' location. If + * `Environment ID` is not specified, we assume default 'draft' environment + * (`Environment ID` might be referred to as environment name at some places). + * If `User ID` is not specified, we are using "-". It's up to the API caller + * to choose an appropriate `Session ID` and `User Id`. They can be a random + * number or some type of user and session identifiers (preferably hashed). + * The length of the `Session ID` and `User ID` must not exceed 36 characters. + * For more information, see the [API interactions + * guide](https://cloud.google.com/dialogflow/docs/api-overview). + * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * @param {google.cloud.dialogflow.v2beta1.QueryParameters} request.queryParams + * The parameters of this query. + * @param {google.cloud.dialogflow.v2beta1.QueryInput} request.queryInput + * Required. The input specification. It can be set to: + * + * 1. an audio config + * which instructs the speech recognizer how to process the speech audio, + * + * 2. a conversational query in the form of text, or + * + * 3. an event that specifies which intent to trigger. + * @param {google.cloud.dialogflow.v2beta1.OutputAudioConfig} request.outputAudioConfig + * Instructs the speech synthesizer how to generate the output + * audio. If this field is not set and agent-level speech synthesizer is not + * configured, no output audio is generated. + * @param {google.protobuf.FieldMask} request.outputAudioConfigMask + * Mask for {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config|output_audio_config} indicating which settings in this + * request-level config should override speech synthesizer settings defined at + * agent-level. + * + * If unspecified or empty, {@link google.cloud.dialogflow.v2beta1.DetectIntentRequest.output_audio_config|output_audio_config} replaces the agent-level + * config in its entirety. + * @param {Buffer} request.inputAudio + * The natural language speech audio to be processed. This field + * should be populated iff `query_input` is set to an input audio config. + * A single request can contain up to 1 minute of speech audio data. + * @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 [DetectIntentResponse]{@link google.cloud.dialogflow.v2beta1.DetectIntentResponse}. + * 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/v2beta1/sessions.detect_intent.js + * region_tag:dialogflow_v2beta1_generated_Sessions_DetectIntent_async + */ + detectIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest | undefined, + {} | undefined + ] + >; + detectIntent( + request: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + | protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + detectIntent( + request: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + | protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest + | null + | undefined, + {} | null | undefined + > + ): void; + detectIntent( + request?: protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + | protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + | protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse, + protos.google.cloud.dialogflow.v2beta1.IDetectIntentRequest | 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({ + session: request.session ?? '', + }); + this.initialize(); + return this.innerApiCalls.detectIntent(request, options, callback); + } + + /** + * Processes a natural language query in audio format in a streaming fashion + * and returns structured, actionable data as a result. This method is only + * available via the gRPC API (not REST). + * + * If you might use + * [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa) + * or other CCAI products now or in the future, consider using + * {@link google.cloud.dialogflow.v2beta1.Participants.StreamingAnalyzeContent|StreamingAnalyzeContent} + * instead of `StreamingDetectIntent`. `StreamingAnalyzeContent` has + * additional functionality for Agent Assist and other CCAI products. + * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/es/docs/agents-versions). + * + * @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 is both readable and writable. It accepts objects + * representing [StreamingDetectIntentRequest]{@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest} for write() method, and + * will emit objects representing [StreamingDetectIntentResponse]{@link google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse} on 'data' event asynchronously. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming) + * for more details and examples. + * @example include:samples/generated/v2beta1/sessions.streaming_detect_intent.js + * region_tag:dialogflow_v2beta1_generated_Sessions_StreamingDetectIntent_async + */ + streamingDetectIntent(options?: CallOptions): gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingDetectIntent(null, options); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSession resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionPath( + project: string, + environment: string, + user: string, + session: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionName( + projectAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match( + projectAgentEnvironmentUserSessionName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionName( + projectAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match( + projectAgentEnvironmentUserSessionName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionName( + projectAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match( + projectAgentEnvironmentUserSessionName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSession resource. + * + * @param {string} projectAgentEnvironmentUserSessionName + * A fully-qualified path representing project_agent_environment_user_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionName( + projectAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match( + projectAgentEnvironmentUserSessionName + ).session; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSession resource name string. + * + * @param {string} project + * @param {string} session + * @returns {string} Resource name string. + */ + projectAgentSessionPath(project: string, session: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.render({ + project: project, + session: session, + }); + } + + /** + * Parse the project from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).project; + } + + /** + * Parse the session from ProjectAgentSession resource. + * + * @param {string} projectAgentSessionName + * A fully-qualified path representing project_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionName(projectAgentSessionName: string) { + return this.pathTemplates.projectAgentSessionPathTemplate.match( + projectAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionPath( + project: string, + location: string, + environment: string, + user: string, + session: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSession resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionName + * A fully-qualified path representing project_location_agent_environment_user_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionName( + projectLocationAgentEnvironmentUserSessionName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match( + projectLocationAgentEnvironmentUserSessionName + ).session; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSession resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @returns {string} Resource name string. + */ + projectLocationAgentSessionPath( + project: string, + location: string, + session: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.render({ + project: project, + location: location, + session: session, + }); + } + + /** + * Parse the project from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSession resource. + * + * @param {string} projectLocationAgentSessionName + * A fully-qualified path representing project_location_agent_session resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionName( + projectLocationAgentSessionName: string + ) { + return this.pathTemplates.projectLocationAgentSessionPathTemplate.match( + projectLocationAgentSessionName + ).session; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.sessionsStub && !this._terminated) { + return this.sessionsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/sessions_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/sessions_client_config.json new file mode 100644 index 00000000000..e36850ea9dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/sessions_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Sessions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "DetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "StreamingDetectIntent": { + "timeout_millis": 220000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/sessions_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/sessions_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/sessions_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/src/v2beta1/versions_client.ts b/packages/google-cloud-dialogflow/src/v2beta1/versions_client.ts new file mode 100644 index 00000000000..bd04cbf5a5c --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/versions_client.ts @@ -0,0 +1,3376 @@ +// 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. +// +// ** 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, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} 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/v2beta1/versions_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './versions_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing {@link google.cloud.dialogflow.v2beta1.Version|Versions}. + * @class + * @memberof v2beta1 + */ +export class VersionsClient { + 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}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + versionsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of VersionsClient. + * + * @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 VersionsClient({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 VersionsClient; + 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); + + // 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; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + // 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent' + ), + projectAgentEntityTypePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/entityTypes/{entity_type}' + ), + projectAgentEnvironmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}' + ), + projectAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentFulfillmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/fulfillment' + ), + projectAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/intents/{intent}' + ), + projectAgentSessionContextPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/contexts/{context}' + ), + projectAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/agent/versions/{version}' + ), + projectAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/answerRecords/{answer_record}' + ), + projectConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}' + ), + projectConversationMessagePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/messages/{message}' + ), + projectConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/conversations/{conversation}/participants/{participant}' + ), + projectConversationProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/conversationProfiles/{conversation_profile}' + ), + projectKnowledgeBasePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}' + ), + projectKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + projectLocationAgentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent' + ), + projectLocationAgentEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/entityTypes/{entity_type}' + ), + projectLocationAgentEnvironmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}' + ), + projectLocationAgentEnvironmentUserSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/contexts/{context}' + ), + projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/environments/{environment}/users/{user}/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentFulfillmentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/fulfillment' + ), + projectLocationAgentIntentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/intents/{intent}' + ), + projectLocationAgentSessionContextPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/contexts/{context}' + ), + projectLocationAgentSessionEntityTypePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/sessions/{session}/entityTypes/{entity_type}' + ), + projectLocationAgentVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/agent/versions/{version}' + ), + projectLocationAnswerRecordPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/answerRecords/{answer_record}' + ), + projectLocationConversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + projectLocationConversationMessagePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/messages/{message}' + ), + projectLocationConversationParticipantPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}' + ), + projectLocationConversationProfilePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversationProfiles/{conversation_profile}' + ), + projectLocationKnowledgeBasePathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}' + ), + projectLocationKnowledgeBaseDocumentPathTemplate: + new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/knowledgeBases/{knowledge_base}/documents/{document}' + ), + }; + + // 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 = { + listVersions: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'versions' + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.dialogflow.v2beta1.Versions', + 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.versionsStub) { + return this.versionsStub; + } + + // Put together the "service stub" for + // google.cloud.dialogflow.v2beta1.Versions. + this.versionsStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.dialogflow.v2beta1.Versions' + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.dialogflow.v2beta1.Versions, + 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 versionsStubMethods = [ + 'listVersions', + 'getVersion', + 'createVersion', + 'updateVersion', + 'deleteVersion', + ]; + for (const methodName of versionsStubMethods) { + const callPromise = this.versionsStub.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] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.versionsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'dialogflow.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 'dialogflow.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/dialogflow', + ]; + } + + 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 -- + // ------------------- + /** + * Retrieves the specified agent version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @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 [Version]{@link google.cloud.dialogflow.v2beta1.Version}. + * 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/v2beta1/versions.get_version.js + * region_tag:dialogflow_v2beta1_generated_Versions_GetVersion_async + */ + getVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest | undefined, + {} | undefined + ] + >; + getVersion( + request: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getVersion( + request: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + getVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IGetVersionRequest | 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.getVersion(request, options, callback); + } + /** + * Creates an agent version. + * + * The new version points to the agent instance in the "default" environment. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to create a version for. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {google.cloud.dialogflow.v2beta1.Version} request.version + * Required. The version to create. + * @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 [Version]{@link google.cloud.dialogflow.v2beta1.Version}. + * 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/v2beta1/versions.create_version.js + * region_tag:dialogflow_v2beta1_generated_Versions_CreateVersion_async + */ + createVersion( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest | undefined, + {} | undefined + ] + >; + createVersion( + request: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createVersion( + request: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + createVersion( + request?: protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.ICreateVersionRequest | 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.createVersion(request, options, callback); + } + /** + * Updates the specified agent version. + * + * Note that this method does not allow you to update the state of the agent + * the given version points to. It allows you to update only mutable + * properties of the version resource. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.dialogflow.v2beta1.Version} request.version + * Required. The version to update. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The mask to control which fields get updated. + * @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 [Version]{@link google.cloud.dialogflow.v2beta1.Version}. + * 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/v2beta1/versions.update_version.js + * region_tag:dialogflow_v2beta1_generated_Versions_UpdateVersion_async + */ + updateVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest | undefined, + {} | undefined + ] + >; + updateVersion( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateVersion( + request: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, + callback: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + updateVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.dialogflow.v2beta1.IVersion, + | protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IVersion, + protos.google.cloud.dialogflow.v2beta1.IUpdateVersionRequest | 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({ + 'version.name': request.version!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateVersion(request, options, callback); + } + /** + * Delete the specified agent version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the version to delete. + * Supported formats: + * - `projects//agent/versions/` + * - `projects//locations//agent/versions/` + * @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/v2beta1/versions.delete_version.js + * region_tag:dialogflow_v2beta1_generated_Versions_DeleteVersion_async + */ + deleteVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, + options?: CallOptions + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest | undefined, + {} | undefined + ] + >; + deleteVersion( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteVersion( + request: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + > + ): void; + deleteVersion( + request?: protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IDeleteVersionRequest | 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.deleteVersion(request, options, callback); + } + + /** + * Returns the list of all versions of the specified agent. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Version]{@link google.cloud.dialogflow.v2beta1.Version}. + * 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 `listVersionsAsync()` + * 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. + */ + listVersions( + request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IVersion[], + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse + ] + >; + listVersions( + request: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IVersion + > + ): void; + listVersions( + request: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IVersion + > + ): void; + listVersions( + request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IVersion + >, + callback?: PaginationCallback< + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + | protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse + | null + | undefined, + protos.google.cloud.dialogflow.v2beta1.IVersion + > + ): Promise< + [ + protos.google.cloud.dialogflow.v2beta1.IVersion[], + protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest | null, + protos.google.cloud.dialogflow.v2beta1.IListVersionsResponse + ] + > | 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.listVersions(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 agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 [Version]{@link google.cloud.dialogflow.v2beta1.Version} 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 `listVersionsAsync()` + * 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. + */ + listVersionsStream( + request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + 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['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.createStream( + this.innerApiCalls.listVersions as GaxCall, + request, + callSettings + ); + } + + /** + * Equivalent to `listVersions`, 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 agent to list all versions from. + * Supported formats: + * - `projects//agent` + * - `projects//locations//agent` + * @param {number} [request.pageSize] + * Optional. The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @param {string} [request.pageToken] + * Optional. The next_page_token value returned from a previous list request. + * @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 + * [Version]{@link google.cloud.dialogflow.v2beta1.Version}. 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/v2beta1/versions.list_versions.js + * region_tag:dialogflow_v2beta1_generated_Versions_ListVersions_async + */ + listVersionsAsync( + request?: protos.google.cloud.dialogflow.v2beta1.IListVersionsRequest, + 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['listVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listVersions.asyncIterate( + this.innerApiCalls['listVersions'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @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 [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + + /** + * Lists information about the supported locations for this service. 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 + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @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 + * [Location]{@link google.cloud.location.Location}. 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 + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectAgent resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentPath(project: string) { + return this.pathTemplates.projectAgentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgent resource. + * + * @param {string} projectAgentName + * A fully-qualified path representing project_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentName(projectAgentName: string) { + return this.pathTemplates.projectAgentPathTemplate.match(projectAgentName) + .project; + } + + /** + * Return a fully-qualified projectAgentEntityType resource name string. + * + * @param {string} project + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEntityTypePath(project: string, entityType: string) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.render({ + project: project, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).project; + } + + /** + * Parse the entity_type from ProjectAgentEntityType resource. + * + * @param {string} projectAgentEntityTypeName + * A fully-qualified path representing project_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEntityTypeName( + projectAgentEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEntityTypePathTemplate.match( + projectAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} environment + * @returns {string} Resource name string. + */ + projectAgentEnvironmentPath(project: string, environment: string) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.render({ + project: project, + environment: environment, + }); + } + + /** + * Parse the project from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironment resource. + * + * @param {string} projectAgentEnvironmentName + * A fully-qualified path representing project_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentName( + projectAgentEnvironmentName: string + ) { + return this.pathTemplates.projectAgentEnvironmentPathTemplate.match( + projectAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionContextPath( + project: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentEnvironmentUserSessionContextName( + projectAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match( + projectAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentEnvironmentUserSessionEntityTypePath( + project: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the environment from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + projectAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentFulfillment resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectAgentFulfillmentPath(project: string) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from ProjectAgentFulfillment resource. + * + * @param {string} projectAgentFulfillmentName + * A fully-qualified path representing project_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentFulfillmentName( + projectAgentFulfillmentName: string + ) { + return this.pathTemplates.projectAgentFulfillmentPathTemplate.match( + projectAgentFulfillmentName + ).project; + } + + /** + * Return a fully-qualified projectAgentIntent resource name string. + * + * @param {string} project + * @param {string} intent + * @returns {string} Resource name string. + */ + projectAgentIntentPath(project: string, intent: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.render({ + project: project, + intent: intent, + }); + } + + /** + * Parse the project from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).project; + } + + /** + * Parse the intent from ProjectAgentIntent resource. + * + * @param {string} projectAgentIntentName + * A fully-qualified path representing project_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectAgentIntentName(projectAgentIntentName: string) { + return this.pathTemplates.projectAgentIntentPathTemplate.match( + projectAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectAgentSessionContextPath( + project: string, + session: string, + context: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.render({ + project: project, + session: session, + context: context, + }); + } + + /** + * Parse the project from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectAgentSessionContext resource. + * + * @param {string} projectAgentSessionContextName + * A fully-qualified path representing project_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectAgentSessionContextName( + projectAgentSessionContextName: string + ) { + return this.pathTemplates.projectAgentSessionContextPathTemplate.match( + projectAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectAgentSessionEntityTypePath( + project: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.render({ + project: project, + session: session, + entity_type: entityType, + }); + } + + /** + * Parse the project from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the session from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectAgentSessionEntityType resource. + * + * @param {string} projectAgentSessionEntityTypeName + * A fully-qualified path representing project_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectAgentSessionEntityTypeName( + projectAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectAgentSessionEntityTypePathTemplate.match( + projectAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectAgentVersion resource name string. + * + * @param {string} project + * @param {string} version + * @returns {string} Resource name string. + */ + projectAgentVersionPath(project: string, version: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.render({ + project: project, + version: version, + }); + } + + /** + * Parse the project from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).project; + } + + /** + * Parse the version from ProjectAgentVersion resource. + * + * @param {string} projectAgentVersionName + * A fully-qualified path representing project_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectAgentVersionName(projectAgentVersionName: string) { + return this.pathTemplates.projectAgentVersionPathTemplate.match( + projectAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectAnswerRecord resource name string. + * + * @param {string} project + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectAnswerRecordPath(project: string, answerRecord: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.render({ + project: project, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectAnswerRecordName(projectAnswerRecordName: string) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).project; + } + + /** + * Parse the answer_record from ProjectAnswerRecord resource. + * + * @param {string} projectAnswerRecordName + * A fully-qualified path representing project_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectAnswerRecordName( + projectAnswerRecordName: string + ) { + return this.pathTemplates.projectAnswerRecordPathTemplate.match( + projectAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectConversation resource name string. + * + * @param {string} project + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectConversationPath(project: string, conversation: string) { + return this.pathTemplates.projectConversationPathTemplate.render({ + project: project, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationName(projectConversationName: string) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).project; + } + + /** + * Parse the conversation from ProjectConversation resource. + * + * @param {string} projectConversationName + * A fully-qualified path representing project_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationName( + projectConversationName: string + ) { + return this.pathTemplates.projectConversationPathTemplate.match( + projectConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectConversationMessage resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectConversationMessagePath( + project: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.render({ + project: project, + conversation: conversation, + message: message, + }); + } + + /** + * Parse the project from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).project; + } + + /** + * Parse the conversation from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectConversationMessage resource. + * + * @param {string} projectConversationMessageName + * A fully-qualified path representing project_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectConversationMessageName( + projectConversationMessageName: string + ) { + return this.pathTemplates.projectConversationMessagePathTemplate.match( + projectConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectConversationParticipant resource name string. + * + * @param {string} project + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectConversationParticipantPath( + project: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.render( + { + project: project, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).project; + } + + /** + * Parse the conversation from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectConversationParticipant resource. + * + * @param {string} projectConversationParticipantName + * A fully-qualified path representing project_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectConversationParticipantName( + projectConversationParticipantName: string + ) { + return this.pathTemplates.projectConversationParticipantPathTemplate.match( + projectConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectConversationProfile resource name string. + * + * @param {string} project + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectConversationProfilePath(project: string, conversationProfile: string) { + return this.pathTemplates.projectConversationProfilePathTemplate.render({ + project: project, + conversation_profile: conversationProfile, + }); + } + + /** + * Parse the project from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).project; + } + + /** + * Parse the conversation_profile from ProjectConversationProfile resource. + * + * @param {string} projectConversationProfileName + * A fully-qualified path representing project_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectConversationProfileName( + projectConversationProfileName: string + ) { + return this.pathTemplates.projectConversationProfilePathTemplate.match( + projectConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectKnowledgeBasePath(project: string, knowledgeBase: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseName(projectKnowledgeBaseName: string) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBase resource. + * + * @param {string} projectKnowledgeBaseName + * A fully-qualified path representing project_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseName( + projectKnowledgeBaseName: string + ) { + return this.pathTemplates.projectKnowledgeBasePathTemplate.match( + projectKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectKnowledgeBaseDocumentPath( + project: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render({ + project: project, + knowledge_base: knowledgeBase, + document: document, + }); + } + + /** + * Parse the project from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the knowledge_base from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectKnowledgeBaseDocument resource. + * + * @param {string} projectKnowledgeBaseDocumentName + * A fully-qualified path representing project_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectKnowledgeBaseDocumentName( + projectKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match( + projectKnowledgeBaseDocumentName + ).document; + } + + /** + * Return a fully-qualified projectLocationAgent resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgent resource. + * + * @param {string} projectLocationAgentName + * A fully-qualified path representing project_location_agent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentName(projectLocationAgentName: string) { + return this.pathTemplates.projectLocationAgentPathTemplate.match( + projectLocationAgentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEntityTypePath( + project: string, + location: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.render( + { + project: project, + location: location, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).location; + } + + /** + * Parse the entity_type from ProjectLocationAgentEntityType resource. + * + * @param {string} projectLocationAgentEntityTypeName + * A fully-qualified path representing project_location_agent_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEntityTypeName( + projectLocationAgentEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEntityTypePathTemplate.match( + projectLocationAgentEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironment resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentPath( + project: string, + location: string, + environment: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render( + { + project: project, + location: location, + environment: environment, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironment resource. + * + * @param {string} projectLocationAgentEnvironmentName + * A fully-qualified path representing project_location_agent_environment resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentName( + projectLocationAgentEnvironmentName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match( + projectLocationAgentEnvironmentName + ).environment; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionContextPath( + project: string, + location: string, + environment: string, + user: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentEnvironmentUserSessionContext resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionContextName + * A fully-qualified path representing project_location_agent_environment_user_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + projectLocationAgentEnvironmentUserSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match( + projectLocationAgentEnvironmentUserSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentEnvironmentUserSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} environment + * @param {string} user + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentEnvironmentUserSessionEntityTypePath( + project: string, + location: string, + environment: string, + user: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + environment: environment, + user: user, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).location; + } + + /** + * Parse the environment from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the environment. + */ + matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).environment; + } + + /** + * Parse the user from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the user. + */ + matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).user; + } + + /** + * Parse the session from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentEnvironmentUserSessionEntityType resource. + * + * @param {string} projectLocationAgentEnvironmentUserSessionEntityTypeName + * A fully-qualified path representing project_location_agent_environment_user_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + projectLocationAgentEnvironmentUserSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match( + projectLocationAgentEnvironmentUserSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentFulfillment resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + projectLocationAgentFulfillmentPath(project: string, location: string) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render( + { + project: project, + location: location, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentFulfillment resource. + * + * @param {string} projectLocationAgentFulfillmentName + * A fully-qualified path representing project_location_agent_fulfillment resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentFulfillmentName( + projectLocationAgentFulfillmentName: string + ) { + return this.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match( + projectLocationAgentFulfillmentName + ).location; + } + + /** + * Return a fully-qualified projectLocationAgentIntent resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} intent + * @returns {string} Resource name string. + */ + projectLocationAgentIntentPath( + project: string, + location: string, + intent: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.render({ + project: project, + location: location, + intent: intent, + }); + } + + /** + * Parse the project from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).location; + } + + /** + * Parse the intent from ProjectLocationAgentIntent resource. + * + * @param {string} projectLocationAgentIntentName + * A fully-qualified path representing project_location_agent_intent resource. + * @returns {string} A string representing the intent. + */ + matchIntentFromProjectLocationAgentIntentName( + projectLocationAgentIntentName: string + ) { + return this.pathTemplates.projectLocationAgentIntentPathTemplate.match( + projectLocationAgentIntentName + ).intent; + } + + /** + * Return a fully-qualified projectLocationAgentSessionContext resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} context + * @returns {string} Resource name string. + */ + projectLocationAgentSessionContextPath( + project: string, + location: string, + session: string, + context: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.render( + { + project: project, + location: location, + session: session, + context: context, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).session; + } + + /** + * Parse the context from ProjectLocationAgentSessionContext resource. + * + * @param {string} projectLocationAgentSessionContextName + * A fully-qualified path representing project_location_agent_session_context resource. + * @returns {string} A string representing the context. + */ + matchContextFromProjectLocationAgentSessionContextName( + projectLocationAgentSessionContextName: string + ) { + return this.pathTemplates.projectLocationAgentSessionContextPathTemplate.match( + projectLocationAgentSessionContextName + ).context; + } + + /** + * Return a fully-qualified projectLocationAgentSessionEntityType resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} session + * @param {string} entity_type + * @returns {string} Resource name string. + */ + projectLocationAgentSessionEntityTypePath( + project: string, + location: string, + session: string, + entityType: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render( + { + project: project, + location: location, + session: session, + entity_type: entityType, + } + ); + } + + /** + * Parse the project from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).location; + } + + /** + * Parse the session from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the session. + */ + matchSessionFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).session; + } + + /** + * Parse the entity_type from ProjectLocationAgentSessionEntityType resource. + * + * @param {string} projectLocationAgentSessionEntityTypeName + * A fully-qualified path representing project_location_agent_session_entity_type resource. + * @returns {string} A string representing the entity_type. + */ + matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + projectLocationAgentSessionEntityTypeName: string + ) { + return this.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match( + projectLocationAgentSessionEntityTypeName + ).entity_type; + } + + /** + * Return a fully-qualified projectLocationAgentVersion resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} version + * @returns {string} Resource name string. + */ + projectLocationAgentVersionPath( + project: string, + location: string, + version: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.render({ + project: project, + location: location, + version: version, + }); + } + + /** + * Parse the project from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).project; + } + + /** + * Parse the location from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).location; + } + + /** + * Parse the version from ProjectLocationAgentVersion resource. + * + * @param {string} projectLocationAgentVersionName + * A fully-qualified path representing project_location_agent_version resource. + * @returns {string} A string representing the version. + */ + matchVersionFromProjectLocationAgentVersionName( + projectLocationAgentVersionName: string + ) { + return this.pathTemplates.projectLocationAgentVersionPathTemplate.match( + projectLocationAgentVersionName + ).version; + } + + /** + * Return a fully-qualified projectLocationAnswerRecord resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} answer_record + * @returns {string} Resource name string. + */ + projectLocationAnswerRecordPath( + project: string, + location: string, + answerRecord: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.render({ + project: project, + location: location, + answer_record: answerRecord, + }); + } + + /** + * Parse the project from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).project; + } + + /** + * Parse the location from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).location; + } + + /** + * Parse the answer_record from ProjectLocationAnswerRecord resource. + * + * @param {string} projectLocationAnswerRecordName + * A fully-qualified path representing project_location_answer_record resource. + * @returns {string} A string representing the answer_record. + */ + matchAnswerRecordFromProjectLocationAnswerRecordName( + projectLocationAnswerRecordName: string + ) { + return this.pathTemplates.projectLocationAnswerRecordPathTemplate.match( + projectLocationAnswerRecordName + ).answer_record; + } + + /** + * Return a fully-qualified projectLocationConversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + projectLocationConversationPath( + project: string, + location: string, + conversation: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).project; + } + + /** + * Parse the location from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversation resource. + * + * @param {string} projectLocationConversationName + * A fully-qualified path representing project_location_conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationName( + projectLocationConversationName: string + ) { + return this.pathTemplates.projectLocationConversationPathTemplate.match( + projectLocationConversationName + ).conversation; + } + + /** + * Return a fully-qualified projectLocationConversationMessage resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} message + * @returns {string} Resource name string. + */ + projectLocationConversationMessagePath( + project: string, + location: string, + conversation: string, + message: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + message: message, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).conversation; + } + + /** + * Parse the message from ProjectLocationConversationMessage resource. + * + * @param {string} projectLocationConversationMessageName + * A fully-qualified path representing project_location_conversation_message resource. + * @returns {string} A string representing the message. + */ + matchMessageFromProjectLocationConversationMessageName( + projectLocationConversationMessageName: string + ) { + return this.pathTemplates.projectLocationConversationMessagePathTemplate.match( + projectLocationConversationMessageName + ).message; + } + + /** + * Return a fully-qualified projectLocationConversationParticipant resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} participant + * @returns {string} Resource name string. + */ + projectLocationConversationParticipantPath( + project: string, + location: string, + conversation: string, + participant: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.render( + { + project: project, + location: location, + conversation: conversation, + participant: participant, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).location; + } + + /** + * Parse the conversation from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).conversation; + } + + /** + * Parse the participant from ProjectLocationConversationParticipant resource. + * + * @param {string} projectLocationConversationParticipantName + * A fully-qualified path representing project_location_conversation_participant resource. + * @returns {string} A string representing the participant. + */ + matchParticipantFromProjectLocationConversationParticipantName( + projectLocationConversationParticipantName: string + ) { + return this.pathTemplates.projectLocationConversationParticipantPathTemplate.match( + projectLocationConversationParticipantName + ).participant; + } + + /** + * Return a fully-qualified projectLocationConversationProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation_profile + * @returns {string} Resource name string. + */ + projectLocationConversationProfilePath( + project: string, + location: string, + conversationProfile: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.render( + { + project: project, + location: location, + conversation_profile: conversationProfile, + } + ); + } + + /** + * Parse the project from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).project; + } + + /** + * Parse the location from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).location; + } + + /** + * Parse the conversation_profile from ProjectLocationConversationProfile resource. + * + * @param {string} projectLocationConversationProfileName + * A fully-qualified path representing project_location_conversation_profile resource. + * @returns {string} A string representing the conversation_profile. + */ + matchConversationProfileFromProjectLocationConversationProfileName( + projectLocationConversationProfileName: string + ) { + return this.pathTemplates.projectLocationConversationProfilePathTemplate.match( + projectLocationConversationProfileName + ).conversation_profile; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBase resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBasePath( + project: string, + location: string, + knowledgeBase: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.render({ + project: project, + location: location, + knowledge_base: knowledgeBase, + }); + } + + /** + * Parse the project from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBase resource. + * + * @param {string} projectLocationKnowledgeBaseName + * A fully-qualified path representing project_location_knowledge_base resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + projectLocationKnowledgeBaseName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBasePathTemplate.match( + projectLocationKnowledgeBaseName + ).knowledge_base; + } + + /** + * Return a fully-qualified projectLocationKnowledgeBaseDocument resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} knowledge_base + * @param {string} document + * @returns {string} Resource name string. + */ + projectLocationKnowledgeBaseDocumentPath( + project: string, + location: string, + knowledgeBase: string, + document: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render( + { + project: project, + location: location, + knowledge_base: knowledgeBase, + document: document, + } + ); + } + + /** + * Parse the project from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).project; + } + + /** + * Parse the location from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).location; + } + + /** + * Parse the knowledge_base from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the knowledge_base. + */ + matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).knowledge_base; + } + + /** + * Parse the document from ProjectLocationKnowledgeBaseDocument resource. + * + * @param {string} projectLocationKnowledgeBaseDocumentName + * A fully-qualified path representing project_location_knowledge_base_document resource. + * @returns {string} A string representing the document. + */ + matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + projectLocationKnowledgeBaseDocumentName: string + ) { + return this.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match( + projectLocationKnowledgeBaseDocumentName + ).document; + } + + /** + * 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.versionsStub && !this._terminated) { + return this.versionsStub.then(stub => { + this._terminated = true; + stub.close(); + this.locationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/versions_client_config.json b/packages/google-cloud-dialogflow/src/v2beta1/versions_client_config.json new file mode 100644 index 00000000000..e748590d57d --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/versions_client_config.json @@ -0,0 +1,54 @@ +{ + "interfaces": { + "google.cloud.dialogflow.v2beta1.Versions": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "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": { + "ListVersions": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "GetVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "CreateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "UpdateVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + }, + "DeleteVersion": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "default" + } + } + } + } +} diff --git a/packages/google-cloud-dialogflow/src/v2beta1/versions_proto_list.json b/packages/google-cloud-dialogflow/src/v2beta1/versions_proto_list.json new file mode 100644 index 00000000000..cb5136f11dc --- /dev/null +++ b/packages/google-cloud-dialogflow/src/v2beta1/versions_proto_list.json @@ -0,0 +1,23 @@ +[ + "../../protos/google/cloud/dialogflow/v2beta1/agent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/answer_record.proto", + "../../protos/google/cloud/dialogflow/v2beta1/audio_config.proto", + "../../protos/google/cloud/dialogflow/v2beta1/context.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/conversation_profile.proto", + "../../protos/google/cloud/dialogflow/v2beta1/document.proto", + "../../protos/google/cloud/dialogflow/v2beta1/entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/environment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/fulfillment.proto", + "../../protos/google/cloud/dialogflow/v2beta1/gcs.proto", + "../../protos/google/cloud/dialogflow/v2beta1/human_agent_assistant_event.proto", + "../../protos/google/cloud/dialogflow/v2beta1/intent.proto", + "../../protos/google/cloud/dialogflow/v2beta1/knowledge_base.proto", + "../../protos/google/cloud/dialogflow/v2beta1/participant.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session.proto", + "../../protos/google/cloud/dialogflow/v2beta1/session_entity_type.proto", + "../../protos/google/cloud/dialogflow/v2beta1/validation_result.proto", + "../../protos/google/cloud/dialogflow/v2beta1/version.proto", + "../../protos/google/cloud/dialogflow/v2beta1/webhook.proto" +] diff --git a/packages/google-cloud-dialogflow/system-test/fixtures/sample/src/index.js b/packages/google-cloud-dialogflow/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..602a6fa148e --- /dev/null +++ b/packages/google-cloud-dialogflow/system-test/fixtures/sample/src/index.js @@ -0,0 +1,44 @@ +// 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. +// +// ** 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 dialogflow = require('@google-cloud/dialogflow'); + +function main() { + const agentsClient = new dialogflow.AgentsClient(); + const answerRecordsClient = new dialogflow.AnswerRecordsClient(); + const contextsClient = new dialogflow.ContextsClient(); + const conversationDatasetsClient = + new dialogflow.ConversationDatasetsClient(); + const conversationModelsClient = new dialogflow.ConversationModelsClient(); + const conversationProfilesClient = + new dialogflow.ConversationProfilesClient(); + const conversationsClient = new dialogflow.ConversationsClient(); + const documentsClient = new dialogflow.DocumentsClient(); + const entityTypesClient = new dialogflow.EntityTypesClient(); + const environmentsClient = new dialogflow.EnvironmentsClient(); + const fulfillmentsClient = new dialogflow.FulfillmentsClient(); + const intentsClient = new dialogflow.IntentsClient(); + const knowledgeBasesClient = new dialogflow.KnowledgeBasesClient(); + const participantsClient = new dialogflow.ParticipantsClient(); + const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient(); + const sessionsClient = new dialogflow.SessionsClient(); + const versionsClient = new dialogflow.VersionsClient(); +} + +main(); diff --git a/packages/google-cloud-dialogflow/system-test/fixtures/sample/src/index.ts b/packages/google-cloud-dialogflow/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..4318a4fcfe9 --- /dev/null +++ b/packages/google-cloud-dialogflow/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,150 @@ +// 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. +// +// ** 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 { + AgentsClient, + AnswerRecordsClient, + ContextsClient, + ConversationDatasetsClient, + ConversationModelsClient, + ConversationProfilesClient, + ConversationsClient, + DocumentsClient, + EntityTypesClient, + EnvironmentsClient, + FulfillmentsClient, + IntentsClient, + KnowledgeBasesClient, + ParticipantsClient, + SessionEntityTypesClient, + SessionsClient, + VersionsClient, +} from '@google-cloud/dialogflow'; + +// check that the client class type name can be used +function doStuffWithAgentsClient(client: AgentsClient) { + client.close(); +} +function doStuffWithAnswerRecordsClient(client: AnswerRecordsClient) { + client.close(); +} +function doStuffWithContextsClient(client: ContextsClient) { + client.close(); +} +function doStuffWithConversationDatasetsClient( + client: ConversationDatasetsClient +) { + client.close(); +} +function doStuffWithConversationModelsClient(client: ConversationModelsClient) { + client.close(); +} +function doStuffWithConversationProfilesClient( + client: ConversationProfilesClient +) { + client.close(); +} +function doStuffWithConversationsClient(client: ConversationsClient) { + client.close(); +} +function doStuffWithDocumentsClient(client: DocumentsClient) { + client.close(); +} +function doStuffWithEntityTypesClient(client: EntityTypesClient) { + client.close(); +} +function doStuffWithEnvironmentsClient(client: EnvironmentsClient) { + client.close(); +} +function doStuffWithFulfillmentsClient(client: FulfillmentsClient) { + client.close(); +} +function doStuffWithIntentsClient(client: IntentsClient) { + client.close(); +} +function doStuffWithKnowledgeBasesClient(client: KnowledgeBasesClient) { + client.close(); +} +function doStuffWithParticipantsClient(client: ParticipantsClient) { + client.close(); +} +function doStuffWithSessionEntityTypesClient(client: SessionEntityTypesClient) { + client.close(); +} +function doStuffWithSessionsClient(client: SessionsClient) { + client.close(); +} +function doStuffWithVersionsClient(client: VersionsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const agentsClient = new AgentsClient(); + doStuffWithAgentsClient(agentsClient); + // check that the client instance can be created + const answerRecordsClient = new AnswerRecordsClient(); + doStuffWithAnswerRecordsClient(answerRecordsClient); + // check that the client instance can be created + const contextsClient = new ContextsClient(); + doStuffWithContextsClient(contextsClient); + // check that the client instance can be created + const conversationDatasetsClient = new ConversationDatasetsClient(); + doStuffWithConversationDatasetsClient(conversationDatasetsClient); + // check that the client instance can be created + const conversationModelsClient = new ConversationModelsClient(); + doStuffWithConversationModelsClient(conversationModelsClient); + // check that the client instance can be created + const conversationProfilesClient = new ConversationProfilesClient(); + doStuffWithConversationProfilesClient(conversationProfilesClient); + // check that the client instance can be created + const conversationsClient = new ConversationsClient(); + doStuffWithConversationsClient(conversationsClient); + // check that the client instance can be created + const documentsClient = new DocumentsClient(); + doStuffWithDocumentsClient(documentsClient); + // check that the client instance can be created + const entityTypesClient = new EntityTypesClient(); + doStuffWithEntityTypesClient(entityTypesClient); + // check that the client instance can be created + const environmentsClient = new EnvironmentsClient(); + doStuffWithEnvironmentsClient(environmentsClient); + // check that the client instance can be created + const fulfillmentsClient = new FulfillmentsClient(); + doStuffWithFulfillmentsClient(fulfillmentsClient); + // check that the client instance can be created + const intentsClient = new IntentsClient(); + doStuffWithIntentsClient(intentsClient); + // check that the client instance can be created + const knowledgeBasesClient = new KnowledgeBasesClient(); + doStuffWithKnowledgeBasesClient(knowledgeBasesClient); + // check that the client instance can be created + const participantsClient = new ParticipantsClient(); + doStuffWithParticipantsClient(participantsClient); + // check that the client instance can be created + const sessionEntityTypesClient = new SessionEntityTypesClient(); + doStuffWithSessionEntityTypesClient(sessionEntityTypesClient); + // check that the client instance can be created + const sessionsClient = new SessionsClient(); + doStuffWithSessionsClient(sessionsClient); + // check that the client instance can be created + const versionsClient = new VersionsClient(); + doStuffWithVersionsClient(versionsClient); +} + +main(); diff --git a/packages/google-cloud-dialogflow/system-test/install.ts b/packages/google-cloud-dialogflow/system-test/install.ts new file mode 100644 index 00000000000..6dd1eaadafa --- /dev/null +++ b/packages/google-cloud-dialogflow/system-test/install.ts @@ -0,0 +1,51 @@ +// 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. +// +// ** 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/packages/google-cloud-dialogflow/test/gapic_agents_v2.ts b/packages/google-cloud-dialogflow/test/gapic_agents_v2.ts new file mode 100644 index 00000000000..a3b1a3d72f5 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_agents_v2.ts @@ -0,0 +1,5602 @@ +// 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. +// +// ** 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 agentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2.AgentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = agentsModule.v2.AgentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = agentsModule.v2.AgentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = agentsModule.v2.AgentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new agentsModule.v2.AgentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new agentsModule.v2.AgentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.agentsStub, undefined); + await client.initialize(); + assert(client.agentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.agentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.agentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new agentsModule.v2.AgentsClient({ + 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 agentsModule.v2.AgentsClient({ + 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('getAgent', () => { + it('invokes getAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Agent() + ); + client.innerApiCalls.getAgent = stubSimpleCall(expectedResponse); + const [response] = await client.getAgent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Agent() + ); + client.innerApiCalls.getAgent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAgent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IAgent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgent with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgent with closed client', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAgent(request), expectedError); + }); + }); + + describe('setAgent', () => { + it('invokes setAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SetAgentRequest() + ); + request.agent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SetAgentRequest', + ['agent', 'parent'] + ); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Agent() + ); + client.innerApiCalls.setAgent = stubSimpleCall(expectedResponse); + const [response] = await client.setAgent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SetAgentRequest() + ); + request.agent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SetAgentRequest', + ['agent', 'parent'] + ); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Agent() + ); + client.innerApiCalls.setAgent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setAgent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IAgent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAgent with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SetAgentRequest() + ); + request.agent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SetAgentRequest', + ['agent', 'parent'] + ); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAgent with closed client', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SetAgentRequest() + ); + request.agent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SetAgentRequest', + ['agent', 'parent'] + ); + request.agent.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setAgent(request), expectedError); + }); + }); + + describe('deleteAgent', () => { + it('invokes deleteAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAgent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAgent( + 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.deleteAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgent with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAgent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgent with closed client', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAgent(request), expectedError); + }); + }); + + describe('getValidationResult', () => { + it('invokes getValidationResult without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetValidationResultRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetValidationResultRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ValidationResult() + ); + client.innerApiCalls.getValidationResult = + stubSimpleCall(expectedResponse); + const [response] = await client.getValidationResult(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getValidationResult without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetValidationResultRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetValidationResultRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ValidationResult() + ); + client.innerApiCalls.getValidationResult = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getValidationResult( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IValidationResult | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getValidationResult with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetValidationResultRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetValidationResultRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getValidationResult = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getValidationResult(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getValidationResult with closed client', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetValidationResultRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetValidationResultRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getValidationResult(request), expectedError); + }); + }); + + describe('trainAgent', () => { + it('invokes trainAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.TrainAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.TrainAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.trainAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.trainAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes trainAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.TrainAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.TrainAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.trainAgent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.trainAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes trainAgent with call error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.TrainAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.TrainAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.trainAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes trainAgent with LRO error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.TrainAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.TrainAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.trainAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkTrainAgentProgress without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + 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.checkTrainAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkTrainAgentProgress with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + 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.checkTrainAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('exportAgent', () => { + it('invokes exportAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ExportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ExportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAgent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IExportAgentResponse, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IExportAgentResponse, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAgent with call error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ExportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.exportAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAgent with LRO error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ExportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.exportAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportAgentProgress without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + 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.checkExportAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportAgentProgress with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + 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.checkExportAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importAgent', () => { + it('invokes importAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.importAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAgent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAgent with call error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAgent with LRO error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportAgentProgress without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + 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.checkImportAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportAgentProgress with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + 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.checkImportAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('restoreAgent', () => { + it('invokes restoreAgent without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.RestoreAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.RestoreAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreAgent without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.RestoreAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.RestoreAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreAgent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreAgent with call error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.RestoreAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.RestoreAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.restoreAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreAgent with LRO error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.RestoreAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.RestoreAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.restoreAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreAgentProgress without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + 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.checkRestoreAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreAgentProgress with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + 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.checkRestoreAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('searchAgents', () => { + it('invokes searchAgents without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + ]; + client.innerApiCalls.searchAgents = stubSimpleCall(expectedResponse); + const [response] = await client.searchAgents(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAgents without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + ]; + client.innerApiCalls.searchAgents = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAgents( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IAgent[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAgents with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAgents = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.searchAgents(request), expectedError); + const actualRequest = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAgentsStream without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + ]; + client.descriptors.page.searchAgents.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.searchAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Agent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Agent) => { + 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.searchAgents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAgents, request) + ); + assert( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchAgentsStream with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAgents.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.searchAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Agent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Agent) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAgents, request) + ); + assert( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAgents without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Agent()), + ]; + client.descriptors.page.searchAgents.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IAgent[] = []; + const iterable = client.searchAgentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.searchAgents.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAgents with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAgents.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAgentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IAgent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.searchAgents.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new agentsModule.v2.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_agents_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_agents_v2beta1.ts new file mode 100644 index 00000000000..5cb29dc5717 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_agents_v2beta1.ts @@ -0,0 +1,5212 @@ +// 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. +// +// ** 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 agentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2beta1.AgentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = agentsModule.v2beta1.AgentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = agentsModule.v2beta1.AgentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = agentsModule.v2beta1.AgentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new agentsModule.v2beta1.AgentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new agentsModule.v2beta1.AgentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.agentsStub, undefined); + await client.initialize(); + assert(client.agentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.agentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.agentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new agentsModule.v2beta1.AgentsClient({ + 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 agentsModule.v2beta1.AgentsClient({ + 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('getAgent', () => { + it('invokes getAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ); + client.innerApiCalls.getAgent = stubSimpleCall(expectedResponse); + const [response] = await client.getAgent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ); + client.innerApiCalls.getAgent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAgent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IAgent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgent with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAgent with closed client', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAgent(request), expectedError); + }); + }); + + describe('setAgent', () => { + it('invokes setAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest() + ); + request.agent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SetAgentRequest', + ['agent', 'parent'] + ); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ); + client.innerApiCalls.setAgent = stubSimpleCall(expectedResponse); + const [response] = await client.setAgent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest() + ); + request.agent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SetAgentRequest', + ['agent', 'parent'] + ); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ); + client.innerApiCalls.setAgent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setAgent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IAgent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAgent with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest() + ); + request.agent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SetAgentRequest', + ['agent', 'parent'] + ); + request.agent.parent = defaultValue1; + const expectedHeaderRequestParams = `agent.parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setAgent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setAgent with closed client', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SetAgentRequest() + ); + request.agent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SetAgentRequest', + ['agent', 'parent'] + ); + request.agent.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setAgent(request), expectedError); + }); + }); + + describe('deleteAgent', () => { + it('invokes deleteAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAgent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAgent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAgent( + 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.deleteAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgent with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAgent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAgent with closed client', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAgent(request), expectedError); + }); + }); + + describe('getValidationResult', () => { + it('invokes getValidationResult without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ValidationResult() + ); + client.innerApiCalls.getValidationResult = + stubSimpleCall(expectedResponse); + const [response] = await client.getValidationResult(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getValidationResult without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ValidationResult() + ); + client.innerApiCalls.getValidationResult = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getValidationResult( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IValidationResult | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getValidationResult with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getValidationResult = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getValidationResult(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getValidationResult as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getValidationResult with closed client', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetValidationResultRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetValidationResultRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getValidationResult(request), expectedError); + }); + }); + + describe('trainAgent', () => { + it('invokes trainAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.TrainAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.trainAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.trainAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes trainAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.TrainAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.trainAgent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.trainAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes trainAgent with call error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.TrainAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.trainAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes trainAgent with LRO error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.TrainAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.TrainAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.trainAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.trainAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.trainAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkTrainAgentProgress without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + 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.checkTrainAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkTrainAgentProgress with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + 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.checkTrainAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('exportAgent', () => { + it('invokes exportAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ExportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ExportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportAgent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2beta1.IExportAgentResponse, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAgent with call error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ExportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.exportAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportAgent with LRO error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ExportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ExportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.exportAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportAgentProgress without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + 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.checkExportAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportAgentProgress with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + 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.checkExportAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importAgent', () => { + it('invokes importAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ImportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.importAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ImportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importAgent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAgent with call error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ImportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importAgent with LRO error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ImportAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ImportAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportAgentProgress without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + 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.checkImportAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportAgentProgress with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + 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.checkImportAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('restoreAgent', () => { + it('invokes restoreAgent without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreAgent = stubLongRunningCall(expectedResponse); + const [operation] = await client.restoreAgent(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreAgent without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.restoreAgent = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreAgent( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreAgent with call error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.restoreAgent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreAgent with LRO error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.RestoreAgentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.RestoreAgentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreAgent = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.restoreAgent(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreAgent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkRestoreAgentProgress without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + 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.checkRestoreAgentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkRestoreAgentProgress with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + 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.checkRestoreAgentProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('searchAgents', () => { + it('invokes searchAgents without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + ]; + client.innerApiCalls.searchAgents = stubSimpleCall(expectedResponse); + const [response] = await client.searchAgents(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAgents without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + ]; + client.innerApiCalls.searchAgents = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.searchAgents( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IAgent[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAgents with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.searchAgents = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.searchAgents(request), expectedError); + const actualRequest = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.searchAgents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes searchAgentsStream without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + ]; + client.descriptors.page.searchAgents.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.searchAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Agent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Agent) => { + 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.searchAgents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAgents, request) + ); + assert( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes searchAgentsStream with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAgents.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.searchAgentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Agent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Agent) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.searchAgents, request) + ); + assert( + (client.descriptors.page.searchAgents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAgents without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Agent() + ), + ]; + client.descriptors.page.searchAgents.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IAgent[] = []; + const iterable = client.searchAgentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.searchAgents.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with searchAgents with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SearchAgentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SearchAgentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.searchAgents.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.searchAgentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IAgent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.searchAgents.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.searchAgents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new agentsModule.v2beta1.AgentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_answer_records_v2.ts b/packages/google-cloud-dialogflow/test/gapic_answer_records_v2.ts new file mode 100644 index 00000000000..add55604cb0 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_answer_records_v2.ts @@ -0,0 +1,4140 @@ +// 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. +// +// ** 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 answerrecordsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2.AnswerRecordsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + answerrecordsModule.v2.AnswerRecordsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + answerrecordsModule.v2.AnswerRecordsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = answerrecordsModule.v2.AnswerRecordsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.answerRecordsStub, undefined); + await client.initialize(); + assert(client.answerRecordsStub); + }); + + it('has close method for the initialized client', done => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.answerRecordsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.answerRecordsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + 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 answerrecordsModule.v2.AnswerRecordsClient({ + 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('updateAnswerRecord', () => { + it('invokes updateAnswerRecord without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest() + ); + request.answerRecord ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', + ['answerRecord', 'name'] + ); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ); + client.innerApiCalls.updateAnswerRecord = + stubSimpleCall(expectedResponse); + const [response] = await client.updateAnswerRecord(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAnswerRecord without error using callback', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest() + ); + request.answerRecord ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', + ['answerRecord', 'name'] + ); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ); + client.innerApiCalls.updateAnswerRecord = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAnswerRecord( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IAnswerRecord | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAnswerRecord with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest() + ); + request.answerRecord ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', + ['answerRecord', 'name'] + ); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAnswerRecord = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAnswerRecord with closed client', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest() + ); + request.answerRecord ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateAnswerRecordRequest', + ['answerRecord', 'name'] + ); + request.answerRecord.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + }); + }); + + describe('listAnswerRecords', () => { + it('invokes listAnswerRecords without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + ]; + client.innerApiCalls.listAnswerRecords = stubSimpleCall(expectedResponse); + const [response] = await client.listAnswerRecords(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAnswerRecords without error using callback', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + ]; + client.innerApiCalls.listAnswerRecords = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAnswerRecords( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IAnswerRecord[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAnswerRecords with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAnswerRecords = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listAnswerRecords(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAnswerRecordsStream without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + ]; + client.descriptors.page.listAnswerRecords.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAnswerRecordsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.AnswerRecord[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.AnswerRecord) => { + 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.listAnswerRecords.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAnswerRecords, request) + ); + assert( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAnswerRecordsStream with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAnswerRecords.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAnswerRecordsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.AnswerRecord[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.AnswerRecord) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAnswerRecords, request) + ); + assert( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAnswerRecords without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnswerRecord() + ), + ]; + client.descriptors.page.listAnswerRecords.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IAnswerRecord[] = []; + const iterable = client.listAnswerRecordsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAnswerRecords with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAnswerRecords.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAnswerRecordsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IAnswerRecord[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new answerrecordsModule.v2.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_answer_records_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_answer_records_v2beta1.ts new file mode 100644 index 00000000000..0426fd0932a --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_answer_records_v2beta1.ts @@ -0,0 +1,3870 @@ +// 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. +// +// ** 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 answerrecordsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2beta1.AnswerRecordsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + answerrecordsModule.v2beta1.AnswerRecordsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + answerrecordsModule.v2beta1.AnswerRecordsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = answerrecordsModule.v2beta1.AnswerRecordsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.answerRecordsStub, undefined); + await client.initialize(); + assert(client.answerRecordsStub); + }); + + it('has close method for the initialized client', done => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.answerRecordsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.answerRecordsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + 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 answerrecordsModule.v2beta1.AnswerRecordsClient({ + 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('getAnswerRecord', () => { + it('invokes getAnswerRecord without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ); + client.innerApiCalls.getAnswerRecord = stubSimpleCall(expectedResponse); + const [response] = await client.getAnswerRecord(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAnswerRecord as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAnswerRecord as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAnswerRecord without error using callback', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ); + client.innerApiCalls.getAnswerRecord = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAnswerRecord( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getAnswerRecord as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAnswerRecord as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAnswerRecord with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getAnswerRecord = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getAnswerRecord(request), expectedError); + assert(stub.calledOnce); + const actualRequest = ( + client.innerApiCalls.getAnswerRecord as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getAnswerRecord as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getAnswerRecord with closed client', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetAnswerRecordRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getAnswerRecord(request), expectedError); + assert(stub.calledOnce); + }); + }); + + describe('updateAnswerRecord', () => { + it('invokes updateAnswerRecord without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest() + ); + request.answerRecord ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', + ['answerRecord', 'name'] + ); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ); + client.innerApiCalls.updateAnswerRecord = + stubSimpleCall(expectedResponse); + const [response] = await client.updateAnswerRecord(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAnswerRecord without error using callback', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest() + ); + request.answerRecord ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', + ['answerRecord', 'name'] + ); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ); + client.innerApiCalls.updateAnswerRecord = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateAnswerRecord( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAnswerRecord with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest() + ); + request.answerRecord ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', + ['answerRecord', 'name'] + ); + request.answerRecord.name = defaultValue1; + const expectedHeaderRequestParams = `answer_record.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateAnswerRecord = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateAnswerRecord as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateAnswerRecord with closed client', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest() + ); + request.answerRecord ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateAnswerRecordRequest', + ['answerRecord', 'name'] + ); + request.answerRecord.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateAnswerRecord(request), expectedError); + }); + }); + + describe('listAnswerRecords', () => { + it('invokes listAnswerRecords without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + ]; + client.innerApiCalls.listAnswerRecords = stubSimpleCall(expectedResponse); + const [response] = await client.listAnswerRecords(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAnswerRecords without error using callback', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + ]; + client.innerApiCalls.listAnswerRecords = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAnswerRecords( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAnswerRecords with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listAnswerRecords = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listAnswerRecords(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listAnswerRecords as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listAnswerRecordsStream without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + ]; + client.descriptors.page.listAnswerRecords.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listAnswerRecordsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.AnswerRecord[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.AnswerRecord) => { + 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.listAnswerRecords.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAnswerRecords, request) + ); + assert( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listAnswerRecordsStream with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAnswerRecords.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listAnswerRecordsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.AnswerRecord[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.AnswerRecord) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listAnswerRecords, request) + ); + assert( + (client.descriptors.page.listAnswerRecords.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAnswerRecords without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnswerRecord() + ), + ]; + client.descriptors.page.listAnswerRecords.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[] = + []; + const iterable = client.listAnswerRecordsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listAnswerRecords with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListAnswerRecordsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listAnswerRecords.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAnswerRecordsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IAnswerRecord[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listAnswerRecords.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new answerrecordsModule.v2beta1.AnswerRecordsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_contexts_v2.ts b/packages/google-cloud-dialogflow/test/gapic_contexts_v2.ts new file mode 100644 index 00000000000..c20139bfabb --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_contexts_v2.ts @@ -0,0 +1,4696 @@ +// 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. +// +// ** 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 contextsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2.ContextsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = contextsModule.v2.ContextsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = contextsModule.v2.ContextsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = contextsModule.v2.ContextsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new contextsModule.v2.ContextsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new contextsModule.v2.ContextsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.contextsStub, undefined); + await client.initialize(); + assert(client.contextsStub); + }); + + it('has close method for the initialized client', done => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.contextsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.contextsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new contextsModule.v2.ContextsClient({ + 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 contextsModule.v2.ContextsClient({ + 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('getContext', () => { + it('invokes getContext without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Context() + ); + client.innerApiCalls.getContext = stubSimpleCall(expectedResponse); + const [response] = await client.getContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getContext without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Context() + ); + client.innerApiCalls.getContext = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getContext( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IContext | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getContext with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getContext = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getContext(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getContext with closed client', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getContext(request), expectedError); + }); + }); + + describe('createContext', () => { + it('invokes createContext without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateContextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Context() + ); + client.innerApiCalls.createContext = stubSimpleCall(expectedResponse); + const [response] = await client.createContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createContext without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateContextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Context() + ); + client.innerApiCalls.createContext = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createContext( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IContext | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createContext with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateContextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createContext = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createContext(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createContext with closed client', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateContextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createContext(request), expectedError); + }); + }); + + describe('updateContext', () => { + it('invokes updateContext without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateContextRequest() + ); + request.context ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateContextRequest', + ['context', 'name'] + ); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Context() + ); + client.innerApiCalls.updateContext = stubSimpleCall(expectedResponse); + const [response] = await client.updateContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateContext without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateContextRequest() + ); + request.context ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateContextRequest', + ['context', 'name'] + ); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Context() + ); + client.innerApiCalls.updateContext = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateContext( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IContext | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateContext with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateContextRequest() + ); + request.context ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateContextRequest', + ['context', 'name'] + ); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateContext = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateContext(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateContext with closed client', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateContextRequest() + ); + request.context ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateContextRequest', + ['context', 'name'] + ); + request.context.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateContext(request), expectedError); + }); + }); + + describe('deleteContext', () => { + it('invokes deleteContext without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); + const [response] = await client.deleteContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteContext without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteContext = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteContext( + 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.deleteContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteContext with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteContext = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteContext(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteContext with closed client', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteContext(request), expectedError); + }); + }); + + describe('deleteAllContexts', () => { + it('invokes deleteAllContexts without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteAllContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAllContexts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAllContexts without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteAllContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAllContexts = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAllContexts( + 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.deleteAllContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAllContexts with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteAllContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAllContexts = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteAllContexts(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAllContexts with closed client', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteAllContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteAllContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAllContexts(request), expectedError); + }); + }); + + describe('listContexts', () => { + it('invokes listContexts without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + ]; + client.innerApiCalls.listContexts = stubSimpleCall(expectedResponse); + const [response] = await client.listContexts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listContexts without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + ]; + client.innerApiCalls.listContexts = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listContexts( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IContext[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listContexts with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listContexts = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listContexts(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listContextsStream without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + ]; + client.descriptors.page.listContexts.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listContextsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Context[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Context) => { + 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.listContexts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listContexts, request) + ); + assert( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listContextsStream with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listContexts.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listContextsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Context[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Context) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listContexts, request) + ); + assert( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listContexts without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Context()), + ]; + client.descriptors.page.listContexts.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IContext[] = []; + const iterable = client.listContextsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listContexts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listContexts with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listContexts.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listContextsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IContext[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listContexts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = '/rendered/path/projectAgentSession'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath( + 'projectValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new contextsModule.v2.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_contexts_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_contexts_v2beta1.ts new file mode 100644 index 00000000000..1004a112f23 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_contexts_v2beta1.ts @@ -0,0 +1,4306 @@ +// 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. +// +// ** 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 contextsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2beta1.ContextsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = contextsModule.v2beta1.ContextsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = contextsModule.v2beta1.ContextsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = contextsModule.v2beta1.ContextsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new contextsModule.v2beta1.ContextsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new contextsModule.v2beta1.ContextsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.contextsStub, undefined); + await client.initialize(); + assert(client.contextsStub); + }); + + it('has close method for the initialized client', done => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.contextsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.contextsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new contextsModule.v2beta1.ContextsClient({ + 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 contextsModule.v2beta1.ContextsClient({ + 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('getContext', () => { + it('invokes getContext without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ); + client.innerApiCalls.getContext = stubSimpleCall(expectedResponse); + const [response] = await client.getContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getContext without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ); + client.innerApiCalls.getContext = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getContext( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IContext | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getContext with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getContext = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getContext(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getContext with closed client', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getContext(request), expectedError); + }); + }); + + describe('createContext', () => { + it('invokes createContext without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateContextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ); + client.innerApiCalls.createContext = stubSimpleCall(expectedResponse); + const [response] = await client.createContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createContext without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateContextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ); + client.innerApiCalls.createContext = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createContext( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IContext | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createContext with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateContextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createContext = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createContext(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createContext with closed client', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateContextRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createContext(request), expectedError); + }); + }); + + describe('updateContext', () => { + it('invokes updateContext without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest() + ); + request.context ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateContextRequest', + ['context', 'name'] + ); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ); + client.innerApiCalls.updateContext = stubSimpleCall(expectedResponse); + const [response] = await client.updateContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateContext without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest() + ); + request.context ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateContextRequest', + ['context', 'name'] + ); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ); + client.innerApiCalls.updateContext = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateContext( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IContext | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateContext with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest() + ); + request.context ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateContextRequest', + ['context', 'name'] + ); + request.context.name = defaultValue1; + const expectedHeaderRequestParams = `context.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateContext = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateContext(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateContext with closed client', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateContextRequest() + ); + request.context ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateContextRequest', + ['context', 'name'] + ); + request.context.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateContext(request), expectedError); + }); + }); + + describe('deleteContext', () => { + it('invokes deleteContext without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteContext = stubSimpleCall(expectedResponse); + const [response] = await client.deleteContext(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteContext without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteContext = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteContext( + 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.deleteContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteContext with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteContext = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteContext(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteContext as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteContext with closed client', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteContextRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteContextRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteContext(request), expectedError); + }); + }); + + describe('deleteAllContexts', () => { + it('invokes deleteAllContexts without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAllContexts = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAllContexts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAllContexts without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteAllContexts = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAllContexts( + 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.deleteAllContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAllContexts with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAllContexts = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteAllContexts(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteAllContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteAllContexts with closed client', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteAllContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteAllContexts(request), expectedError); + }); + }); + + describe('listContexts', () => { + it('invokes listContexts without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + ]; + client.innerApiCalls.listContexts = stubSimpleCall(expectedResponse); + const [response] = await client.listContexts(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listContexts without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + ]; + client.innerApiCalls.listContexts = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listContexts( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IContext[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listContexts with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listContexts = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listContexts(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listContexts as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listContextsStream without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + ]; + client.descriptors.page.listContexts.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listContextsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Context[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Context) => { + 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.listContexts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listContexts, request) + ); + assert( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listContextsStream with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listContexts.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listContextsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Context[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Context) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listContexts, request) + ); + assert( + (client.descriptors.page.listContexts.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listContexts without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Context() + ), + ]; + client.descriptors.page.listContexts.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IContext[] = []; + const iterable = client.listContextsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listContexts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listContexts with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListContextsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListContextsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listContexts.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listContextsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IContext[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listContexts.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listContexts.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = '/rendered/path/projectAgentSession'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath( + 'projectValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new contextsModule.v2beta1.ContextsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_conversation_datasets_v2.ts b/packages/google-cloud-dialogflow/test/gapic_conversation_datasets_v2.ts new file mode 100644 index 00000000000..dc2f792b883 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_conversation_datasets_v2.ts @@ -0,0 +1,5250 @@ +// 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. +// +// ** 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 conversationdatasetsModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2.ConversationDatasetsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + conversationdatasetsModule.v2.ConversationDatasetsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + conversationdatasetsModule.v2.ConversationDatasetsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + conversationdatasetsModule.v2.ConversationDatasetsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationDatasetsStub, undefined); + await client.initialize(); + assert(client.conversationDatasetsStub); + }); + + it('has close method for the initialized client', done => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationDatasetsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationDatasetsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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 conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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('getConversationDataset', () => { + it('invokes getConversationDataset without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationDatasetRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ); + client.innerApiCalls.getConversationDataset = + stubSimpleCall(expectedResponse); + const [response] = await client.getConversationDataset(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationDataset without error using callback', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationDatasetRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ); + client.innerApiCalls.getConversationDataset = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationDataset( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversationDataset | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationDataset with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationDatasetRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationDataset = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getConversationDataset(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationDataset with closed client', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationDatasetRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getConversationDataset(request), + expectedError + ); + }); + }); + + describe('createConversationDataset', () => { + it('invokes createConversationDataset without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationDataset = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createConversationDataset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationDataset without error using callback', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationDataset = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationDataset( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IConversationDataset, + protos.google.cloud.dialogflow.v2.ICreateConversationDatasetOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationDataset with call error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationDataset = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.createConversationDataset(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationDataset with LRO error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationDatasetRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationDataset = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createConversationDataset(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConversationDatasetProgress without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkCreateConversationDatasetProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConversationDatasetProgress with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkCreateConversationDatasetProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteConversationDataset', () => { + it('invokes deleteConversationDataset without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConversationDataset = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConversationDataset(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationDataset without error using callback', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConversationDataset = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConversationDataset( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationDatasetOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationDataset with call error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationDataset = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteConversationDataset(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.deleteConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationDataset with LRO error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationDatasetRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationDataset = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteConversationDataset(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteConversationDataset as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationDataset as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConversationDatasetProgress without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkDeleteConversationDatasetProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConversationDatasetProgress with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkDeleteConversationDatasetProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importConversationData', () => { + it('invokes importConversationData without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportConversationDataRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importConversationData = + stubLongRunningCall(expectedResponse); + const [operation] = await client.importConversationData(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importConversationData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importConversationData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importConversationData without error using callback', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportConversationDataRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importConversationData = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importConversationData( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationResponse, + protos.google.cloud.dialogflow.v2.IImportConversationDataOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importConversationData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importConversationData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importConversationData with call error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportConversationDataRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importConversationData = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.importConversationData(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.importConversationData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importConversationData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importConversationData with LRO error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportConversationDataRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportConversationDataRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importConversationData = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importConversationData(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.importConversationData as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importConversationData as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportConversationDataProgress without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkImportConversationDataProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportConversationDataProgress with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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.checkImportConversationDataProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listConversationDatasets', () => { + it('invokes listConversationDatasets without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + ]; + client.innerApiCalls.listConversationDatasets = + stubSimpleCall(expectedResponse); + const [response] = await client.listConversationDatasets(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationDatasets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationDatasets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationDatasets without error using callback', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + ]; + client.innerApiCalls.listConversationDatasets = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationDatasets( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2.IConversationDataset[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationDatasets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationDatasets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationDatasets with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationDatasets = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listConversationDatasets(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listConversationDatasets as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationDatasets as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationDatasetsStream without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + ]; + client.descriptors.page.listConversationDatasets.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listConversationDatasetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationDataset[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.ConversationDataset) => { + 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.listConversationDatasets + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listConversationDatasets, request) + ); + assert( + ( + client.descriptors.page.listConversationDatasets + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationDatasetsStream with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationDatasets.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationDatasetsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationDataset[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.ConversationDataset) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listConversationDatasets + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listConversationDatasets, request) + ); + assert( + ( + client.descriptors.page.listConversationDatasets + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationDatasets without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationDataset() + ), + ]; + client.descriptors.page.listConversationDatasets.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversationDataset[] = + []; + const iterable = client.listConversationDatasetsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationDatasets + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationDatasets + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationDatasets with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationDatasetsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationDatasetsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationDatasets.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationDatasetsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversationDataset[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationDatasets + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationDatasets + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('location', () => { + const fakePath = '/rendered/path/location'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + 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('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = + new conversationdatasetsModule.v2.ConversationDatasetsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_conversation_models_v2.ts b/packages/google-cloud-dialogflow/test/gapic_conversation_models_v2.ts new file mode 100644 index 00000000000..e1593ca545b --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_conversation_models_v2.ts @@ -0,0 +1,5999 @@ +// 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. +// +// ** 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 conversationmodelsModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2.ConversationModelsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + conversationmodelsModule.v2.ConversationModelsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + conversationmodelsModule.v2.ConversationModelsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = conversationmodelsModule.v2.ConversationModelsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationModelsStub, undefined); + await client.initialize(); + assert(client.conversationModelsStub); + }); + + it('has close method for the initialized client', done => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationModelsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationModelsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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 conversationmodelsModule.v2.ConversationModelsClient({ + 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('getConversationModel', () => { + it('invokes getConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ); + client.innerApiCalls.getConversationModel = + stubSimpleCall(expectedResponse); + const [response] = await client.getConversationModel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ); + client.innerApiCalls.getConversationModel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationModel( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversationModel | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModel with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationModel = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getConversationModel(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModel with closed client', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversationModel(request), expectedError); + }); + }); + + describe('getConversationModelEvaluation', () => { + it('invokes getConversationModelEvaluation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ); + client.innerApiCalls.getConversationModelEvaluation = + stubSimpleCall(expectedResponse); + const [response] = await client.getConversationModelEvaluation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationModelEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationModelEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModelEvaluation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ); + client.innerApiCalls.getConversationModelEvaluation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationModelEvaluation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationModelEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationModelEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModelEvaluation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationModelEvaluation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getConversationModelEvaluation(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getConversationModelEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationModelEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationModelEvaluation with closed client', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationModelEvaluationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getConversationModelEvaluation(request), + expectedError + ); + }); + }); + + describe('createConversationModel', () => { + it('invokes createConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationModelRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationModel = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createConversationModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationModelRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationModel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationModel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IConversationModel, + protos.google.cloud.dialogflow.v2.ICreateConversationModelOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModel with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationModelRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationModel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.createConversationModel(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModel with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationModelRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationModel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createConversationModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConversationModelProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkCreateConversationModelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConversationModelProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkCreateConversationModelProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteConversationModel', () => { + it('invokes deleteConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConversationModel = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConversationModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConversationModel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConversationModel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeleteConversationModelOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationModel with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationModel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteConversationModel(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.deleteConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationModel with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationModel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteConversationModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConversationModelProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkDeleteConversationModelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConversationModelProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkDeleteConversationModelProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deployConversationModel', () => { + it('invokes deployConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeployConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deployConversationModel = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deployConversationModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deployConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deployConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeployConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deployConversationModel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deployConversationModel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IDeployConversationModelOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deployConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deployConversationModel with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeployConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployConversationModel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.deployConversationModel(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.deployConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deployConversationModel with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeployConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeployConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deployConversationModel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deployConversationModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deployConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deployConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeployConversationModelProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkDeployConversationModelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeployConversationModelProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkDeployConversationModelProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('undeployConversationModel', () => { + it('invokes undeployConversationModel without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UndeployConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeployConversationModel = + stubLongRunningCall(expectedResponse); + const [operation] = await client.undeployConversationModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.undeployConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeployConversationModel without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UndeployConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.undeployConversationModel = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeployConversationModel( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IUndeployConversationModelOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.undeployConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeployConversationModel with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UndeployConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployConversationModel = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.undeployConversationModel(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.undeployConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes undeployConversationModel with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UndeployConversationModelRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UndeployConversationModelRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployConversationModel = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.undeployConversationModel(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.undeployConversationModel as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.undeployConversationModel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUndeployConversationModelProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkUndeployConversationModelProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUndeployConversationModelProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkUndeployConversationModelProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('createConversationModelEvaluation', () => { + it('invokes createConversationModelEvaluation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationModelEvaluation = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createConversationModelEvaluation( + request + ); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationModelEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationModelEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModelEvaluation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConversationModelEvaluation = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationModelEvaluation( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IConversationModelEvaluation, + protos.google.cloud.dialogflow.v2.ICreateConversationModelEvaluationOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationModelEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationModelEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModelEvaluation with call error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationModelEvaluation = + stubLongRunningCall(undefined, expectedError); + await assert.rejects( + client.createConversationModelEvaluation(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createConversationModelEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationModelEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationModelEvaluation with LRO error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationModelEvaluationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationModelEvaluation = + stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConversationModelEvaluation( + request + ); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createConversationModelEvaluation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationModelEvaluation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConversationModelEvaluationProgress without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkCreateConversationModelEvaluationProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConversationModelEvaluationProgress with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + 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.checkCreateConversationModelEvaluationProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listConversationModels', () => { + it('invokes listConversationModels without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + ]; + client.innerApiCalls.listConversationModels = + stubSimpleCall(expectedResponse); + const [response] = await client.listConversationModels(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationModels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationModels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModels without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + ]; + client.innerApiCalls.listConversationModels = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationModels( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2.IConversationModel[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationModels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationModels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModels with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationModels = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listConversationModels(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listConversationModels as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationModels as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModelsStream without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + ]; + client.descriptors.page.listConversationModels.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listConversationModelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationModel[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.ConversationModel) => { + 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.listConversationModels + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listConversationModels, request) + ); + assert( + ( + client.descriptors.page.listConversationModels + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationModelsStream with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationModels.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationModelsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationModel[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.ConversationModel) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listConversationModels + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listConversationModels, request) + ); + assert( + ( + client.descriptors.page.listConversationModels + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationModels without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModel() + ), + ]; + client.descriptors.page.listConversationModels.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversationModel[] = + []; + const iterable = client.listConversationModelsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationModels + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationModels + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationModels with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationModels.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationModelsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversationModel[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationModels + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationModels + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listConversationModelEvaluations', () => { + it('invokes listConversationModelEvaluations without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + ]; + client.innerApiCalls.listConversationModelEvaluations = + stubSimpleCall(expectedResponse); + const [response] = await client.listConversationModelEvaluations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationModelEvaluations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationModelEvaluations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModelEvaluations without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + ]; + client.innerApiCalls.listConversationModelEvaluations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationModelEvaluations( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationModelEvaluations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationModelEvaluations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModelEvaluations with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationModelEvaluations = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listConversationModelEvaluations(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listConversationModelEvaluations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationModelEvaluations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationModelEvaluationsStream without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + ]; + client.descriptors.page.listConversationModelEvaluations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listConversationModelEvaluationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation + ) => { + 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.listConversationModelEvaluations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listConversationModelEvaluations, + request + ) + ); + assert( + ( + client.descriptors.page.listConversationModelEvaluations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationModelEvaluationsStream with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationModelEvaluations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationModelEvaluationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2.ConversationModelEvaluation + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listConversationModelEvaluations + .createStream as SinonStub + ) + .getCall(0) + .calledWith( + client.innerApiCalls.listConversationModelEvaluations, + request + ) + ); + assert( + ( + client.descriptors.page.listConversationModelEvaluations + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationModelEvaluations without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationModelEvaluation() + ), + ]; + client.descriptors.page.listConversationModelEvaluations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[] = + []; + const iterable = client.listConversationModelEvaluationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationModelEvaluations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationModelEvaluations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationModelEvaluations with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationModelEvaluationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationModelEvaluations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationModelEvaluationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversationModelEvaluation[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationModelEvaluations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationModelEvaluations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new conversationmodelsModule.v2.ConversationModelsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_conversation_profiles_v2.ts b/packages/google-cloud-dialogflow/test/gapic_conversation_profiles_v2.ts new file mode 100644 index 00000000000..f34cdb1e297 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_conversation_profiles_v2.ts @@ -0,0 +1,5502 @@ +// 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. +// +// ** 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 conversationprofilesModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2.ConversationProfilesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + conversationprofilesModule.v2.ConversationProfilesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + conversationprofilesModule.v2.ConversationProfilesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + conversationprofilesModule.v2.ConversationProfilesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationProfilesStub, undefined); + await client.initialize(); + assert(client.conversationProfilesStub); + }); + + it('has close method for the initialized client', done => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationProfilesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationProfilesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + 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 conversationprofilesModule.v2.ConversationProfilesClient({ + 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('getConversationProfile', () => { + it('invokes getConversationProfile without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ); + client.innerApiCalls.getConversationProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.getConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationProfile without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ); + client.innerApiCalls.getConversationProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationProfile( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversationProfile | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationProfile with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationProfile = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getConversationProfile(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationProfile with closed client', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getConversationProfile(request), + expectedError + ); + }); + }); + + describe('createConversationProfile', () => { + it('invokes createConversationProfile without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationProfileRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ); + client.innerApiCalls.createConversationProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.createConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationProfile without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationProfileRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ); + client.innerApiCalls.createConversationProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationProfile( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversationProfile | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationProfile with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationProfileRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationProfile = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createConversationProfile(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationProfile with closed client', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationProfileRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.createConversationProfile(request), + expectedError + ); + }); + }); + + describe('updateConversationProfile', () => { + it('invokes updateConversationProfile without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest() + ); + request.conversationProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', + ['conversationProfile', 'name'] + ); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ); + client.innerApiCalls.updateConversationProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.updateConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConversationProfile without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest() + ); + request.conversationProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', + ['conversationProfile', 'name'] + ); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ); + client.innerApiCalls.updateConversationProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConversationProfile( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversationProfile | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConversationProfile with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest() + ); + request.conversationProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', + ['conversationProfile', 'name'] + ); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConversationProfile = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateConversationProfile(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConversationProfile with closed client', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateConversationProfileRequest() + ); + request.conversationProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateConversationProfileRequest', + ['conversationProfile', 'name'] + ); + request.conversationProfile.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateConversationProfile(request), + expectedError + ); + }); + }); + + describe('deleteConversationProfile', () => { + it('invokes deleteConversationProfile without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteConversationProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationProfile without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteConversationProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConversationProfile( + 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.deleteConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationProfile with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteConversationProfile(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationProfile with closed client', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.deleteConversationProfile(request), + expectedError + ); + }); + }); + + describe('setSuggestionFeatureConfig', () => { + it('invokes setSuggestionFeatureConfig without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setSuggestionFeatureConfig = + stubLongRunningCall(expectedResponse); + const [operation] = await client.setSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setSuggestionFeatureConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setSuggestionFeatureConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.ISetSuggestionFeatureConfigOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig with call error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.setSuggestionFeatureConfig(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig with LRO error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SetSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.setSuggestionFeatureConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkSetSuggestionFeatureConfigProgress without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + 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.checkSetSuggestionFeatureConfigProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetSuggestionFeatureConfigProgress with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + 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.checkSetSuggestionFeatureConfigProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('clearSuggestionFeatureConfig', () => { + it('invokes clearSuggestionFeatureConfig without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.clearSuggestionFeatureConfig = + stubLongRunningCall(expectedResponse); + const [operation] = await client.clearSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.clearSuggestionFeatureConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.clearSuggestionFeatureConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IConversationProfile, + protos.google.cloud.dialogflow.v2.IClearSuggestionFeatureConfigOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig with call error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.clearSuggestionFeatureConfig(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig with LRO error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ClearSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.clearSuggestionFeatureConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkClearSuggestionFeatureConfigProgress without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + 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.checkClearSuggestionFeatureConfigProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkClearSuggestionFeatureConfigProgress with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + 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.checkClearSuggestionFeatureConfigProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listConversationProfiles', () => { + it('invokes listConversationProfiles without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + ]; + client.innerApiCalls.listConversationProfiles = + stubSimpleCall(expectedResponse); + const [response] = await client.listConversationProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationProfiles without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + ]; + client.innerApiCalls.listConversationProfiles = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationProfiles( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2.IConversationProfile[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationProfiles with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationProfiles = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listConversationProfiles(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationProfilesStream without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + ]; + client.descriptors.page.listConversationProfiles.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listConversationProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationProfile[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.ConversationProfile) => { + 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.listConversationProfiles + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listConversationProfiles, request) + ); + assert( + ( + client.descriptors.page.listConversationProfiles + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationProfilesStream with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationProfiles.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.ConversationProfile[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.ConversationProfile) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listConversationProfiles + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listConversationProfiles, request) + ); + assert( + ( + client.descriptors.page.listConversationProfiles + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationProfiles without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ConversationProfile() + ), + ]; + client.descriptors.page.listConversationProfiles.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversationProfile[] = + []; + const iterable = client.listConversationProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationProfiles + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationProfiles + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationProfiles with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationProfiles.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversationProfile[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationProfiles + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationProfiles + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('cXSecuritySettings', () => { + const fakePath = '/rendered/path/cXSecuritySettings'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_settings: 'securitySettingsValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cXSecuritySettingsPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cXSecuritySettingsPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cXSecuritySettingsPath', () => { + const result = client.cXSecuritySettingsPath( + 'projectValue', + 'locationValue', + 'securitySettingsValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.cXSecuritySettingsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCXSecuritySettingsName', () => { + const result = client.matchProjectFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.cXSecuritySettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCXSecuritySettingsName', () => { + const result = client.matchLocationFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.cXSecuritySettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSecuritySettingsFromCXSecuritySettingsName', () => { + const result = + client.matchSecuritySettingsFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, 'securitySettingsValue'); + assert( + ( + client.pathTemplates.cXSecuritySettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = + new conversationprofilesModule.v2.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_conversation_profiles_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_conversation_profiles_v2beta1.ts new file mode 100644 index 00000000000..8ae4c9f13f6 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_conversation_profiles_v2beta1.ts @@ -0,0 +1,5089 @@ +// 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. +// +// ** 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 conversationprofilesModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2beta1.ConversationProfilesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + conversationprofilesModule.v2beta1.ConversationProfilesClient + .servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + conversationprofilesModule.v2beta1.ConversationProfilesClient + .apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + conversationprofilesModule.v2beta1.ConversationProfilesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationProfilesStub, undefined); + await client.initialize(); + assert(client.conversationProfilesStub); + }); + + it('has close method for the initialized client', done => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationProfilesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationProfilesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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 conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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('getConversationProfile', () => { + it('invokes getConversationProfile without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ); + client.innerApiCalls.getConversationProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.getConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationProfile without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ); + client.innerApiCalls.getConversationProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversationProfile( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationProfile with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversationProfile = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getConversationProfile(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversationProfile with closed client', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.getConversationProfile(request), + expectedError + ); + }); + }); + + describe('createConversationProfile', () => { + it('invokes createConversationProfile without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ); + client.innerApiCalls.createConversationProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.createConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationProfile without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ); + client.innerApiCalls.createConversationProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversationProfile( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationProfile with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversationProfile = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createConversationProfile(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversationProfile with closed client', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateConversationProfileRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.createConversationProfile(request), + expectedError + ); + }); + }); + + describe('updateConversationProfile', () => { + it('invokes updateConversationProfile without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest() + ); + request.conversationProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', + ['conversationProfile', 'name'] + ); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ); + client.innerApiCalls.updateConversationProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.updateConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConversationProfile without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest() + ); + request.conversationProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', + ['conversationProfile', 'name'] + ); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ); + client.innerApiCalls.updateConversationProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConversationProfile( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IConversationProfile | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConversationProfile with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest() + ); + request.conversationProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', + ['conversationProfile', 'name'] + ); + request.conversationProfile.name = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConversationProfile = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateConversationProfile(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConversationProfile with closed client', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest() + ); + request.conversationProfile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateConversationProfileRequest', + ['conversationProfile', 'name'] + ); + request.conversationProfile.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateConversationProfile(request), + expectedError + ); + }); + }); + + describe('deleteConversationProfile', () => { + it('invokes deleteConversationProfile without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteConversationProfile = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteConversationProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationProfile without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteConversationProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConversationProfile( + 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.deleteConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationProfile with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversationProfile = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteConversationProfile(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteConversationProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConversationProfile with closed client', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteConversationProfileRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.deleteConversationProfile(request), + expectedError + ); + }); + }); + + describe('setSuggestionFeatureConfig', () => { + it('invokes setSuggestionFeatureConfig without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setSuggestionFeatureConfig = + stubLongRunningCall(expectedResponse); + const [operation] = await client.setSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.setSuggestionFeatureConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setSuggestionFeatureConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.ISetSuggestionFeatureConfigOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig with call error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.setSuggestionFeatureConfig(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes setSuggestionFeatureConfig with LRO error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.setSuggestionFeatureConfig = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.setSuggestionFeatureConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.setSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkSetSuggestionFeatureConfigProgress without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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.checkSetSuggestionFeatureConfigProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkSetSuggestionFeatureConfigProgress with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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.checkSetSuggestionFeatureConfigProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('clearSuggestionFeatureConfig', () => { + it('invokes clearSuggestionFeatureConfig without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.clearSuggestionFeatureConfig = + stubLongRunningCall(expectedResponse); + const [operation] = await client.clearSuggestionFeatureConfig(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.clearSuggestionFeatureConfig = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.clearSuggestionFeatureConfig( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2beta1.IConversationProfile, + protos.google.cloud.dialogflow.v2beta1.IClearSuggestionFeatureConfigOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig with call error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.clearSuggestionFeatureConfig(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clearSuggestionFeatureConfig with LRO error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigRequest', + ['conversationProfile'] + ); + request.conversationProfile = defaultValue1; + const expectedHeaderRequestParams = `conversation_profile=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clearSuggestionFeatureConfig = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.clearSuggestionFeatureConfig(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clearSuggestionFeatureConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkClearSuggestionFeatureConfigProgress without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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.checkClearSuggestionFeatureConfigProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkClearSuggestionFeatureConfigProgress with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + 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.checkClearSuggestionFeatureConfigProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listConversationProfiles', () => { + it('invokes listConversationProfiles without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + ]; + client.innerApiCalls.listConversationProfiles = + stubSimpleCall(expectedResponse); + const [response] = await client.listConversationProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationProfiles without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + ]; + client.innerApiCalls.listConversationProfiles = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversationProfiles( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2beta1.IConversationProfile[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationProfiles with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversationProfiles = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listConversationProfiles(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversationProfiles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationProfilesStream without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + ]; + client.descriptors.page.listConversationProfiles.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listConversationProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.ConversationProfile[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.ConversationProfile + ) => { + 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.listConversationProfiles + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listConversationProfiles, request) + ); + assert( + ( + client.descriptors.page.listConversationProfiles + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationProfilesStream with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationProfiles.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.ConversationProfile[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.ConversationProfile + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listConversationProfiles + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listConversationProfiles, request) + ); + assert( + ( + client.descriptors.page.listConversationProfiles + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationProfiles without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ConversationProfile() + ), + ]; + client.descriptors.page.listConversationProfiles.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IConversationProfile[] = + []; + const iterable = client.listConversationProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationProfiles + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationProfiles + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversationProfiles with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationProfilesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversationProfiles.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IConversationProfile[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversationProfiles + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listConversationProfiles + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('cXSecuritySettings', () => { + const fakePath = '/rendered/path/cXSecuritySettings'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + security_settings: 'securitySettingsValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.cXSecuritySettingsPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.cXSecuritySettingsPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('cXSecuritySettingsPath', () => { + const result = client.cXSecuritySettingsPath( + 'projectValue', + 'locationValue', + 'securitySettingsValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.cXSecuritySettingsPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromCXSecuritySettingsName', () => { + const result = client.matchProjectFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.cXSecuritySettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromCXSecuritySettingsName', () => { + const result = client.matchLocationFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.cXSecuritySettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSecuritySettingsFromCXSecuritySettingsName', () => { + const result = + client.matchSecuritySettingsFromCXSecuritySettingsName(fakePath); + assert.strictEqual(result, 'securitySettingsValue'); + assert( + ( + client.pathTemplates.cXSecuritySettingsPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = + new conversationprofilesModule.v2beta1.ConversationProfilesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_conversations_v2.ts b/packages/google-cloud-dialogflow/test/gapic_conversations_v2.ts new file mode 100644 index 00000000000..541a7772bbf --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_conversations_v2.ts @@ -0,0 +1,4700 @@ +// 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. +// +// ** 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 conversationsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2.ConversationsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + conversationsModule.v2.ConversationsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + conversationsModule.v2.ConversationsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = conversationsModule.v2.ConversationsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new conversationsModule.v2.ConversationsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new conversationsModule.v2.ConversationsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationsStub, undefined); + await client.initialize(); + assert(client.conversationsStub); + }); + + it('has close method for the initialized client', done => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationsModule.v2.ConversationsClient({ + 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 conversationsModule.v2.ConversationsClient({ + 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('createConversation', () => { + it('invokes createConversation without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ); + client.innerApiCalls.createConversation = + stubSimpleCall(expectedResponse); + const [response] = await client.createConversation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversation without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ); + client.innerApiCalls.createConversation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversation with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createConversation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversation with closed client', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateConversationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createConversation(request), expectedError); + }); + }); + + describe('getConversation', () => { + it('invokes getConversation without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ); + client.innerApiCalls.getConversation = stubSimpleCall(expectedResponse); + const [response] = await client.getConversation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversation without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ); + client.innerApiCalls.getConversation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversation with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getConversation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversation with closed client', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversation(request), expectedError); + }); + }); + + describe('completeConversation', () => { + it('invokes completeConversation without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CompleteConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CompleteConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ); + client.innerApiCalls.completeConversation = + stubSimpleCall(expectedResponse); + const [response] = await client.completeConversation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeConversation without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CompleteConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CompleteConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ); + client.innerApiCalls.completeConversation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeConversation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeConversation with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CompleteConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CompleteConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.completeConversation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.completeConversation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeConversation with closed client', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CompleteConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CompleteConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeConversation(request), expectedError); + }); + }); + + describe('listConversations', () => { + it('invokes listConversations without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + ]; + client.innerApiCalls.listConversations = stubSimpleCall(expectedResponse); + const [response] = await client.listConversations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversations without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + ]; + client.innerApiCalls.listConversations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversations( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IConversation[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversations with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversations = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listConversations(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationsStream without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + ]; + client.descriptors.page.listConversations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listConversationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Conversation[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Conversation) => { + 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.listConversations.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listConversations, request) + ); + assert( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationsStream with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Conversation[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Conversation) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listConversations, request) + ); + assert( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversations without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Conversation() + ), + ]; + client.descriptors.page.listConversations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IConversation[] = []; + const iterable = client.listConversationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversations.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversations with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IConversation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversations.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMessages', () => { + it('invokes listMessages without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + ]; + client.innerApiCalls.listMessages = stubSimpleCall(expectedResponse); + const [response] = await client.listMessages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMessages without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + ]; + client.innerApiCalls.listMessages = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMessages( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IMessage[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMessages with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMessages = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listMessages(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMessagesStream without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + ]; + client.descriptors.page.listMessages.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Message[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Message) => { + 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.listMessages.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listMessages, request) + ); + assert( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMessagesStream with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMessages.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Message[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Message) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listMessages, request) + ); + assert( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMessages without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Message()), + ]; + client.descriptors.page.listMessages.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IMessage[] = []; + const iterable = client.listMessagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMessages.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMessages with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMessages.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMessagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IMessage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMessages.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new conversationsModule.v2.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_conversations_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_conversations_v2beta1.ts new file mode 100644 index 00000000000..645e65070d3 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_conversations_v2beta1.ts @@ -0,0 +1,4584 @@ +// 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. +// +// ** 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 conversationsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2beta1.ConversationsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + conversationsModule.v2beta1.ConversationsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + conversationsModule.v2beta1.ConversationsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = conversationsModule.v2beta1.ConversationsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new conversationsModule.v2beta1.ConversationsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationsStub, undefined); + await client.initialize(); + assert(client.conversationsStub); + }); + + it('has close method for the initialized client', done => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.conversationsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.conversationsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new conversationsModule.v2beta1.ConversationsClient({ + 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 conversationsModule.v2beta1.ConversationsClient({ + 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('createConversation', () => { + it('invokes createConversation without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateConversationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ); + client.innerApiCalls.createConversation = + stubSimpleCall(expectedResponse); + const [response] = await client.createConversation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversation without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateConversationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ); + client.innerApiCalls.createConversation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IConversation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversation with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateConversationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createConversation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConversation with closed client', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateConversationRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createConversation(request), expectedError); + }); + }); + + describe('getConversation', () => { + it('invokes getConversation without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ); + client.innerApiCalls.getConversation = stubSimpleCall(expectedResponse); + const [response] = await client.getConversation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversation without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ); + client.innerApiCalls.getConversation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IConversation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversation with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getConversation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConversation with closed client', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConversation(request), expectedError); + }); + }); + + describe('completeConversation', () => { + it('invokes completeConversation without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ); + client.innerApiCalls.completeConversation = + stubSimpleCall(expectedResponse); + const [response] = await client.completeConversation(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeConversation without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ); + client.innerApiCalls.completeConversation = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.completeConversation( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IConversation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeConversation with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.completeConversation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.completeConversation(request), expectedError); + const actualRequest = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.completeConversation as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes completeConversation with closed client', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompleteConversationRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CompleteConversationRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.completeConversation(request), expectedError); + }); + }); + + describe('batchCreateMessages', () => { + it('invokes batchCreateMessages without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse() + ); + client.innerApiCalls.batchCreateMessages = + stubSimpleCall(expectedResponse); + const [response] = await client.batchCreateMessages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchCreateMessages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateMessages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateMessages without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesResponse() + ); + client.innerApiCalls.batchCreateMessages = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateMessages( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IBatchCreateMessagesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchCreateMessages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateMessages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateMessages with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateMessages = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.batchCreateMessages(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchCreateMessages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateMessages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateMessages with closed client', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchCreateMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.batchCreateMessages(request), expectedError); + }); + }); + + describe('suggestConversationSummary', () => { + it('invokes suggestConversationSummary without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', + ['conversation'] + ); + request.conversation = defaultValue1; + const expectedHeaderRequestParams = `conversation=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse() + ); + client.innerApiCalls.suggestConversationSummary = + stubSimpleCall(expectedResponse); + const [response] = await client.suggestConversationSummary(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestConversationSummary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestConversationSummary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestConversationSummary without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', + ['conversation'] + ); + request.conversation = defaultValue1; + const expectedHeaderRequestParams = `conversation=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryResponse() + ); + client.innerApiCalls.suggestConversationSummary = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestConversationSummary( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.ISuggestConversationSummaryResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestConversationSummary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestConversationSummary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestConversationSummary with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', + ['conversation'] + ); + request.conversation = defaultValue1; + const expectedHeaderRequestParams = `conversation=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestConversationSummary = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.suggestConversationSummary(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.suggestConversationSummary as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestConversationSummary as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestConversationSummary with closed client', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestConversationSummaryRequest', + ['conversation'] + ); + request.conversation = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.suggestConversationSummary(request), + expectedError + ); + }); + }); + + describe('listConversations', () => { + it('invokes listConversations without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + ]; + client.innerApiCalls.listConversations = stubSimpleCall(expectedResponse); + const [response] = await client.listConversations(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversations without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + ]; + client.innerApiCalls.listConversations = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversations( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2beta1.IConversation[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversations with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversations = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listConversations(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listConversations as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConversationsStream without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + ]; + client.descriptors.page.listConversations.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listConversationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Conversation[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Conversation) => { + 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.listConversations.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listConversations, request) + ); + assert( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConversationsStream with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversations.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listConversationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Conversation[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Conversation) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listConversations, request) + ); + assert( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversations without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Conversation() + ), + ]; + client.descriptors.page.listConversations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IConversation[] = + []; + const iterable = client.listConversationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversations.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConversations with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListConversationsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListConversationsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConversations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConversationsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IConversation[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listConversations.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMessages', () => { + it('invokes listMessages without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + ]; + client.innerApiCalls.listMessages = stubSimpleCall(expectedResponse); + const [response] = await client.listMessages(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMessages without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + ]; + client.innerApiCalls.listMessages = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMessages( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IMessage[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMessages with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMessages = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listMessages(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listMessages as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMessagesStream without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + ]; + client.descriptors.page.listMessages.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Message[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Message) => { + 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.listMessages.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listMessages, request) + ); + assert( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMessagesStream with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMessages.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listMessagesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Message[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Message) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listMessages, request) + ); + assert( + (client.descriptors.page.listMessages.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMessages without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Message() + ), + ]; + client.descriptors.page.listMessages.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IMessage[] = []; + const iterable = client.listMessagesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listMessages.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMessages with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListMessagesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListMessagesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listMessages.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMessagesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IMessage[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listMessages.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listMessages.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new conversationsModule.v2beta1.ConversationsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_documents_v2.ts b/packages/google-cloud-dialogflow/test/gapic_documents_v2.ts new file mode 100644 index 00000000000..54bdb8e6676 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_documents_v2.ts @@ -0,0 +1,5619 @@ +// 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. +// +// ** 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 documentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2.DocumentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = documentsModule.v2.DocumentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = documentsModule.v2.DocumentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = documentsModule.v2.DocumentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new documentsModule.v2.DocumentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new documentsModule.v2.DocumentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentsStub, undefined); + await client.initialize(); + assert(client.documentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.documentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentsModule.v2.DocumentsClient({ + 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 documentsModule.v2.DocumentsClient({ + 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('getDocument', () => { + it('invokes getDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Document() + ); + client.innerApiCalls.getDocument = stubSimpleCall(expectedResponse); + const [response] = await client.getDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Document() + ); + client.innerApiCalls.getDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDocument( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IDocument | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDocument = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with closed client', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDocument(request), expectedError); + }); + }); + + describe('createDocument', () => { + it('invokes createDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkCreateDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkCreateDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importDocuments', () => { + it('invokes importDocuments without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importDocuments = + stubLongRunningCall(expectedResponse); + const [operation] = await client.importDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importDocuments = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importDocuments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ImportDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ImportDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importDocuments(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportDocumentsProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkImportDocumentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportDocumentsProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkImportDocumentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteDocument', () => { + it('invokes deleteDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkDeleteDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkDeleteDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateDocument', () => { + it('invokes updateDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest() + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateDocumentRequest', + ['document', 'name'] + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest() + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateDocumentRequest', + ['document', 'name'] + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest() + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateDocumentRequest', + ['document', 'name'] + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateDocumentRequest() + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateDocumentRequest', + ['document', 'name'] + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkUpdateDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkUpdateDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('reloadDocument', () => { + it('invokes reloadDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ReloadDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reloadDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.reloadDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reloadDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ReloadDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reloadDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reloadDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reloadDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ReloadDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.reloadDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reloadDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ReloadDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ReloadDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.reloadDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkReloadDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkReloadDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReloadDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkReloadDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('exportDocument', () => { + it('invokes exportDocument without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ExportDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.exportDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportDocument without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ExportDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.exportDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IDocument, + protos.google.cloud.dialogflow.v2.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportDocument with call error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ExportDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.exportDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.exportDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes exportDocument with LRO error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ExportDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ExportDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.exportDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.exportDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkExportDocumentProgress without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkExportDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportDocumentProgress with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + 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.checkExportDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listDocuments', () => { + it('invokes listDocuments without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + ]; + client.innerApiCalls.listDocuments = stubSimpleCall(expectedResponse); + const [response] = await client.listDocuments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocuments without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + ]; + client.innerApiCalls.listDocuments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDocuments( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IDocument[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocuments with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDocuments = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listDocuments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocumentsStream without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + ]; + client.descriptors.page.listDocuments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Document[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Document) => { + 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.listDocuments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDocuments, request) + ); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDocumentsStream with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Document[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Document) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDocuments, request) + ); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDocuments without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Document()), + ]; + client.descriptors.page.listDocuments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IDocument[] = []; + const iterable = client.listDocumentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDocuments.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDocuments with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDocumentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IDocument[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDocuments.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new documentsModule.v2.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_documents_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_documents_v2beta1.ts new file mode 100644 index 00000000000..f22c8f47b12 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_documents_v2beta1.ts @@ -0,0 +1,5036 @@ +// 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. +// +// ** 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 documentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2beta1.DocumentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = documentsModule.v2beta1.DocumentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = documentsModule.v2beta1.DocumentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = documentsModule.v2beta1.DocumentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new documentsModule.v2beta1.DocumentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentsStub, undefined); + await client.initialize(); + assert(client.documentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.documentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.documentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new documentsModule.v2beta1.DocumentsClient({ + 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 documentsModule.v2beta1.DocumentsClient({ + 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('getDocument', () => { + it('invokes getDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ); + client.innerApiCalls.getDocument = stubSimpleCall(expectedResponse); + const [response] = await client.getDocument(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ); + client.innerApiCalls.getDocument = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDocument( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IDocument | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDocument = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDocument with closed client', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getDocument(request), expectedError); + }); + }); + + describe('createDocument', () => { + it('invokes createDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.createDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createDocument with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateDocumentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.createDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateDocumentProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkCreateDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateDocumentProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkCreateDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('importDocuments', () => { + it('invokes importDocuments without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importDocuments = + stubLongRunningCall(expectedResponse); + const [operation] = await client.importDocuments(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.importDocuments = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.importDocuments( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2beta1.IImportDocumentsResponse, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.importDocuments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes importDocuments with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ImportDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.importDocuments = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.importDocuments(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.importDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkImportDocumentsProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkImportDocumentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkImportDocumentsProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkImportDocumentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteDocument', () => { + it('invokes deleteDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteDocument with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.deleteDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteDocumentProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkDeleteDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteDocumentProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkDeleteDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateDocument', () => { + it('invokes updateDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest() + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', + ['document', 'name'] + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest() + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', + ['document', 'name'] + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest() + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', + ['document', 'name'] + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.updateDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateDocument with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest() + ); + request.document ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateDocumentRequest', + ['document', 'name'] + ); + request.document.name = defaultValue1; + const expectedHeaderRequestParams = `document.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.updateDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateDocumentProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkUpdateDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateDocumentProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkUpdateDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('reloadDocument', () => { + it('invokes reloadDocument without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reloadDocument = + stubLongRunningCall(expectedResponse); + const [operation] = await client.reloadDocument(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reloadDocument without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.reloadDocument = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reloadDocument( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2beta1.IDocument, + protos.google.cloud.dialogflow.v2beta1.IKnowledgeOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reloadDocument with call error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.reloadDocument(request), expectedError); + const actualRequest = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reloadDocument with LRO error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ReloadDocumentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reloadDocument = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.reloadDocument(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reloadDocument as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkReloadDocumentProgress without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkReloadDocumentProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkReloadDocumentProgress with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + 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.checkReloadDocumentProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listDocuments', () => { + it('invokes listDocuments without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + ]; + client.innerApiCalls.listDocuments = stubSimpleCall(expectedResponse); + const [response] = await client.listDocuments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocuments without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + ]; + client.innerApiCalls.listDocuments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDocuments( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IDocument[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocuments with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDocuments = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listDocuments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDocuments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listDocumentsStream without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + ]; + client.descriptors.page.listDocuments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Document[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Document) => { + 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.listDocuments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDocuments, request) + ); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listDocumentsStream with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDocumentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Document[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Document) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDocuments, request) + ); + assert( + (client.descriptors.page.listDocuments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDocuments without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Document() + ), + ]; + client.descriptors.page.listDocuments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IDocument[] = []; + const iterable = client.listDocumentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDocuments.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listDocuments with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListDocumentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListDocumentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDocuments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDocumentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IDocument[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDocuments.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listDocuments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new documentsModule.v2beta1.DocumentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_entity_types_v2.ts b/packages/google-cloud-dialogflow/test/gapic_entity_types_v2.ts new file mode 100644 index 00000000000..02b882788b2 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_entity_types_v2.ts @@ -0,0 +1,5845 @@ +// 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. +// +// ** 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 entitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2.EntityTypesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = entitytypesModule.v2.EntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = entitytypesModule.v2.EntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = entitytypesModule.v2.EntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new entitytypesModule.v2.EntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.entityTypesStub, undefined); + await client.initialize(); + assert(client.entityTypesStub); + }); + + it('has close method for the initialized client', done => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.entityTypesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.entityTypesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new entitytypesModule.v2.EntityTypesClient({ + 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 entitytypesModule.v2.EntityTypesClient({ + 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('getEntityType', () => { + it('invokes getEntityType without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ); + client.innerApiCalls.getEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.getEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEntityType without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ); + client.innerApiCalls.getEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEntityType with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEntityType with closed client', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEntityType(request), expectedError); + }); + }); + + describe('createEntityType', () => { + it('invokes createEntityType without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ); + client.innerApiCalls.createEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.createEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEntityType without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ); + client.innerApiCalls.createEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEntityType with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEntityType with closed client', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEntityType(request), expectedError); + }); + }); + + describe('updateEntityType', () => { + it('invokes updateEntityType without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest() + ); + request.entityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', + ['entityType', 'name'] + ); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ); + client.innerApiCalls.updateEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.updateEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEntityType without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest() + ); + request.entityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', + ['entityType', 'name'] + ); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ); + client.innerApiCalls.updateEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEntityType with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest() + ); + request.entityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', + ['entityType', 'name'] + ); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEntityType with closed client', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateEntityTypeRequest() + ); + request.entityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateEntityTypeRequest', + ['entityType', 'name'] + ); + request.entityType.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEntityType(request), expectedError); + }); + }); + + describe('deleteEntityType', () => { + it('invokes deleteEntityType without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEntityType without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEntityType( + 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.deleteEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEntityType with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEntityType with closed client', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteEntityType(request), expectedError); + }); + }); + + describe('batchUpdateEntityTypes', () => { + it('invokes batchUpdateEntityTypes without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateEntityTypes = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateEntityTypes = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateEntityTypes( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntityTypes with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchUpdateEntityTypes(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntityTypes with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchUpdateEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchUpdateEntityTypesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchUpdateEntityTypesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateEntityTypesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchUpdateEntityTypesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchDeleteEntityTypes', () => { + it('invokes batchDeleteEntityTypes without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteEntityTypes = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteEntityTypes = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteEntityTypes( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntityTypes with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchDeleteEntityTypes(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntityTypes with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchDeleteEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchDeleteEntityTypesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchDeleteEntityTypesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteEntityTypesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchDeleteEntityTypesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchCreateEntities', () => { + it('invokes batchCreateEntities without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchCreateEntities = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchCreateEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateEntities without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchCreateEntities = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateEntities( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateEntities with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchCreateEntities(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateEntities with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchCreateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchCreateEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchCreateEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchCreateEntitiesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchCreateEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchCreateEntitiesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchUpdateEntities', () => { + it('invokes batchUpdateEntities without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateEntities = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntities without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateEntities = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateEntities( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntities with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchUpdateEntities(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntities with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchUpdateEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchUpdateEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchUpdateEntitiesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchUpdateEntitiesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchDeleteEntities', () => { + it('invokes batchDeleteEntities without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteEntities = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntities without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteEntities = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteEntities( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntities with call error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchDeleteEntities(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntities with LRO error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchDeleteEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchDeleteEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchDeleteEntitiesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + 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.checkBatchDeleteEntitiesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listEntityTypes', () => { + it('invokes listEntityTypes without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + ]; + client.innerApiCalls.listEntityTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + ]; + client.innerApiCalls.listEntityTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEntityTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IEntityType[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntityTypes with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntityTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listEntityTypes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntityTypesStream without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + ]; + client.descriptors.page.listEntityTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.EntityType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.EntityType) => { + 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.listEntityTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEntityTypes, request) + ); + assert( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listEntityTypesStream with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.EntityType[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.EntityType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEntityTypes, request) + ); + assert( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEntityTypes without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EntityType() + ), + ]; + client.descriptors.page.listEntityTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IEntityType[] = []; + const iterable = client.listEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listEntityTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEntityTypes with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IEntityType[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listEntityTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new entitytypesModule.v2.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_entity_types_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_entity_types_v2beta1.ts new file mode 100644 index 00000000000..894dab0e4a7 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_entity_types_v2beta1.ts @@ -0,0 +1,5437 @@ +// 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. +// +// ** 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 entitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2beta1.EntityTypesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + entitytypesModule.v2beta1.EntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + entitytypesModule.v2beta1.EntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = entitytypesModule.v2beta1.EntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.entityTypesStub, undefined); + await client.initialize(); + assert(client.entityTypesStub); + }); + + it('has close method for the initialized client', done => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.entityTypesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.entityTypesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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 entitytypesModule.v2beta1.EntityTypesClient({ + 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('getEntityType', () => { + it('invokes getEntityType without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ); + client.innerApiCalls.getEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.getEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEntityType without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ); + client.innerApiCalls.getEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEntityType with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEntityType with closed client', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEntityType(request), expectedError); + }); + }); + + describe('createEntityType', () => { + it('invokes createEntityType without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ); + client.innerApiCalls.createEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.createEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEntityType without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ); + client.innerApiCalls.createEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEntityType with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEntityType with closed client', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEntityType(request), expectedError); + }); + }); + + describe('updateEntityType', () => { + it('invokes updateEntityType without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest() + ); + request.entityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', + ['entityType', 'name'] + ); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ); + client.innerApiCalls.updateEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.updateEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEntityType without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest() + ); + request.entityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', + ['entityType', 'name'] + ); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ); + client.innerApiCalls.updateEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEntityType with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest() + ); + request.entityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', + ['entityType', 'name'] + ); + request.entityType.name = defaultValue1; + const expectedHeaderRequestParams = `entity_type.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEntityType with closed client', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest() + ); + request.entityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateEntityTypeRequest', + ['entityType', 'name'] + ); + request.entityType.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEntityType(request), expectedError); + }); + }); + + describe('deleteEntityType', () => { + it('invokes deleteEntityType without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEntityType = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEntityType without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEntityType( + 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.deleteEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEntityType with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEntityType with closed client', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteEntityType(request), expectedError); + }); + }); + + describe('batchUpdateEntityTypes', () => { + it('invokes batchUpdateEntityTypes without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateEntityTypes = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateEntityTypes(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateEntityTypes = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateEntityTypes( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateEntityTypesResponse, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntityTypes with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchUpdateEntityTypes(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntityTypes with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntityTypes = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchUpdateEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchUpdateEntityTypesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchUpdateEntityTypesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateEntityTypesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchUpdateEntityTypesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchDeleteEntityTypes', () => { + it('invokes batchDeleteEntityTypes without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteEntityTypes = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteEntityTypes(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteEntityTypes = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteEntityTypes( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntityTypes with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects( + client.batchDeleteEntityTypes(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntityTypes with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntityTypes = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchDeleteEntityTypes(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchDeleteEntityTypesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchDeleteEntityTypesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteEntityTypesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchDeleteEntityTypesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchCreateEntities', () => { + it('invokes batchCreateEntities without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchCreateEntities = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchCreateEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateEntities without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchCreateEntities = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchCreateEntities( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateEntities with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchCreateEntities(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchCreateEntities with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchCreateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchCreateEntities = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchCreateEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchCreateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchCreateEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchCreateEntitiesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchCreateEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchCreateEntitiesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchUpdateEntities', () => { + it('invokes batchUpdateEntities without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateEntities = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntities without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateEntities = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateEntities( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntities with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchUpdateEntities(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateEntities with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateEntities = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchUpdateEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchUpdateEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchUpdateEntitiesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchUpdateEntitiesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchDeleteEntities', () => { + it('invokes batchDeleteEntities without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteEntities = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteEntities(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntities without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteEntities = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteEntities( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntities with call error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchDeleteEntities(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteEntities with LRO error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteEntitiesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteEntities = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchDeleteEntities(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteEntities as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchDeleteEntitiesProgress without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchDeleteEntitiesProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteEntitiesProgress with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + 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.checkBatchDeleteEntitiesProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listEntityTypes', () => { + it('invokes listEntityTypes without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + ]; + client.innerApiCalls.listEntityTypes = stubSimpleCall(expectedResponse); + const [response] = await client.listEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntityTypes without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + ]; + client.innerApiCalls.listEntityTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEntityTypes( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IEntityType[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntityTypes with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntityTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listEntityTypes(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntityTypesStream without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + ]; + client.descriptors.page.listEntityTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.EntityType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.EntityType) => { + 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.listEntityTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEntityTypes, request) + ); + assert( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listEntityTypesStream with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.EntityType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.EntityType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEntityTypes, request) + ); + assert( + (client.descriptors.page.listEntityTypes.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEntityTypes without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EntityType() + ), + ]; + client.descriptors.page.listEntityTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IEntityType[] = + []; + const iterable = client.listEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listEntityTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEntityTypes with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEntityTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IEntityType[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listEntityTypes.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEntityTypes.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new entitytypesModule.v2beta1.EntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_environments_v2.ts b/packages/google-cloud-dialogflow/test/gapic_environments_v2.ts new file mode 100644 index 00000000000..1b78f23da88 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_environments_v2.ts @@ -0,0 +1,4886 @@ +// 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. +// +// ** 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 environmentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2.EnvironmentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = environmentsModule.v2.EnvironmentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = environmentsModule.v2.EnvironmentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = environmentsModule.v2.EnvironmentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new environmentsModule.v2.EnvironmentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.environmentsStub, undefined); + await client.initialize(); + assert(client.environmentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.environmentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.environmentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new environmentsModule.v2.EnvironmentsClient({ + 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 environmentsModule.v2.EnvironmentsClient({ + 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('getEnvironment', () => { + it('invokes getEnvironment without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ); + client.innerApiCalls.getEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.getEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironment without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ); + client.innerApiCalls.getEnvironment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnvironment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IEnvironment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironment with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getEnvironment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironment with closed client', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEnvironment(request), expectedError); + }); + }); + + describe('createEnvironment', () => { + it('invokes createEnvironment without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateEnvironmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ); + client.innerApiCalls.createEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.createEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEnvironment without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateEnvironmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ); + client.innerApiCalls.createEnvironment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEnvironment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IEnvironment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEnvironment with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateEnvironmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createEnvironment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEnvironment with closed client', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateEnvironmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEnvironment(request), expectedError); + }); + }); + + describe('updateEnvironment', () => { + it('invokes updateEnvironment without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest() + ); + request.environment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', + ['environment', 'name'] + ); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ); + client.innerApiCalls.updateEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.updateEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEnvironment without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest() + ); + request.environment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', + ['environment', 'name'] + ); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ); + client.innerApiCalls.updateEnvironment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEnvironment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IEnvironment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEnvironment with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest() + ); + request.environment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', + ['environment', 'name'] + ); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateEnvironment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEnvironment with closed client', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateEnvironmentRequest() + ); + request.environment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateEnvironmentRequest', + ['environment', 'name'] + ); + request.environment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEnvironment(request), expectedError); + }); + }); + + describe('deleteEnvironment', () => { + it('invokes deleteEnvironment without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEnvironment without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEnvironment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEnvironment( + 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.deleteEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEnvironment with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteEnvironment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEnvironment with closed client', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteEnvironment(request), expectedError); + }); + }); + + describe('listEnvironments', () => { + it('invokes listEnvironments without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + ]; + client.innerApiCalls.listEnvironments = stubSimpleCall(expectedResponse); + const [response] = await client.listEnvironments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEnvironments without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + ]; + client.innerApiCalls.listEnvironments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEnvironments( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IEnvironment[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEnvironments with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEnvironments = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listEnvironments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEnvironmentsStream without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + ]; + client.descriptors.page.listEnvironments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Environment[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Environment) => { + 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.listEnvironments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEnvironments, request) + ); + assert( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listEnvironmentsStream with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Environment[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Environment) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEnvironments, request) + ); + assert( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEnvironments without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Environment() + ), + ]; + client.descriptors.page.listEnvironments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IEnvironment[] = []; + const iterable = client.listEnvironmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listEnvironments.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEnvironments with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEnvironmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IEnvironment[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listEnvironments.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('getEnvironmentHistory', () => { + it('invokes getEnvironmentHistory without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + ]; + client.innerApiCalls.getEnvironmentHistory = + stubSimpleCall(expectedResponse); + const [response] = await client.getEnvironmentHistory(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironmentHistory without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + ]; + client.innerApiCalls.getEnvironmentHistory = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnvironmentHistory( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironmentHistory with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironmentHistory = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getEnvironmentHistory(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironmentHistoryStream without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + ]; + client.descriptors.page.getEnvironmentHistory.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.getEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry + ) => { + 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.getEnvironmentHistory + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.getEnvironmentHistory, request) + ); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes getEnvironmentHistoryStream with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.getEnvironmentHistory.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.getEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.getEnvironmentHistory, request) + ); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with getEnvironmentHistory without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.EnvironmentHistory.Entry() + ), + ]; + client.descriptors.page.getEnvironmentHistory.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[] = + []; + const iterable = client.getEnvironmentHistoryAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.getEnvironmentHistory + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with getEnvironmentHistory with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.getEnvironmentHistory.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.getEnvironmentHistoryAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.EnvironmentHistory.IEntry[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.getEnvironmentHistory + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new environmentsModule.v2.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_environments_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_environments_v2beta1.ts new file mode 100644 index 00000000000..d2e73e31587 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_environments_v2beta1.ts @@ -0,0 +1,4480 @@ +// 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. +// +// ** 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 environmentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2beta1.EnvironmentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + environmentsModule.v2beta1.EnvironmentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + environmentsModule.v2beta1.EnvironmentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = environmentsModule.v2beta1.EnvironmentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.environmentsStub, undefined); + await client.initialize(); + assert(client.environmentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.environmentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.environmentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + 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 environmentsModule.v2beta1.EnvironmentsClient({ + 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('getEnvironment', () => { + it('invokes getEnvironment without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ); + client.innerApiCalls.getEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.getEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironment without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ); + client.innerApiCalls.getEnvironment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnvironment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironment with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getEnvironment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironment with closed client', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getEnvironment(request), expectedError); + }); + }); + + describe('createEnvironment', () => { + it('invokes createEnvironment without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ); + client.innerApiCalls.createEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.createEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEnvironment without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ); + client.innerApiCalls.createEnvironment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEnvironment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEnvironment with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createEnvironment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEnvironment with closed client', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateEnvironmentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createEnvironment(request), expectedError); + }); + }); + + describe('updateEnvironment', () => { + it('invokes updateEnvironment without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest() + ); + request.environment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', + ['environment', 'name'] + ); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ); + client.innerApiCalls.updateEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.updateEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEnvironment without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest() + ); + request.environment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', + ['environment', 'name'] + ); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ); + client.innerApiCalls.updateEnvironment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateEnvironment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IEnvironment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEnvironment with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest() + ); + request.environment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', + ['environment', 'name'] + ); + request.environment.name = defaultValue1; + const expectedHeaderRequestParams = `environment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateEnvironment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateEnvironment with closed client', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest() + ); + request.environment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateEnvironmentRequest', + ['environment', 'name'] + ); + request.environment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateEnvironment(request), expectedError); + }); + }); + + describe('deleteEnvironment', () => { + it('invokes deleteEnvironment without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEnvironment = stubSimpleCall(expectedResponse); + const [response] = await client.deleteEnvironment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEnvironment without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteEnvironment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteEnvironment( + 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.deleteEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEnvironment with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteEnvironment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteEnvironment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteEnvironment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteEnvironment with closed client', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteEnvironmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteEnvironment(request), expectedError); + }); + }); + + describe('listEnvironments', () => { + it('invokes listEnvironments without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + ]; + client.innerApiCalls.listEnvironments = stubSimpleCall(expectedResponse); + const [response] = await client.listEnvironments(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEnvironments without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + ]; + client.innerApiCalls.listEnvironments = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEnvironments( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2beta1.IEnvironment[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEnvironments with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEnvironments = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listEnvironments(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEnvironments as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEnvironmentsStream without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + ]; + client.descriptors.page.listEnvironments.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Environment[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Environment) => { + 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.listEnvironments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEnvironments, request) + ); + assert( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listEnvironmentsStream with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listEnvironmentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Environment[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Environment) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listEnvironments, request) + ); + assert( + (client.descriptors.page.listEnvironments.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEnvironments without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Environment() + ), + ]; + client.descriptors.page.listEnvironments.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IEnvironment[] = + []; + const iterable = client.listEnvironmentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listEnvironments.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listEnvironments with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListEnvironmentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listEnvironments.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listEnvironmentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IEnvironment[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listEnvironments.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listEnvironments.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('getEnvironmentHistory', () => { + it('invokes getEnvironmentHistory without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + ]; + client.innerApiCalls.getEnvironmentHistory = + stubSimpleCall(expectedResponse); + const [response] = await client.getEnvironmentHistory(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironmentHistory without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + ]; + client.innerApiCalls.getEnvironmentHistory = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getEnvironmentHistory( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironmentHistory with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getEnvironmentHistory = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getEnvironmentHistory(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getEnvironmentHistory as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getEnvironmentHistoryStream without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + ]; + client.descriptors.page.getEnvironmentHistory.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.getEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + ) => { + 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.getEnvironmentHistory + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.getEnvironmentHistory, request) + ); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes getEnvironmentHistoryStream with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.getEnvironmentHistory.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.getEnvironmentHistoryStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.getEnvironmentHistory, request) + ); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with getEnvironmentHistory without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.Entry() + ), + ]; + client.descriptors.page.getEnvironmentHistory.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[] = + []; + const iterable = client.getEnvironmentHistoryAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.getEnvironmentHistory + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with getEnvironmentHistory with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetEnvironmentHistoryRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.getEnvironmentHistory.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.getEnvironmentHistoryAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.EnvironmentHistory.IEntry[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.getEnvironmentHistory + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.getEnvironmentHistory + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new environmentsModule.v2beta1.EnvironmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_fulfillments_v2.ts b/packages/google-cloud-dialogflow/test/gapic_fulfillments_v2.ts new file mode 100644 index 00000000000..5f7c1576e66 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_fulfillments_v2.ts @@ -0,0 +1,3864 @@ +// 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. +// +// ** 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 fulfillmentsModule from '../src'; + +import {protobuf, LocationProtos} 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 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('v2.FulfillmentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = fulfillmentsModule.v2.FulfillmentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = fulfillmentsModule.v2.FulfillmentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = fulfillmentsModule.v2.FulfillmentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.fulfillmentsStub, undefined); + await client.initialize(); + assert(client.fulfillmentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.fulfillmentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.fulfillmentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + 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 fulfillmentsModule.v2.FulfillmentsClient({ + 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('getFulfillment', () => { + it('invokes getFulfillment without error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetFulfillmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Fulfillment() + ); + client.innerApiCalls.getFulfillment = stubSimpleCall(expectedResponse); + const [response] = await client.getFulfillment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFulfillment without error using callback', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetFulfillmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Fulfillment() + ); + client.innerApiCalls.getFulfillment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFulfillment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IFulfillment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFulfillment with error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetFulfillmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFulfillment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getFulfillment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFulfillment with closed client', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetFulfillmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetFulfillmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFulfillment(request), expectedError); + }); + }); + + describe('updateFulfillment', () => { + it('invokes updateFulfillment without error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest() + ); + request.fulfillment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', + ['fulfillment', 'name'] + ); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Fulfillment() + ); + client.innerApiCalls.updateFulfillment = stubSimpleCall(expectedResponse); + const [response] = await client.updateFulfillment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFulfillment without error using callback', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest() + ); + request.fulfillment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', + ['fulfillment', 'name'] + ); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Fulfillment() + ); + client.innerApiCalls.updateFulfillment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFulfillment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IFulfillment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFulfillment with error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest() + ); + request.fulfillment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', + ['fulfillment', 'name'] + ); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFulfillment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateFulfillment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFulfillment with closed client', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateFulfillmentRequest() + ); + request.fulfillment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateFulfillmentRequest', + ['fulfillment', 'name'] + ); + request.fulfillment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFulfillment(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new fulfillmentsModule.v2.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_fulfillments_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_fulfillments_v2beta1.ts new file mode 100644 index 00000000000..ab05ae458e1 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_fulfillments_v2beta1.ts @@ -0,0 +1,3452 @@ +// 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. +// +// ** 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 fulfillmentsModule from '../src'; + +import {protobuf, LocationProtos} 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 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('v2beta1.FulfillmentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + fulfillmentsModule.v2beta1.FulfillmentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + fulfillmentsModule.v2beta1.FulfillmentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = fulfillmentsModule.v2beta1.FulfillmentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.fulfillmentsStub, undefined); + await client.initialize(); + assert(client.fulfillmentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.fulfillmentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.fulfillmentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + 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 fulfillmentsModule.v2beta1.FulfillmentsClient({ + 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('getFulfillment', () => { + it('invokes getFulfillment without error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Fulfillment() + ); + client.innerApiCalls.getFulfillment = stubSimpleCall(expectedResponse); + const [response] = await client.getFulfillment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFulfillment without error using callback', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Fulfillment() + ); + client.innerApiCalls.getFulfillment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getFulfillment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IFulfillment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFulfillment with error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getFulfillment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getFulfillment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getFulfillment with closed client', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetFulfillmentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getFulfillment(request), expectedError); + }); + }); + + describe('updateFulfillment', () => { + it('invokes updateFulfillment without error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest() + ); + request.fulfillment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', + ['fulfillment', 'name'] + ); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Fulfillment() + ); + client.innerApiCalls.updateFulfillment = stubSimpleCall(expectedResponse); + const [response] = await client.updateFulfillment(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFulfillment without error using callback', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest() + ); + request.fulfillment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', + ['fulfillment', 'name'] + ); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Fulfillment() + ); + client.innerApiCalls.updateFulfillment = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateFulfillment( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IFulfillment | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFulfillment with error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest() + ); + request.fulfillment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', + ['fulfillment', 'name'] + ); + request.fulfillment.name = defaultValue1; + const expectedHeaderRequestParams = `fulfillment.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateFulfillment = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateFulfillment(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateFulfillment as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateFulfillment with closed client', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest() + ); + request.fulfillment ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateFulfillmentRequest', + ['fulfillment', 'name'] + ); + request.fulfillment.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateFulfillment(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new fulfillmentsModule.v2beta1.FulfillmentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_intents_v2.ts b/packages/google-cloud-dialogflow/test/gapic_intents_v2.ts new file mode 100644 index 00000000000..2355b2cf2ba --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_intents_v2.ts @@ -0,0 +1,5234 @@ +// 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. +// +// ** 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 intentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2.IntentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = intentsModule.v2.IntentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = intentsModule.v2.IntentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = intentsModule.v2.IntentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new intentsModule.v2.IntentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new intentsModule.v2.IntentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.intentsStub, undefined); + await client.initialize(); + assert(client.intentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.intentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.intentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new intentsModule.v2.IntentsClient({ + 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 intentsModule.v2.IntentsClient({ + 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('getIntent', () => { + it('invokes getIntent without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Intent() + ); + client.innerApiCalls.getIntent = stubSimpleCall(expectedResponse); + const [response] = await client.getIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIntent without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Intent() + ); + client.innerApiCalls.getIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IIntent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIntent with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIntent with closed client', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIntent(request), expectedError); + }); + }); + + describe('createIntent', () => { + it('invokes createIntent without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateIntentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Intent() + ); + client.innerApiCalls.createIntent = stubSimpleCall(expectedResponse); + const [response] = await client.createIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIntent without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateIntentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Intent() + ); + client.innerApiCalls.createIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IIntent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIntent with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateIntentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIntent with closed client', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateIntentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createIntent(request), expectedError); + }); + }); + + describe('updateIntent', () => { + it('invokes updateIntent without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateIntentRequest() + ); + request.intent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateIntentRequest', + ['intent', 'name'] + ); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Intent() + ); + client.innerApiCalls.updateIntent = stubSimpleCall(expectedResponse); + const [response] = await client.updateIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIntent without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateIntentRequest() + ); + request.intent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateIntentRequest', + ['intent', 'name'] + ); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Intent() + ); + client.innerApiCalls.updateIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IIntent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIntent with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateIntentRequest() + ); + request.intent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateIntentRequest', + ['intent', 'name'] + ); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIntent with closed client', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateIntentRequest() + ); + request.intent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateIntentRequest', + ['intent', 'name'] + ); + request.intent.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateIntent(request), expectedError); + }); + }); + + describe('deleteIntent', () => { + it('invokes deleteIntent without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIntent without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIntent( + 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.deleteIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIntent with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIntent with closed client', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteIntent(request), expectedError); + }); + }); + + describe('batchUpdateIntents', () => { + it('invokes batchUpdateIntents without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateIntents = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateIntents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateIntents without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateIntents = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateIntents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateIntents with call error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchUpdateIntents(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateIntents with LRO error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchUpdateIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchUpdateIntents(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchUpdateIntentsProgress without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + 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.checkBatchUpdateIntentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateIntentsProgress with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + 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.checkBatchUpdateIntentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchDeleteIntents', () => { + it('invokes batchDeleteIntents without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteIntents = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteIntents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteIntents without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteIntents = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteIntents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteIntents with call error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchDeleteIntents(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteIntents with LRO error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.BatchDeleteIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchDeleteIntents(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchDeleteIntentsProgress without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + 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.checkBatchDeleteIntentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteIntentsProgress with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + 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.checkBatchDeleteIntentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listIntents', () => { + it('invokes listIntents without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + ]; + client.innerApiCalls.listIntents = stubSimpleCall(expectedResponse); + const [response] = await client.listIntents(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIntents without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + ]; + client.innerApiCalls.listIntents = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIntents( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IIntent[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIntents with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listIntents = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listIntents(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIntentsStream without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + ]; + client.descriptors.page.listIntents.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Intent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Intent) => { + 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.listIntents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIntents, request) + ); + assert( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listIntentsStream with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIntents.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Intent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Intent) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIntents, request) + ); + assert( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listIntents without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Intent()), + ]; + client.descriptors.page.listIntents.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IIntent[] = []; + const iterable = client.listIntentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listIntents with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listIntentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IIntent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new intentsModule.v2.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_intents_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_intents_v2beta1.ts new file mode 100644 index 00000000000..2fbcdd7c831 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_intents_v2beta1.ts @@ -0,0 +1,4844 @@ +// 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. +// +// ** 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 intentsModule from '../src'; + +import {PassThrough} from 'stream'; + +import { + protobuf, + LROperation, + operationsProtos, + LocationProtos, +} 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('v2beta1.IntentsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = intentsModule.v2beta1.IntentsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = intentsModule.v2beta1.IntentsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = intentsModule.v2beta1.IntentsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new intentsModule.v2beta1.IntentsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new intentsModule.v2beta1.IntentsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.intentsStub, undefined); + await client.initialize(); + assert(client.intentsStub); + }); + + it('has close method for the initialized client', done => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.intentsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.intentsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new intentsModule.v2beta1.IntentsClient({ + 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 intentsModule.v2beta1.IntentsClient({ + 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('getIntent', () => { + it('invokes getIntent without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ); + client.innerApiCalls.getIntent = stubSimpleCall(expectedResponse); + const [response] = await client.getIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIntent without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ); + client.innerApiCalls.getIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IIntent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIntent with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIntent = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIntent with closed client', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIntent(request), expectedError); + }); + }); + + describe('createIntent', () => { + it('invokes createIntent without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateIntentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ); + client.innerApiCalls.createIntent = stubSimpleCall(expectedResponse); + const [response] = await client.createIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIntent without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateIntentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ); + client.innerApiCalls.createIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IIntent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIntent with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateIntentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createIntent with closed client', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateIntentRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createIntent(request), expectedError); + }); + }); + + describe('updateIntent', () => { + it('invokes updateIntent without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest() + ); + request.intent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', + ['intent', 'name'] + ); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ); + client.innerApiCalls.updateIntent = stubSimpleCall(expectedResponse); + const [response] = await client.updateIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIntent without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest() + ); + request.intent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', + ['intent', 'name'] + ); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ); + client.innerApiCalls.updateIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IIntent | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIntent with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest() + ); + request.intent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', + ['intent', 'name'] + ); + request.intent.name = defaultValue1; + const expectedHeaderRequestParams = `intent.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateIntent with closed client', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateIntentRequest() + ); + request.intent ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateIntentRequest', + ['intent', 'name'] + ); + request.intent.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateIntent(request), expectedError); + }); + }); + + describe('deleteIntent', () => { + it('invokes deleteIntent without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIntent = stubSimpleCall(expectedResponse); + const [response] = await client.deleteIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIntent without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIntent( + 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.deleteIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIntent with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteIntent with closed client', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteIntentRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteIntent(request), expectedError); + }); + }); + + describe('batchUpdateIntents', () => { + it('invokes batchUpdateIntents without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateIntents = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchUpdateIntents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateIntents without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchUpdateIntents = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchUpdateIntents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.cloud.dialogflow.v2beta1.IBatchUpdateIntentsResponse, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateIntents with call error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchUpdateIntents(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchUpdateIntents with LRO error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchUpdateIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchUpdateIntents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchUpdateIntents(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchUpdateIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchUpdateIntentsProgress without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + 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.checkBatchUpdateIntentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchUpdateIntentsProgress with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + 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.checkBatchUpdateIntentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchDeleteIntents', () => { + it('invokes batchDeleteIntents without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteIntents = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteIntents(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteIntents without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.batchDeleteIntents = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteIntents( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + > | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.protobuf.IStruct + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteIntents with call error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall( + undefined, + expectedError + ); + await assert.rejects(client.batchDeleteIntents(request), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes batchDeleteIntents with LRO error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.BatchDeleteIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteIntents = stubLongRunningCall( + undefined, + undefined, + expectedError + ); + const [operation] = await client.batchDeleteIntents(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkBatchDeleteIntentsProgress without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + 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.checkBatchDeleteIntentsProgress( + expectedResponse.name + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkBatchDeleteIntentsProgress with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + 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.checkBatchDeleteIntentsProgress(''), + expectedError + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listIntents', () => { + it('invokes listIntents without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + ]; + client.innerApiCalls.listIntents = stubSimpleCall(expectedResponse); + const [response] = await client.listIntents(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIntents without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + ]; + client.innerApiCalls.listIntents = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIntents( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IIntent[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIntents with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listIntents = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listIntents(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listIntents as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listIntentsStream without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + ]; + client.descriptors.page.listIntents.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Intent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Intent) => { + 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.listIntents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIntents, request) + ); + assert( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listIntentsStream with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIntents.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listIntentsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Intent[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Intent) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listIntents, request) + ); + assert( + (client.descriptors.page.listIntents.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listIntents without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Intent() + ), + ]; + client.descriptors.page.listIntents.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IIntent[] = []; + const iterable = client.listIntentsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listIntents with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListIntentsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListIntentsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listIntents.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError + ); + const iterable = client.listIntentsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IIntent[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listIntents.asyncIterate as SinonStub).getCall( + 0 + ).args[1], + request + ); + assert( + (client.descriptors.page.listIntents.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.getOperation(request); + }, expectedError); + assert( + (client.operationsClient.getOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = + stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub).getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.cancelOperation(request); + }, expectedError); + assert( + (client.operationsClient.cancelOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = + stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub).getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(async () => { + await client.deleteOperation(request); + }, expectedError); + assert( + (client.operationsClient.deleteOperation as SinonStub) + .getCall(0) + .calledWith(request) + ); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.operationsClient.descriptor.listOperations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new intentsModule.v2beta1.IntentsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2.ts b/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2.ts new file mode 100644 index 00000000000..ccf54c46706 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2.ts @@ -0,0 +1,4534 @@ +// 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. +// +// ** 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 knowledgebasesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2.KnowledgeBasesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + knowledgebasesModule.v2.KnowledgeBasesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + knowledgebasesModule.v2.KnowledgeBasesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = knowledgebasesModule.v2.KnowledgeBasesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.knowledgeBasesStub, undefined); + await client.initialize(); + assert(client.knowledgeBasesStub); + }); + + it('has close method for the initialized client', done => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.knowledgeBasesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.knowledgeBasesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + 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 knowledgebasesModule.v2.KnowledgeBasesClient({ + 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('getKnowledgeBase', () => { + it('invokes getKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.getKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ); + client.innerApiCalls.getKnowledgeBase = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getKnowledgeBase( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKnowledgeBase with closed client', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + }); + }); + + describe('createKnowledgeBase', () => { + it('invokes createKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ); + client.innerApiCalls.createKnowledgeBase = + stubSimpleCall(expectedResponse); + const [response] = await client.createKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ); + client.innerApiCalls.createKnowledgeBase = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createKnowledgeBase( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createKnowledgeBase = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKnowledgeBase with closed client', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateKnowledgeBaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + }); + }); + + describe('deleteKnowledgeBase', () => { + it('invokes deleteKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteKnowledgeBase = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteKnowledgeBase = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteKnowledgeBase( + 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.deleteKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKnowledgeBase with closed client', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + }); + }); + + describe('updateKnowledgeBase', () => { + it('invokes updateKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest() + ); + request.knowledgeBase ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', + ['knowledgeBase', 'name'] + ); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ); + client.innerApiCalls.updateKnowledgeBase = + stubSimpleCall(expectedResponse); + const [response] = await client.updateKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest() + ); + request.knowledgeBase ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', + ['knowledgeBase', 'name'] + ); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ); + client.innerApiCalls.updateKnowledgeBase = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateKnowledgeBase( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest() + ); + request.knowledgeBase ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', + ['knowledgeBase', 'name'] + ); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKnowledgeBase with closed client', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest() + ); + request.knowledgeBase ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateKnowledgeBaseRequest', + ['knowledgeBase', 'name'] + ); + request.knowledgeBase.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + }); + }); + + describe('listKnowledgeBases', () => { + it('invokes listKnowledgeBases without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + ]; + client.innerApiCalls.listKnowledgeBases = + stubSimpleCall(expectedResponse); + const [response] = await client.listKnowledgeBases(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKnowledgeBases without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + ]; + client.innerApiCalls.listKnowledgeBases = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listKnowledgeBases( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IKnowledgeBase[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKnowledgeBases with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listKnowledgeBases = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listKnowledgeBases(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKnowledgeBasesStream without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + ]; + client.descriptors.page.listKnowledgeBases.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listKnowledgeBasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.KnowledgeBase[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.KnowledgeBase) => { + 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.listKnowledgeBases.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listKnowledgeBases, request) + ); + assert( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listKnowledgeBasesStream with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKnowledgeBases.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listKnowledgeBasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.KnowledgeBase[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.KnowledgeBase) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listKnowledgeBases, request) + ); + assert( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKnowledgeBases without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.KnowledgeBase() + ), + ]; + client.descriptors.page.listKnowledgeBases.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IKnowledgeBase[] = []; + const iterable = client.listKnowledgeBasesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKnowledgeBases with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKnowledgeBases.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listKnowledgeBasesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IKnowledgeBase[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new knowledgebasesModule.v2.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2beta1.ts new file mode 100644 index 00000000000..d293127d72d --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_knowledge_bases_v2beta1.ts @@ -0,0 +1,4125 @@ +// 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. +// +// ** 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 knowledgebasesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2beta1.KnowledgeBasesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + knowledgebasesModule.v2beta1.KnowledgeBasesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + knowledgebasesModule.v2beta1.KnowledgeBasesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = knowledgebasesModule.v2beta1.KnowledgeBasesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.knowledgeBasesStub, undefined); + await client.initialize(); + assert(client.knowledgeBasesStub); + }); + + it('has close method for the initialized client', done => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.knowledgeBasesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.knowledgeBasesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + 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 knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + 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('getKnowledgeBase', () => { + it('invokes getKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall(expectedResponse); + const [response] = await client.getKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ); + client.innerApiCalls.getKnowledgeBase = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getKnowledgeBase( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getKnowledgeBase = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getKnowledgeBase with closed client', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getKnowledgeBase(request), expectedError); + }); + }); + + describe('createKnowledgeBase', () => { + it('invokes createKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ); + client.innerApiCalls.createKnowledgeBase = + stubSimpleCall(expectedResponse); + const [response] = await client.createKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ); + client.innerApiCalls.createKnowledgeBase = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createKnowledgeBase( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createKnowledgeBase = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createKnowledgeBase with closed client', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateKnowledgeBaseRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createKnowledgeBase(request), expectedError); + }); + }); + + describe('deleteKnowledgeBase', () => { + it('invokes deleteKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteKnowledgeBase = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteKnowledgeBase = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteKnowledgeBase( + 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.deleteKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteKnowledgeBase = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteKnowledgeBase with closed client', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteKnowledgeBaseRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteKnowledgeBase(request), expectedError); + }); + }); + + describe('updateKnowledgeBase', () => { + it('invokes updateKnowledgeBase without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest() + ); + request.knowledgeBase ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', + ['knowledgeBase', 'name'] + ); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ); + client.innerApiCalls.updateKnowledgeBase = + stubSimpleCall(expectedResponse); + const [response] = await client.updateKnowledgeBase(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKnowledgeBase without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest() + ); + request.knowledgeBase ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', + ['knowledgeBase', 'name'] + ); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ); + client.innerApiCalls.updateKnowledgeBase = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateKnowledgeBase( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKnowledgeBase with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest() + ); + request.knowledgeBase ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', + ['knowledgeBase', 'name'] + ); + request.knowledgeBase.name = defaultValue1; + const expectedHeaderRequestParams = `knowledge_base.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateKnowledgeBase = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateKnowledgeBase as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateKnowledgeBase with closed client', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest() + ); + request.knowledgeBase ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateKnowledgeBaseRequest', + ['knowledgeBase', 'name'] + ); + request.knowledgeBase.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateKnowledgeBase(request), expectedError); + }); + }); + + describe('listKnowledgeBases', () => { + it('invokes listKnowledgeBases without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + ]; + client.innerApiCalls.listKnowledgeBases = + stubSimpleCall(expectedResponse); + const [response] = await client.listKnowledgeBases(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKnowledgeBases without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + ]; + client.innerApiCalls.listKnowledgeBases = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listKnowledgeBases( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKnowledgeBases with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listKnowledgeBases = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listKnowledgeBases(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listKnowledgeBases as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listKnowledgeBasesStream without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + ]; + client.descriptors.page.listKnowledgeBases.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listKnowledgeBasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase) => { + 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.listKnowledgeBases.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listKnowledgeBases, request) + ); + assert( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listKnowledgeBasesStream with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKnowledgeBases.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listKnowledgeBasesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.KnowledgeBase) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listKnowledgeBases, request) + ); + assert( + (client.descriptors.page.listKnowledgeBases.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKnowledgeBases without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.KnowledgeBase() + ), + ]; + client.descriptors.page.listKnowledgeBases.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[] = + []; + const iterable = client.listKnowledgeBasesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listKnowledgeBases with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListKnowledgeBasesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listKnowledgeBases.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listKnowledgeBasesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IKnowledgeBase[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listKnowledgeBases.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new knowledgebasesModule.v2beta1.KnowledgeBasesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_participants_v2.ts b/packages/google-cloud-dialogflow/test/gapic_participants_v2.ts new file mode 100644 index 00000000000..69998313531 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_participants_v2.ts @@ -0,0 +1,5022 @@ +// 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. +// +// ** 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 participantsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 stubBidiStreamingCall( + response?: ResponseType, + error?: Error +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +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('v2.ParticipantsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = participantsModule.v2.ParticipantsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = participantsModule.v2.ParticipantsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = participantsModule.v2.ParticipantsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new participantsModule.v2.ParticipantsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new participantsModule.v2.ParticipantsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.participantsStub, undefined); + await client.initialize(); + assert(client.participantsStub); + }); + + it('has close method for the initialized client', done => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.participantsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.participantsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new participantsModule.v2.ParticipantsClient({ + 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 participantsModule.v2.ParticipantsClient({ + 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('createParticipant', () => { + it('invokes createParticipant without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateParticipantRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ); + client.innerApiCalls.createParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.createParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createParticipant without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateParticipantRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ); + client.innerApiCalls.createParticipant = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createParticipant( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IParticipant | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createParticipant with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateParticipantRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createParticipant = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createParticipant(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createParticipant with closed client', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateParticipantRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createParticipant(request), expectedError); + }); + }); + + describe('getParticipant', () => { + it('invokes getParticipant without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetParticipantRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ); + client.innerApiCalls.getParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.getParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getParticipant without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetParticipantRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ); + client.innerApiCalls.getParticipant = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getParticipant( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IParticipant | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getParticipant with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetParticipantRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getParticipant = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getParticipant(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getParticipant with closed client', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetParticipantRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getParticipant(request), expectedError); + }); + }); + + describe('updateParticipant', () => { + it('invokes updateParticipant without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest() + ); + request.participant ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateParticipantRequest', + ['participant', 'name'] + ); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ); + client.innerApiCalls.updateParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.updateParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParticipant without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest() + ); + request.participant ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateParticipantRequest', + ['participant', 'name'] + ); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ); + client.innerApiCalls.updateParticipant = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateParticipant( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IParticipant | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParticipant with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest() + ); + request.participant ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateParticipantRequest', + ['participant', 'name'] + ); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParticipant = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateParticipant(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParticipant with closed client', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateParticipantRequest() + ); + request.participant ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateParticipantRequest', + ['participant', 'name'] + ); + request.participant.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateParticipant(request), expectedError); + }); + }); + + describe('analyzeContent', () => { + it('invokes analyzeContent without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.AnalyzeContentRequest', + ['participant'] + ); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnalyzeContentResponse() + ); + client.innerApiCalls.analyzeContent = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeContent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeContent without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.AnalyzeContentRequest', + ['participant'] + ); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnalyzeContentResponse() + ); + client.innerApiCalls.analyzeContent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeContent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IAnalyzeContentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeContent with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.AnalyzeContentRequest', + ['participant'] + ); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeContent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.analyzeContent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeContent with closed client', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.AnalyzeContentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.AnalyzeContentRequest', + ['participant'] + ); + request.participant = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeContent(request), expectedError); + }); + }); + + describe('suggestArticles', () => { + it('invokes suggestArticles without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestArticlesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestArticlesResponse() + ); + client.innerApiCalls.suggestArticles = stubSimpleCall(expectedResponse); + const [response] = await client.suggestArticles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestArticles without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestArticlesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestArticlesResponse() + ); + client.innerApiCalls.suggestArticles = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestArticles( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.ISuggestArticlesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestArticles with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestArticlesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestArticles = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.suggestArticles(request), expectedError); + const actualRequest = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestArticles with closed client', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestArticlesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestArticlesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestArticles(request), expectedError); + }); + }); + + describe('suggestFaqAnswers', () => { + it('invokes suggestFaqAnswers without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse() + ); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(expectedResponse); + const [response] = await client.suggestFaqAnswers(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestFaqAnswers without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersResponse() + ); + client.innerApiCalls.suggestFaqAnswers = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestFaqAnswers( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.ISuggestFaqAnswersResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestFaqAnswers with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + const actualRequest = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestFaqAnswers with closed client', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestFaqAnswersRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + }); + }); + + describe('suggestSmartReplies', () => { + it('invokes suggestSmartReplies without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse() + ); + client.innerApiCalls.suggestSmartReplies = + stubSimpleCall(expectedResponse); + const [response] = await client.suggestSmartReplies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesResponse() + ); + client.innerApiCalls.suggestSmartReplies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestSmartReplies( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.ISuggestSmartRepliesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestSmartReplies = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.suggestSmartReplies(request), expectedError); + const actualRequest = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies with closed client', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.SuggestSmartRepliesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestSmartReplies(request), expectedError); + }); + }); + + describe('streamingAnalyzeContent', () => { + it('invokes streamingAnalyzeContent without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse() + ); + client.innerApiCalls.streamingAnalyzeContent = + stubBidiStreamingCall(expectedResponse); + const stream = client.streamingAnalyzeContent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.streamingAnalyzeContent as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + + it('invokes streamingAnalyzeContent with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall( + undefined, + expectedError + ); + const stream = client.streamingAnalyzeContent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2.StreamingAnalyzeContentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.streamingAnalyzeContent as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + }); + + describe('listParticipants', () => { + it('invokes listParticipants without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + ]; + client.innerApiCalls.listParticipants = stubSimpleCall(expectedResponse); + const [response] = await client.listParticipants(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listParticipants without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + ]; + client.innerApiCalls.listParticipants = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listParticipants( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IParticipant[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listParticipants with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listParticipants = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listParticipants(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listParticipantsStream without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + ]; + client.descriptors.page.listParticipants.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listParticipantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Participant[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Participant) => { + 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.listParticipants.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listParticipants, request) + ); + assert( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listParticipantsStream with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listParticipants.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listParticipantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Participant[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Participant) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listParticipants, request) + ); + assert( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listParticipants without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Participant() + ), + ]; + client.descriptors.page.listParticipants.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IParticipant[] = []; + const iterable = client.listParticipantsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listParticipants.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listParticipants with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listParticipants.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listParticipantsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IParticipant[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listParticipants.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new participantsModule.v2.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_participants_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_participants_v2beta1.ts new file mode 100644 index 00000000000..8c9a4a7e2a2 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_participants_v2beta1.ts @@ -0,0 +1,5097 @@ +// 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. +// +// ** 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 participantsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 stubBidiStreamingCall( + response?: ResponseType, + error?: Error +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + +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('v2beta1.ParticipantsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + participantsModule.v2beta1.ParticipantsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + participantsModule.v2beta1.ParticipantsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = participantsModule.v2beta1.ParticipantsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new participantsModule.v2beta1.ParticipantsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.participantsStub, undefined); + await client.initialize(); + assert(client.participantsStub); + }); + + it('has close method for the initialized client', done => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.participantsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.participantsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new participantsModule.v2beta1.ParticipantsClient({ + 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 participantsModule.v2beta1.ParticipantsClient({ + 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('createParticipant', () => { + it('invokes createParticipant without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ); + client.innerApiCalls.createParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.createParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createParticipant without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ); + client.innerApiCalls.createParticipant = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createParticipant( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IParticipant | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createParticipant with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createParticipant = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createParticipant(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createParticipant with closed client', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateParticipantRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createParticipant(request), expectedError); + }); + }); + + describe('getParticipant', () => { + it('invokes getParticipant without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetParticipantRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ); + client.innerApiCalls.getParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.getParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getParticipant without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetParticipantRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ); + client.innerApiCalls.getParticipant = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getParticipant( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IParticipant | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getParticipant with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetParticipantRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getParticipant = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getParticipant(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getParticipant with closed client', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetParticipantRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetParticipantRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getParticipant(request), expectedError); + }); + }); + + describe('updateParticipant', () => { + it('invokes updateParticipant without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest() + ); + request.participant ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', + ['participant', 'name'] + ); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ); + client.innerApiCalls.updateParticipant = stubSimpleCall(expectedResponse); + const [response] = await client.updateParticipant(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParticipant without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest() + ); + request.participant ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', + ['participant', 'name'] + ); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ); + client.innerApiCalls.updateParticipant = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateParticipant( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IParticipant | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParticipant with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest() + ); + request.participant ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', + ['participant', 'name'] + ); + request.participant.name = defaultValue1; + const expectedHeaderRequestParams = `participant.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateParticipant = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateParticipant(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateParticipant as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateParticipant with closed client', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest() + ); + request.participant ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateParticipantRequest', + ['participant', 'name'] + ); + request.participant.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateParticipant(request), expectedError); + }); + }); + + describe('analyzeContent', () => { + it('invokes analyzeContent without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', + ['participant'] + ); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse() + ); + client.innerApiCalls.analyzeContent = stubSimpleCall(expectedResponse); + const [response] = await client.analyzeContent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeContent without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', + ['participant'] + ); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentResponse() + ); + client.innerApiCalls.analyzeContent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.analyzeContent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IAnalyzeContentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeContent with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', + ['participant'] + ); + request.participant = defaultValue1; + const expectedHeaderRequestParams = `participant=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.analyzeContent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.analyzeContent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.analyzeContent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes analyzeContent with closed client', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.AnalyzeContentRequest', + ['participant'] + ); + request.participant = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.analyzeContent(request), expectedError); + }); + }); + + describe('suggestArticles', () => { + it('invokes suggestArticles without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse() + ); + client.innerApiCalls.suggestArticles = stubSimpleCall(expectedResponse); + const [response] = await client.suggestArticles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestArticles without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesResponse() + ); + client.innerApiCalls.suggestArticles = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestArticles( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.ISuggestArticlesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestArticles with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestArticles = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.suggestArticles(request), expectedError); + const actualRequest = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestArticles as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestArticles with closed client', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestArticlesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestArticles(request), expectedError); + }); + }); + + describe('suggestFaqAnswers', () => { + it('invokes suggestFaqAnswers without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse() + ); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall(expectedResponse); + const [response] = await client.suggestFaqAnswers(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestFaqAnswers without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersResponse() + ); + client.innerApiCalls.suggestFaqAnswers = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestFaqAnswers( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.ISuggestFaqAnswersResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestFaqAnswers with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestFaqAnswers = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + const actualRequest = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestFaqAnswers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestFaqAnswers with closed client', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestFaqAnswersRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestFaqAnswers(request), expectedError); + }); + }); + + describe('suggestSmartReplies', () => { + it('invokes suggestSmartReplies without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse() + ); + client.innerApiCalls.suggestSmartReplies = + stubSimpleCall(expectedResponse); + const [response] = await client.suggestSmartReplies(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesResponse() + ); + client.innerApiCalls.suggestSmartReplies = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.suggestSmartReplies( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.ISuggestSmartRepliesResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.suggestSmartReplies = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.suggestSmartReplies(request), expectedError); + const actualRequest = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.suggestSmartReplies as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes suggestSmartReplies with closed client', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.SuggestSmartRepliesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.suggestSmartReplies(request), expectedError); + }); + }); + + describe('compileSuggestion', () => { + it('invokes compileSuggestion without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse() + ); + client.innerApiCalls.compileSuggestion = stubSimpleCall(expectedResponse); + const [response] = await client.compileSuggestion(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.compileSuggestion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.compileSuggestion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes compileSuggestion without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionResponse() + ); + client.innerApiCalls.compileSuggestion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.compileSuggestion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.ICompileSuggestionResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.compileSuggestion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.compileSuggestion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes compileSuggestion with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.compileSuggestion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.compileSuggestion(request), expectedError); + assert(stub.calledOnce); + const actualRequest = ( + client.innerApiCalls.compileSuggestion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.compileSuggestion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes compileSuggestion with closed client', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CompileSuggestionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.compileSuggestion(request), expectedError); + assert(stub.calledOnce); + }); + }); + + describe('streamingAnalyzeContent', () => { + it('invokes streamingAnalyzeContent without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse() + ); + client.innerApiCalls.streamingAnalyzeContent = + stubBidiStreamingCall(expectedResponse); + const stream = client.streamingAnalyzeContent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.streamingAnalyzeContent as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + + it('invokes streamingAnalyzeContent with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingAnalyzeContent = stubBidiStreamingCall( + undefined, + expectedError + ); + const stream = client.streamingAnalyzeContent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.StreamingAnalyzeContentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.streamingAnalyzeContent as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + }); + + describe('listParticipants', () => { + it('invokes listParticipants without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + ]; + client.innerApiCalls.listParticipants = stubSimpleCall(expectedResponse); + const [response] = await client.listParticipants(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listParticipants without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + ]; + client.innerApiCalls.listParticipants = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listParticipants( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2beta1.IParticipant[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listParticipants with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listParticipants = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listParticipants(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listParticipants as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listParticipantsStream without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + ]; + client.descriptors.page.listParticipants.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listParticipantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Participant[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Participant) => { + 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.listParticipants.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listParticipants, request) + ); + assert( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listParticipantsStream with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listParticipants.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listParticipantsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Participant[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Participant) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listParticipants, request) + ); + assert( + (client.descriptors.page.listParticipants.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listParticipants without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Participant() + ), + ]; + client.descriptors.page.listParticipants.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IParticipant[] = + []; + const iterable = client.listParticipantsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listParticipants.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listParticipants with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListParticipantsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListParticipantsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listParticipants.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listParticipantsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IParticipant[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listParticipants.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listParticipants.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listSuggestions', () => { + it('invokes listSuggestions without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + ]; + client.innerApiCalls.listSuggestions = stubSimpleCall(expectedResponse); + const [response] = await client.listSuggestions(request); + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSuggestions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSuggestions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSuggestions without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + ]; + client.innerApiCalls.listSuggestions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSuggestions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.ISuggestion[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSuggestions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSuggestions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSuggestions with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSuggestions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listSuggestions(request), expectedError); + assert(stub.calledOnce); + const actualRequest = ( + client.innerApiCalls.listSuggestions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSuggestions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSuggestionsStream without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + ]; + client.descriptors.page.listSuggestions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSuggestionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Suggestion[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Suggestion) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert(stub.calledOnce); + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSuggestions, request) + ); + assert( + (client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSuggestionsStream with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSuggestions.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSuggestionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Suggestion[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Suggestion) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert(stub.calledOnce); + assert( + (client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSuggestions, request) + ); + assert( + (client.descriptors.page.listSuggestions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSuggestions without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Suggestion() + ), + ]; + client.descriptors.page.listSuggestions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.ISuggestion[] = + []; + const iterable = client.listSuggestionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert(stub.calledOnce); + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSuggestions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSuggestions with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const stub = sinon.stub(client, 'warn'); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSuggestionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSuggestions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSuggestionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.ISuggestion[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert(stub.calledOnce); + assert.deepStrictEqual( + ( + client.descriptors.page.listSuggestions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listSuggestions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new participantsModule.v2beta1.ParticipantsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2.ts b/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2.ts new file mode 100644 index 00000000000..22cb7015a57 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2.ts @@ -0,0 +1,4642 @@ +// 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. +// +// ** 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 sessionentitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2.SessionEntityTypesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + sessionentitytypesModule.v2.SessionEntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + sessionentitytypesModule.v2.SessionEntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sessionentitytypesModule.v2.SessionEntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionEntityTypesStub, undefined); + await client.initialize(); + assert(client.sessionEntityTypesStub); + }); + + it('has close method for the initialized client', done => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sessionEntityTypesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionEntityTypesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + 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 sessionentitytypesModule.v2.SessionEntityTypesClient({ + 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('getSessionEntityType', () => { + it('invokes getSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ); + client.innerApiCalls.getSessionEntityType = + stubSimpleCall(expectedResponse); + const [response] = await client.getSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ); + client.innerApiCalls.getSessionEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.ISessionEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getSessionEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSessionEntityType with closed client', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSessionEntityType(request), expectedError); + }); + }); + + describe('createSessionEntityType', () => { + it('invokes createSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ); + client.innerApiCalls.createSessionEntityType = + stubSimpleCall(expectedResponse); + const [response] = await client.createSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ); + client.innerApiCalls.createSessionEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.ISessionEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createSessionEntityType(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSessionEntityType with closed client', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateSessionEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.createSessionEntityType(request), + expectedError + ); + }); + }); + + describe('updateSessionEntityType', () => { + it('invokes updateSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', + ['sessionEntityType', 'name'] + ); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ); + client.innerApiCalls.updateSessionEntityType = + stubSimpleCall(expectedResponse); + const [response] = await client.updateSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', + ['sessionEntityType', 'name'] + ); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ); + client.innerApiCalls.updateSessionEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.ISessionEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', + ['sessionEntityType', 'name'] + ); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateSessionEntityType(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSessionEntityType with closed client', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateSessionEntityTypeRequest', + ['sessionEntityType', 'name'] + ); + request.sessionEntityType.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateSessionEntityType(request), + expectedError + ); + }); + }); + + describe('deleteSessionEntityType', () => { + it('invokes deleteSessionEntityType without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSessionEntityType = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSessionEntityType without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSessionEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSessionEntityType( + 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.deleteSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSessionEntityType with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteSessionEntityType(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSessionEntityType with closed client', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.deleteSessionEntityType(request), + expectedError + ); + }); + }); + + describe('listSessionEntityTypes', () => { + it('invokes listSessionEntityTypes without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + ]; + client.innerApiCalls.listSessionEntityTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listSessionEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSessionEntityTypes without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + ]; + client.innerApiCalls.listSessionEntityTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSessionEntityTypes( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2.ISessionEntityType[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSessionEntityTypes with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listSessionEntityTypes(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSessionEntityTypesStream without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + ]; + client.descriptors.page.listSessionEntityTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.SessionEntityType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.SessionEntityType) => { + 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.listSessionEntityTypes + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSessionEntityTypes, request) + ); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSessionEntityTypesStream with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.SessionEntityType[] = + []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.SessionEntityType) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSessionEntityTypes, request) + ); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSessionEntityTypes without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2.SessionEntityType() + ), + ]; + client.descriptors.page.listSessionEntityTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.ISessionEntityType[] = + []; + const iterable = client.listSessionEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSessionEntityTypes with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSessionEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.ISessionEntityType[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = '/rendered/path/projectAgentSession'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath( + 'projectValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionentitytypesModule.v2.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2beta1.ts new file mode 100644 index 00000000000..89eb1dedac3 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_session_entity_types_v2beta1.ts @@ -0,0 +1,4304 @@ +// 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. +// +// ** 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 sessionentitytypesModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2beta1.SessionEntityTypesClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = + sessionentitytypesModule.v2beta1.SessionEntityTypesClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = + sessionentitytypesModule.v2beta1.SessionEntityTypesClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = + sessionentitytypesModule.v2beta1.SessionEntityTypesClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionEntityTypesStub, undefined); + await client.initialize(); + assert(client.sessionEntityTypesStub); + }); + + it('has close method for the initialized client', done => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sessionEntityTypesStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionEntityTypesStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + 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 sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + 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('getSessionEntityType', () => { + it('invokes getSessionEntityType without error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ); + client.innerApiCalls.getSessionEntityType = + stubSimpleCall(expectedResponse); + const [response] = await client.getSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSessionEntityType without error using callback', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ); + client.innerApiCalls.getSessionEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSessionEntityType with error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getSessionEntityType(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getSessionEntityType with closed client', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSessionEntityType(request), expectedError); + }); + }); + + describe('createSessionEntityType', () => { + it('invokes createSessionEntityType without error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ); + client.innerApiCalls.createSessionEntityType = + stubSimpleCall(expectedResponse); + const [response] = await client.createSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSessionEntityType without error using callback', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ); + client.innerApiCalls.createSessionEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSessionEntityType with error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.createSessionEntityType(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSessionEntityType with closed client', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateSessionEntityTypeRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.createSessionEntityType(request), + expectedError + ); + }); + }); + + describe('updateSessionEntityType', () => { + it('invokes updateSessionEntityType without error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', + ['sessionEntityType', 'name'] + ); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ); + client.innerApiCalls.updateSessionEntityType = + stubSimpleCall(expectedResponse); + const [response] = await client.updateSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSessionEntityType without error using callback', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', + ['sessionEntityType', 'name'] + ); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ); + client.innerApiCalls.updateSessionEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSessionEntityType( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSessionEntityType with error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', + ['sessionEntityType', 'name'] + ); + request.sessionEntityType.name = defaultValue1; + const expectedHeaderRequestParams = `session_entity_type.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.updateSessionEntityType(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSessionEntityType with closed client', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest() + ); + request.sessionEntityType ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateSessionEntityTypeRequest', + ['sessionEntityType', 'name'] + ); + request.sessionEntityType.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.updateSessionEntityType(request), + expectedError + ); + }); + }); + + describe('deleteSessionEntityType', () => { + it('invokes deleteSessionEntityType without error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSessionEntityType = + stubSimpleCall(expectedResponse); + const [response] = await client.deleteSessionEntityType(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSessionEntityType without error using callback', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteSessionEntityType = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSessionEntityType( + 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.deleteSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSessionEntityType with error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSessionEntityType = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.deleteSessionEntityType(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSessionEntityType as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSessionEntityType with closed client', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteSessionEntityTypeRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects( + client.deleteSessionEntityType(request), + expectedError + ); + }); + }); + + describe('listSessionEntityTypes', () => { + it('invokes listSessionEntityTypes without error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + ]; + client.innerApiCalls.listSessionEntityTypes = + stubSimpleCall(expectedResponse); + const [response] = await client.listSessionEntityTypes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSessionEntityTypes without error using callback', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + ]; + client.innerApiCalls.listSessionEntityTypes = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSessionEntityTypes( + request, + ( + err?: Error | null, + result?: + | protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[] + | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSessionEntityTypes with error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSessionEntityTypes = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.listSessionEntityTypes(request), + expectedError + ); + const actualRequest = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSessionEntityTypes as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSessionEntityTypesStream without error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + ]; + client.descriptors.page.listSessionEntityTypes.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.SessionEntityType[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.SessionEntityType + ) => { + 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.listSessionEntityTypes + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSessionEntityTypes, request) + ); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listSessionEntityTypesStream with error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSessionEntityTypesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.SessionEntityType[] = + []; + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.SessionEntityType + ) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub + ) + .getCall(0) + .calledWith(client.innerApiCalls.listSessionEntityTypes, request) + ); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .createStream as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSessionEntityTypes without error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.SessionEntityType() + ), + ]; + client.descriptors.page.listSessionEntityTypes.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[] = + []; + const iterable = client.listSessionEntityTypesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listSessionEntityTypes with error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListSessionEntityTypesRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSessionEntityTypes.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSessionEntityTypesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.ISessionEntityType[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.descriptors.page.listSessionEntityTypes + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = '/rendered/path/projectAgentSession'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath( + 'projectValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = + new sessionentitytypesModule.v2beta1.SessionEntityTypesClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_sessions_v2.ts b/packages/google-cloud-dialogflow/test/gapic_sessions_v2.ts new file mode 100644 index 00000000000..2ef47007210 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_sessions_v2.ts @@ -0,0 +1,4200 @@ +// 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. +// +// ** 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 sessionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 stubBidiStreamingCall( + response?: ResponseType, + error?: Error +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + 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('v2.SessionsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = sessionsModule.v2.SessionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = sessionsModule.v2.SessionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sessionsModule.v2.SessionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sessionsModule.v2.SessionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sessionsModule.v2.SessionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionsStub, undefined); + await client.initialize(); + assert(client.sessionsStub); + }); + + it('has close method for the initialized client', done => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sessionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionsModule.v2.SessionsClient({ + 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 sessionsModule.v2.SessionsClient({ + 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('detectIntent', () => { + it('invokes detectIntent without error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DetectIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DetectIntentRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DetectIntentResponse() + ); + client.innerApiCalls.detectIntent = stubSimpleCall(expectedResponse); + const [response] = await client.detectIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectIntent without error using callback', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DetectIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DetectIntentRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DetectIntentResponse() + ); + client.innerApiCalls.detectIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detectIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IDetectIntentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectIntent with error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DetectIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DetectIntentRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detectIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.detectIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectIntent with closed client', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DetectIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DetectIntentRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.detectIntent(request), expectedError); + }); + }); + + describe('streamingDetectIntent', () => { + it('invokes streamingDetectIntent without error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.StreamingDetectIntentRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.StreamingDetectIntentResponse() + ); + client.innerApiCalls.streamingDetectIntent = + stubBidiStreamingCall(expectedResponse); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2.StreamingDetectIntentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + + it('invokes streamingDetectIntent with error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.StreamingDetectIntentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall( + undefined, + expectedError + ); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2.StreamingDetectIntentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSession', () => { + const fakePath = '/rendered/path/projectAgentEnvironmentUserSession'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionPath', () => { + const result = client.projectAgentEnvironmentUserSessionPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = '/rendered/path/projectAgentSession'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath( + 'projectValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSession', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSession'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSession', () => { + const fakePath = '/rendered/path/projectLocationAgentSession'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionPath', () => { + const result = client.projectLocationAgentSessionPath( + 'projectValue', + 'locationValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionsModule.v2.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_sessions_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_sessions_v2beta1.ts new file mode 100644 index 00000000000..afe209f9c16 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_sessions_v2beta1.ts @@ -0,0 +1,3786 @@ +// 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. +// +// ** 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 sessionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 stubBidiStreamingCall( + response?: ResponseType, + error?: Error +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + 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('v2beta1.SessionsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = sessionsModule.v2beta1.SessionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = sessionsModule.v2beta1.SessionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = sessionsModule.v2beta1.SessionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sessionsModule.v2beta1.SessionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionsStub, undefined); + await client.initialize(); + assert(client.sessionsStub); + }); + + it('has close method for the initialized client', done => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.sessionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.sessionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sessionsModule.v2beta1.SessionsClient({ + 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 sessionsModule.v2beta1.SessionsClient({ + 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('detectIntent', () => { + it('invokes detectIntent without error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DetectIntentRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DetectIntentResponse() + ); + client.innerApiCalls.detectIntent = stubSimpleCall(expectedResponse); + const [response] = await client.detectIntent(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectIntent without error using callback', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DetectIntentRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DetectIntentResponse() + ); + client.innerApiCalls.detectIntent = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.detectIntent( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IDetectIntentResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectIntent with error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DetectIntentRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedHeaderRequestParams = `session=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.detectIntent = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.detectIntent(request), expectedError); + const actualRequest = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.detectIntent as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes detectIntent with closed client', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DetectIntentRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DetectIntentRequest', + ['session'] + ); + request.session = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.detectIntent(request), expectedError); + }); + }); + + describe('streamingDetectIntent', () => { + it('invokes streamingDetectIntent without error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse() + ); + client.innerApiCalls.streamingDetectIntent = + stubBidiStreamingCall(expectedResponse); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + + it('invokes streamingDetectIntent with error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingDetectIntent = stubBidiStreamingCall( + undefined, + expectedError + ); + const stream = client.streamingDetectIntent(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.dialogflow.v2beta1.StreamingDetectIntentResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.streamingDetectIntent as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSession', () => { + const fakePath = '/rendered/path/projectAgentEnvironmentUserSession'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionPath', () => { + const result = client.projectAgentEnvironmentUserSessionPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSession', () => { + const fakePath = '/rendered/path/projectAgentSession'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionPath', () => { + const result = client.projectAgentSessionPath( + 'projectValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionName', () => { + const result = client.matchProjectFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionName', () => { + const result = client.matchSessionFromProjectAgentSessionName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSession', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSession'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionPath', () => { + const result = client.projectLocationAgentEnvironmentUserSessionPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSession', () => { + const fakePath = '/rendered/path/projectLocationAgentSession'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentSessionPath', () => { + const result = client.projectLocationAgentSessionPath( + 'projectValue', + 'locationValue', + 'sessionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new sessionsModule.v2beta1.SessionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_versions_v2.ts b/packages/google-cloud-dialogflow/test/gapic_versions_v2.ts new file mode 100644 index 00000000000..c23dd451d13 --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_versions_v2.ts @@ -0,0 +1,4505 @@ +// 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. +// +// ** 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 versionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2.VersionsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = versionsModule.v2.VersionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = versionsModule.v2.VersionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = versionsModule.v2.VersionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new versionsModule.v2.VersionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new versionsModule.v2.VersionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.versionsStub, undefined); + await client.initialize(); + assert(client.versionsStub); + }); + + it('has close method for the initialized client', done => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.versionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.versionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new versionsModule.v2.VersionsClient({ + 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 versionsModule.v2.VersionsClient({ + 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('getVersion', () => { + it('invokes getVersion without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Version() + ); + client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Version() + ); + client.innerApiCalls.getVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with closed client', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.GetVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.GetVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVersion(request), expectedError); + }); + }); + + describe('createVersion', () => { + it('invokes createVersion without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Version() + ); + client.innerApiCalls.createVersion = stubSimpleCall(expectedResponse); + const [response] = await client.createVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVersion without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Version() + ); + client.innerApiCalls.createVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVersion with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVersion with closed client', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.CreateVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.CreateVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createVersion(request), expectedError); + }); + }); + + describe('updateVersion', () => { + it('invokes updateVersion without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateVersionRequest() + ); + request.version ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateVersionRequest', + ['version', 'name'] + ); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Version() + ); + client.innerApiCalls.updateVersion = stubSimpleCall(expectedResponse); + const [response] = await client.updateVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVersion without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateVersionRequest() + ); + request.version ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateVersionRequest', + ['version', 'name'] + ); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.Version() + ); + client.innerApiCalls.updateVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVersion with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateVersionRequest() + ); + request.version ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateVersionRequest', + ['version', 'name'] + ); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVersion with closed client', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.UpdateVersionRequest() + ); + request.version ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.UpdateVersionRequest', + ['version', 'name'] + ); + request.version.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateVersion(request), expectedError); + }); + }); + + describe('deleteVersion', () => { + it('invokes deleteVersion without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteVersion( + 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.deleteVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with closed client', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.DeleteVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.DeleteVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteVersion(request), expectedError); + }); + }); + + describe('listVersions', () => { + it('invokes listVersions without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + ]; + client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersions without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + ]; + client.innerApiCalls.listVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVersions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2.IVersion[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersions with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listVersions(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersionsStream without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + ]; + client.descriptors.page.listVersions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Version[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Version) => { + 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.listVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listVersions, request) + ); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listVersionsStream with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2.Version[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2.Version) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listVersions, request) + ); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVersions without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + generateSampleMessage(new protos.google.cloud.dialogflow.v2.Version()), + ]; + client.descriptors.page.listVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2.IVersion[] = []; + const iterable = client.listVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVersions with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2.IVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('conversationDataset', () => { + const fakePath = '/rendered/path/conversationDataset'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_dataset: 'conversationDatasetValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationDatasetPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.conversationDatasetPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('conversationDatasetPath', () => { + const result = client.conversationDatasetPath( + 'projectValue', + 'locationValue', + 'conversationDatasetValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromConversationDatasetName', () => { + const result = client.matchProjectFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromConversationDatasetName', () => { + const result = + client.matchLocationFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationDatasetFromConversationDatasetName', () => { + const result = + client.matchConversationDatasetFromConversationDatasetName(fakePath); + assert.strictEqual(result, 'conversationDatasetValue'); + assert( + ( + client.pathTemplates.conversationDatasetPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModel', () => { + const fakePath = '/rendered/path/projectConversationModel'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationModelPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationModelPath', () => { + const result = client.projectConversationModelPath( + 'projectValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelName', () => { + const result = + client.matchProjectFromProjectConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelName', () => { + const result = + client.matchConversationModelFromProjectConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationModelEvaluation', () => { + const fakePath = '/rendered/path/projectConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationModelEvaluationPath', () => { + const result = client.projectConversationModelEvaluationPath( + 'projectValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates.projectConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModel', () => { + const fakePath = '/rendered/path/projectLocationConversationModel'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelPath', () => { + const result = client.projectLocationConversationModelPath( + 'projectValue', + 'locationValue', + 'conversationModelValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates.projectLocationConversationModelPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationModelEvaluation', () => { + const fakePath = + '/rendered/path/projectLocationConversationModelEvaluation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_model: 'conversationModelValue', + evaluation: 'evaluationValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationModelEvaluationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationModelEvaluationPath', () => { + const result = client.projectLocationConversationModelEvaluationPath( + 'projectValue', + 'locationValue', + 'conversationModelValue', + 'evaluationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchProjectFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchLocationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationModelFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchConversationModelFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'conversationModelValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEvaluationFromProjectLocationConversationModelEvaluationName', () => { + const result = + client.matchEvaluationFromProjectLocationConversationModelEvaluationName( + fakePath + ); + assert.strictEqual(result, 'evaluationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationModelEvaluationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new versionsModule.v2.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/test/gapic_versions_v2beta1.ts b/packages/google-cloud-dialogflow/test/gapic_versions_v2beta1.ts new file mode 100644 index 00000000000..dcc811fd97d --- /dev/null +++ b/packages/google-cloud-dialogflow/test/gapic_versions_v2beta1.ts @@ -0,0 +1,4115 @@ +// 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. +// +// ** 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 versionsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} 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 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('v2beta1.VersionsClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = versionsModule.v2beta1.VersionsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = versionsModule.v2beta1.VersionsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = versionsModule.v2beta1.VersionsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new versionsModule.v2beta1.VersionsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new versionsModule.v2beta1.VersionsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.versionsStub, undefined); + await client.initialize(); + assert(client.versionsStub); + }); + + it('has close method for the initialized client', done => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.versionsStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.versionsStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new versionsModule.v2beta1.VersionsClient({ + 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 versionsModule.v2beta1.VersionsClient({ + 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('getVersion', () => { + it('invokes getVersion without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ); + client.innerApiCalls.getVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ); + client.innerApiCalls.getVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.getVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getVersion with closed client', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.GetVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.GetVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getVersion(request), expectedError); + }); + }); + + describe('createVersion', () => { + it('invokes createVersion without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ); + client.innerApiCalls.createVersion = stubSimpleCall(expectedResponse); + const [response] = await client.createVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVersion without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ); + client.innerApiCalls.createVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVersion with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.createVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createVersion with closed client', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.CreateVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.CreateVersionRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createVersion(request), expectedError); + }); + }); + + describe('updateVersion', () => { + it('invokes updateVersion without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest() + ); + request.version ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', + ['version', 'name'] + ); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ); + client.innerApiCalls.updateVersion = stubSimpleCall(expectedResponse); + const [response] = await client.updateVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVersion without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest() + ); + request.version ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', + ['version', 'name'] + ); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ); + client.innerApiCalls.updateVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateVersion( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IVersion | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVersion with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest() + ); + request.version ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', + ['version', 'name'] + ); + request.version.name = defaultValue1; + const expectedHeaderRequestParams = `version.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.updateVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateVersion with closed client', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.UpdateVersionRequest() + ); + request.version ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.UpdateVersionRequest', + ['version', 'name'] + ); + request.version.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateVersion(request), expectedError); + }); + }); + + describe('deleteVersion', () => { + it('invokes deleteVersion without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteVersion = stubSimpleCall(expectedResponse); + const [response] = await client.deleteVersion(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.innerApiCalls.deleteVersion = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteVersion( + 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.deleteVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteVersion = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.deleteVersion(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteVersion as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteVersion with closed client', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.DeleteVersionRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.DeleteVersionRequest', + ['name'] + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteVersion(request), expectedError); + }); + }); + + describe('listVersions', () => { + it('invokes listVersions without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + ]; + client.innerApiCalls.listVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listVersions(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersions without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + ]; + client.innerApiCalls.listVersions = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listVersions( + request, + ( + err?: Error | null, + result?: protos.google.cloud.dialogflow.v2beta1.IVersion[] | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersions with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listVersions = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.listVersions(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listVersions as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listVersionsStream without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + ]; + client.descriptors.page.listVersions.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Version[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Version) => { + 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.listVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listVersions, request) + ); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listVersionsStream with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.createStream = stubPageStreamingCall( + undefined, + expectedError + ); + const stream = client.listVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.dialogflow.v2beta1.Version[] = []; + stream.on( + 'data', + (response: protos.google.cloud.dialogflow.v2beta1.Version) => { + responses.push(response); + } + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listVersions, request) + ); + assert( + (client.descriptors.page.listVersions.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVersions without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.Version() + ), + ]; + client.descriptors.page.listVersions.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.dialogflow.v2beta1.IVersion[] = []; + const iterable = client.listVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listVersions with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.dialogflow.v2beta1.ListVersionsRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.dialogflow.v2beta1.ListVersionsRequest', + ['parent'] + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listVersions.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.dialogflow.v2beta1.IVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listVersions.asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + (client.descriptors.page.listVersions.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined) + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + describe('project', () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgent', () => { + const fakePath = '/rendered/path/projectAgent'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentPath', () => { + const result = client.projectAgentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectAgentPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentName', () => { + const result = client.matchProjectFromProjectAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectAgentPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEntityType', () => { + const fakePath = '/rendered/path/projectAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEntityTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEntityTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEntityTypePath', () => { + const result = client.projectAgentEntityTypePath( + 'projectValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironment', () => { + const fakePath = '/rendered/path/projectAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentEnvironmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentEnvironmentPath', () => { + const result = client.projectAgentEnvironmentPath( + 'projectValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionContextPath', () => { + const result = client.projectAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentEnvironmentUserSessionEntityTypePath', () => { + const result = client.projectAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentFulfillment', () => { + const fakePath = '/rendered/path/projectAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentFulfillmentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentFulfillmentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentFulfillmentPath', () => { + const result = client.projectAgentFulfillmentPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentIntent', () => { + const fakePath = '/rendered/path/projectAgentIntent'; + const expectedParameters = { + project: 'projectValue', + intent: 'intentValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentIntentPath', () => { + const result = client.projectAgentIntentPath( + 'projectValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentIntentName', () => { + const result = client.matchProjectFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectAgentIntentName', () => { + const result = client.matchIntentFromProjectAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionContext', () => { + const fakePath = '/rendered/path/projectAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionContextPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentSessionContextPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentSessionContextPath', () => { + const result = client.projectAgentSessionContextPath( + 'projectValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectAgentSessionContextName', () => { + const result = + client.matchContextFromProjectAgentSessionContextName(fakePath); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectAgentSessionEntityTypePath', () => { + const result = client.projectAgentSessionEntityTypePath( + 'projectValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectAgentSessionEntityTypeName(fakePath); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAgentVersion', () => { + const fakePath = '/rendered/path/projectAgentVersion'; + const expectedParameters = { + project: 'projectValue', + version: 'versionValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAgentVersionPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAgentVersionPath', () => { + const result = client.projectAgentVersionPath( + 'projectValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAgentVersionName', () => { + const result = client.matchProjectFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectAgentVersionName', () => { + const result = client.matchVersionFromProjectAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectAnswerRecord', () => { + const fakePath = '/rendered/path/projectAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + answer_record: 'answerRecordValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectAnswerRecordPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectAnswerRecordPath', () => { + const result = client.projectAnswerRecordPath( + 'projectValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectAnswerRecordName', () => { + const result = client.matchProjectFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversation', () => { + const fakePath = '/rendered/path/projectConversation'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationPath', () => { + const result = client.projectConversationPath( + 'projectValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationName', () => { + const result = client.matchProjectFromProjectConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationName', () => { + const result = + client.matchConversationFromProjectConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationMessage', () => { + const fakePath = '/rendered/path/projectConversationMessage'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationMessagePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationMessagePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationMessagePath', () => { + const result = client.projectConversationMessagePath( + 'projectValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationMessageName', () => { + const result = + client.matchProjectFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationMessageName', () => { + const result = + client.matchConversationFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectConversationMessageName', () => { + const result = + client.matchMessageFromProjectConversationMessageName(fakePath); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationParticipant', () => { + const fakePath = '/rendered/path/projectConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectConversationParticipantPath', () => { + const result = client.projectConversationParticipantPath( + 'projectValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationParticipantName', () => { + const result = + client.matchProjectFromProjectConversationParticipantName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectConversationParticipantName', () => { + const result = + client.matchConversationFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates.projectConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectConversationProfile', () => { + const fakePath = '/rendered/path/projectConversationProfile'; + const expectedParameters = { + project: 'projectValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectConversationProfilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectConversationProfilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectConversationProfilePath', () => { + const result = client.projectConversationProfilePath( + 'projectValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectConversationProfileName', () => { + const result = + client.matchProjectFromProjectConversationProfileName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBase', () => { + const fakePath = '/rendered/path/projectKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBasePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectKnowledgeBasePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectKnowledgeBasePath', () => { + const result = client.projectKnowledgeBasePath( + 'projectValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectKnowledgeBaseDocumentPath', () => { + const result = client.projectKnowledgeBaseDocumentPath( + 'projectValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectKnowledgeBaseDocumentName(fakePath); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates.projectKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgent', () => { + const fakePath = '/rendered/path/projectLocationAgent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentPath', () => { + const result = client.projectLocationAgentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentName', () => { + const result = + client.matchProjectFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentName', () => { + const result = + client.matchLocationFromProjectLocationAgentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEntityTypePath', () => { + const result = client.projectLocationAgentEntityTypePath( + 'projectValue', + 'locationValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEntityTypeName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironment', () => { + const fakePath = '/rendered/path/projectLocationAgentEnvironment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentPath', () => { + const result = client.projectLocationAgentEnvironmentPath( + 'projectValue', + 'locationValue', + 'environmentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentEnvironmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionContext', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionContextPath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionContextPath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentEnvironmentUserSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentEnvironmentUserSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentEnvironmentUserSessionEntityType', () => { + const fakePath = + '/rendered/path/projectLocationAgentEnvironmentUserSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + environment: 'environmentValue', + user: 'userValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentEnvironmentUserSessionEntityTypePath', () => { + const result = + client.projectLocationAgentEnvironmentUserSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'environmentValue', + 'userValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEnvironmentFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'environmentValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchUserFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'userValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentEnvironmentUserSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentEnvironmentUserSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentFulfillment', () => { + const fakePath = '/rendered/path/projectLocationAgentFulfillment'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentFulfillmentPath', () => { + const result = client.projectLocationAgentFulfillmentPath( + 'projectValue', + 'locationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchProjectFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentFulfillmentName', () => { + const result = + client.matchLocationFromProjectLocationAgentFulfillmentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentFulfillmentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentIntent', () => { + const fakePath = '/rendered/path/projectLocationAgentIntent'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + intent: 'intentValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentIntentPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectLocationAgentIntentPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentIntentPath', () => { + const result = client.projectLocationAgentIntentPath( + 'projectValue', + 'locationValue', + 'intentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentIntentName', () => { + const result = + client.matchProjectFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentIntentName', () => { + const result = + client.matchLocationFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchIntentFromProjectLocationAgentIntentName', () => { + const result = + client.matchIntentFromProjectLocationAgentIntentName(fakePath); + assert.strictEqual(result, 'intentValue'); + assert( + ( + client.pathTemplates.projectLocationAgentIntentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionContext', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionContext'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + context: 'contextValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionContextPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionContextPath', () => { + const result = client.projectLocationAgentSessionContextPath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'contextValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchContextFromProjectLocationAgentSessionContextName', () => { + const result = + client.matchContextFromProjectLocationAgentSessionContextName( + fakePath + ); + assert.strictEqual(result, 'contextValue'); + assert( + ( + client.pathTemplates.projectLocationAgentSessionContextPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentSessionEntityType', () => { + const fakePath = '/rendered/path/projectLocationAgentSessionEntityType'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + session: 'sessionValue', + entity_type: 'entityTypeValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentSessionEntityTypePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationAgentSessionEntityTypePath', () => { + const result = client.projectLocationAgentSessionEntityTypePath( + 'projectValue', + 'locationValue', + 'sessionValue', + 'entityTypeValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchProjectFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchLocationFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchSessionFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchSessionFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'sessionValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchEntityTypeFromProjectLocationAgentSessionEntityTypeName', () => { + const result = + client.matchEntityTypeFromProjectLocationAgentSessionEntityTypeName( + fakePath + ); + assert.strictEqual(result, 'entityTypeValue'); + assert( + ( + client.pathTemplates + .projectLocationAgentSessionEntityTypePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAgentVersion', () => { + const fakePath = '/rendered/path/projectLocationAgentVersion'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + version: 'versionValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAgentVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAgentVersionPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAgentVersionPath', () => { + const result = client.projectLocationAgentVersionPath( + 'projectValue', + 'locationValue', + 'versionValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAgentVersionName', () => { + const result = + client.matchProjectFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAgentVersionName', () => { + const result = + client.matchLocationFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchVersionFromProjectLocationAgentVersionName', () => { + const result = + client.matchVersionFromProjectLocationAgentVersionName(fakePath); + assert.strictEqual(result, 'versionValue'); + assert( + ( + client.pathTemplates.projectLocationAgentVersionPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationAnswerRecord', () => { + const fakePath = '/rendered/path/projectLocationAnswerRecord'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + answer_record: 'answerRecordValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationAnswerRecordPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationAnswerRecordPath', () => { + const result = client.projectLocationAnswerRecordPath( + 'projectValue', + 'locationValue', + 'answerRecordValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationAnswerRecordName', () => { + const result = + client.matchProjectFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationAnswerRecordName', () => { + const result = + client.matchLocationFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchAnswerRecordFromProjectLocationAnswerRecordName', () => { + const result = + client.matchAnswerRecordFromProjectLocationAnswerRecordName(fakePath); + assert.strictEqual(result, 'answerRecordValue'); + assert( + ( + client.pathTemplates.projectLocationAnswerRecordPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversation', () => { + const fakePath = '/rendered/path/projectLocationConversation'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectLocationConversationPath', () => { + const result = client.projectLocationConversationPath( + 'projectValue', + 'locationValue', + 'conversationValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationName', () => { + const result = + client.matchProjectFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationName', () => { + const result = + client.matchLocationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationName', () => { + const result = + client.matchConversationFromProjectLocationConversationName(fakePath); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationMessage', () => { + const fakePath = '/rendered/path/projectLocationConversationMessage'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + message: 'messageValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationMessagePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationMessagePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationMessagePath', () => { + const result = client.projectLocationConversationMessagePath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'messageValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationMessageName', () => { + const result = + client.matchProjectFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationMessageName', () => { + const result = + client.matchLocationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationMessageName', () => { + const result = + client.matchConversationFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchMessageFromProjectLocationConversationMessageName', () => { + const result = + client.matchMessageFromProjectLocationConversationMessageName( + fakePath + ); + assert.strictEqual(result, 'messageValue'); + assert( + ( + client.pathTemplates.projectLocationConversationMessagePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationParticipant', () => { + const fakePath = '/rendered/path/projectLocationConversationParticipant'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation: 'conversationValue', + participant: 'participantValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationParticipantPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationParticipantPath', () => { + const result = client.projectLocationConversationParticipantPath( + 'projectValue', + 'locationValue', + 'conversationValue', + 'participantValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationParticipantName', () => { + const result = + client.matchProjectFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchLocationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationFromProjectLocationConversationParticipantName', () => { + const result = + client.matchConversationFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'conversationValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchParticipantFromProjectLocationConversationParticipantName', () => { + const result = + client.matchParticipantFromProjectLocationConversationParticipantName( + fakePath + ); + assert.strictEqual(result, 'participantValue'); + assert( + ( + client.pathTemplates + .projectLocationConversationParticipantPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationConversationProfile', () => { + const fakePath = '/rendered/path/projectLocationConversationProfile'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + conversation_profile: 'conversationProfileValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationConversationProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationConversationProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationConversationProfilePath', () => { + const result = client.projectLocationConversationProfilePath( + 'projectValue', + 'locationValue', + 'conversationProfileValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationConversationProfileName', () => { + const result = + client.matchProjectFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationConversationProfileName', () => { + const result = + client.matchLocationFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchConversationProfileFromProjectLocationConversationProfileName', () => { + const result = + client.matchConversationProfileFromProjectLocationConversationProfileName( + fakePath + ); + assert.strictEqual(result, 'conversationProfileValue'); + assert( + ( + client.pathTemplates.projectLocationConversationProfilePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBase', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBase'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBasePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBasePath', () => { + const result = client.projectLocationKnowledgeBasePath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates.projectLocationKnowledgeBasePathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + + describe('projectLocationKnowledgeBaseDocument', () => { + const fakePath = '/rendered/path/projectLocationKnowledgeBaseDocument'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + knowledge_base: 'knowledgeBaseValue', + document: 'documentValue', + }; + const client = new versionsModule.v2beta1.VersionsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationKnowledgeBaseDocumentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationKnowledgeBaseDocumentPath', () => { + const result = client.projectLocationKnowledgeBaseDocumentPath( + 'projectValue', + 'locationValue', + 'knowledgeBaseValue', + 'documentValue' + ); + assert.strictEqual(result, fakePath); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .render as SinonStub + ) + .getCall(-1) + .calledWith(expectedParameters) + ); + }); + + it('matchProjectFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchProjectFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'projectValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchLocationFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchLocationFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'locationValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchKnowledgeBaseFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'knowledgeBaseValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + + it('matchDocumentFromProjectLocationKnowledgeBaseDocumentName', () => { + const result = + client.matchDocumentFromProjectLocationKnowledgeBaseDocumentName( + fakePath + ); + assert.strictEqual(result, 'documentValue'); + assert( + ( + client.pathTemplates + .projectLocationKnowledgeBaseDocumentPathTemplate + .match as SinonStub + ) + .getCall(-1) + .calledWith(fakePath) + ); + }); + }); + }); +}); diff --git a/packages/google-cloud-dialogflow/tsconfig.json b/packages/google-cloud-dialogflow/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/packages/google-cloud-dialogflow/tsconfig.json @@ -0,0 +1,19 @@ +{ + "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/packages/google-cloud-dialogflow/webpack.config.js b/packages/google-cloud-dialogflow/webpack.config.js new file mode 100644 index 00000000000..754be3d486b --- /dev/null +++ b/packages/google-cloud-dialogflow/webpack.config.js @@ -0,0 +1,64 @@ +// 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: 'dialogflow', + filename: './dialogflow.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', +}; diff --git a/release-please-config.json b/release-please-config.json index ca8fb90627b..e45f948facd 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -18,6 +18,7 @@ "packages/google-cloud-dataplex": {}, "packages/google-cloud-dataproc": {}, "packages/google-cloud-deploy": {}, + "packages/google-cloud-dialogflow": {}, "packages/google-cloud-discoveryengine": {}, "packages/google-cloud-gkeconnect-gateway": {}, "packages/google-cloud-gkemulticloud": {},